public class AdapterFileManager extends Object implements FileManager
LocatorFile, one LocatorClassLoader and
one LocatorURL
Main operations:
LocationMapperLocationMapper 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".StreamManager,
LocationMapper,
FileUtilsfilePathSeparator, logAllLookups, PATH_DELIMITER| Constructor and Description |
|---|
AdapterFileManager(StreamManager streamManager) |
AdapterFileManager(StreamManager streamManager,
LocationMapper mapper)
Create a FileManger using a RIOT StreamManager and RIOT LocationMapper
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCacheModel(String uri,
Model m) |
void |
addLocator(Locator oldloc)
Add a locator to the end of the locators list
|
void |
addLocatorClassLoader(ClassLoader cLoad)
Add a class loader locator
|
void |
addLocatorFile()
Add a file locator
|
void |
addLocatorFile(String dir)
Add a file locator which uses dir as its working directory
|
void |
addLocatorFTP() |
void |
addLocatorHTTP() |
void |
addLocatorURL() |
void |
addLocatorZip(String zfn)
Add a zip file locator
|
FileManager |
clone() |
static AdapterFileManager |
get()
Get the global file manager.
|
Model |
getFromCache(String filenameOrURI)
Read out of the cache - return null if not in the cache
|
LocationMapper |
getLocationMapper()
Get the location mapping
|
StreamManager |
getStreamManager()
Return the associate stream manager
|
boolean |
hasCachedModel(String filenameOrURI) |
boolean |
isCachingModels()
return whether caching is on of off
|
Model |
loadModel(String filenameOrURI,
String rdfSyntax)
Deprecated.
|
Model |
loadModel(String filenameOrURI,
String baseURI,
String rdfSyntax)
Deprecated.
|
Model |
loadModelInternal(String filenameOrURI) |
Iterator<Locator> |
locators()
Return an iterator over all the handlers
|
static AdapterFileManager |
makeGlobal()
Create a "standard" FileManager.
|
String |
mapURI(String filenameOrURI)
Apply the mapping of a filename or URI
|
InputStream |
open(String filenameOrURI)
Open a file using the locators of this FileManager Throws
RiotNotFoundException if not found.
|
InputStream |
openNoMap(String filenameOrURI)
Open a file using the locators of this FileManager but without location
mapping.
|
TypedStream |
openNoMapOrNull(String filenameOrURI)
Open a file using the locators of this FileManager without location
mapping.
|
Model |
readModel(Model model,
String filenameOrURI,
String rdfSyntax)
Deprecated.
|
Model |
readModel(Model model,
String filenameOrURI,
String baseURI,
String syntax)
Deprecated.
|
Model |
readModelInternal(Model model,
String filenameOrURI) |
String |
readWholeFileAsUTF8(InputStream in)
Deprecated.
Use
IO.readWholeFileAsUTF8(InputStream) |
String |
readWholeFileAsUTF8(String filename)
Deprecated.
Use
IO.readWholeFileAsUTF8(String) |
void |
remove(Locator loc)
Remove a locator
|
void |
removeCacheModel(String uri) |
void |
resetCache()
Reset the model cache
|
static 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 created
|
void |
setLocationMapper(LocationMapper mapper)
Set the location mapping
|
void |
setModelCaching(boolean state)
Change the state of model cache : does not clear the cache
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreate, create, createStd, getInternal, loadModel, readModel, setGlobalFileManagerpublic AdapterFileManager(StreamManager streamManager)
public AdapterFileManager(StreamManager streamManager, LocationMapper mapper)
public static AdapterFileManager get()
get in interface FileManagerpublic static void setGlobalFileManager(AdapterFileManager globalFileManager)
globalFileManager - public FileManager clone()
clone in interface FileManagerclone in class Objectpublic static AdapterFileManager makeGlobal()
public StreamManager getStreamManager()
public void setLocationMapper(LocationMapper mapper)
setLocationMapper in interface FileManagerpublic LocationMapper getLocationMapper()
getLocationMapper in interface FileManagerpublic Iterator<Locator> locators()
locators in interface FileManagerpublic void remove(Locator loc)
remove in interface FileManagerpublic void addLocator(Locator oldloc)
addLocator in interface FileManagerpublic void addLocatorFile()
addLocatorFile in interface FileManagerpublic void addLocatorFile(String dir)
addLocatorFile in interface FileManagerpublic void addLocatorClassLoader(ClassLoader cLoad)
addLocatorClassLoader in interface FileManagerpublic void addLocatorURL()
addLocatorURL in interface FileManagerpublic void addLocatorHTTP()
public void addLocatorFTP()
public void addLocatorZip(String zfn)
addLocatorZip in interface FileManagerpublic void resetCache()
resetCache in interface FileManagerpublic void setModelCaching(boolean state)
setModelCaching in interface FileManagerpublic boolean isCachingModels()
isCachingModels in interface FileManagerpublic Model getFromCache(String filenameOrURI)
getFromCache in interface FileManagerpublic boolean hasCachedModel(String filenameOrURI)
hasCachedModel in interface FileManagerpublic void addCacheModel(String uri, Model m)
addCacheModel in interface FileManagerpublic void removeCacheModel(String uri)
removeCacheModel in interface FileManagerpublic InputStream open(String filenameOrURI)
open in interface FileManagerpublic String mapURI(String filenameOrURI)
mapURI in interface FileManagerpublic InputStream openNoMap(String filenameOrURI)
openNoMap in interface FileManagerpublic TypedStream openNoMapOrNull(String filenameOrURI)
openNoMapOrNull in interface FileManagerpublic Model loadModelInternal(String filenameOrURI)
loadModelInternal in interface FileManager@Deprecated public Model loadModel(String filenameOrURI, String rdfSyntax)
loadModel in interface FileManagerfilenameOrURI - The filename or a URI (file:, http:)rdfSyntax - RDF Serialization syntax.JenaException - if there is syntax error in file.@Deprecated public Model loadModel(String filenameOrURI, String baseURI, String rdfSyntax)
loadModel in interface FileManagerfilenameOrURI - The filename or a URI (file:, http:)baseURI - Base URI for loading the RDF model.rdfSyntax - RDF Serialization syntax.JenaException - if there is syntax error in file.public Model readModelInternal(Model model, String filenameOrURI)
readModelInternal in interface FileManager@Deprecated public Model readModel(Model model, String filenameOrURI, String rdfSyntax)
readModel in interface FileManagermodel - filenameOrURI - rdfSyntax - RDF Serialization syntax.JenaException - if there is syntax error in file.@Deprecated public Model readModel(Model model, String filenameOrURI, String baseURI, String syntax)
readModel in interface FileManagermodel - filenameOrURI - baseURI - syntax - JenaException - if there is syntax error in file.@Deprecated public String readWholeFileAsUTF8(InputStream in)
IO.readWholeFileAsUTF8(InputStream)readWholeFileAsUTF8 in interface FileManagerpublic String readWholeFileAsUTF8(String filename)
IO.readWholeFileAsUTF8(String)readWholeFileAsUTF8 in interface FileManagerLicenced under the Apache License, Version 2.0