Package org.apache.uima.resource.impl
Class ConfigurableDataResource_impl
- java.lang.Object
-
- org.apache.uima.resource.Resource_ImplBase
-
- org.apache.uima.resource.impl.ConfigurableDataResource_impl
-
- All Implemented Interfaces:
DataResource,Resource
public class ConfigurableDataResource_impl extends Resource_ImplBase implements DataResource
A simpleDataResourceimplementation that can read data from a file via a URL. There is an attribute for specifying the location of a local cache for a remote file, but this is not currently being used.
-
-
Field Summary
Fields Modifier and Type Field Description private java.net.URLmFileUrlURL of file.private java.net.URImUriURI of data.-
Fields inherited from interface org.apache.uima.resource.DataResource
PARAM_RELATIVE_PATH_RESOLVER
-
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 Constructor Description ConfigurableDataResource_impl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()Releases all resources held by thisResource.booleanequals(java.lang.Object obj)Determines if thisDataResourceis equal to anotherDataResource.java.io.InputStreamgetInputStream()Gets anInputStreamto the data.protected java.io.FilegetLocalCache()Gets the file name of the local cache for a remote resource file, if any.java.net.URIgetUri()Gets the URI of the data.java.net.URLgetUrl()Gets the URL where the data is stored.inthashCode()Gest the hash code for thisDataResource.booleaninitialize(ResourceSpecifier aSpecifier, java.util.Map<java.lang.String,java.lang.Object> aAdditionalParams)Initializes this DataResource.-
Methods inherited from class org.apache.uima.resource.Resource_ImplBase
getCasManager, getLogger, getMetaData, getRelativePathResolver, getResourceManager, getUimaContext, getUimaContextAdmin, loadUserClass, loadUserClassOrThrow, setContextHolder, setContextHolderX, setLogger, setMetaData, withContextHolder
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.uima.resource.Resource
getLogger, getMetaData, getResourceManager, getUimaContext, getUimaContextAdmin, setLogger
-
-
-
-
Method Detail
-
initialize
public boolean initialize(ResourceSpecifier aSpecifier, java.util.Map<java.lang.String,java.lang.Object> aAdditionalParams) throws ResourceInitializationException
Initializes this DataResource.- Specified by:
initializein interfaceResource- Overrides:
initializein classResource_ImplBase- Parameters:
aSpecifier- describes how to create this DataResource. Must (at least for now) be aFileResourceSpecifier.aAdditionalParams- not currently used- Returns:
- true if and only if initialization completed successfully. Returns false if this
implementation cannot handle the given
ResourceSpecifier. - Throws:
ResourceInitializationException- if a failure occurs during initialization.- See Also:
Resource.initialize(ResourceSpecifier, Map)
-
destroy
public void destroy()
Description copied from interface:ResourceReleases all resources held by thisResource.- Specified by:
destroyin interfaceResource- Overrides:
destroyin classResource_ImplBase- See Also:
Resource.destroy()
-
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOExceptionDescription copied from interface:DataResourceGets anInputStreamto the data. It is the caller's responsibility to close this input stream when finished with it.- Specified by:
getInputStreamin interfaceDataResource- Returns:
- an InputStream to the data
- Throws:
java.io.IOException- if an I/O error occurred when trying to open the stream- See Also:
DataResource.getInputStream()
-
getUri
public java.net.URI getUri()
Description copied from interface:DataResourceGets the URI of the data. In general, this method will return a URI that is equivalent to the URL returned byDataResource.getUrl(). However, in the case whereDataResource.getUrl()returns null (indicating no URL available), this method may still return a URI. This can be the case if the URI does not use a standard protocol such as http or file.- Specified by:
getUriin interfaceDataResource- Returns:
- The URI of the data
-
getUrl
public java.net.URL getUrl()
Description copied from interface:DataResourceGets the URL where the data is stored. This method may return null if there is no appropriate URL (for example if the data is stored in a relational database). It is recommended that theDataResource.getInputStream()method be used whenever possible - see the class comment for more information.- Specified by:
getUrlin interfaceDataResource- Returns:
- the URL where the data is stored, or null if this is not available.
- See Also:
DataResource.getUrl()
-
getLocalCache
protected java.io.File getLocalCache()
Gets the file name of the local cache for a remote resource file, if any. This is not currently supported; it always returns null.- Returns:
- the local cache File
-
equals
public boolean equals(java.lang.Object obj)
Description copied from interface:DataResourceDetermines if thisDataResourceis equal to anotherDataResource. It is important thatDataResourceimplementations override this method appropriately, because theResourceManagercan make use of this method to determine when cached data can be reused. TwoDataResources that areequalaccording to this method will be considered to provide access to the same data; therefore, a common cache can be used.- Specified by:
equalsin interfaceDataResource- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- the object to compare to- Returns:
- true if and only if
aObjis aDataResourceand provides access to the same data as this object. - See Also:
DataResource.equals(java.lang.Object)
-
hashCode
public int hashCode()
Description copied from interface:DataResourceGest the hash code for thisDataResource. As always, if theDataResource.equals(Object)method is overridden, this method should also be overridden. Two objects that areequalmust have the same hash code.- Specified by:
hashCodein interfaceDataResource- Overrides:
hashCodein classjava.lang.Object- Returns:
- the hash code for this object
- See Also:
DataResource.hashCode()
-
-