Package org.apache.uima.analysis_engine.impl

Examples of org.apache.uima.analysis_engine.impl.AnalysisEngineDescription_impl


    try {
      File baseDescriptorFile = JUnitExtension
              .getFile("ImportImplTest/subdir/subdir2/AggregateTaeForNestedImportTest.xml");
      File importedFile = JUnitExtension
              .getFile("ImportImplTest/subdir/PrimitiveTaeForNestedImportTest.xml");
      AnalysisEngineDescription_impl agg = (AnalysisEngineDescription_impl) UIMAFramework.getXMLParser()
              .parseAnalysisEngineDescription(new XMLInputSource(baseDescriptorFile));
      assertEquals(baseDescriptorFile.toURL(), agg.getSourceUrl());

      AnalysisEngineDescription_impl prim = (AnalysisEngineDescription_impl) agg.getDelegateAnalysisEngineSpecifiers()
              .get("Annotator1");
      assertEquals(importedFile.toURL(), prim.getSourceUrl());

      prim.getAnalysisEngineMetaData().getTypeSystem().resolveImports();
      assertEquals(1, prim.getAnalysisEngineMetaData().getTypeSystem().getTypes().length);
    } catch (Exception e) {
      JUnitExtension.handleException(e);
    }
  }
View Full Code Here


   */
  protected void setUp() throws Exception {
    try {
      super.setUp();
      // create resource specifier and a pool containing 3 instances
      mDesc = new AnalysisEngineDescription_impl();
      mDesc.setPrimitive(true);
      mDesc.setAnnotatorImplementationName("org.apache.uima.analysis_engine.impl.TestAnnotator");
      mDesc.getMetaData().setName("Test TAE");
      mDesc.getMetaData().setDescription("This is a test.");
      pool1 = new ResourcePool(3, mDesc, AnalysisEngine.class);
View Full Code Here

   * @see junit.framework.TestCase#setUp()
   */
  protected void setUp() throws Exception {
    try {
      super.setUp();
      mSimpleDesc = new AnalysisEngineDescription_impl();
      mSimpleDesc.setFrameworkImplementation(Constants.JAVA_FRAMEWORK_NAME);
      mSimpleDesc.setPrimitive(true);
      mSimpleDesc.getMetaData().setName("Test Primitive TAE");
      mSimpleDesc
              .setAnnotatorImplementationName("org.apache.uima.analysis_engine.impl.TestAnnotator");
View Full Code Here

      AnalysisEnginePool pool = new AnalysisEnginePool("taePool", 3, mSimpleDesc);
      _testProcess(pool, 0);

      // test simple aggregate MultithreadableTextAnalysisEngine
      // (again using TestAnnotator class)
      AnalysisEngineDescription aggDesc = new AnalysisEngineDescription_impl();
      aggDesc.setPrimitive(false);
      aggDesc.getMetaData().setName("Test Aggregate TAE");
      aggDesc.getDelegateAnalysisEngineSpecifiersWithImports().put("Test", mSimpleDesc);
      FixedFlow_impl flow = new FixedFlow_impl();
      flow.setFixedFlow(new String[] { "Test" });
      aggDesc.getAnalysisEngineMetaData().setFlowConstraints(flow);
      pool = new AnalysisEnginePool("taePool", 3, aggDesc);
      _testProcess(pool, 0);

      // multiple threads!
      final int NUM_THREADS = 4;
View Full Code Here

  }

  public void testReconfigure() throws Exception {
    try {
      // create simple primitive TextAnalysisEngine descriptor (using TestAnnotator class)
      AnalysisEngineDescription primitiveDesc = new AnalysisEngineDescription_impl();
      primitiveDesc.setPrimitive(true);
      primitiveDesc.getMetaData().setName("Test Primitive TAE");
      primitiveDesc
              .setAnnotatorImplementationName("org.apache.uima.analysis_engine.impl.TestAnnotator");
      ConfigurationParameter p1 = new ConfigurationParameter_impl();
      p1.setName("StringParam");
      p1.setDescription("parameter with String data type");
      p1.setType(ConfigurationParameter.TYPE_STRING);
      primitiveDesc.getMetaData().getConfigurationParameterDeclarations()
              .setConfigurationParameters(new ConfigurationParameter[] { p1 });
      primitiveDesc.getMetaData().getConfigurationParameterSettings().setParameterSettings(
              new NameValuePair[] { new NameValuePair_impl("StringParam", "Test1") });

      // create pool
      AnalysisEnginePool pool = new AnalysisEnginePool("taePool", 3, primitiveDesc);
View Full Code Here

  protected void setUp() throws Exception {
    aeFactory = new AnalysisEngineFactory_impl();
  }

  public void testInvalidFrameworkImplementation() {
    AnalysisEngineDescription desc = new AnalysisEngineDescription_impl();
    desc.setFrameworkImplementation("foo");   
    try {
      aeFactory.produceResource(AnalysisEngine.class, desc, Collections.EMPTY_MAP);
      fail();
    } catch (ResourceInitializationException e) {
      assertNotNull(e.getMessage());
View Full Code Here

   */
  protected void setUp() throws Exception {
    try {
      super.setUp();
      // create resource specifier and a pool containing 2 instances
      AnalysisEngineDescription primitiveDesc = new AnalysisEngineDescription_impl();
      primitiveDesc.setPrimitive(true);
      primitiveDesc
              .setAnnotatorImplementationName("org.apache.uima.analysis_engine.impl.TestAnnotator");
      primitiveDesc.getMetaData().setName("Test Annotator");
      ConfigurationParameter p1 = new ConfigurationParameter_impl();
      p1.setName("StringParam");
      p1.setDescription("parameter with String data type");
      p1.setType(ConfigurationParameter.TYPE_STRING);
      primitiveDesc.getMetaData().getConfigurationParameterDeclarations()
              .setConfigurationParameters(new ConfigurationParameter[] { p1 });
      // create a ResourceService_impl
      service = new ResourceService_impl();
      service.initialize(primitiveDesc, null);
    } catch (Exception e) {
View Full Code Here

    try {
      File baseDescriptorFile = JUnitExtension
              .getFile("ImportImplTest/subdir/subdir2/AggregateTaeForNestedImportTest.xml");
      File importedFile = JUnitExtension
              .getFile("ImportImplTest/subdir/PrimitiveTaeForNestedImportTest.xml");
      AnalysisEngineDescription_impl agg = (AnalysisEngineDescription_impl) UIMAFramework.getXMLParser()
              .parseAnalysisEngineDescription(new XMLInputSource(baseDescriptorFile));
      assertEquals(baseDescriptorFile.toURL(), agg.getSourceUrl());

      AnalysisEngineDescription_impl prim = (AnalysisEngineDescription_impl) agg.getDelegateAnalysisEngineSpecifiers()
              .get("Annotator1");
      assertEquals(importedFile.toURL(), prim.getSourceUrl());

      prim.getAnalysisEngineMetaData().getTypeSystem().resolveImports();
      assertEquals(1, prim.getAnalysisEngineMetaData().getTypeSystem().getTypes().length);
    } catch (Exception e) {
      JUnitExtension.handleException(e);
    }
  }
View Full Code Here

              + analysisEngineDescriptions.size() + "]does not match number of component names ["
              + componentNames.size() + "].");
    }

    // create the descriptor and set configuration parameters
    AnalysisEngineDescription desc = new AnalysisEngineDescription_impl();
    desc.setFrameworkImplementation(Constants.JAVA_FRAMEWORK_NAME);
    desc.setPrimitive(false);

    // if any of the aggregated analysis engines does not allow multiple
    // deployment, then the
    // aggregate engine may also not be multiply deployed
    boolean allowMultipleDeploy = true;
    for (AnalysisEngineDescription d : analysisEngineDescriptions) {
      allowMultipleDeploy &= d.getAnalysisEngineMetaData().getOperationalProperties()
              .isMultipleDeploymentAllowed();
    }
    desc.getAnalysisEngineMetaData().getOperationalProperties()
            .setMultipleDeploymentAllowed(allowMultipleDeploy);

    List<String> flowNames = new ArrayList<String>();

    for (int i = 0; i < analysisEngineDescriptions.size(); i++) {
      AnalysisEngineDescription aed = analysisEngineDescriptions.get(i);
      String componentName = componentNames.get(i);
      desc.getDelegateAnalysisEngineSpecifiersWithImports().put(componentName, aed);
      flowNames.add(componentName);
    }

    if (flowControllerDescription != null) {
      FlowControllerDeclaration flowControllerDeclaration = new FlowControllerDeclaration_impl();
      flowControllerDeclaration.setSpecifier(flowControllerDescription);
      desc.setFlowControllerDeclaration(flowControllerDeclaration);
    }

    FixedFlow fixedFlow = new FixedFlow_impl();
    fixedFlow.setFixedFlow(flowNames.toArray(new String[flowNames.size()]));
    desc.getAnalysisEngineMetaData().setFlowConstraints(fixedFlow);

    if (typePriorities != null) {
      desc.getAnalysisEngineMetaData().setTypePriorities(typePriorities);
    }

    if (sofaMappings != null) {
      desc.setSofaMappings(sofaMappings);
    }

    return desc;
  }
View Full Code Here

  protected void setUp() throws Exception {
    aeFactory = new AnalysisEngineFactory_impl();
  }

  public void testInvalidFrameworkImplementation() {
    AnalysisEngineDescription desc = new AnalysisEngineDescription_impl();
    desc.setFrameworkImplementation("foo");   
    try {
      aeFactory.produceResource(AnalysisEngine.class, desc, Collections.EMPTY_MAP);
      fail();
    } catch (ResourceInitializationException e) {
      assertNotNull(e.getMessage());
View Full Code Here

TOP

Related Classes of org.apache.uima.analysis_engine.impl.AnalysisEngineDescription_impl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.