Examples of OperationalProperties


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

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

  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

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

   */
  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

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

    desc.setAnnotatorImplementationName(componentClass.getName());
    org.apache.uima.fit.descriptor.OperationalProperties componentAnno = ReflectionUtil
            .getInheritableAnnotation(org.apache.uima.fit.descriptor.OperationalProperties.class,
                    componentClass);
    if (componentAnno != null) {
      OperationalProperties op = desc.getAnalysisEngineMetaData().getOperationalProperties();
      op.setMultipleDeploymentAllowed(componentAnno.multipleDeploymentAllowed());
      op.setModifiesCas(componentAnno.modifiesCas());
      op.setOutputsNewCASes(componentAnno.outputsNewCases());
    } else {
      OperationalProperties op = desc.getAnalysisEngineMetaData().getOperationalProperties();
      op.setMultipleDeploymentAllowed(MULTIPLE_DEPLOYMENT_ALLOWED_DEFAULT);
      op.setModifiesCas(MODIFIES_CAS_DEFAULT);
      op.setOutputsNewCASes(OUTPUTS_NEW_CASES_DEFAULT);
    }

    // Configure resource meta data
    AnalysisEngineMetaData meta = desc.getAnalysisEngineMetaData();
    ResourceMetaDataFactory.configureResourceMetaData(meta, componentClass);
View Full Code Here

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

          Capability[] dlgCapabilities = dlgAeMetadata.getCapabilities();
          if (dlgCapabilities != null)
            for (int n = 0; n < dlgCapabilities.length; n++)
              allCapabilities.add(dlgCapabilities[n]);
          // check operational properties
          OperationalProperties dlgOperProps = dlgAeMetadata.getOperationalProperties();
          if (dlgOperProps != null) {
            if (!dlgOperProps.isMultipleDeploymentAllowed())
              isMultipleDeploymentAllowed = false;
            if (dlgOperProps.getModifiesCas())
              modifiesCas = true;
          } else
            // by default, AE modifies CAS
            modifiesCas = true;
        } else if (dlgSpecifier instanceof CasConsumerDescription) {
          // get CC metadata
          ProcessingResourceMetaData dlgCcMetadata = ((CasConsumerDescription) dlgSpecifier)
                  .getCasConsumerMetaData();
          // collect CC capabilities
          Capability[] dlgCapabilities = dlgCcMetadata.getCapabilities();
          if (dlgCapabilities != null)
            for (int n = 0; n < dlgCapabilities.length; n++)
              allCapabilities.add(dlgCapabilities[n]);
          // check operational properties
          OperationalProperties dlgOperProps = dlgCcMetadata.getOperationalProperties();
          if (dlgOperProps != null) {
            if (!dlgOperProps.isMultipleDeploymentAllowed())
              isMultipleDeploymentAllowed = false;
          }
        } else
          // other categories (CR, CI) are not allowed
          throw new IllegalArgumentException("unsupported input component");
      }
      // merge capabilities, excluding duplicates
      Capability[] mergedCapabilities = mergeCapabilities(allCapabilities, rsFactory);
      // set aggregate capabilities
      aggMetadata.setCapabilities(mergedCapabilities);
      // set aggregate operational properties
      OperationalProperties aggOperProps = aggMetadata.getOperationalProperties();
      if (aggOperProps != null) {
        aggOperProps.setMultipleDeploymentAllowed(isMultipleDeploymentAllowed);
        aggOperProps.setModifiesCas(modifiesCas);
      }
    } catch (IllegalArgumentException exc) {
      PMController.logErrorMessage("Invalid input component # " + lastInputNo);
      PMController.logErrorMessage("IllegalArgumentException: " + exc.getMessage());
      aggDescription = null;
View Full Code Here

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

   *
   * @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

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

    // 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

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

    metadata = new ProcessingResourceMetaData_impl();
    // Each CasProcessor has name
    name = casProcessorType.getName();
    metadata.setName(name);

    OperationalProperties operationalProperties = new OperationalProperties_impl();
    operationalProperties.setModifiesCas(true);
    operationalProperties.setMultipleDeploymentAllowed(true);
    metadata.setOperationalProperties(operationalProperties);

    ConfigurationParameterSettings settings = new ConfigurationParameterSettings_impl();
    settings.setParameterValue(Constants.CAS_PROCESSOR_CONFIG, casProcessorType);
    metadata.setConfigurationParameterSettings(settings);
View Full Code Here

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

        //can't throw exception from here so just log it and return the default
        UIMAFramework.getLogger(this.getClass()).log(Level.SEVERE, e.getMessage(), e);
        return true;
      }
    }
    OperationalProperties opProps =  resourceMetadata.getOperationalProperties();
    if (opProps != null) {
      return !opProps.isMultipleDeploymentAllowed();
    }
    return true; //default
  }
View Full Code Here

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

        //can't throw exception from here so just log it and return the default
        UIMAFramework.getLogger(this.getClass()).log(Level.SEVERE, e.getMessage(), e);
        return false;
      }
    }
    OperationalProperties opProps =  resourceMetadata.getOperationalProperties();
    if (opProps != null) {
      return !opProps.getModifiesCas();
    }
    return false; //default 
  }
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.