org.apache.uima.resource
Class Resource_ImplBase

java.lang.Object
  extended by org.apache.uima.resource.Resource_ImplBase
All Implemented Interfaces:
Resource
Direct Known Subclasses:
ConfigurableResource_ImplBase

public abstract class Resource_ImplBase
extends Object
implements Resource

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_PARAM_SETTINGS, PARAM_PERFORMANCE_TUNING_SETTINGS, PARAM_RESOURCE_MANAGER, PARAM_UIMA_CONTEXT
 
Constructor Summary
Resource_ImplBase()
           
 
Method Summary
 void destroy()
          Releases all resources held by this Resource.
 CasManager getCasManager()
          Get the CasManager for this Resource.
 Logger getLogger()
          Gets the Logger that this Resource is currently using.
 ResourceMetaData getMetaData()
          Gets the metadata that describes this Resource.
 ResourceManager getResourceManager()
          Gets the ResourceManager that this Resource uses to locate other Resources.
 UimaContext getUimaContext()
          Gets the UIMA Context for this Resource.
 UimaContextAdmin getUimaContextAdmin()
          Gets the Admin interface to this Resource's UimaContext.
 boolean initialize(ResourceSpecifier aSpecifier, Map<String,Object> aAdditionalParams)
          Initializes this Resource from a ResourceSpecifier.
 void setLogger(Logger aLogger)
          Sets the Logger that this Resource will use.
protected  void setMetaData(ResourceMetaData aMetaData)
          Sets the ResourceMetaData object associated with this Resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Resource_ImplBase

public Resource_ImplBase()
Method Detail

initialize

public boolean initialize(ResourceSpecifier aSpecifier,
                          Map<String,Object> aAdditionalParams)
                   throws ResourceInitializationException
Description copied from interface: Resource
Initializes this Resource from a ResourceSpecifier. Applications do not need to call this method. It is called automatically by the ResourceFactory and cannot be called a second time.

Specified by:
initialize in interface Resource
Parameters:
aSpecifier - specifies how to create a resource or locate an existing resource service.
aAdditionalParams - a Map containing additional parameters. May be null if 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. Reutrns false if the given ResourceSpecifier is not of an appropriate type for this Resource. If the ResourceSpecifier is 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.
See Also:
Resource.initialize(org.apache.uima.resource.ResourceSpecifier, java.util.Map)

destroy

public void destroy()
Description copied from interface: Resource
Releases all resources held by this Resource.

Specified by:
destroy in interface Resource
See Also:
Resource.destroy()

getMetaData

public ResourceMetaData getMetaData()
Description copied from interface: Resource
Gets the metadata that describes this Resource.

Specified by:
getMetaData in interface Resource
Returns:
an object containing all metadata for this resource.
See Also:
Resource.getMetaData()

setMetaData

protected void setMetaData(ResourceMetaData aMetaData)
Sets the ResourceMetaData object associated with this Resource. 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 this Resource

getLogger

public Logger getLogger()
Description copied from interface: Resource
Gets the Logger that this Resource is currently using.

Specified by:
getLogger in interface Resource
Returns:
this Resource's logger
See Also:
Resource.getLogger()

setLogger

public void setLogger(Logger aLogger)
Description copied from interface: Resource
Sets the Logger that this Resource will use. If this method is not called, the default logger (UIMAFramework.getLogger()) will be used.

Specified by:
setLogger in interface Resource
Parameters:
aLogger - the logger for this Resource to use
See Also:
Resource.setLogger(org.apache.uima.util.Logger)

getResourceManager

public ResourceManager getResourceManager()
Description copied from interface: Resource
Gets the ResourceManager that this Resource uses to locate other Resources.

Specified by:
getResourceManager in interface Resource
Returns:
the ResourceManager
See Also:
Resource.getResourceManager()

getUimaContext

public UimaContext getUimaContext()
Description copied from interface: Resource
Gets the UIMA Context for this Resource. This can be used to access external resources or facilities such as the Logger.

Specified by:
getUimaContext in interface Resource
Returns:
the UimaContext for use by this Resource

getUimaContextAdmin

public UimaContextAdmin getUimaContextAdmin()
Gets the Admin interface to this Resource's UimaContext.

Specified by:
getUimaContextAdmin in interface Resource
Returns:
the administrative interface to this Resource's UimaContext

getCasManager

public CasManager getCasManager()
Get the CasManager for this Resource. The CasManager manages the creation and pooling of CASes.

Returns:
the CasManager


Copyright © 2010 The Apache Software Foundation. All Rights Reserved.