Package org.apache.uima.resource.metadata

Examples of org.apache.uima.resource.metadata.ProcessingResourceMetaData


      if (!fwImpl.startsWith(Constants.JAVA_FRAMEWORK_NAME)) {
        return false;
      }

      super.initialize(aSpecifier, aAdditionalParams);
      ProcessingResourceMetaData md = (ProcessingResourceMetaData) mDescription.getMetaData();

      // Get logger for this class
      Logger logger = getLogger();
      logger.logrb(Level.CONFIG, CLASS_NAME.getName(), "initialize", LOG_RESOURCE_BUNDLE,
              "UIMA_analysis_engine_init_begin__CONFIG", md.getName());

      // Normalize language codes. Need to do this since a wide variety of
      // spellings are acceptable according to ISO.
      normalizeIsoLangCodes(md);

      // clone this metadata and assign a UUID if not already present
      ResourceMetaData mdCopy = (ResourceMetaData) md.clone();

      if (mdCopy.getUUID() == null) {
        mdCopy.setUUID(UUIDGenerator.generate());
      }
      setMetaData(mdCopy);

      // validate the AnalysisEngineDescription and throw a
      // ResourceInitializationException if there is a problem
      mDescription.validate(getResourceManager());

      // Read parameters from the aAdditionalParams map.
      if (aAdditionalParams == null) {
        aAdditionalParams = Collections.emptyMap();
      }
      // determine if verification mode is on
      mVerificationMode = aAdditionalParams.containsKey(PARAM_VERIFICATION_MODE);

      // determine if this component is Sofa-aware (based on whether it
      // declares any input or output sofas in its capabilities)
      mSofaAware = getAnalysisEngineMetaData().isSofaAware();

      initializeAnalysisComponent(aAdditionalParams);

      // Initialize ResultSpec based on output capabilities
      // TODO: should only do this for outermost AE
      resetResultSpecificationToDefault();

      logger.logrb(Level.CONFIG, CLASS_NAME.getName(), "initialize", LOG_RESOURCE_BUNDLE,
              "UIMA_analysis_engine_init_successful__CONFIG", md.getName());
      return true;
    } catch (ResourceConfigurationException e) {
      throw new ResourceInitializationException(
              ResourceInitializationException.ERROR_INITIALIZING_FROM_DESCRIPTOR, new Object[] {
                  getMetaData().getName(), aSpecifier.getSourceUrlString() });
View Full Code Here


   */
  private Capability[] getAllComponentCapabilities() {
    ArrayList<Capability> capabilityList = new ArrayList<Capability>();
    Iterator<ProcessingResourceMetaData> iter = _getComponentMetaData().values().iterator();
    while (iter.hasNext()) {
      ProcessingResourceMetaData md = iter.next();
      capabilityList.addAll(Arrays.asList(md.getCapabilities()));
    }
    Capability[] capabilityArray = new Capability[capabilityList.size()];
    capabilityList.toArray(capabilityArray);
    return capabilityArray;
  }
View Full Code Here

    }

    // iterate over metadata for all components
    Iterator<ProcessingResourceMetaData> metadataIterator = _getComponentMetaData().values().iterator();
    while (metadataIterator.hasNext()) {
      ProcessingResourceMetaData md = metadataIterator.next();
      if (md.getTypeSystem() != null)
        typeSystems.add(md.getTypeSystem());
      if (md.getTypePriorities() != null)
        typePriorities.add(md.getTypePriorities());
      if (md.getFsIndexCollection() != null)
        fsIndexCollections.add(md.getFsIndexCollection());
    }

    // now do merge
    TypeSystemDescription aggTypeDesc = CasCreationUtils.mergeTypeSystems(typeSystems,
            getResourceManager());
View Full Code Here

    OperationalProperties aggProps = getAnalysisEngineMetaData().getOperationalProperties();
    if (aggProps != null) {
      boolean atLeastOneCasMultiplier = false;
      Iterator<ProcessingResourceMetaData> metadataIterator = _getComponentMetaData().values().iterator();
      while (metadataIterator.hasNext()) {
        ProcessingResourceMetaData md = metadataIterator.next();
        OperationalProperties componentProps = md.getOperationalProperties();
        if (componentProps != null) {
          if (aggProps.isMultipleDeploymentAllowed()
                  && !componentProps.isMultipleDeploymentAllowed()) {
            throw new ResourceInitializationException(
                    ResourceInitializationException.INVALID_MULTIPLE_DEPLOYMENT_ALLOWED,
                    new Object[] { getAnalysisEngineMetaData().getName(), md.getName(),
                        getAnalysisEngineMetaData().getSourceUrlString() });
          }
          if (!aggProps.getModifiesCas() && componentProps.getModifiesCas()) {
            throw new ResourceInitializationException(
                    ResourceInitializationException.INVALID_MODIFIES_CAS, new Object[] {
                        getAnalysisEngineMetaData().getName(), md.getName(),
                        getAnalysisEngineMetaData().getSourceUrlString() });
          }
          if (componentProps.getOutputsNewCASes()) {
            atLeastOneCasMultiplier = true;
          }
View Full Code Here

      }

      mergeDelegateAnalysisEngineMetaData();     
    }

    ProcessingResourceMetaData md = (ProcessingResourceMetaData) mDescription.getMetaData();
    // resolve imports for primitives
    if (mDescription instanceof AnalysisEngineDescription  &&
            ((AnalysisEngineDescription)mDescription).isPrimitive()) {
        try {
          md.resolveImports();
        } catch (InvalidXMLException e1) {
        throw new ResourceInitializationException(e1);
      }
       }

    super.initialize(aSpecifier, aAdditionalParams);

    getLogger().logrb(Level.CONFIG, CLASS_NAME.getName(), "initialize", LOG_RESOURCE_BUNDLE,
            "UIMA_analysis_engine_init_begin__CONFIG", md.getName());

 
    // Normalize language codes. Need to do this since a wide variety of
    // spellings are acceptable according to ISO.
    normalizeIsoLangCodes(md);

    // clone this metadata and assign a UUID if not already present
    AnalysisEngineMetaData mdCopy = (AnalysisEngineMetaData) md.clone();

    if (mdCopy.getUUID() == null) {
      mdCopy.setUUID(UUIDGenerator.generate());
    }
    setMetaData(mdCopy);

    // Read parameters from the aAdditionalParams map.
    if (aAdditionalParams == null) {
      aAdditionalParams = Collections.emptyMap();
    }

    // determine if verification mode is on
    mVerificationMode = aAdditionalParams.containsKey(PARAM_VERIFICATION_MODE);

    // determine if this component is Sofa-aware (based on whether it
    // declares any input or output sofas in its capabilities)
    mSofaAware = getAnalysisEngineMetaData().isSofaAware();

    initializeAnalysisComponent();

    resetResultSpecificationToDefault();

    getLogger().logrb(Level.CONFIG, CLASS_NAME.getName(), "initialize", LOG_RESOURCE_BUNDLE,
            "UIMA_analysis_engine_init_successful__CONFIG", md.getName());

    return true;
  }
