|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.metamatrix.common.tree.directory.FileSystemEntry
public class FileSystemEntry
This class represents a single resource on a hierarchical system, such as a file system.
Field Summary |
---|
Fields inherited from interface com.metamatrix.common.tree.directory.DirectoryEntry |
---|
TYPE_FILE, TYPE_FOLDER |
Constructor Summary | |
---|---|
|
FileSystemEntry(java.io.File file)
|
protected |
FileSystemEntry(java.io.File file,
ObjectDefinition type)
|
Method Summary | |
---|---|
boolean |
canRead()
Return whether it is possible to read from this DirectoryEntry, and whether an input stream can be obtained for this entry. |
boolean |
canWrite()
Return whether it is possible to write to this DirectoryEntry, and whether an output stream can be obtained for this entry. |
int |
compareTo(java.lang.Object obj)
Compares this object to another. |
protected TreeNode |
copy(FileSystemEntry newParent)
Creates a copy of this DirectoryEntry under the specified folder. |
boolean |
equals(java.lang.Object obj)
Returns true if the specified object is semantically equal to this instance. |
boolean |
exists()
Return whether this DirectoryEntry represents an existing resource. |
java.lang.String |
getAbsoluteSeparator()
Obtain the character (as a String) that is used to separate names in a path sequence for the abstract path. |
char |
getAbsoluteSeparatorChar()
Obtain the character that is used to separate names in a path sequence for the absolute path. |
protected PropertyDefinition |
getDescriptionPropertyDefinition()
This method is used to determine which, if any, of the property definitions for this object are used to access the description. |
protected java.io.File |
getFile()
|
java.lang.String |
getFullName()
Obtain the full name of the DirectoryEntry which is unique within the DirectoryEntryView. |
java.io.InputStream |
getInputStream()
If this DirectoryEntry is readable, then return an InputStream instance to the resource represented by this entry. |
java.util.Date |
getLastModifiedDate()
Return the last modification time property value |
java.lang.String |
getName()
Obtain the name of this DirectoryEntry. |
protected PropertyDefinition |
getNamePropertyDefinition()
This method is used to determine which, if any, of the property definitions for this object are used to access the name. |
java.lang.String |
getNamespace()
Obtain the namespace to which this DirectoryEntry belongs. |
java.io.OutputStream |
getOutputStream()
If this DirectoryEntry is writable, then return an OutputStream instance to the resource represented by this entry. |
java.lang.String |
getParentFolderPath()
Helper method to find the path for the parent folder. |
protected static java.util.List |
getPropertyDefinitionList()
|
protected java.util.List |
getPropertyDefinitions()
Get the definitions of the properties for the DirectoryEntry instances returned from this view. |
java.lang.String |
getSeparator()
Obtain the character (as a String) that is used to separate names in a path sequence for the abstract path. |
char |
getSeparatorChar()
Obtain the character that is used to separate names in a path sequence for the abstract path. |
ObjectDefinition |
getType()
Determine the ObjectDefinition type of this DirectoryEntry. |
protected java.lang.Object |
getValue(PropertyDefinition def)
Return the value for this objects's property that corresponds to the specified PropertyDefinition. |
java.util.zip.ZipFile |
getZipFile()
Create a ZipFile instance if the entry represents a zip file |
protected boolean |
hasChildWithName(java.lang.String name)
|
int |
hashCode()
Returns the hash code value for this object. |
boolean |
isEmpty()
|
boolean |
isFile()
|
boolean |
isFolder()
Determine whether this DirectoryEntry is of type FolderDefinition, meaning it represents a container that may have children. |
protected boolean |
isMarked()
Return the marked state of the specified entry. |
boolean |
isModified()
Return whether this node has undergone changes. |
boolean |
isReadOnly()
Return whether this object is read only and may not be modified. |
protected boolean |
isValidValue(PropertyDefinition definition,
java.lang.Object value)
|
boolean |
loadPreview()
Load property values associated with this DirectoryEntry and return whether the preview properties are now available. |
protected boolean |
loadProperties()
Load the properties for the file. |
protected boolean |
move(FileSystemEntry newParent)
Moves this DirectoryEntry under the specified folder. |
protected boolean |
renameTo(java.lang.String newName)
Renames this DirectoryEntry to the specified new name. |
boolean |
setLastModifiedDate(java.util.Date date)
Set the last modification time property value |
protected void |
setMarked(boolean marked)
Set the marked state of the TreeNode entry. |
protected void |
setValue(PropertyDefinition def,
java.lang.Object value)
Set this object's value for the property defined by the specified PropertyDefinition. |
java.lang.String |
toString()
Return the string form of this DirectoryEntry. |
java.net.URL |
toURL()
Converts this abstract pathname into a URL. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FileSystemEntry(java.io.File file) throws java.io.IOException
java.io.IOException
protected FileSystemEntry(java.io.File file, ObjectDefinition type) throws java.io.IOException
java.io.IOException
Method Detail |
---|
protected java.io.File getFile()
protected static java.util.List getPropertyDefinitionList()
protected void setMarked(boolean marked)
marked
- the marked state of the entry.protected boolean isMarked()
protected java.util.List getPropertyDefinitions()
protected PropertyDefinition getNamePropertyDefinition()
protected PropertyDefinition getDescriptionPropertyDefinition()
public boolean canWrite()
exists()
returns true).
- Specified by:
canWrite
in interface DirectoryEntry
- Returns:
- true if writing is possible, as well as whether an OutputStream instance
can be obtained by calling the
getOutputStream()
method.
public boolean canRead()
exists()
returns false).
- Specified by:
canRead
in interface DirectoryEntry
- Returns:
- true if reading is possible, as well as whether an InputStream instance
can be obtained by calling the
getInputStream()
method.
public java.lang.String getParentFolderPath()
protected boolean isValidValue(PropertyDefinition definition, java.lang.Object value)
public boolean exists()
exists
in interface TreeNode
public java.lang.String getName()
getName
in interface TreeNode
public java.lang.String getFullName()
getFullName
in interface TreeNode
public java.lang.String getNamespace()
getNamespace
in interface TreeNode
public char getAbsoluteSeparatorChar()
public java.lang.String getAbsoluteSeparator()
public char getSeparatorChar()
getSeparatorChar
in interface TreeNode
public java.lang.String getSeparator()
getSeparator
in interface TreeNode
public boolean loadPreview()
loadPreview
in interface DirectoryEntry
public java.io.InputStream getInputStream() throws java.io.IOException
getInputStream
in interface DirectoryEntry
java.lang.AssertionError
- if this method is called on a DirectoryEntry
for which canRead()
returns false.
java.io.IOException
- if there was an error creating the streampublic java.io.OutputStream getOutputStream() throws java.io.IOException
getOutputStream
in interface DirectoryEntry
java.lang.AssertionError
- if this method is called on a DirectoryEntry
for which canWrite()
returns false.
java.io.IOException
- if there was an error creating the streampublic boolean isFolder()
getType() returns FolderDefinition, or false otherwise.
public boolean isFile()
public boolean isEmpty()
public ObjectDefinition getType()
getType
in interface TreeNode
protected boolean renameTo(java.lang.String newName)
protected boolean move(FileSystemEntry newParent)
protected TreeNode copy(FileSystemEntry newParent)
public java.net.URL toURL() throws java.net.MalformedURLException
toURL
in interface DirectoryEntry
java.net.MalformedURLException
- if the URL is malformed.public int compareTo(java.lang.Object obj)
Note: this method is consistent with
equals()
, meaning that
(compare(x, y)==0) == (x.equals(y))
.
compareTo
in interface TreeNode
compareTo
in interface java.lang.Comparable
obj
- the object that this instance is to be compared to.
java.lang.ClassCastException
- if the specified object's type prevents it
from being compared to this instance.public boolean equals(java.lang.Object obj)
compareTo()
.
equals
in interface TreeNode
equals
in class java.lang.Object
obj
- the object that this instance is to be compared to.
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in interface TreeNode
toString
in class java.lang.Object
getPath
protected boolean loadProperties()
protected boolean hasChildWithName(java.lang.String name)
protected void setValue(PropertyDefinition def, java.lang.Object value)
def
- the reference to the PropertyDefinition describing the
property whose value is to be changed; may not be nullvalue
- the new value for the property; the cardinality and type
must conform PropertyDefinition
java.lang.AssertionError
- if the property definition reference
is null, or if the object is read only.
java.lang.IllegalArgumentException
- if the value does not correspond
to the PropertyDefinition requirements.protected java.lang.Object getValue(PropertyDefinition def)
def
- the reference to the PropertyDefinition describing the
property whose value is to be returned; may not be null
java.lang.AssertionError
- if the property definition reference
is nullpublic boolean isReadOnly()
public boolean isModified()
isModified
in interface TreeNode
public java.util.Date getLastModifiedDate()
public boolean setLastModifiedDate(java.util.Date date)
public java.util.zip.ZipFile getZipFile() throws java.io.IOException
java.lang.AssertionError
- if this method is called on a DirectoryEntry
for which canRead()
returns false.
java.io.IOException
- if there was an error creating the ZipFile.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |