Examples of CASMgr


Examples of org.apache.uima.cas.admin.CASMgr

    try {
      ResultSpecification_impl rs = new ResultSpecification_impl();
      rs.addCapabilities(capabilities);

      // create Type System
      CASMgr casMgr = CASFactory.createCAS();
      TypeSystemMgr tsMgr = casMgr.getTypeSystemMgr();
      Type fakeType = tsMgr.addType("FakeType", tsMgr.getTopType());
      Type anotherType = tsMgr.addType("AnotherType", tsMgr.getTopType());
      tsMgr.addFeature("FakeFeature", fakeType, tsMgr.getTopType());
      tsMgr.addFeature("FakeFeature2", fakeType, tsMgr.getTopType());
      tsMgr.addFeature("AnotherFeature", anotherType, tsMgr.getTopType());
View Full Code Here

Examples of org.apache.uima.cas.admin.CASMgr

      initialHeapSizeStr = aPerformanceTuningSettings
          .getProperty(UIMAFramework.CAS_INITIAL_HEAP_SIZE);
    }

    // create CAS using either aTypeSystem or aTypeSystemDesc
    CASMgr casMgr;
    if (aTypeSystem != null) {
      if (initialHeapSizeStr != null) {
        casMgr = CASFactory.createCAS(Integer.parseInt(initialHeapSizeStr), aTypeSystem);
      } else {
        casMgr = CASFactory.createCAS(aTypeSystem);
      }
    } else // no TypeSystem to reuse - create a new one
    {
      if (initialHeapSizeStr != null) {
        casMgr = CASFactory.createCAS(Integer.parseInt(initialHeapSizeStr));
      } else {
        casMgr = CASFactory.createCAS();
      }
      // install type system
      setupTypeSystem(casMgr, aTypeSystemDesc);
      // Commit the type system
      ((CASImpl) casMgr).commitTypeSystem();
    }

    try {
      // install TypePriorities into CAS
      setupTypePriorities(casMgr, aTypePriorities);

      // install Built-in indexes into CAS
      casMgr.initCASIndexes();
    } catch (CASException e) {
      throw new ResourceInitializationException(e);
    }

    // install AnalysisEngine's custom indexes into CAS
    setupIndexes(casMgr, aFsIndexes);

    // Commit the index repository
    casMgr.getIndexRepositoryMgr().commit();

    // Set JCas ClassLoader
    if (aResourceManager.getExtensionClassLoader() != null) {
      casMgr.setJCasClassLoader(aResourceManager.getExtensionClassLoader());
    }

    return casMgr.getCAS().getView(CAS.NAME_DEFAULT_SOFA);
  }
View Full Code Here

Examples of org.apache.uima.cas.admin.CASMgr

    }
  }

  private CAS getCAS() throws ResourceInitializationException, CASException {
    // Create an initial CASMgr from the factory.
    CASMgr casMgr0 = CASFactory.createCAS();
    CASMgr casMgr = null;
    // this call does nothing: because 2nd arg is null
    CasCreationUtils.setupTypeSystem(casMgr0, null);
    // Create a writable type system.
    TypeSystemMgr tsa = casMgr0.getTypeSystemMgr();

    // Commit the type system.
    ((CASImpl) casMgr0).commitTypeSystem();

    casMgr = CASFactory.createCAS(tsa);

    // Create the Base indexes.
    casMgr.initCASIndexes();
    // Commit the index repository.
    FSIndexRepositoryMgr irm = casMgr.getIndexRepositoryMgr();

    irm.commit();

    // Create the default text Sofa and return CAS view
    return casMgr.getCAS().getCurrentView();
  }
View Full Code Here

Examples of org.apache.uima.cas.admin.CASMgr

      TypeDescription supertype = tsd1.addType("test.Super", "", "uima.cas.TOP");
      supertype.addFeature("testfeat", "", "uima.cas.Integer");
      TypeDescription subtype = tsd1.addType("test.Sub", "", "test.Super");
      subtype.addFeature("testfeat", "", "uima.cas.Integer");

      CASMgr casMgr = CASFactory.createCAS();
      CasCreationUtils.setupTypeSystem(casMgr, tsd1);
      assertNotNull(casMgr.getTypeSystemMgr().getType("test.Super")
              .getFeatureByBaseName("testfeat"));

      TypeSystemDescription tsd2 = new TypeSystemDescription_impl();
      tsd2.setTypes(new TypeDescription[] { subtype, supertype });

      casMgr = CASFactory.createCAS();
      CasCreationUtils.setupTypeSystem(casMgr, tsd2);
      assertNotNull(casMgr.getTypeSystemMgr().getType("test.Super")
              .getFeatureByBaseName("testfeat"));

    } catch (ResourceInitializationException e) {
      JUnitExtension.handleException(e);
    }