View Full Code Here

            (AnalysisEngineDescription) mDescription, getResourceManager());
    FsIndexCollection aggIndexColl = CasCreationUtils
            .mergeDelegateAnalysisEngineFsIndexCollections((AnalysisEngineDescription)mDescription, getResourceManager());

    // assign results of merge to this aggregate AE's metadata
    ProcessingResourceMetaData aggregateMD = (ProcessingResourceMetaData) mDescription.getMetaData();
    aggregateMD.setTypeSystem(aggTypeSystem);
    aggregateMD.setTypePriorities(aggTypePriorities);
    aggregateMD.setFsIndexCollection(aggIndexColl);
  }
View Full Code Here

    List<TypeSystemDescription> typeSystems = new ArrayList<TypeSystemDescription>();
    List<TypePriorities> typePriorities = new ArrayList<TypePriorities>();
    List<FsIndexCollection> fsIndexes = new ArrayList<FsIndexCollection>();
    Iterator<ProcessingResourceMetaData> it = mdList.iterator();
    while (it.hasNext()) {
      ProcessingResourceMetaData md = it.next();
      if (md.getTypeSystem() != null)
        typeSystems.add(md.getTypeSystem());
      if (md.getTypePriorities() != null)
        typePriorities.add(md.getTypePriorities());
      if (md.getFsIndexCollection() != null)
        fsIndexes.add(md.getFsIndexCollection());
    }

    // merge
    TypeSystemDescription aggTypeDesc = mergeTypeSystems(typeSystems, aResourceManager);
    TypePriorities aggTypePriorities = mergeTypePriorities(typePriorities, aResourceManager);
View Full Code Here

    List<TypeSystemDescription> typeSystems = new ArrayList<TypeSystemDescription>();
    List<TypePriorities> typePriorities = new ArrayList<TypePriorities>();
    List<FsIndexCollection> fsIndexes = new ArrayList<FsIndexCollection>();
    Iterator<ProcessingResourceMetaData> it = mdList.iterator();
    while (it.hasNext()) {
      ProcessingResourceMetaData md = it.next();
      if (md.getTypeSystem() != null)
        typeSystems.add(md.getTypeSystem());
      if (md.getTypePriorities() != null)
        typePriorities.add(md.getTypePriorities());
      if (md.getFsIndexCollection() != null)
        fsIndexes.add(md.getFsIndexCollection());
    }

    // merge TypePriorities and FsIndexes
    TypePriorities aggTypePriorities = mergeTypePriorities(typePriorities, aResourceManager);
    FsIndexCollection aggIndexColl = mergeFsIndexes(fsIndexes, aResourceManager);
View Full Code Here

    // extract type systems and merge
    List<TypeSystemDescription> typeSystems = new ArrayList<TypeSystemDescription>();
    Iterator<ProcessingResourceMetaData> it = mdList.iterator();
    while (it.hasNext()) {
      ProcessingResourceMetaData md = (ProcessingResourceMetaData) it.next();
      if (md.getTypeSystem() != null)
        typeSystems.add(md.getTypeSystem());
    }
    return mergeTypeSystems(typeSystems, aResourceManager, aOutputMergedTypes);
  }
View Full Code Here

    // extract FsIndexCollections and merge
    List<FsIndexCollection> fsIndexes = new ArrayList<FsIndexCollection>();
    Iterator<ProcessingResourceMetaData> it = mdList.iterator();
    while (it.hasNext()) {
      ProcessingResourceMetaData md = (ProcessingResourceMetaData) it.next();
      if (md.getFsIndexCollection() != null)
        fsIndexes.add(md.getFsIndexCollection());
    }
    return mergeFsIndexes(fsIndexes, aResourceManager);
  }
View Full Code Here

TOP

Related Classes of org.apache.uima.resource.metadata.ProcessingResourceMetaData

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.