org.apache.jena.riot.adapters
Class AdapterFileManager

java.lang.Object
  extended by com.hp.hpl.jena.util.FileManager
      extended by org.apache.jena.riot.adapters.AdapterFileManager

public class AdapterFileManager
extends FileManager

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:

Utilities: A FileManager works in conjunction with a LocationMapper. A 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 class com.hp.hpl.jena.util.FileManager
filePathSeparator, PATH_DELIMITER
 
Constructor Summary
AdapterFileManager(StreamManager streamManager)
           
AdapterFileManager(StreamManager streamManager, LocationMapper mapper)
          Create a FileManger using a RIOT StreamManager and RIOT LocationMapper
 
Method Summary
 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()
          Deprecated. 
 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
 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.
 String remap(String filenameOrURI)
          Deprecated. Use mapURI
 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
 
Methods inherited from class com.hp.hpl.jena.util.FileManager
getCachingModels, loadModel, loadModel, loadModel, readModel, readModel, readModel, readWholeFileAsUTF8, readWholeFileAsUTF8, setGlobalFileManager, setMapper, setStdLocators
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AdapterFileManager

public AdapterFileManager(StreamManager streamManager)

AdapterFileManager

public AdapterFileManager(StreamManager streamManager,
                          LocationMapper mapper)
Create a FileManger using a RIOT StreamManager and RIOT LocationMapper

Method Detail

get

public static AdapterFileManager get()
Get the global file manager.

Returns:
the global file manager

setGlobalFileManager

public 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

Parameters:
globalFileManager -

clone

public FileManager clone()
Overrides:
clone in class FileManager

makeGlobal

public static AdapterFileManager makeGlobal()
Create a "standard" FileManager.


getStreamManager

public StreamManager getStreamManager()
Return the associate stream manager


setLocationMapper

public void setLocationMapper(LocationMapper mapper)
Set the location mapping

Overrides:
setLocationMapper in class FileManager

getLocationMapper

public LocationMapper getLocationMapper()
Get the location mapping

Overrides:
getLocationMapper in class FileManager

locators

public Iterator<Locator> locators()
Return an iterator over all the handlers

Overrides:
locators in class FileManager

remove

public void remove(Locator loc)
Remove a locator

Overrides:
remove in class FileManager

addLocator

public void addLocator(Locator oldloc)
Add a locator to the end of the locators list

Overrides:
addLocator in class FileManager

addLocatorFile

public void addLocatorFile()
Add a file locator

Overrides:
addLocatorFile in class FileManager

addLocatorFile

public void addLocatorFile(String dir)
Add a file locator which uses dir as its working directory

Overrides:
addLocatorFile in class FileManager

addLocatorClassLoader

public void addLocatorClassLoader(ClassLoader cLoad)
Add a class loader locator

Overrides:
addLocatorClassLoader in class FileManager

addLocatorURL

@Deprecated
public void addLocatorURL()
Deprecated. 

Add a URL locator

Overrides:
addLocatorURL in class FileManager

addLocatorHTTP

public void addLocatorHTTP()

addLocatorFTP

public void addLocatorFTP()

addLocatorZip

public void addLocatorZip(String zfn)
Add a zip file locator

Overrides:
addLocatorZip in class FileManager

resetCache

public void resetCache()
Reset the model cache

Overrides:
resetCache in class FileManager

setModelCaching

public void setModelCaching(boolean state)
Change the state of model cache : does not clear the cache

Overrides:
setModelCaching in class FileManager

isCachingModels

public boolean isCachingModels()
return whether caching is on of off

Overrides:
isCachingModels in class FileManager

getFromCache

public Model getFromCache(String filenameOrURI)
Read out of the cache - return null if not in the cache

Overrides:
getFromCache in class FileManager

hasCachedModel

public boolean hasCachedModel(String filenameOrURI)
Overrides:
hasCachedModel in class FileManager

addCacheModel

public void addCacheModel(String uri,
                          Model m)
Overrides:
addCacheModel in class FileManager

removeCacheModel

public void removeCacheModel(String uri)
Overrides:
removeCacheModel in class FileManager

open

public InputStream open(String filenameOrURI)
Open a file using the locators of this FileManager Throws RiotNotFoundException if not found.

Overrides:
open in class FileManager

mapURI

public String mapURI(String filenameOrURI)
Apply the mapping of a filename or URI

Overrides:
mapURI in class FileManager

openNoMap

public InputStream openNoMap(String filenameOrURI)
Open a file using the locators of this FileManager but without location mapping. Throws RiotNotFoundException if not found.

Overrides:
openNoMap in class FileManager

openNoMapOrNull

public TypedStream openNoMapOrNull(String filenameOrURI)
Open a file using the locators of this FileManager without location mapping. Return null if not found

Overrides:
openNoMapOrNull in class FileManager

remap

@Deprecated
public String remap(String filenameOrURI)
Deprecated. Use mapURI

Overrides:
remap in class FileManager


Licenced under the Apache License, Version 2.0