|
|
|
|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.torweg.pulse.util.entity.AbstractBasicEntity
org.torweg.pulse.util.entity.AbstractNamedEntity
org.torweg.pulse.vfs.VirtualFile
@Entity public class VirtualFile
a file in the VirtualFileSystem.
The maximum length for a URI denoting a VirtualFile is 131072
bytes: This allows a path depth of 255 with a maximum file name length of 256
characters each, stored in UTF-8.
Due to various compatibility issues a VirtualFile's name must match
the following regular expression: [a-zA-Z0-9_\.\- ]+.
URIs to VirtualFiles are constructed as follows:
<em>scheme</em>: [public | private]<em>authority</em>: noneExamples:
private:///mydirectory/myfile.txtpublic:///fileInRootDirectory.xmlpublic:///file/In/DirectoryDescriptor/Structure/photo.png
To get an instance of a VirtualFile use
VirtualFileSystem.getVirtualFile(URI, User) or
VirtualFileSystem.getVirtualFile(String, User).
| Field Summary | |
|---|---|
static java.lang.String |
VALID_NAME_REGEX
regular expression to determine if a name is valid for a VirtualFile. |
| Constructor Summary | |
|---|---|
protected |
VirtualFile()
Deprecated. |
protected |
VirtualFile(User acc,
java.net.URI p)
constructs a new VirtualFile for the given URI with the
given User as the accessor. |
| Method Summary | |
|---|---|
boolean |
addDeadProperty(DeadProperty prop)
adds the given dead property to the file's dead properties. |
void |
addReadRole(Role r)
adds a Role to the read roles. |
void |
addWriteRole(Role r)
adds a Role to the write roles. |
boolean |
canRead(User u)
tests whether the given User is allowed to read the
VirtualFile. |
boolean |
canWrite(User u)
tests whether the given User is allowed to write to the
VirtualFile. |
protected static java.net.URI |
cleanURI(java.net.URI uri)
cleans a VFS URI. |
void |
clearReadRoles()
Clears the read-roles. |
void |
clearWriteRoles()
Clears the write-roles. |
long |
created()
convenience method for getCreated() to resemble
java.io.File. |
org.jdom.Element |
deserializeToJDOM()
this will deserialize the state of the JDOMable as a JDOM
Element. |
boolean |
equals(java.lang.Object o)
compares the VirtualFile to the given Object. |
boolean |
exists()
tests whether the file or directory denoted by this abstract pathname exists. |
java.util.List<VirtualFile> |
getChildren()
returns the children of the VirtualFile, if it is a directory. |
long |
getCreated()
returns the timestamp of the creation of the VirtualFile. |
User |
getCreator()
returns the User who created the VirtualFile. |
java.util.Set<DeadProperty> |
getDeadProperties()
returns an unmodifiable view of the dead properties. |
DeadProperty |
getDeadProperty(DeadProperty prototype)
returns the file's DeadProperty identified by the given
prototype. |
java.lang.String |
getETag()
returns a strong ETag for the VirtualFile (see RFC 2616, Section 14.19). |
java.lang.Long |
getFilesize()
returns the size of the VirtualFile in bytes or -1, if
the VirtualFile is a directory. |
java.net.URI |
getHttpURI()
returns a URI to access the VirtualFile via HTTP. |
long |
getLastModified()
returns the timestamp of the last modification. |
User |
getLastModifier()
returns the User who modified the VirtualFile most
recently. |
VirtualFile |
getParent()
returns the parent VirtualFile or null, if this
VirtualFile is in the root of a store. |
java.util.Set<Role> |
getReadRoles()
returns an unmodifiable view of the read roles. |
java.net.URI |
getURI()
returns the path denoting the VirtualFile. |
java.util.Set<Role> |
getWriteRoles()
returns an unmodifiable view of the write roles. |
int |
hashCode()
returns a hash code for the VirtualFile. |
boolean |
isDirectory()
returns true, if the VirtualFile is a directory. |
boolean |
isFile()
returns true, if the VirtualFile is a file. |
boolean |
isPublic()
indicates, whether the VirtualFile is from the public or the
private store. |
long |
lastModified()
convenience method for getLastModified() to resemble
java.io.File. |
protected void |
removeChild(VirtualFile f)
removes a child from the parent. |
boolean |
removeDeadProperty(DeadProperty prototype)
removes a given dead property from the file's dead properties. |
void |
removeReadRole(Role r)
removes a Role from the read roles. |
void |
removeWriteRole(Role r)
removes a Role from the write roles. |
protected void |
setDirectory(boolean isDir)
VFS internally used method to set the isDirectory flag. |
protected void |
setFilesize(java.lang.Long size)
sets the filesize. |
protected void |
setLastModified(java.lang.Long lm)
sets the timestamp of the last modification. |
protected void |
setLastModifier(User user)
sets the User who modified the VirtualFile most recently. |
protected void |
setParent(VirtualFile p)
this method should be called from the constructors of implementing classes to store a reference to the parent VirtualFile. |
protected void |
setParent(VirtualFile p,
boolean inheritPermissions)
this method should be called from the constructors of implementing classes to store a reference to the parent VirtualFile. |
protected void |
setURI(java.net.URI p)
sets the path for the VirtualFile. |
net.sf.json.JSONObject |
toJSON()
returns a JSON-representation of the VirtualFile. |
| Methods inherited from class org.torweg.pulse.util.entity.AbstractNamedEntity |
|---|
getName, setName |
| Methods inherited from class org.torweg.pulse.util.entity.AbstractBasicEntity |
|---|
compareTo, getFullQualifiedClassNameJAXB, getId |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.torweg.pulse.util.INamed |
|---|
getName |
| Field Detail |
|---|
public static final java.lang.String VALID_NAME_REGEX
VirtualFile.
| Constructor Detail |
|---|
@Deprecated protected VirtualFile()
NOTE: To get an instance of a VirtualFile use
VirtualFileSystem.getVirtualFile(URI, User) or
VirtualFileSystem.getVirtualFile(String, User) .
protected VirtualFile(User acc,
java.net.URI p)
throws VFIOException
VirtualFile for the given URI with the
given User as the accessor.
NOTE: To get an instance of a VirtualFile use
VirtualFileSystem.getVirtualFile(URI, User) or
VirtualFileSystem.getVirtualFile(String, User) .
acc - the User to be used for access checksp - the URI of the file
VFIOException - if the given URI is not a legal URI for
VirtualFiles| Method Detail |
|---|
protected static java.net.URI cleanURI(java.net.URI uri)
throws VFIOException,
java.net.URISyntaxException
uri - the URI to clean
VFIOException - on errors checking the URI
java.net.URISyntaxException - on errors creating the cleaned URIprotected final void setDirectory(boolean isDir)
isDir - true for directories; otherwise falsepublic final long created()
getCreated() to resemble
java.io.File.
VirtualFilegetCreated()public final long getCreated()
VirtualFile.
VirtualFilepublic final User getCreator()
User who created the VirtualFile.
User who created the VirtualFilepublic final long lastModified()
getLastModified() to resemble
java.io.File.
VirtualFilegetLastModified()public final long getLastModified()
protected final void setLastModified(java.lang.Long lm)
lm - the timestamppublic final User getLastModifier()
User who modified the VirtualFile most
recently.
User who modified the VirtualFile most
recentlyprotected final void setLastModifier(User user)
User who modified the VirtualFile most recently.
user - the last modifier of the filepublic final java.lang.Long getFilesize()
VirtualFile in bytes or -1, if
the VirtualFile is a directory.
VirtualFile in bytes or -1, if
the VirtualFile is a directoryprotected final void setFilesize(java.lang.Long size)
size - the filesize in bytes.public final java.util.Set<DeadProperty> getDeadProperties()
public final boolean addDeadProperty(DeadProperty prop)
throws VFIOException
If the file already contains a dead property which is equal to the given
property (DeadProperty.equals(Object)), the existing property is
patched (DeadProperty.patch(DeadProperty)) with the given
property.
prop - the property to be added
true, if and only if, the property has been added.
Otherwise false.
VFIOException - on errors patching an existing propertypublic final DeadProperty getDeadProperty(DeadProperty prototype)
DeadProperty identified by the given
prototype.
prototype - the prototype of the requested property
DeadProperty identified by the given prototype
or null, if no such property existsDeadProperty.extractPrototype()public final boolean removeDeadProperty(DeadProperty prototype)
prototype - the property to remove
true, if and only if, the property has been removed.
Otherwise false.public final java.net.URI getURI()
VirtualFile.
VirtualFile
protected final void setURI(java.net.URI p)
throws java.io.UnsupportedEncodingException, IllegalFileNameException
VirtualFile.
p - the path
java.io.UnsupportedEncodingException - on errors decoding the name from the path
IllegalFileNameException - if the name of the VirtualFile does not match
[a-zA-Z0-9_\.\-]+.public final java.net.URI getHttpURI()
URI to access the VirtualFile via HTTP.
URI to access the VirtualFile via HTTP, or
null if the VirtualFile is privatepublic final boolean isDirectory()
true, if the VirtualFile is a directory.
true, if the VirtualFile is a directory.
Otherwise false.isFile()public final boolean isFile()
true, if the VirtualFile is a file.
true, if the VirtualFile is a file. Otherwise
false.isDirectory()public final boolean canRead(User u)
User is allowed to read the
VirtualFile.
u - the user to check against
true if and only if the file specified by this abstract
pathname exists and can be read by the user; false
otherwisepublic final boolean canWrite(User u)
User is allowed to write to the
VirtualFile.
u - the user to check against
true if and only if the file specified by this abstract
pathname exists and can be written by the user; false
otherwisepublic final void addReadRole(Role r)
Role to the read roles.
r - the role to addpublic final void removeReadRole(Role r)
Role from the read roles.
r - the role to removepublic final java.util.Set<Role> getReadRoles()
public final void clearReadRoles()
public final void addWriteRole(Role r)
Role to the write roles.
r - the role to addpublic final void removeWriteRole(Role r)
Role from the write roles.
r - the role to removepublic final void clearWriteRoles()
public final java.util.Set<Role> getWriteRoles()
public final boolean exists()
true if and only if the file or directory denoted by this
abstract pathname exists; false otherwisepublic final java.lang.String getETag()
VirtualFile (see RFC 2616, Section 14.19).
public final VirtualFile getParent()
VirtualFile or null, if this
VirtualFile is in the root of a store.
VirtualFile or null, if this
VirtualFile is in the root of a storeprotected final void setParent(VirtualFile p)
VirtualFile.
Overriding methods must ensure to call
super.setParent(VirtualFile)!
p - the parent VirtualFile
protected final void setParent(VirtualFile p,
boolean inheritPermissions)
VirtualFile.
Overriding methods must ensure to call
super.setParent(VirtualFile, boolean)!
p - the parent VirtualFileinheritPermissions - true, if all Permissions of the parent shall
be inherited.protected final void removeChild(VirtualFile f)
f - the child to be removed
public final java.util.List<VirtualFile> getChildren()
throws VFIOException
VirtualFile, if it is a directory.
VirtualFile, if it is a directory
VFIOException - if the VirtualFile is not a directorypublic final boolean isPublic()
VirtualFile is from the public or the
private store.
true, if the VirtualFile is from the public
store. Otherwise false.public org.jdom.Element deserializeToJDOM()
JDOMableJDOMable as a JDOM
Element.
deserializeToJDOM in interface JDOMableVirtualFilepublic int hashCode()
VirtualFile.
hashCode in class AbstractBasicEntityVirtualFileAbstractBasicEntity.hashCode()public boolean equals(java.lang.Object o)
VirtualFile to the given Object.
equals in class AbstractBasicEntityo - the Object to compare to
true, if and only if the given Object is a
VirtualFile with the same URIpublic final net.sf.json.JSONObject toJSON()
VirtualFile.
VirtualFile
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||