Package org.apache.uima.resource
Class Resource_ImplBase
java.lang.Object
org.apache.uima.resource.Resource_ImplBase
- All Implemented Interfaces:
Resource
- Direct Known Subclasses:
ASB_impl,ConfigurableDataResource_impl,ConfigurableResource_ImplBase,DataResource_impl,FileLanguageResource_impl,ProcessingContainer,Resource_ImplBase,ResourceServiceAdapter
Implementation base class for
Resources. Provides access to
resource metadata and the UIMA Context, which in turn provides access to framework facilities
such as logging and resource management.-
Field Summary
Fields inherited from interface org.apache.uima.resource.Resource
PARAM_AGGREGATE_SOFA_MAPPINGS, PARAM_CONFIG_MANAGER, PARAM_CONFIG_PARAM_SETTINGS, PARAM_EXTERNAL_OVERRIDE_SETTINGS, PARAM_PERFORMANCE_TUNING_SETTINGS, PARAM_RESOURCE_MANAGER, PARAM_UIMA_CONTEXT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Releases all resources held by thisResource.Gets the Logger that this Resource is currently using.Gets the metadata that describes thisResource.getRelativePathResolver(Map<String, Object> aAdditionalParams) Gets theResourceManagerthat this Resource uses to locate other Resources.Gets the UIMA Context for this Resource.Gets the Administrative interface to the UIMA Context.booleaninitialize(ResourceSpecifier aSpecifier, Map<String, Object> aAdditionalParams) Initializes thisResourcefrom aResourceSpecifier.Class<?>loadUserClass(String name) Class<?>loadUserClassOrThrow(String name, ResourceSpecifier aSpecifier) voidsetContextHolderX(Runnable_withException userCode) voidSet the logger in the current UimaContext for use by user annotators.protected voidsetMetaData(ResourceMetaData aMetaData) Sets theResourceMetaDataobject associated with thisResource.voidwithContextHolder(Runnable userCode)
-
Constructor Details
-
Resource_ImplBase
public Resource_ImplBase()
-
-
Method Details
-
initialize
public boolean initialize(ResourceSpecifier aSpecifier, Map<String, Object> aAdditionalParams) throws ResourceInitializationExceptionDescription copied from interface:ResourceInitializes thisResourcefrom aResourceSpecifier. Applications do not need to call this method. It is called automatically by theResourceFactoryand cannot be called a second time.- Specified by:
initializein interfaceResource- Parameters:
aSpecifier- specifies how to create a resource or locate an existing resource service.aAdditionalParams- a Map containing additional parameters. May benullif there are no parameters. Each class that implements this interface can decide what additional parameters it supports.- Returns:
- true if and only if initialization completed successfully. Returns false if the given
ResourceSpecifieris not of an appropriate type for this Resource. If theResourceSpecifieris of an appropriate type but is invalid or if some other failure occurs, an exception should be thrown. - Throws:
ResourceInitializationException- if a failure occurs during initialization.
-
destroy
public void destroy()Description copied from interface:ResourceReleases all resources held by thisResource. -
getMetaData
Description copied from interface:ResourceGets the metadata that describes thisResource.- Specified by:
getMetaDatain interfaceResource- Returns:
- an object containing all metadata for this resource.
-
setMetaData
Sets theResourceMetaDataobject associated with thisResource. Any previously existing metadata will be replaced.Resource subclasses should call this method during initialization in order to set the metadata before any calls to
getMetaData()are made.- Parameters:
aMetaData- metadata to assign to thisResource
-
getLogger
Description copied from interface:ResourceGets the Logger that this Resource is currently using. -
setLogger
Set the logger in the current UimaContext for use by user annotators. -
getResourceManager
Description copied from interface:ResourceGets theResourceManagerthat this Resource uses to locate other Resources.- Specified by:
getResourceManagerin interfaceResource- Returns:
- the ResourceManager
-
getUimaContext
Description copied from interface:ResourceGets the UIMA Context for this Resource. This can be used to access external resources or facilities such as the Logger.- Specified by:
getUimaContextin interfaceResource- Returns:
- the UimaContext for use by this Resource
-
getUimaContextAdmin
Description copied from interface:ResourceGets the Administrative interface to the UIMA Context. This can be used by deployment wrappers to modify the UimaContext (for example, by setting the Session object).- Specified by:
getUimaContextAdminin interfaceResource- Returns:
- the Admin interface to this Resource's UimaContext.
-
getCasManager
- Returns:
- the CasManager for this Resource. The CasManager manages the creation and pooling of CASes.
-
loadUserClass
- Throws:
ClassNotFoundException
-
loadUserClassOrThrow
public Class<?> loadUserClassOrThrow(String name, ResourceSpecifier aSpecifier) throws ResourceInitializationException - Throws:
ResourceInitializationException
-
getRelativePathResolver
-
withContextHolder
-
setContextHolderX
- Throws:
Exception
-
setContextHolder
-