Package org.apache.uima.resource

Examples of org.apache.uima.resource.ResourceCreationSpecifier


    }
        ResourceSpecifier crrs = xmlParser.parseCollectionReaderDescription(in);

        duccOut.debug(location, job.getDuccId(), crcfg);
        // CR overrides
        ResourceCreationSpecifier specifier = (ResourceCreationSpecifier) crrs;
        ConfigurationParameterDeclarations configurationParameterDeclarations = specifier.getMetaData().getConfigurationParameterDeclarations();
        ConfigurationParameterSettings cps = specifier.getMetaData().getConfigurationParameterSettings();
        if(crcfg!= null) {
            // Tokenize override assignments on whitespace, honoring but stripping quotes
            // Then create a map from all of them
            ArrayList<String> toks = QuotedOptions.tokenizeList(crcfg, true);
            Map<String,String> map = QuotedOptions.parseAssignments(toks, false);
View Full Code Here


        // Do not generate descriptors for abstract classes, they cannot be instantiated.
        if (Modifier.isAbstract(clazz.getModifiers())) {
          continue;
        }
       
        ResourceCreationSpecifier desc = null;
        switch (Util.getType(componentLoader, clazz)) {
          case ANALYSIS_ENGINE:
            desc = AnalysisEngineFactory.createEngineDescription(clazz);
            break;
          case COLLECTION_READER:
View Full Code Here

      if (!(aSpecifier instanceof FlowControllerDescription)) {
        throw new ResourceInitializationException(
                ResourceInitializationException.NOT_A_FLOW_CONTROLLER_DESCRIPTOR, new Object[] {
                    aSpecifier.getSourceUrlString(), aSpecifier.getClass().getName() });
      }
      ResourceCreationSpecifier desc = (ResourceCreationSpecifier) aSpecifier;

      // also framework implementation must start with org.apache.uima.java
      final String fwImpl = desc.getFrameworkImplementation();
      if (fwImpl == null
              || !fwImpl.equalsIgnoreCase(Constants.JAVA_FRAMEWORK_NAME)) {
        throw new ResourceInitializationException(
                ResourceInitializationException.UNSUPPORTED_FRAMEWORK_IMPLEMENTATION, new Object[] {
                    fwImpl, aSpecifier.getSourceUrlString() });
      }

      super.initialize(aSpecifier, aAdditionalParams);

      // validate the descriptor
      desc.validate(getResourceManager());

      // instantiate FlowController
      mFlowController = instantiateFlowController(desc);

      // record metadata
      setMetaData(desc.getMetaData());

      // add our metadata to the CasManager, so that it will pick up our
      // type system, priorities, and indexes
      getCasManager().addMetaData(getProcessingResourceMetaData());
View Full Code Here

            && aResourceClass.isAssignableFrom(TextAnalysisEngine.class))
    // NOTE: for backwards-compatibility, we have to check TextAnalysisEngine,
    // not AnalysisEngine. Otherwise produceTAE would fail becasue
    // TextAnalysisEngien.class.isAssignableFrom(AnalysisEngine.class) is false.
    {
      ResourceCreationSpecifier spec = (ResourceCreationSpecifier) aSpecifier;
      if (multiprocessing) {
        resource = new MultiprocessingAnalysisEngine_impl();
      } else {

        String frameworkImpl = spec.getFrameworkImplementation();
        if (frameworkImpl == null || frameworkImpl.length() == 0) {
          throw new ResourceInitializationException(
                  ResourceInitializationException.MISSING_FRAMEWORK_IMPLEMENTATION,
                  new Object[] { aSpecifier.getSourceUrlString() });
        }

        if (frameworkImpl.startsWith(Constants.CPP_FRAMEWORK_NAME)) {
          resource = new UimacppAnalysisEngineImpl();
        } else if (frameworkImpl.startsWith(Constants.JAVA_FRAMEWORK_NAME)) {
          if (spec instanceof AnalysisEngineDescription
                  && !((AnalysisEngineDescription) spec).isPrimitive()) {
            resource = new AggregateAnalysisEngine_impl();
          } else {
            resource = new PrimitiveAnalysisEngine_impl();
          }
        } else {
          throw new ResourceInitializationException(
                  ResourceInitializationException.UNSUPPORTED_FRAMEWORK_IMPLEMENTATION,
                  new Object[] { spec.getFrameworkImplementation(), aSpecifier.getSourceUrlString() });
        }
      }
    }

    if (resource != null && resource.initialize(aSpecifier, aAdditionalParams)) {
View Full Code Here

      if (!(aSpecifier instanceof FlowControllerDescription)) {
        throw new ResourceInitializationException(
                ResourceInitializationException.NOT_A_FLOW_CONTROLLER_DESCRIPTOR, new Object[] {
                    aSpecifier.getSourceUrlString(), aSpecifier.getClass().getName() });
      }
      ResourceCreationSpecifier desc = (ResourceCreationSpecifier) aSpecifier;

      // also framework implementation must start with org.apache.uima.java
      final String fwImpl = desc.getFrameworkImplementation();
      if (fwImpl == null
              || !fwImpl.equalsIgnoreCase(Constants.JAVA_FRAMEWORK_NAME)) {
        throw new ResourceInitializationException(
                ResourceInitializationException.UNSUPPORTED_FRAMEWORK_IMPLEMENTATION, new Object[] {
                    fwImpl, aSpecifier.getSourceUrlString() });
      }

      super.initialize(aSpecifier, aAdditionalParams);

      // validate the descriptor
      desc.validate(getResourceManager());

      // instantiate FlowController
      mFlowController = instantiateFlowController(desc);

      // record metadata
      setMetaData(desc.getMetaData());

      // add our metadata to the CasManager, so that it will pick up our
      // type system, priorities, and indexes
      getCasManager().addMetaData(getProcessingResourceMetaData());
View Full Code Here

   * @throws IOException
   *           if the descriptor could not be read
   */
  public static CollectionReaderDescription createReaderDescriptionFromPath(String descriptorPath,
          Object... configurationData) throws UIMAException, IOException {
    ResourceCreationSpecifier specifier = createResourceCreationSpecifier(descriptorPath,
            configurationData);
    return (CollectionReaderDescription) specifier;
  }
View Full Code Here

TOP

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

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.