org.entityfs.cap.entityattrs.impl.metadata
Class AttributesEnablingFileDelegateProxy<T extends EntityAttributes>

java.lang.Object
  extended by org.entityfs.support.lang.ObjectProxySupport<T>
      extended by org.entityfs.impl.AbstractEntityDelegateProxy<FileDelegate,FileAdapter>
          extended by org.entityfs.impl.AbstractFileDelegateProxy
              extended by org.entityfs.cap.entityattrs.impl.metadata.AttributesEnablingFileDelegateProxy<T>
All Implemented Interfaces:
AttributesEntityDelegate<T>, EntityDelegate, FileDelegate

public class AttributesEnablingFileDelegateProxy<T extends EntityAttributes>
extends AbstractFileDelegateProxy
implements AttributesEntityDelegate<T>


Constructor Summary
AttributesEnablingFileDelegateProxy(FileDelegate fd, AbstractEntityAttributesEnablingFileSystemDelegate<T> fsd, ChildEntityAttributeManager<T> attrs)
           
 
Method Summary
 void assertParentIsReadLocked()
           
 void assertParentIsWriteLocked()
           
 void copyAttributes(DirectoryImplementation targetParent, EntityImplementation target)
          This implementation does not copy any attributes.
 void delete()
          Delete the file.
 T getAttributes()
          Get the entity attributes.
 Class<T> getAttributesType()
          Get the type of entity attributes provided by this delegate.
protected  AbstractEntityAttributesEnablingFileSystemDelegate<T> getFileSystemDelegate()
           
 void rename(String oldName, DirectoryImplementation targetDir, String newName)
          Rename and/or move the entity.
 void setAttributes(T attr)
          Set (and save) the entity attributes.
 void setDefaultAttributes(String name, ObjectFactory<T> defaultAttributesFactory)
          This sets attributes from the default attributes factory on the new entity if the file system delegate has an EntityAttributesPreparer set.
 void setParentAttributes(ChildEntityAttributeManager<T> attr)
           
 
Methods inherited from class org.entityfs.impl.AbstractFileDelegateProxy
getDataSize, getSize, openChannelForRead, openChannelForWrite, openForRandomAccess, openForRead, openForWrite, replaceContents
 
Methods inherited from class org.entityfs.impl.AbstractEntityDelegateProxy
canRead, canWrite, copy, exists, getDelegateOfTypeOrNull, getEntityAdapter, getFileSystem, getLastModified, getName, getOwner, init, isReadOnly, setLastModified, setOwner
 
Methods inherited from class org.entityfs.support.lang.ObjectProxySupport
equals, getProxied, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.entityfs.impl.EntityDelegate
canRead, canWrite, copy, exists, getDelegateOfTypeOrNull, getEntityAdapter, getFileSystem, getLastModified, getName, getOwner, init, isReadOnly, setLastModified, setOwner
 

Constructor Detail

AttributesEnablingFileDelegateProxy

public AttributesEnablingFileDelegateProxy(FileDelegate fd,
                                           AbstractEntityAttributesEnablingFileSystemDelegate<T> fsd,
                                           ChildEntityAttributeManager<T> attrs)
Method Detail

getAttributesType

public Class<T> getAttributesType()
Description copied from interface: AttributesEntityDelegate
Get the type of entity attributes provided by this delegate.

Specified by:
getAttributesType in interface AttributesEntityDelegate<T extends EntityAttributes>
Returns:
The type of entity attributes provided.

setParentAttributes

public void setParentAttributes(ChildEntityAttributeManager<T> attr)

getFileSystemDelegate

protected AbstractEntityAttributesEnablingFileSystemDelegate<T> getFileSystemDelegate()

assertParentIsReadLocked

public void assertParentIsReadLocked()

assertParentIsWriteLocked

public void assertParentIsWriteLocked()

getAttributes

public T getAttributes()
Description copied from interface: AttributesEntityDelegate
Get the entity attributes.

Specified by:
getAttributes in interface AttributesEntityDelegate<T extends EntityAttributes>
Returns:
The entity attributes.

setAttributes

public void setAttributes(T attr)
Description copied from interface: AttributesEntityDelegate
Set (and save) the entity attributes.

Specified by:
setAttributes in interface AttributesEntityDelegate<T extends EntityAttributes>
Parameters:
attr - The new attributes for the entity.

delete

public void delete()
Description copied from interface: FileDelegate
Delete the file.

Specified by:
delete in interface FileDelegate
Overrides:
delete in class AbstractFileDelegateProxy

rename

public void rename(String oldName,
                   DirectoryImplementation targetDir,
                   String newName)
            throws FileSystemException
Description copied from interface: EntityDelegate
Rename and/or move the entity.

Specified by:
rename in interface EntityDelegate
Overrides:
rename in class AbstractEntityDelegateProxy<FileDelegate,FileAdapter>
Parameters:
oldName - The old name,
targetDir - The new parent directory.
newName - The new name.
Throws:
FileSystemException - On errors.

setDefaultAttributes

public void setDefaultAttributes(String name,
                                 ObjectFactory<T> defaultAttributesFactory)
This sets attributes from the default attributes factory on the new entity if the file system delegate has an EntityAttributesPreparer set. (Otherwise, the attributes will be set the first time that they are saved.)

Subclasses may override this if necessary.

Specified by:
setDefaultAttributes in interface AttributesEntityDelegate<T extends EntityAttributes>
Parameters:
name - The name of the new entity.
defaultAttributesFactory - Factory for the default entity attributes for the entity type of the delegate.

copyAttributes

public void copyAttributes(DirectoryImplementation targetParent,
                           EntityImplementation target)
Description copied from class: AbstractEntityDelegateProxy
This implementation does not copy any attributes. Override to modify that behavior.

Specified by:
copyAttributes in interface EntityDelegate
Overrides:
copyAttributes in class AbstractEntityDelegateProxy<FileDelegate,FileAdapter>
Parameters:
targetParent - The parent directory of the target. This is null if target is a root directory of a file system. Otherwise it is locked for writing.
target - The target entity to copy attributes to. Locked for writing.