Examples of OperationalProperties


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

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

   
    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

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

      this.getSection().layout();
    } else {
      implName.setText("");
      setEnabled(false);
    }
    OperationalProperties ops = getOperationalProperties();
    if (null != ops) {
      setButtonSelection(modifiesCas, ops.getModifiesCas());
      setButtonSelection(multipleDeploymentAllowed, ops.isMultipleDeploymentAllowed());
      setButtonSelection(outputsNewCASes, ops.getOutputsNewCASes());
    } else {
      setButtonSelection(modifiesCas, true);
      setButtonSelection(multipleDeploymentAllowed, false);
      setButtonSelection(outputsNewCASes, false);
    }
View Full Code Here

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

   *
   * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
   */
  public void handleEvent(Event event) {
    valueChanged = false;
    OperationalProperties ops = getOperationalProperties();
    if (event.widget == findButton) {
      String className = null;
      try {
        String implKind = editor.getAeDescription().getFrameworkImplementation();
        if (Constants.CPP_FRAMEWORK_NAME.equals(implKind)) {
          FileDialog dialog = new FileDialog(getSection().getShell(), SWT.NONE);
          String[] extensions = { "*.dll" };
          dialog.setFilterExtensions(extensions);
          String sStartDir = Platform.getLocation().toString();
          dialog.setFilterPath(sStartDir);
          className = dialog.open();

        } else {
          SelectionDialog typeDialog = JavaUI.createTypeDialog(getSection().getShell(), editor
                  .getEditorSite().getWorkbenchWindow(), editor.getSearchScopeForDescriptorType(),
                  IJavaElementSearchConstants.CONSIDER_CLASSES, false, "*");
          typeDialog.setTitle(MessageFormat.format("Choose the {0} implementation class",
                  new Object[] { editor.descriptorTypeString() }));
          typeDialog.setMessage("Filter/mask:");
          if (typeDialog.open() == Window.CANCEL)
            return;
          Object[] result = typeDialog.getResult();
          if (result != null && result.length > 0)
            className = ((IType) result[0]).getFullyQualifiedName();
        }
        if (className == null || className.equals("")) //$NON-NLS-1$
          return;
        implName.setText(className);
        editor.getAeDescription().setAnnotatorImplementationName(className);
        valueChanged = true;
      } catch (JavaModelException e) {
        throw new InternalErrorCDE("unexpected Exception", e);
      }
    } else if (event.widget == modifiesCas) {
      ops.setModifiesCas(setValueChangedBoolean(modifiesCas.getSelection(), ops.getModifiesCas()));
    } else if (event.widget == multipleDeploymentAllowed) {
      ops.setMultipleDeploymentAllowed(setValueChangedBoolean(multipleDeploymentAllowed
              .getSelection(), ops.isMultipleDeploymentAllowed()));
    } else if (event.widget == outputsNewCASes) {
      ops.setOutputsNewCASes(setValueChangedBoolean(outputsNewCASes.getSelection(), ops
              .getOutputsNewCASes()));
    } else if (event.widget == implName) {
      editor.getAeDescription().setAnnotatorImplementationName(
              setValueChanged(implName.getText(), editor.getAeDescription()
                      .getAnnotatorImplementationName()));
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

      // test a complex descriptor
      XMLInputSource in = new XMLInputSource(JUnitExtension
              .getFile("AnnotatorContextTest/AnnotatorWithGroupsAndNonGroupParams.xml"));
      AnalysisEngineDescription desc = UIMAFramework.getXMLParser().parseAnalysisEngineDescription(in);
      OperationalProperties opProps = desc.getAnalysisEngineMetaData().getOperationalProperties();
      assertNotNull(opProps);
      assertEquals(true, opProps.getModifiesCas());
      assertEquals(true, opProps.isMultipleDeploymentAllowed());
      writer = new StringWriter();
      desc.toXML(writer);
      String descXml = writer.getBuffer().toString();
      is = new ByteArrayInputStream(descXml.getBytes(encoding));
      AnalysisEngineDescription newDesc = (AnalysisEngineDescription) UIMAFramework.getXMLParser()
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.