View Full Code Here

Examples of org.apache.uima.cas.admin.CASMgr

  public void callProcess(CAS aCAS) throws ResourceServiceException {
    try {
      AFrame requestFrame = new AFrame();
      requestFrame.fset(Constants.VINCI_COMMAND, Constants.ANNOTATE);
      // serialize CAS (including type system)
      CASMgr cas = (CASMgr) aCAS;
      CASCompleteSerializer serializer = Serialization.serializeCASComplete(cas);

      requestFrame.fsetTrueBinary("BinaryCAS", SerializationUtils.serialize(serializer));

      AFrame responseFrame = (AFrame) mVinciClient.sendAndReceive(requestFrame, mTimeout);
View Full Code Here

Examples of org.apache.uima.cas.admin.CASMgr

      throw new AsynchAEException(e);
    }
  }
 
  public static TypeSystemImpl getTypeSystemImpl(ProcessingResourceMetaData resource) throws ResourceInitializationException {
    CASMgr casMgr = CASFactory.createCAS(8, false);
    try {
      CasCreationUtils.setupTypeSystem(casMgr, resource.getTypeSystem());
      ((CASImpl) casMgr).commitTypeSystem();
    } catch (ResourceInitializationException e) {
      UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, "AggregateAnalysisEngineController_impl",
View Full Code Here

Examples of org.apache.uima.cas.admin.CASMgr

      // "com.sun.java.swing.plaf.windows.WindowsLookAndFeel");

      MainFrame frame = new MainFrame();
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

      CASMgr casMgr = CASFactory.createCAS();
      frame.setTypeSystem(casMgr.getTypeSystemMgr());

      // frame.showAnnotFeats();

      frame.pack();
      frame.setVisible(true);
View Full Code Here

Examples of org.apache.uima.cas.admin.CASMgr

*/
public class CASInitializer {

  public static CAS initCas(AnnotatorInitializer init) {
    // Create an initial CASMgr from the factory.
    CASMgr casMgr0 = CASFactory.createCAS();
    CASMgr casMgr = null;
    try {
      CasCreationUtils.setupTypeSystem(casMgr0, (TypeSystemDescription) null);
      // Create a writable type system.
      TypeSystemMgr tsa = casMgr0.getTypeSystemMgr();
      ((TypeSystemImpl) tsa).setCommitted(false);
      // do the type system tests
      init.initTypeSystem(tsa);
      // Commit the type system.
      ((CASImpl) casMgr0).commitTypeSystem();

      casMgr = CASFactory.createCAS(tsa);

      // Create the Base indexes.
      casMgr.initCASIndexes();
      // Commit the index repository.
      FSIndexRepositoryMgr irm = casMgr.getIndexRepositoryMgr();
      init.initIndexes(irm, casMgr.getTypeSystemMgr());
      irm.commit();
    } catch (ResourceInitializationException e) {
      e.printStackTrace();
    } catch (CASException e) {
      e.printStackTrace();
    }

    // Create the default text Sofa and return CAS view
    return casMgr.getCAS().getCurrentView();
  }
View Full Code Here

Examples of org.apache.uima.cas.admin.CASMgr

        casSerializerOut.byteHeapArray = (byte[]) getSerializedDataJNI(BYTEHEAP);
        casSerializerOut.shortHeapArray = (short[]) getSerializedDataJNI(SHORTHEAP);
        casSerializerOut.longHeapArray = (long[]) getSerializedDataJNI(LONGHEAP);

        CASMgr casMgr = (CASMgr) cas;
        CAS newCAS = Serialization.createCAS(casMgr, casSerializerOut);
        if (newCAS != casMgr) {
          throw new RuntimeException("CASMgr and CAS should be identical");
        }
      }
View Full Code Here

Examples of org.apache.uima.cas.admin.CASMgr

        casSerializerOut.byteHeapArray = (byte[]) getSerializedSegmentDataJNI(BYTEHEAP);
        casSerializerOut.shortHeapArray = (short[]) getSerializedSegmentDataJNI(SHORTHEAP);
        casSerializerOut.longHeapArray = (long[]) getSerializedSegmentDataJNI(LONGHEAP);
        releaseSegmentJNI();

        CASMgr casMgr = (CASMgr) segment;
        CAS newCAS = Serialization.createCAS(casMgr, casSerializerOut);
        if (newCAS != casMgr) {
          throw new RuntimeException("CASMgr and CAS should be identical");
        }
      } else {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.