org.openide.loaders
Class MultiDataObject.Entry

java.lang.Object
  |
  +--org.openide.loaders.MultiDataObject.Entry
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
FileEntry, FileEntry.Folder, FileEntry.Numb
Enclosing class:
MultiDataObject

public abstract class MultiDataObject.Entry
extends Object
implements Serializable

Represents one file in a group data object.

See Also:
Serialized Form

Constructor Summary
protected MultiDataObject.Entry(FileObject file)
           
 
Method Summary
abstract  FileObject copy(FileObject f, String suffix)
          Called when the entry is to be copied.
abstract  FileObject createFromTemplate(FileObject f, String name)
          Called when the entry is to be created from a template.
abstract  void delete()
          Called when the entry is to be deleted.
 boolean equals(Object o)
           
 MultiDataObject getDataObject()
          Get the multi data object this entry is assigned to.
 FileObject getFile()
          Get the file this entry works with.
 int hashCode()
           
 boolean isImportant()
          Method that allows to check whether an entry is important or is not.
 boolean isLocked()
          Tests whether the entry is locked.
abstract  FileObject move(FileObject f, String suffix)
          Called when the entry is to be moved.
abstract  FileObject rename(String name)
          Called when the entry is to be renamed.
 FileLock takeLock()
          Try to lock this file entry.
protected  Object writeReplace()
          Make a Serialization replacement.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiDataObject.Entry

protected MultiDataObject.Entry(FileObject file)
Method Detail

getFile

public final FileObject getFile()
Get the file this entry works with.

getDataObject

public final MultiDataObject getDataObject()
Get the multi data object this entry is assigned to.
Returns:
the data object

isImportant

public boolean isImportant()
Method that allows to check whether an entry is important or is not. Should be overriden by subclasses, the current implementation returns true.
Returns:
true if this entry is important or false if not

copy

public abstract FileObject copy(FileObject f,
                                String suffix)
                         throws IOException
Called when the entry is to be copied. Depending on the entry type, it should either copy the underlying FileObject, or do nothing (if it cannot be copied).
Parameters:
f - the folder to create this entry in
name - the new name to use
Returns:
the copied FileObject or null if it cannot be copied
Throws:
IOException - when the operation fails

rename

public abstract FileObject rename(String name)
                           throws IOException
Called when the entry is to be renamed. Depending on the entry type, it should either rename the underlying FileObject, or delete it (if it cannot be renamed).
Parameters:
name - the new name
Returns:
the renamed FileObject or null if it has been deleted
Throws:
IOException - when the operation fails

move

public abstract FileObject move(FileObject f,
                                String suffix)
                         throws IOException
Called when the entry is to be moved. Depending on the entry type, it should either move the underlying FileObject, or delete it (if it cannot be moved).
Parameters:
f - the folder to move this entry to
suffix - the suffix to use
Returns:
the moved FileObject or null if it has been deleted
Throws:
IOException - when the operation fails

delete

public abstract void delete()
                     throws IOException
Called when the entry is to be deleted.
Throws:
IOException - when the operation fails

createFromTemplate

public abstract FileObject createFromTemplate(FileObject f,
                                              String name)
                                       throws IOException
Called when the entry is to be created from a template. Depending on the entry type, it should either copy the underlying FileObject, or do nothing (if it cannot be copied).
Parameters:
f - the folder to create this entry in
name - the new name to use
Returns:
the copied FileObject or null if it cannot be copied
Throws:
IOException - when the operation fails

takeLock

public FileLock takeLock()
                  throws IOException
Try to lock this file entry.
Returns:
the lock if the operation was successful; otherwise null
Throws:
IOException - if the lock could not be taken

isLocked

public boolean isLocked()
Tests whether the entry is locked.
Returns:
true if so

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

writeReplace

protected Object writeReplace()
Make a Serialization replacement. The entry is identified by the file object is holds. When serialized, it stores the file object and the data object. On deserialization it finds the data object and creates the right entry for it.


Built on December 12 2001.  |  Portions Copyright 1997-2001 Sun Microsystems, Inc. All rights reserved.