|
|
|
|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.torweg.pulse.vfs.VirtualFileSystem
public final class VirtualFileSystem
the VirtualFileSystem is a singleton providing access to
VirtualFiles.
The VirtualFileSystem actually uses VFSProviders to access
the individual VirtualFiles. The VirtualFileSystem consists
of two stores: a private and a public store. VirtualFiles stored in
the public store will also be available via HTTP. Moreover, each store may
have a different VFSProvider.
A VirtualFile is identified via its URI. URIs for
VirtualFiles must contain a scheme and a path. The
scheme may either be public for public files, or private for
private files. The URIs must not contain authority, host or port
information as well as fragments or queries.
Example for a URI identifying a private file file.txt in a
top level directory directory:
private:///directory/file.txt
Example for a URI identifying a public file something.txt in
the root directory:
public:///something.txt
| Method Summary | |
|---|---|
boolean |
delete(VirtualFile file)
deletes the given VirtualFile and purges it from the
VirtualFileSystems full text search index. |
protected boolean |
distribute(VirtualFile file, User user)
distributes the VirtualFile. |
boolean |
exists(java.net.URI uri)
returns whether the URI identifies an existing object. |
VirtualFile |
fromHttpURI(java.net.URI uri)
checks if the given HTTP URI denotes a VirtualFile. |
java.util.Collection<DeadProperty> |
getAllDeadProperties()
returns prototypes of all known dead properties. |
java.util.Collection<DeadProperty> |
getAllDeadProperties(org.hibernate.Session s)
returns prototypes of all known dead properties using the given session. |
long |
getCreated(java.net.URI uri, User user)
returns the creation date of the VirtualFile identified by the
given URI. |
long |
getFileSize(java.net.URI uri, User user)
returns the size of the VirtualFile identified by the given
URI. |
java.net.URI |
getHttpURI(VirtualFile file)
resolves the HTTP path to the given VirtualFile. |
VFInputStream |
getInputStream(VirtualFile file)
provides an InputStream to read the VirtualFile . |
static VirtualFileSystem |
getInstance()
provides access to the VirtualFileSystem. |
long |
getLastModified(java.net.URI uri, User user)
returns the last modification date of the VirtualFile identified
by the given URI. |
VFOutputStream |
getOutputStream(VirtualFile file, User user)
provides an OutputStream to write the VirtualFile. |
java.lang.String |
getPrivateHTTPBase()
return the private HTTP base URI. |
protected VFSProvider |
getPrivateProvider()
returns the private provider. |
protected VFSProvider |
getProvider(java.net.URI uri)
returns the VFSProvider for the given URI. |
VFSProvider |
getProvider(VirtualFile f)
returns the VFSProvider for the given VirtualFile. |
java.lang.String |
getPublicHTTPBase()
return the public HTTP base URI. |
protected VFSProvider |
getPublicProvider()
returns the public provider. |
VirtualFile |
getVirtualFile(java.lang.String path, User user)
returns a VirtualFile for the given path. |
VirtualFile |
getVirtualFile(java.net.URI uri, User user)
returns a VirtualFile for the given path. |
protected void |
index(VirtualFile file)
indexes the given VirtualFile for full text search. |
static VirtualFileSystem |
init(org.jdom.Element conf)
initialises and configures the VirtualFileSystem. |
boolean |
isCollection(java.net.URI uri)
returns whether the URI identifies a collection. |
boolean |
isResource(java.net.URI uri)
returns whether the URI identifies a resource. |
protected VirtualFile |
loadVirtualFile(java.net.URI path)
tries to load a VirtualFile for the given path. |
VirtualFile |
loadVirtualFile(java.net.URI path,
org.hibernate.Session s)
tries to load a VirtualFile for the given path. |
protected void |
markModified(VirtualFile file, User user)
updates the modification tokens for the file. |
boolean |
mkdir(VirtualFile dir, User user)
creates a new directory. |
protected void |
setPrivateProvider(VFSProvider p)
|
protected void |
setPublicProvider(VFSProvider p)
|
void |
updateFileSize(VirtualFile file)
updates the file size for the given file but does not save the changes in the database. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
protected VirtualFile loadVirtualFile(java.net.URI path)
throws java.io.IOException
VirtualFile for the given path.
Utility method for an atomic load.
path - the path
VirtualFile or null, if no such file exists.
java.io.IOException - on errors loading the file
public VirtualFile loadVirtualFile(java.net.URI path,
org.hibernate.Session s)
throws java.io.IOException
VirtualFile for the given path.
path - the paths - the session with current transaction
VirtualFile or null, if no such file exists.
java.io.IOException - on errors loading the fileprotected VFSProvider getPrivateProvider()
protected void setPrivateProvider(VFSProvider p)
p - the private provider to setprotected VFSProvider getPublicProvider()
protected void setPublicProvider(VFSProvider p)
p - the public provider to setprotected VFSProvider getProvider(java.net.URI uri)
VFSProvider for the given URI.
uri - the URI
null, if no such provider existspublic VFSProvider getProvider(VirtualFile f)
VFSProvider for the given VirtualFile.
f - the file
protected void markModified(VirtualFile file, User user)
file - the fileuser - the userprotected boolean distribute(VirtualFile file, User user)
VirtualFile.
file - the VirtualFile to be distributeduser - the user who modified the file
true if the distribution has been successful; otherwise
falseprotected void index(VirtualFile file)
VirtualFile for full text search.
This method is called upon VFOutputStream.close() to start the
indexing.
TODO: has to be implemented yet
file - the file to be indexed
public VFInputStream getInputStream(VirtualFile file)
throws VFIOException
InputStream to read the VirtualFile .
file - the VirtualFile to be read from the
InputStream
InputStream to read from the VirtualFile
VFIOException - on errors aquiring the InputStream
public VFOutputStream getOutputStream(VirtualFile file, User user)
throws VFIOException
OutputStream to write the VirtualFile.
file - the VirtualFile to be written to by the
OutputStreamuser - the user used to access the file
OutputStream to read from the VirtualFile
VFIOException - on errors aquiring the OutputStreampublic void updateFileSize(VirtualFile file)
file - the filepublic boolean delete(VirtualFile file)
VirtualFile and purges it from the
VirtualFileSystems full text search index.
file - the VirtualFile to be deleted
true, if successful. Otherwise false.public static VirtualFileSystem getInstance()
VirtualFileSystem.
VirtualFileSystem singleton
public VirtualFile getVirtualFile(java.lang.String path, User user)
throws java.io.IOException,
java.net.URISyntaxException
VirtualFile for the given path.
path - the path locating the VirtualFileuser - the User to be used for access checks
VirtualFile for the given path.
java.io.IOException - on errors accessing the VirtualFile
java.net.URISyntaxException - on errors parsing the URI
public VirtualFile getVirtualFile(java.net.URI uri, User user)
throws java.io.IOException
VirtualFile for the given path.
uri - the path locating the VirtualFileuser - the User to be used for access checks
VirtualFile for the given path.
java.io.IOException - on errors accessing the VirtualFilepublic java.util.Collection<DeadProperty> getAllDeadProperties()
public java.util.Collection<DeadProperty> getAllDeadProperties(org.hibernate.Session s)
It is assumed that the transaction is controlled by the caller.
s - the HibernateTM session
public java.net.URI getHttpURI(VirtualFile file)
VirtualFile.
file - the VirtualFile to be resolved
URI to the VirtualFile or null, if
the VirtualFile is privatepublic VirtualFile fromHttpURI(java.net.URI uri)
URI denotes a VirtualFile.
uri - the HTTP uri
VirtualFile or null, if the URI does
not denote a VirtualFile
public long getFileSize(java.net.URI uri, User user)
throws java.io.IOException
VirtualFile identified by the given
URI.
uri - the uriuser - the user
java.io.IOException - on errors
public long getCreated(java.net.URI uri, User user)
throws java.io.IOException
VirtualFile identified by the
given URI.
uri - the uriuser - the user
java.io.IOException - on errors
public long getLastModified(java.net.URI uri, User user)
throws java.io.IOException
VirtualFile identified
by the given URI.
uri - the uriuser - the user
java.io.IOException - on errors
public boolean isCollection(java.net.URI uri)
throws java.io.IOException
URI identifies a collection.
uri - the URI
true, if and only if the URI identifies a collection.
Otherwise false.
java.io.IOException - on errors
public boolean isResource(java.net.URI uri)
throws java.io.IOException
URI identifies a resource.
uri - the URI
true, if and only if the URI identifies a resource.
Otherwise false.
java.io.IOException - on errors
public boolean exists(java.net.URI uri)
throws java.io.IOException
URI identifies an existing object.
uri - the URI
true, if and only if the URI identifies an existing
object. Otherwise false.
java.io.IOException - on errors
public boolean mkdir(VirtualFile dir, User user)
throws VFIOException
dir - the directory to be createduser - the user who creates the directory
true, if and only if the directory has been created
VFIOException - on errors creating the directorypublic java.lang.String getPublicHTTPBase()
public java.lang.String getPrivateHTTPBase()
public static VirtualFileSystem init(org.jdom.Element conf)
VirtualFileSystem.
conf - the configuration element
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||