org.semanticdesktop.aperture.accessor.file
Class FileAccessor

java.lang.Object
  extended by org.semanticdesktop.aperture.accessor.file.FileAccessor
All Implemented Interfaces:
DataAccessor

public class FileAccessor
extends Object
implements DataAccessor

A DataAccessor implementation for the file scheme.

FileAccessor can be passed a File instance by putting a File object in the params Map with the String "file" as key. It will then use this File, rather than constructing one based on the specified URL. This can optimize cases where a File instance is already available.


Field Summary
static String FILE_KEY
           
 
Constructor Summary
FileAccessor()
           
 
Method Summary
 DataObject getDataObject(String url, DataSource source, Map params, RDFContainerFactory containerFactory)
          Return a DataObject for the specified url.
 DataObject getDataObjectIfModified(String url, DataSource source, AccessData accessData, Map params, RDFContainerFactory containerFactory)
          Return a DataObject for the specified url.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILE_KEY

public static final String FILE_KEY
See Also:
Constant Field Values
Constructor Detail

FileAccessor

public FileAccessor()
Method Detail

getDataObject

public DataObject getDataObject(String url,
                                DataSource source,
                                Map params,
                                RDFContainerFactory containerFactory)
                         throws UrlNotFoundException,
                                IOException
Return a DataObject for the specified url. If the specified Map contains a "file" key with a File instance as value, this File will be used to retrieve information from, else one will be created by using the specified url.

Specified by:
getDataObject in interface DataAccessor
Parameters:
url - The url of the requested resource.
source - The DataSource to be registered as the source of the DataObject (optional).
params - Additional parameters facilitating access to the physical resource (optional).
containerFactory - An RDFContainerFactory that delivers the RDFContainer to which the metadata of the DataObject should be added. The provided RDFContainer can later be retrieved as the DataObject's metadata container.
Returns:
A DataObject for the specified URI.
Throws:
UrlNotFoundException - When the specified url did not point to an existing resource.
IOException - When any kind of I/O error occurs.

getDataObjectIfModified

public DataObject getDataObjectIfModified(String url,
                                          DataSource source,
                                          AccessData accessData,
                                          Map params,
                                          RDFContainerFactory containerFactory)
                                   throws UrlNotFoundException,
                                          IOException
Return a DataObject for the specified url. If the specified Map contains a "file" key with a File instance as value, this File will be used to retrieve information from, else one will be created by using the specified url.

Specified by:
getDataObjectIfModified in interface DataAccessor
Parameters:
url - The url of the requested resource.
source - The DataSource to be registered as the source of the DataObject (optional).
accessData - Any access data obtained during the previous access to this DataObject (optional).
params - Additional parameters facilitating access to the physical resource (optional).
containerFactory - An RDFContainerFactory that delivers the RDFContainer to which the metadata of the DataObject should be added. The provided RDFContainer can later be retrieved as the DataObject's metadata container.
Returns:
A DataObject for the specified URI, or null when the binary resource has not been modified since the last access.
Throws:
UrlNotFoundException - When the specified url did not point to an existing resource.
IOException - When any kind of I/O error occurs.


Copyright © 2010 Aperture Development Team. All Rights Reserved.