Package org.apache.uima.resource.metadata

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


   * Returns true. By contract, CAS Consumers must be read only.
   *
   * @see org.apache.uima.collection.base_cpm.CasProcessor#isReadOnly()
   */
  public final boolean isReadOnly() {
    OperationalProperties opProps = getProcessingResourceMetaData().getOperationalProperties();
    return opProps == null ? true : !opProps.getModifiesCas();
  }
View Full Code Here


   
    AnalysisEngineMetaData aggregateMd = new AnalysisEngineMetaData_impl();
    FixedFlow fixedFlow = new FixedFlow_impl();
    fixedFlow.setFixedFlow(new String[]{"key1", "key2", "key3"});
    aggregateMd.setFlowConstraints(fixedFlow);
    OperationalProperties opProps = new OperationalProperties_impl();
    aggregateMd.setOperationalProperties(opProps);
   
    UimaContextAdmin rootContext = UIMAFramework.newUimaContext(
            UIMAFramework.getLogger(), UIMAFramework.newDefaultResourceManager(),
            UIMAFramework.newConfigurationManager());
View Full Code Here

   *
   * @throws Exception
   */
  private boolean isMultipleDeploymentAllowed(String aDescPath, String aCpName, boolean isConsumer)
          throws Exception {
    OperationalProperties op = null;
    // Parse the descriptor to access Operational Properties
    ResourceSpecifier resourceSpecifier = cpeFactory.getSpecifier(new File(aDescPath).toURL());
    if (resourceSpecifier != null && resourceSpecifier instanceof ResourceCreationSpecifier) {
      ResourceMetaData md = ((ResourceCreationSpecifier) resourceSpecifier).getMetaData();
      if (md instanceof ProcessingResourceMetaData) {
        op = ((ProcessingResourceMetaData) md).getOperationalProperties();
        if (op == null) {
          // Operational Properties not defined, so use defaults
          if (isConsumer) {
            return false; // the default for CasConsumer
          }
          return true; // default for AEs
        }
        return op.isMultipleDeploymentAllowed();
      }
    }
    throw new ResourceConfigurationException(ResourceInitializationException.NOT_A_CAS_PROCESSOR,
            new Object[] { aCpName, "<unknown>", aDescPath });

View Full Code Here

    // casProcessingConfigMap may not contain configuration for this Cas Processor if this CP has
    // been
    // added dynamically via API. In this case, just go to metadata and determine via its
    // OperationalProperties if this is parallelizable component.
    if (!cpeFactory.casProcessorConfigMap.containsKey(aCpName)) {
      OperationalProperties op = aProcessor.getProcessingResourceMetaData()
              .getOperationalProperties();
      if (op != null) {
        return op.isMultipleDeploymentAllowed();
      }

      if (UIMAFramework.getLogger().isLoggable(Level.SEVERE)) {
        UIMAFramework.getLogger(this.getClass()).logrb(Level.SEVERE, this.getClass().getName(),
                "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
View Full Code Here

  public AnalysisEngineDescription_impl() {
    setMetaData(new AnalysisEngineMetaData_impl());
    setFrameworkImplementation(Constants.JAVA_FRAMEWORK_NAME);
    // Set default operational properties. These are used if the
    // descriptor is constructed programatically, rather than parsed.
    OperationalProperties opProps = UIMAFramework.getResourceSpecifierFactory()
            .createOperationalProperties();
    opProps.setModifiesCas(true);
    opProps.setMultipleDeploymentAllowed(true);
    opProps.setOutputsNewCASes(false);
    getAnalysisEngineMetaData().setOperationalProperties(opProps);
  }
View Full Code Here

   */
  public void buildFromXMLElement(Element aElement, XMLParser aParser, ParsingOptions aOptions)
          throws InvalidXMLException {
    super.buildFromXMLElement(aElement, aParser, aOptions);
    if (getAnalysisEngineMetaData().getOperationalProperties() == null) {
      OperationalProperties opProps = UIMAFramework.getResourceSpecifierFactory()
              .createOperationalProperties();
      opProps.setModifiesCas(true);
      opProps.setMultipleDeploymentAllowed(true);
      getAnalysisEngineMetaData().setOperationalProperties(opProps);
    }
  }
View Full Code Here

   * (non-Javadoc)
   *
   * @see org.apache.uima.cas_processor.CasProcessor#isReadOnly()
   */
  public boolean isReadOnly() {
    OperationalProperties opProps = getAnalysisEngineMetaData().getOperationalProperties();
    return opProps == null ? false : !opProps.getModifiesCas();
  }
View Full Code Here

   *
   * @throws ResourceInitializationException
   *           if there is an invalid parameter override declaration
   */
  protected void validateOperationalProperties() throws ResourceInitializationException {
    OperationalProperties aggProps = getAnalysisEngineMetaData().getOperationalProperties();
    if (aggProps != null) {
      boolean atLeastOneCasMultiplier = false;
      Iterator metadataIterator = _getComponentMetaData().values().iterator();
      while (metadataIterator.hasNext()) {
        ProcessingResourceMetaData md = (ProcessingResourceMetaData) 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;
          }
        }
      }
      if (aggProps.getOutputsNewCASes() && !atLeastOneCasMultiplier) {
View Full Code Here

   */
  public FlowControllerDescription_impl() {
    setMetaData(new ProcessingResourceMetaData_impl());
    setFrameworkImplementation(Constants.JAVA_FRAMEWORK_NAME);
    // set default operational properties (may be overrriden during parsing)
    OperationalProperties opProps = UIMAFramework.getResourceSpecifierFactory()
            .createOperationalProperties();
    opProps.setModifiesCas(false);
    opProps.setMultipleDeploymentAllowed(true);
    opProps.setOutputsNewCASes(false);
    getFlowControllerMetaData().setOperationalProperties(opProps);
  }
View Full Code Here

   */
  public void buildFromXMLElement(Element aElement, XMLParser aParser, ParsingOptions aOptions)
          throws InvalidXMLException {
    super.buildFromXMLElement(aElement, aParser, aOptions);
    if (getFlowControllerMetaData().getOperationalProperties() == null) {
      OperationalProperties opProps = UIMAFramework.getResourceSpecifierFactory()
              .createOperationalProperties();
      opProps.setModifiesCas(false);
      opProps.setMultipleDeploymentAllowed(true);
      opProps.setOutputsNewCASes(false);
      getFlowControllerMetaData().setOperationalProperties(opProps);
    }
  }
View Full Code Here

TOP

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

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.