Package org.apache.uima

Examples of org.apache.uima.UimaContext


    getIndexWriterInstance();
  }
 
  private void getIndexWriterInstance()
      throws ResourceInitializationException {
    UimaContext uimaContext = getContext();
    IndexWriterProvider indexWriterProvider;
    try {
      indexWriterProvider = (IndexWriterProvider) uimaContext
          .getResourceObject(RESOURCE_INDEX_WRITER_PROVIDER);
    } catch (ResourceAccessException e) {
      throw new ResourceInitializationException(e);
    }
    indexWriter = indexWriterProvider.getIndexWriter();
View Full Code Here


*/
public class InitializableFactoryTest {

  @Test
  public void testInitializableFactory() throws Exception {
    UimaContext context = UimaContextFactory.createUimaContext(
            InitializableClass.PARAM_BOOLEAN_PARAMETER, true);
    InitializableClass ic = InitializableFactory.create(context, InitializableClass.class);
    assertTrue(ic.booleanParameter);

    NotInitializableClass nic = InitializableFactory.create(context, NotInitializableClass.class);
View Full Code Here

            "goodbye");
  }

  @Test(expected = ResourceInitializationException.class)
  public void testBadConstructor() throws ResourceInitializationException {
    UimaContext context = UimaContextFactory.createUimaContext(
            InitializableClass.PARAM_BOOLEAN_PARAMETER, true);
    InitializableFactory.create(context, NoDefaultConstructor.class);
  }
View Full Code Here

          }
          initializeComponentCasPool(aComponentCasPoolSize, anInitialCasHeapSize);
        }
      }
    } else {
      UimaContext childContext = parentController.getChildUimaContext(endpointName);
      if ( childContext != null && childContext instanceof UimaContextAdmin ) {
        // check requested Cas logging
        String qualifiedContextName = ((UimaContextAdmin)childContext).getQualifiedContextName();
        if (casLogComponents!= null && (this instanceof AggregateAnalysisEngineController) &&
                casLogComponents.contains(anEndpointName)) {
View Full Code Here

        } else {
          serviceName = "Top Level Aggregate Service";
        }
      } else {
        try {
          UimaContext childContext = parentController.getChildUimaContext(endpointName);
          serviceName = ((UimaContextAdmin)childContext).getQualifiedContextName();
          if ( serviceName != null ) {
            if ( serviceName.startsWith("/")) {
              serviceName = serviceName.substring(1);
              serviceName = serviceName.replaceAll("/", "_"); // normalize
View Full Code Here

public class UimaContextFactoryTest {

  @Test
  public void test() throws ResourceInitializationException {
    UimaContext context = UimaContextFactory
            .createUimaContext("myBoolean", true, "myBooleans", new Boolean[] { true, false, true,
                false }, "myFloat", 1.0f, "myFloats", new Float[] { 2.0f, 2.1f, 3.0f }, "myInt", 1,
                    "myInts", new Integer[] { 2, 3, 4 }, "myString", "yourString", "myStrings",
                    new String[] { "yourString1", "yourString2", "yourString3" });
    assertEquals(true, context.getConfigParameterValue("myBoolean"));
    Boolean[] myBooleans = (Boolean[]) context.getConfigParameterValue("myBooleans");
    assertEquals(4, myBooleans.length);
    assertEquals(true, myBooleans[0]);
    assertEquals(false, myBooleans[1]);
    assertEquals(true, myBooleans[2]);
    assertEquals(false, myBooleans[3]);

    assertEquals(1.0f, context.getConfigParameterValue("myFloat"));
    Float[] myFloats = (Float[]) context.getConfigParameterValue("myFloats");
    assertEquals(3, myFloats.length);
    assertEquals(2.0d, myFloats[0].doubleValue(), 0.001d);
    assertEquals(2.1d, myFloats[1].doubleValue(), 0.001d);
    assertEquals(3.0d, myFloats[2].doubleValue(), 0.001d);

    assertEquals(1, context.getConfigParameterValue("myInt"));
    Integer[] myInts = (Integer[]) context.getConfigParameterValue("myInts");
    assertEquals(3, myInts.length);
    assertEquals(2L, myInts[0].longValue());
    assertEquals(3L, myInts[1].longValue());
    assertEquals(4L, myInts[2].longValue());

    assertEquals("yourString", context.getConfigParameterValue("myString"));
    String[] myStrings = (String[]) context.getConfigParameterValue("myStrings");
    assertEquals(3, myStrings.length);
    assertEquals("yourString1", myStrings[0]);
    assertEquals("yourString2", myStrings[1]);
    assertEquals("yourString3", myStrings[2]);
View Full Code Here

public class InitializableFactoryTest {

  @Test
  public void testInitializableFactory() throws Exception {
    UimaContext context = UimaContextFactory.createUimaContext(
            InitializableClass.PARAM_BOOLEAN_PARAMETER, true);
    InitializableClass ic = InitializableFactory.create(context, InitializableClass.class);
    assertTrue(ic.booleanParameter);

    NotInitializableClass nic = InitializableFactory.create(context, NotInitializableClass.class);
View Full Code Here

    assertFalse(nic.booleanParameter);
  }

  @Test(expected = ResourceInitializationException.class)
  public void testBadConstructor() throws ResourceInitializationException {
    UimaContext context = UimaContextFactory.createUimaContext(
            InitializableClass.PARAM_BOOLEAN_PARAMETER, true);
    InitializableFactory.create(context, NoDefaultConstructor.class);
  }
View Full Code Here

          }
          initializeComponentCasPool(aComponentCasPoolSize, anInitialCasHeapSize);
        }
      }
    } else {
      UimaContext childContext = parentController.getChildUimaContext(endpointName);
      if ( childContext != null && childContext instanceof UimaContextAdmin ) {
        // check requested Cas logging
        String qualifiedContextName = ((UimaContextAdmin)childContext).getQualifiedContextName();
        if (casLogComponents!= null && (this instanceof AggregateAnalysisEngineController) &&
                casLogComponents.contains(anEndpointName)) {
View Full Code Here

        } else {
          serviceName = "Top Level Aggregate Service";
        }
      } else {
        try {
          UimaContext childContext = parentController.getChildUimaContext(endpointName);
          serviceName = ((UimaContextAdmin)childContext).getQualifiedContextName();
          if ( serviceName != null ) {
            if ( serviceName.startsWith("/")) {
              serviceName = serviceName.substring(1);
              serviceName = serviceName.replaceAll("/", "_"); // normalize
View Full Code Here

TOP

Related Classes of org.apache.uima.UimaContext

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.