/** * Gets the ResourceManager used by this UimaContext to locate and access external resources * * @return the ResourceManager */ public ResourceManager getResourceManager() { if (null == mPearResourceManager) { return parentContext.getResourceManager(); } return mPearResourceManager; }
/** * Gets the ResourceManager that all components of this CPE should share. * * @return the resource manager */ public ResourceManager getResourceManager() { return uimaContext.getResourceManager(); }
private void initializeResourceManager() { if (context instanceof UimaContextAdmin) { UimaContextAdmin uca = (UimaContextAdmin) context; ResourceManager rm = uca.getResourceManager(); if (rm != null) { resourceManager = rm; } } if (resourceManager == null) { resourceManager = UIMAFramework.newDefaultResourceManager(); } }
/** * Gets the extension ClassLoader to used to locate the message digests. If this returns null, * then message digests will be searched for using this.class.getClassLoader(). */ private ClassLoader getExtensionClassLoader() { if (context instanceof UimaContextAdmin) { ResourceManager resMgr = ((UimaContextAdmin) context).getResourceManager(); if (resMgr != null) { return resMgr.getExtensionClassLoader(); } else { return null; } } return null; } }
public static AnalysisEngine produceAnalysisEngine(UimaContext c, AnalysisEngineDescription aeDesc) throws ResourceInitializationException { AnalysisEngine ae; if (c != null) { ae = UIMAFramework.produceAnalysisEngine(aeDesc, ((UimaContextAdmin) c).getResourceManager(), null); } else { ae = UIMAFramework.produceAnalysisEngine(aeDesc); } return ae; }
/** * @see org.apache.uima.resource.Resource#getResourceManager() */ public ResourceManager getResourceManager() { if (getUimaContextAdmin() != null) return getUimaContextAdmin().getResourceManager(); else return null; }
ResourceManager resMgr = ((UimaContextAdmin) aContext).getResourceManager(); if (!(resMgr instanceof ResourceManager_impl)) {
public ResourceManager newResourceManager() throws ResourceInitializationException { try { UimaContext activeContext = UimaContextHolder.getContext(); if (activeContext != null) { // If we are already in a UIMA context, then we re-use it. Mind that the JCas cannot // handle switching across more than one classloader. // This can be done since UIMA 2.9.0 and starts being handled in uimaFIT 2.3.0 // See https://issues.apache.org/jira/browse/UIMA-5056 return ((UimaContextAdmin) activeContext).getResourceManager(); } else { // If there is no UIMA context, then we create a new resource manager // UIMA core still does not fall back to the context classloader in all cases. // This was the default behavior until uimaFIT 2.2.0. ResourceManager resMgr = UIMAFramework.newDefaultResourceManager(); resMgr.setExtensionClassPath(ClassUtils.getDefaultClassLoader(), "", true); return resMgr; } } catch (MalformedURLException e) { throw new ResourceInitializationException(e); } } }
public void collectionProcessComplete(ProcessTrace trace) throws ResourceProcessException, IOException { GIS.PRINT_MESSAGES = false; DoccatModel categoryModel = DocumentCategorizerME.train(language, ObjectStreamUtils.createObjectStream(documentSamples)); File modelFile = new File(getUimaContextAdmin().getResourceManager() .getDataPath() + File.separatorChar + mModelName); OpennlpUtil.serialize(categoryModel, modelFile); }
/** * Called if the processing is finished, this method * does the training. */ public void collectionProcessComplete(ProcessTrace trace) throws ResourceProcessException, IOException { GIS.PRINT_MESSAGES = false; ChunkerModel chunkerModel = ChunkerME.train(language, ObjectStreamUtils.createObjectStream(mChunkSamples), 100, 5); // dereference to allow garbage collection mChunkSamples = null; File modelFile = new File(getUimaContextAdmin().getResourceManager() .getDataPath() + File.separatorChar + mModelName); OpennlpUtil.serialize(chunkerModel, modelFile); }
/** * Called if the processing is finished, this method * does the training. */ public void collectionProcessComplete(ProcessTrace trace) throws ResourceProcessException, IOException { GIS.PRINT_MESSAGES = false; POSModel posTaggerModel = POSTaggerME.train(language, ObjectStreamUtils.createObjectStream(mPOSSamples), ModelType.MAXENT, tagDictionary, null, 100, 5); // dereference to allow garbage collection mPOSSamples = null; File modelFile = new File(getUimaContextAdmin().getResourceManager() .getDataPath() + File.separatorChar + mModelName); OpennlpUtil.serialize(posTaggerModel, modelFile); }
flowControllerClass = Class_TCCL.forName(flowControllerClassName, getUimaContextAdmin().getResourceManager()); } catch (ClassNotFoundException e) { throw new ResourceInitializationException(ResourceInitializationException.CLASS_NOT_FOUND,
File modelFile = new File(getUimaContextAdmin().getResourceManager() .getDataPath() + File.separatorChar + mModelName);
File modelFile = new File(getUimaContextAdmin().getResourceManager() .getDataPath() + File.separatorChar + mModelName);
File modelFile = new File(getUimaContextAdmin().getResourceManager() .getDataPath() + File.separatorChar + modelPath);
ResourceManager resourceManager = aParentContext.getRootContext().getResourceManager(); XMLInputSource input = resolveImportByName(aFlowControllerDescriptor, resourceManager);
annotatorClass = Class_TCCL.forName(annotatorClassName, getUimaContextAdmin().getResourceManager()); } catch (ClassNotFoundException e) { throw new ResourceInitializationException(
sampleTraceFile = new File(getUimaContextAdmin().getResourceManager() .getDataPath() + File.separatorChar + sampleTraceFileName); sampleTraceFileEncoding = CasConsumerUtil.getRequiredStringParameter(
sampleTraceFile = new File(getUimaContextAdmin().getResourceManager() .getDataPath() + File.separatorChar + sampleTraceFileName); sampleTraceFileEncoding = CasConsumerUtil.getRequiredStringParameter(
sampleTraceFile = new File(getUimaContextAdmin().getResourceManager() .getDataPath() + File.separatorChar + sampleTraceFileName); sampleTraceFileEncoding = CasConsumerUtil.getRequiredStringParameter(