Class FileObjectContentEntity
- java.lang.Object
-
- org.pentaho.di.trans.steps.pentahoreporting.urlrepository.FileObjectContentEntity
-
- All Implemented Interfaces:
Serializable,org.pentaho.reporting.libraries.repository.ContentEntity
- Direct Known Subclasses:
FileObjectContentItem,FileObjectContentLocation
public abstract class FileObjectContentEntity extends Object implements org.pentaho.reporting.libraries.repository.ContentEntity, Serializable
A content-entity that uses a java.io.File as backend. The entity can read theLibRepositoryBoot.SIZE_ATTRIBUTEand can read and write theLibRepositoryBoot.VERSION_ATTRIBUTE.- Author:
- Thomas Morgner, Alexander Buloichik
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedFileObjectContentEntity(org.pentaho.reporting.libraries.repository.ContentLocation parent, org.apache.commons.vfs2.FileObject backend)Creates a new content-entity for the given file using the given content location as parent.protectedFileObjectContentEntity(org.pentaho.reporting.libraries.repository.Repository repository, org.apache.commons.vfs2.FileObject backend)Creates a new root content-entity for the given file using the given content location as parent.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleandelete()Attempts to delete the entity.ObjectgetAttribute(String domain, String key)Returns a attribute value for the given domain (namespace) and attribute-name.protected org.apache.commons.vfs2.FileObjectgetBackend()Returns the file that provides the backend of this entity.ObjectgetContentId()Returns a unique identifier.StringgetName()Returns the name of the file.org.pentaho.reporting.libraries.repository.ContentLocationgetParent()Returns a reference to the parent location.org.pentaho.reporting.libraries.repository.RepositorygetRepository()Returns the current repository, to which tis entity belongs.booleansetAttribute(String domain, String key, Object value)Updates the attribute value for the given attribute domain and name.
-
-
-
Constructor Detail
-
FileObjectContentEntity
protected FileObjectContentEntity(org.pentaho.reporting.libraries.repository.ContentLocation parent, org.apache.commons.vfs2.FileObject backend)Creates a new content-entity for the given file using the given content location as parent.- Parameters:
parent- the content location representing the parent directory.backend- the file representing this entity.
-
FileObjectContentEntity
protected FileObjectContentEntity(org.pentaho.reporting.libraries.repository.Repository repository, org.apache.commons.vfs2.FileObject backend)Creates a new root content-entity for the given file using the given content location as parent.- Parameters:
repository- the repository for which this entity is created.backend- the file representing this entity.
-
-
Method Detail
-
getRepository
public org.pentaho.reporting.libraries.repository.Repository getRepository()
Returns the current repository, to which tis entity belongs.- Specified by:
getRepositoryin interfaceorg.pentaho.reporting.libraries.repository.ContentEntity- Returns:
- the repository.
-
getName
public String getName()
Returns the name of the file.- Specified by:
getNamein interfaceorg.pentaho.reporting.libraries.repository.ContentEntity- Returns:
- the name, never null.
-
getBackend
protected org.apache.commons.vfs2.FileObject getBackend()
Returns the file that provides the backend of this entity.- Returns:
- the file, never null.
-
getContentId
public Object getContentId()
Returns a unique identifier. This can be canonical filename or a database key. It must be guaranteed that within the same repository the key will be unique.- Specified by:
getContentIdin interfaceorg.pentaho.reporting.libraries.repository.ContentEntity- Returns:
- the unique content ID.
-
getAttribute
public Object getAttribute(String domain, String key)
Returns a attribute value for the given domain (namespace) and attribute-name. Some generic attribute domains and names are defined as constants in theLibRepositoryBootclass.- Specified by:
getAttributein interfaceorg.pentaho.reporting.libraries.repository.ContentEntity- Parameters:
domain- the attribute domain.key- the name of the attribute.- Returns:
- the value or null, if the content-entity does not have a value for this attribute.
-
setAttribute
public boolean setAttribute(String domain, String key, Object value)
Updates the attribute value for the given attribute domain and name. If the element is not writable or the attribute could not be updated for any other reason, the method will return false. This method only returns true, if the attribute has been updated successfully.- Specified by:
setAttributein interfaceorg.pentaho.reporting.libraries.repository.ContentEntity- Parameters:
domain- the attribute domain.key- the attribute namevalue- the new attribute value.- Returns:
- true, if the update was successful, false otherwise.
-
getParent
public org.pentaho.reporting.libraries.repository.ContentLocation getParent()
Returns a reference to the parent location. If this entity represents the root directory, this method will return null.- Specified by:
getParentin interfaceorg.pentaho.reporting.libraries.repository.ContentEntity- Returns:
- the parent or null, if this is the root-directory.
-
delete
public boolean delete()
Attempts to delete the entity. After an entity has been deleted, any call to any of the methods of the entity may produce undefined results.- Specified by:
deletein interfaceorg.pentaho.reporting.libraries.repository.ContentEntity- Returns:
- true, if the entity was deleted and detached from the repository, false otherwise.
-
-