@Override public void buildFromXMLElement(Element aElement, XMLParser aParser, ParsingOptions aOptions) throws InvalidXMLException { // overridden to set proper defaults // https://issues.apache.org/jira/browse/UIMA-2350 // These change depending on the element which is the parent of the parent of this element String grandParentName = ""; Node p = aElement.getParentNode(); if (p instanceof Element) { Node gp = p.getParentNode(); if (gp instanceof Element) { grandParentName = ((Element) gp).getTagName(); } } setModifiesCas(grandParentName.equals("casConsumerDescription") ? false : true); setOutputsNewCASes(grandParentName.equals("collectionReaderDescription") ? true : false); setMultipleDeploymentAllowed(grandParentName.equals("collectionReaderDescription") || grandParentName.equals("casConsumerDescription") ? false : true); super.buildFromXMLElement(aElement, aParser, aOptions); } }
/** * Initializes this instance with configuration defined in the CPE descriptor. * * @param aCasProcessorType - */ public NetworkCasProcessorImpl(CpeCasProcessor aCasProcessorType) { casProcessorType = aCasProcessorType; retryCount = casProcessorType.getErrorHandling().getMaxConsecutiveRestarts().getRestartCount(); if (retryCount == 0) { retryCount = DEFAULT_RETRY_COUNT; } // Instantiate metadata object to store configuration information 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); }