/** * Find the position in the list of the Cas Processor with a given name. * * @param aName the a name * @param aList the a list * @return the position in the list of the Cas Processor with a given name */ private int getPositionInListIfExists(String aName, List aList) { for (int i = 0; i < aList.size(); i++) { List innerList = (ArrayList) aList.get(i); // Get the name of the first CP in the list. The inner list contains CPs of the same kind String currentCPName = ((CasProcessor) innerList.get(0)).getProcessingResourceMetaData() .getName(); if (aName != null && aName.trim().equals(currentCPName.trim())) { return i; } } return -1; }
/** * Returns index to a CasProcessor with a given name in a given List. * * @param aDeployList - * List of CasConsumers to be searched * @param aName - * name of the CasConsumer we want to find * @return 0 - if a CasConsumer is not found in a list, else returns a position in the list where * the CasConsumer can found */ private int getIndexInList(List aDeployList, String aName) { for (int i = 0; i < aDeployList.size(); i++) { List innerList = (ArrayList) aDeployList.get(i); String currentCPName = ((CasProcessor) innerList.get(0)).getProcessingResourceMetaData() .getName(); if (aName != null && aName.trim().equals(currentCPName.trim())) { return i; } } return 0; }
/** * Returns the name of this container. It is the name of the Cas Processor. * * @return the name */ @Override public String getName() { if (processorName == null) { if (metadata != null && Constants.DEPLOYMENT_INTEGRATED.equalsIgnoreCase(casProcessorCPEConfiguration .getDeploymentType())) { processorName = metadata.getName().trim(); } else { processorName = casProcessorCPEConfiguration.getName().trim(); } } return processorName; }
/** * Appends given Cas Processor to the list of CasProcessors. * * @param aCasProcessor - * CasProcessor to add * @throws ResourceConfigurationException the resource configuration exception */ public void addCasProcessor(CasProcessor aCasProcessor) throws ResourceConfigurationException { if (!initialized) { addCasProcessor(aCasProcessor.getProcessingResourceMetaData().getName()); } }
/** * Adds a CASProcessor to the processing pipeline. If a CasProcessor already exists and its * status=DISABLED this method will re-enable the CasProcesser. * * @param aCasProcessor CASProcessor to be added to the processing pipeline * @throws ResourceConfigurationException the resource configuration exception */ public void addCasProcessor(CasProcessor aCasProcessor) throws ResourceConfigurationException { String name = aCasProcessor.getProcessingResourceMetaData().getName(); // Set a global flag to indicate the we should support mixed CasProcessor types. // When this supported is enabled TCAS array will be instantiated to facilitate // conversions between CasData and TCAS. if (aCasProcessor instanceof CasObjectProcessor || aCasProcessor instanceof CasConsumer) { mixedCasProcessorTypeSupport = true; } ArrayList newList = null; int indexPos = getPositionInListIfExists(name, initial_cp_list); if (indexPos == -1) { newList = new ArrayList(); newList.add(aCasProcessor); // New Cas Processor. Add it to a list initial_cp_list.add(newList); } else { newList = (ArrayList) initial_cp_list.get(indexPos); newList.add(aCasProcessor); } }
/** * Creates the default process trace. * * @param aProcessors the a processors * @param srcProcTr the src proc tr * @param aProcessTrace the a process trace */ private void createDefaultProcessTrace(CasProcessor[] aProcessors, ProcessTrace srcProcTr, ProcessTrace aProcessTrace) { for (int i = 0; aProcessors != null && i < aProcessors.length; i++) { String name = aProcessors[i].getProcessingResourceMetaData().getName(); if (name == null) { name = aProcessors[i].getClass().getName(); } synchronized (srcProcTr) { List eventList = srcProcTr.getEventsByComponentName(name, false); for (int j = 0; j < eventList.size(); j++) { ProcessTraceEvent prEvent = (ProcessTraceEvent) eventList.get(j); aProcessTrace.addEvent(prEvent); } } } }
String name = ((CasProcessor) cpList.get(0)).getProcessingResourceMetaData().getName(); if (cpList.size() > 0) {
public synchronized void addCasProcessor(CasProcessor aCasProcessor) { if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) { UIMAFramework.getLogger(this.getClass()).logrb( Level.FINEST, this.getClass().getName(), "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_add_cp_to_pool__FINEST", new Object[] { Thread.currentThread().getName(), aCasProcessor.getProcessingResourceMetaData().getName() }); } mAllInstances.add(aCasProcessor); mFreeInstances.add(aCasProcessor); if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) { UIMAFramework.getLogger(this.getClass()).logrb( Level.FINEST, this.getClass().getName(), "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_show_cp_pool_size__FINEST", new Object[] { Thread.currentThread().getName(), String.valueOf(mAllInstances.size()), String.valueOf(mFreeInstances.size()) }); } }
String name = cp.getProcessingResourceMetaData().getName();
String name = ((CasProcessor) cpList.get(0)).getProcessingResourceMetaData().getName(); if (UIMAFramework.getLogger().isLoggable(Level.CONFIG)) { UIMAFramework.getLogger(this.getClass()).logrb(Level.CONFIG, this.getClass().getName(),
ProcessingResourceMetaData metaData = casProcessor.getProcessingResourceMetaData(); CpeCasProcessor casProcessorType = (CpeCasProcessor) cpeFactory.casProcessorConfigMap .get(metaData.getName());
String name = casProcessor.getProcessingResourceMetaData().getName(); if (!casProcessorConfigMap.containsKey(name)) { casProcessorConfigMap.put(name, processorType);
throw new ResourceInitializationException( ResourceInitializationException.INVALID_MULTIPLE_DEPLOYMENT_ALLOWED, new Object[] { getAnalysisEngineMetaData().getName(), md.getName(), getAnalysisEngineMetaData().getSourceUrlString() }); throw new ResourceInitializationException( ResourceInitializationException.INVALID_MODIFIES_CAS, new Object[] { getAnalysisEngineMetaData().getName(), md.getName(), getAnalysisEngineMetaData().getSourceUrlString() });
ProcessingResourceMetaData metaData = cProcessor.getProcessingResourceMetaData(); CpeCasProcessor casProcessorType = (CpeCasProcessor) cpeFactory.casProcessorConfigMap .get(metaData.getName());
String readerName = collectionReader.getProcessingResourceMetaData().getName(); if (readerName != null) { restoreFromCheckpoint(readerName, "COLLECTION READER PROCESSING TIME");
"UIMA_CPM_add_cp__CONFIG", new Object[] { Thread.currentThread().getName(), casProcessors[i].getProcessingResourceMetaData().getName() });
/** * Convert to ae meta data. * * @param r the r * @return the analysis engine meta data */ private AnalysisEngineMetaData convertToAeMetaData(ResourceMetaData r) { ProcessingResourceMetaData p = (ProcessingResourceMetaData) r; AnalysisEngineMetaData d = UIMAFramework.getResourceSpecifierFactory() .createAnalysisEngineMetaData(); d.setCapabilities(p.getCapabilities()); d.setConfigurationParameterDeclarations(p.getConfigurationParameterDeclarations()); d.setConfigurationParameterSettings(p.getConfigurationParameterSettings()); d.setCopyright(p.getCopyright()); d.setDescription(p.getDescription()); d.setFsIndexCollection(p.getFsIndexCollection()); d.setName(p.getName()); d.setTypePriorities(p.getTypePriorities()); d.setTypeSystem(p.getTypeSystem()); d.setVendor(p.getVendor()); d.setVersion(p.getVersion()); d.setOperationalProperties(p.getOperationalProperties()); ((AnalysisEngineMetaData_impl)d).setInfoset(((MetaDataObject_impl)r).getInfoset()); return d; }