java.lang.Object
org.apache.jena.riot.adapters.AdapterFileManager
- All Implemented Interfaces:
org.apache.jena.util.FileManager
Adapter that provides
FileManager
for RIOT by translating the operations.
FileManager
A FileManager provides access to named file-like resources by opening
InputStreams to things in the filing system, by URL (http: and file:) and
found by the classloader. It can also load RDF data from such a system
resource into an existing model or create a new (Memory-based) model.
There is a global FileManager which provide uniform access to system
resources: applications may also create specialised FileManagers.
A FileManager contains a list of location functions to try: the global
FileManger has one LocatorFile
, one LocatorClassLoader
and
one LocatorURL
Main operations:
- loadModel, readModel : URI to model
- open, openNoMap : URI to input stream
- mapURI : map URI to another by
LocationMapper
- readWholeFileAsUTF8
LocationMapper
is a set of alternative locations for system
resources and a set of alternative prefix locations. For example, a local
copy of a common RDF dataset may be used whenever the usual URL is used by
the application.
The LocatorFile
also supports the idea of "current directory".- See Also:
-
StreamManager
LocationMapper
FileUtils
-
Field Summary
Fields inherited from interface org.apache.jena.util.FileManager
filePathSeparator, logAllLookups, PATH_DELIMITER
-
Constructor Summary
ConstructorDescriptionAdapterFileManager
(StreamManager streamManager) AdapterFileManager
(StreamManager streamManager, LocationMapper mapper) Create a FileManger using a RIOT StreamManager and RIOT LocationMapper -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCacheModel
(String uri, org.apache.jena.rdf.model.Model m) void
addLocator
(org.apache.jena.util.Locator oldloc) Add a locator to the end of the locators listvoid
addLocatorClassLoader
(ClassLoader cLoad) Add a class loader locatorvoid
Add a file locatorvoid
addLocatorFile
(String dir) Add a file locator which uses dir as its working directoryvoid
void
void
void
addLocatorZip
(String zfn) Add a zip file locatororg.apache.jena.util.FileManager
clone()
static AdapterFileManager
get()
Get the global file manager.org.apache.jena.rdf.model.Model
getFromCache
(String filenameOrURI) Read out of the cache - return null if not in the cacheorg.apache.jena.util.LocationMapper
Get the location mappingReturn the associate stream managerboolean
hasCachedModel
(String filenameOrURI) boolean
return whether caching is on of offorg.apache.jena.rdf.model.Model
loadModelInternal
(String filenameOrURI) Iterator<org.apache.jena.util.Locator>
locators()
Return an iterator over all the handlersstatic AdapterFileManager
Create a "standard" FileManager.Apply the mapping of a filename or URIOpen a file using the locators of this FileManager Throws RiotNotFoundException if not found.Open a file using the locators of this FileManager but without location mapping.org.apache.jena.util.TypedStream
openNoMapOrNull
(String filenameOrURI) Open a file using the locators of this FileManager without location mapping.org.apache.jena.rdf.model.Model
readModelInternal
(org.apache.jena.rdf.model.Model model, String filenameOrURI) Deprecated, for removal: This API element is subject to removal in a future version.readWholeFileAsUTF8
(String filename) Deprecated, for removal: This API element is subject to removal in a future version.UseIO.readWholeFileAsUTF8(String)
void
remove
(org.apache.jena.util.Locator loc) Remove a locatorvoid
removeCacheModel
(String uri) void
Reset the model cachestatic void
setGlobalFileManager
(AdapterFileManager globalFileManager) Set the global file manager (as returned by get()) If called before any call to get(), then the usual default filemanager is not createdvoid
setLocationMapper
(org.apache.jena.util.LocationMapper mapper) Set the location mappingvoid
setModelCaching
(boolean state) Change the state of model cache : does not clear the cacheMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.jena.util.FileManager
loadModel, readModel
-
Constructor Details
-
AdapterFileManager
-
AdapterFileManager
Create a FileManger using a RIOT StreamManager and RIOT LocationMapper
-
-
Method Details
-
get
Get the global file manager.- Returns:
- the global file manager
-
setGlobalFileManager
Set the global file manager (as returned by get()) If called before any call to get(), then the usual default filemanager is not created- Parameters:
globalFileManager
-
-
clone
public org.apache.jena.util.FileManager clone()- Specified by:
clone
in interfaceorg.apache.jena.util.FileManager
-
makeGlobal
Create a "standard" FileManager. -
getStreamManager
Return the associate stream manager -
setLocationMapper
public void setLocationMapper(org.apache.jena.util.LocationMapper mapper) Set the location mapping- Specified by:
setLocationMapper
in interfaceorg.apache.jena.util.FileManager
-
getLocationMapper
public org.apache.jena.util.LocationMapper getLocationMapper()Get the location mapping- Specified by:
getLocationMapper
in interfaceorg.apache.jena.util.FileManager
-
locators
Return an iterator over all the handlers- Specified by:
locators
in interfaceorg.apache.jena.util.FileManager
-
remove
public void remove(org.apache.jena.util.Locator loc) Remove a locator- Specified by:
remove
in interfaceorg.apache.jena.util.FileManager
-
addLocator
public void addLocator(org.apache.jena.util.Locator oldloc) Add a locator to the end of the locators list- Specified by:
addLocator
in interfaceorg.apache.jena.util.FileManager
-
addLocatorFile
public void addLocatorFile()Add a file locator- Specified by:
addLocatorFile
in interfaceorg.apache.jena.util.FileManager
-
addLocatorFile
Add a file locator which uses dir as its working directory- Specified by:
addLocatorFile
in interfaceorg.apache.jena.util.FileManager
-
addLocatorClassLoader
Add a class loader locator- Specified by:
addLocatorClassLoader
in interfaceorg.apache.jena.util.FileManager
-
addLocatorURL
public void addLocatorURL()- Specified by:
addLocatorURL
in interfaceorg.apache.jena.util.FileManager
-
addLocatorHTTP
public void addLocatorHTTP() -
addLocatorFTP
public void addLocatorFTP() -
addLocatorZip
Add a zip file locator- Specified by:
addLocatorZip
in interfaceorg.apache.jena.util.FileManager
-
resetCache
public void resetCache()Reset the model cache- Specified by:
resetCache
in interfaceorg.apache.jena.util.FileManager
-
setModelCaching
public void setModelCaching(boolean state) Change the state of model cache : does not clear the cache- Specified by:
setModelCaching
in interfaceorg.apache.jena.util.FileManager
-
isCachingModels
public boolean isCachingModels()return whether caching is on of off- Specified by:
isCachingModels
in interfaceorg.apache.jena.util.FileManager
-
getFromCache
Read out of the cache - return null if not in the cache- Specified by:
getFromCache
in interfaceorg.apache.jena.util.FileManager
-
hasCachedModel
- Specified by:
hasCachedModel
in interfaceorg.apache.jena.util.FileManager
-
addCacheModel
- Specified by:
addCacheModel
in interfaceorg.apache.jena.util.FileManager
-
removeCacheModel
- Specified by:
removeCacheModel
in interfaceorg.apache.jena.util.FileManager
-
open
Open a file using the locators of this FileManager Throws RiotNotFoundException if not found.- Specified by:
open
in interfaceorg.apache.jena.util.FileManager
-
mapURI
Apply the mapping of a filename or URI- Specified by:
mapURI
in interfaceorg.apache.jena.util.FileManager
-
openNoMap
Open a file using the locators of this FileManager but without location mapping. Throws RiotNotFoundException if not found.- Specified by:
openNoMap
in interfaceorg.apache.jena.util.FileManager
-
openNoMapOrNull
Open a file using the locators of this FileManager without location mapping. Return null if not found- Specified by:
openNoMapOrNull
in interfaceorg.apache.jena.util.FileManager
-
loadModelInternal
- Specified by:
loadModelInternal
in interfaceorg.apache.jena.util.FileManager
-
readModelInternal
public org.apache.jena.rdf.model.Model readModelInternal(org.apache.jena.rdf.model.Model model, String filenameOrURI) - Specified by:
readModelInternal
in interfaceorg.apache.jena.util.FileManager
-
readWholeFileAsUTF8
Deprecated, for removal: This API element is subject to removal in a future version.UseIO.readWholeFileAsUTF8(InputStream)
- Specified by:
readWholeFileAsUTF8
in interfaceorg.apache.jena.util.FileManager
-
readWholeFileAsUTF8
Deprecated, for removal: This API element is subject to removal in a future version.UseIO.readWholeFileAsUTF8(String)
- Specified by:
readWholeFileAsUTF8
in interfaceorg.apache.jena.util.FileManager
-
IO.readWholeFileAsUTF8(InputStream)