本文整理了Java中org.apache.uima.resource.ResourceManager.setExtensionClassPath
方法的一些代码示例,展示了ResourceManager.setExtensionClassPath
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ResourceManager.setExtensionClassPath
方法的具体详情如下:
包路径:org.apache.uima.resource.ResourceManager
类名称:ResourceManager
方法名:setExtensionClassPath
[英]Sets the classpath for the UIMA extension ClassLoader and specifies if the extension ClassLoader should also be used to resolve resources. Also allows a parent ClassLoader to be specified.
[中]设置UIMA扩展类加载器的类路径,并指定扩展类加载器是否也应用于解析资源。还允许指定父类加载器。
代码示例来源:origin: dkpro/dkpro-tc
protected static ResourceManager getModelFeatureAwareResourceManager(File tcModelLocation)
throws ResourceInitializationException, MalformedURLException
{
// The features of a model are located in a subfolder where Java does
// not look for them by default. This avoids that during model execution
// several features with the same name are on the classpath which might
// cause undefined behavior as it is not know which feature is first
// found if several with same name exist. We create a new resource
// manager here and point the manager explicitly to this subfolder where
// the features to be used are located.
ResourceManager resourceManager = ResourceManagerFactory.newResourceManager();
String classpathOfModelFeatures = tcModelLocation.getAbsolutePath() + "/"
+ Constants.MODEL_FEATURE_CLASS_FOLDER;
resourceManager.setExtensionClassPath(classpathOfModelFeatures, true);
return resourceManager;
}
代码示例来源:origin: org.dkpro.tc/dkpro-tc-ml
private static ResourceManager getModelFeatureAwareResourceManager(File tcModelLocation)
throws ResourceInitializationException, MalformedURLException
{
// The features of a model are located in a subfolder where Java does
// not look for them by default. This avoids that during model execution
// several features with the same name are on the classpath which might
// cause undefined behavior as it is not know which feature is first
// found if several with same name exist. We create a new resource
// manager here and point the manager explicitly to this subfolder where
// the features to be used are located.
ResourceManager resourceManager = ResourceManagerFactory.newResourceManager();
String classpathOfModelFeatures = tcModelLocation.getAbsolutePath() + "/"
+ Constants.MODEL_FEATURE_CLASS_FOLDER;
resourceManager.setExtensionClassPath(classpathOfModelFeatures, true);
return resourceManager;
}
代码示例来源:origin: edu.utah.bmi.nlp/nlp-core
public ResourceManager createResourceManager() {
ResourceManager resourceManager = UIMAFramework.newDefaultResourceManager();
try {
resourceManager.setExtensionClassPath(this.getClass().getClassLoader(), classPath, true);
} catch (MalformedURLException e1) {
error.newError(IError.ERROR, getString("Internal Error", null), e1);
}
return resourceManager;
}
代码示例来源:origin: org.apache.uima/uimaj-tools
/**
* Creates the resource manager.
*
* @return the resource manager
*/
public ResourceManager createResourceManager() {
ResourceManager resourceManager = UIMAFramework.newDefaultResourceManager();
if (classPath != null && classPath.trim().length() > 0) {
try {
resourceManager.setExtensionClassPath(this.getClass().getClassLoader(), classPath, true);
} catch (MalformedURLException e1) {
error.newError(IError.ERROR, getString("Internal Error", null), e1);
}
}
else {
resourceManager.setExtensionClassLoader(this.getClass().getClassLoader(), true);
}
return resourceManager;
}
代码示例来源:origin: org.apache.uima/uimafit-core
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);
}
}
}
代码示例来源:origin: org.apache.uima/jcasgen-maven-plugin
resourceManager.setExtensionClassPath(classpath, true);
typeSystemDescription.resolveImports(resourceManager);
代码示例来源:origin: apache/uima-uimaj
rsrcMgr.setExtensionClassPath(sp.classPath, true);
if (parentResourceManager != null) {
代码示例来源:origin: apache/uima-uimaj
/**
* returns a valid ResourceManager with the information from the PackageBrowser object.
*
* @param pkgBrowser
* packageBrowser object of an installed PEAR package
*
* @return a ResourceManager object with the information from the PackageBrowser object.
*
* @throws IOException passthru
*/
private static ResourceManager getResourceManager(PackageBrowser pkgBrowser) throws IOException {
ResourceManager resourceMgr = UIMAFramework.newDefaultResourceManager();
// set component data path
if (pkgBrowser.getComponentDataPath() != null) {
resourceMgr.setDataPath(pkgBrowser.getComponentDataPath());
}
// set component classpath
if (pkgBrowser.buildComponentClassPath() != null) {
resourceMgr.setExtensionClassPath(pkgBrowser.buildComponentClassPath(), true);
}
return resourceMgr;
}
代码示例来源:origin: org.apache.uima/uimaj-ep-configurator
resourceManager.setExtensionClassPath(
内容来源于网络,如有侵权,请联系作者删除!