Package org.apache.uima.resource
Interface DataResource
- All Superinterfaces:
Resource
- All Known Implementing Classes:
ConfigurableDataResource_impl,DataResource_impl
DataResource is a simple resource that provides access to data. All
DataResources will implement the getInputStream() method to provide access
to their data.
DataResources may optionally implement getUrl(), which would return the URL
where the data is located. This may be necessary for some applications, but it is strongly
recommended the getInputStream() be used whenever possible, because accessing the data
directly via the URL does not allow the ResourceManager to assist in caching or sharing of data.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringKey for the initialization parameter whose value is a reference to theRelativePathResolverthat this DataResource should use to resolve relative resource URLs.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 -
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermines if thisDataResourceis equal to anotherDataResource.Gets anInputStreamto the data.getUri()Gets the URI of the data.getUrl()Gets the URL where the data is stored.inthashCode()Gest the hash code for thisDataResource.Methods inherited from interface org.apache.uima.resource.Resource
destroy, getLogger, getMetaData, getResourceManager, getUimaContext, getUimaContextAdmin, initialize, setLogger
-
Field Details
-
PARAM_RELATIVE_PATH_RESOLVER
Key for the initialization parameter whose value is a reference to theRelativePathResolverthat this DataResource should use to resolve relative resource URLs. This value is used as a key in theaAdditionalParamsMap that is passed to theResource.initialize(ResourceSpecifier,Map)method.- See Also:
-
-
Method Details
-
getInputStream
Gets anInputStreamto the data. It is the caller's responsibility to close this input stream when finished with it.- Returns:
- an InputStream to the data
- Throws:
IOException- if an I/O error occurred when trying to open the stream
-
getUri
URI getUri()Gets the URI of the data. In general, this method will return a URI that is equivalent to the URL returned bygetUrl(). However, in the case wheregetUrl()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.- Returns:
- The URI of the data
-
getUrl
URL getUrl()Gets 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 thegetInputStream()method be used whenever possible - see the class comment for more information.- Returns:
- the URL where the data is stored, or null if this is not available.
-
equals
Determines 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. -
hashCode
int hashCode()Gest the hash code for thisDataResource. As always, if theequals(Object)method is overridden, this method should also be overridden. Two objects that areequalmust have the same hash code.
-