Package org.apache.uima.resource

Examples of org.apache.uima.resource.Resource


        ResourceInitializationException currentException = null;
        try {
          // check to see if this is a subclass of aResourceClass
          if (aResourceClass.isAssignableFrom(currentClass)) {
            // instantiate this Resource Class
            Resource resource = (Resource) currentClass.newInstance();
            // attempt to initialize it
            UIMAFramework.getLogger(CLASS_NAME).logrb(Level.CONFIG, CLASS_NAME.getName(),
                    "produceResource", LOG_RESOURCE_BUNDLE, "UIMA_trying_resource_class__CONFIG",
                    currentClass.getName());

            if (resource.initialize(aSpecifier, aAdditionalParams)) {
              // success!
              return resource;
            }
          }
        }
View Full Code Here


  public void destroy() {
    // destroy component AnalysisEngines
    Iterator i = mComponentAnalysisEngineMap.entrySet().iterator();
    while (i.hasNext()) {
      Map.Entry entry = (Map.Entry) i.next();
      Resource delegate = (Resource) entry.getValue();
      delegate.destroy();
    }
    if (mFlowControllerContainer != null) {
      mFlowControllerContainer.destroy();
    }
  }
View Full Code Here

                  new Object[] { className, aResourceClass.getName(),
                      aSpecifier.getSourceUrlString() });
        }

        // instantiate this Resource Class
        Resource resource = (Resource) implClass.newInstance();
        // attempt to initialize it
        if (resource.initialize(aSpecifier, aAdditionalParams)) {
          // success!
          return resource;
        } else // failure, for some unknown reason :( This isn't likely to happen
        {
          throw new ResourceInitializationException(
View Full Code Here

                  new Object[] { className, aResourceClass.getName(),
                      aSpecifier.getSourceUrlString() });
        }

        // instantiate this Resource Class
        Resource resource = (Resource) implClass.newInstance();
        // attempt to initialize it
        if (resource.initialize(aSpecifier, aAdditionalParams)) {
          // success!
          return resource;
        } else // failure, for some unknown reason :( This isn't likely to happen
        {
          throw new ResourceInitializationException(
View Full Code Here

        ProcessingResourceMetaData md = new ProcessingResourceMetaData_impl();
        md.setTypePriorities((TypePriorities) current);
        mdList.add(md);
      } else if (current instanceof ResourceSpecifier) {
        // try to instantiate the resource
        Resource resource = null;
        Map resourceMgrInMap = new HashMap();
        resourceMgrInMap.put(Resource.PARAM_RESOURCE_MANAGER, aResourceManager);
        try {
          resource = UIMAFramework.produceResource((ResourceSpecifier) current,
              (null == aResourceManager) ? Collections.EMPTY_MAP : resourceMgrInMap);
        } catch (Exception e) {
          // failed. If aOutputFailedRemotes is non-null, add an entry to it to it, else throw the
          // exception.
          if (aOutputFailedRemotes != null) {
            aOutputFailedRemotes.put(aContextName, e);
          } else {
            if (e instanceof ResourceInitializationException)
              throw (ResourceInitializationException) e;
            else if (e instanceof RuntimeException)
              throw (RuntimeException) e;
            else
              throw new RuntimeException(e);
          }
        }
        if (resource != null) {
          ResourceMetaData metadata = resource.getMetaData();
          if (metadata instanceof ProcessingResourceMetaData) {
            mdList.add(metadata);
          }
          resource.destroy();
        }
      } else {
        throw new ResourceInitializationException(
            ResourceInitializationException.UNSUPPORTED_OBJECT_TYPE_IN_CREATE_CAS,
            new Object[] { current.getClass().getName() });
View Full Code Here

TOP

Related Classes of org.apache.uima.resource.Resource

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.