Class ZipContentLocation
- java.lang.Object
-
- org.pentaho.reporting.libraries.repository.zip.ZipContentLocation
-
- All Implemented Interfaces:
ContentEntity
,ContentLocation
public class ZipContentLocation extends Object implements ContentLocation
-
-
Constructor Summary
Constructors Constructor Description ZipContentLocation(ZipRepository repository, ZipContentLocation parent, String entryName)
ZipContentLocation(ZipRepository repository, ZipContentLocation parent, ZipEntry zipEntry)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ContentItem
createItem(String name)
Creates a new data item in the current location.ContentLocation
createLocation(String name)
Creates a new content location in the current location.boolean
delete()
Attempts to delete the entity.boolean
exists(String name)
Checks, whether an content entity with the given name exists in this content location.Object
getAttribute(String domain, String key)
Returns a attribute value for the given domain (namespace) and attribute-name.Object
getContentId()
Returns a unique identifier.ContentEntity
getEntry(String name)
Returns the content entity with the given name.String
getName()
Returns the name of the entry.ContentLocation
getParent()
Returns a reference to the parent location.Repository
getRepository()
Returns the current repository, to which tis entity belongs.ContentEntity[]
listContents()
Returns all content entities stored in this content-location.boolean
removeEntity(ContentEntity entity)
boolean
setAttribute(String domain, String key, Object value)
Updates the attribute value for the given attribute domain and name.void
updateDirectoryEntry(String[] name, int index, ZipEntry zipEntry)
void
updateEntry(String[] name, int index, ZipEntry zipEntry, byte[] data)
-
-
-
Constructor Detail
-
ZipContentLocation
public ZipContentLocation(ZipRepository repository, ZipContentLocation parent, String entryName)
-
ZipContentLocation
public ZipContentLocation(ZipRepository repository, ZipContentLocation parent, ZipEntry zipEntry)
-
-
Method Detail
-
listContents
public ContentEntity[] listContents() throws ContentIOException
Description copied from interface:ContentLocation
Returns all content entities stored in this content-location.- Specified by:
listContents
in interfaceContentLocation
- Returns:
- the content entities for this location.
- Throws:
ContentIOException
- if an repository error occured.
-
getEntry
public ContentEntity getEntry(String name) throws ContentIOException
Description copied from interface:ContentLocation
Returns the content entity with the given name. If the entity does not exist, an Exception will be raised.- Specified by:
getEntry
in interfaceContentLocation
- Parameters:
name
- the name of the entity to be retrieved.- Returns:
- the content entity for this name, never null.
- Throws:
ContentIOException
- if an repository error occured.
-
exists
public boolean exists(String name)
Description copied from interface:ContentLocation
Checks, whether an content entity with the given name exists in this content location.- Specified by:
exists
in interfaceContentLocation
- Parameters:
name
- the name of the new entity.- Returns:
- true, if an entity exists with this name, false otherwise.
-
createItem
public ContentItem createItem(String name) throws ContentCreationException
Description copied from interface:ContentLocation
Creates a new data item in the current location. This method must never return null. This method will fail if an entity with the same name exists in this location.- Specified by:
createItem
in interfaceContentLocation
- Parameters:
name
- the name of the new entity.- Returns:
- the newly created entity, never null.
- Throws:
ContentCreationException
- if the item could not be created.
-
createLocation
public ContentLocation createLocation(String name) throws ContentCreationException
Description copied from interface:ContentLocation
Creates a new content location in the current location. This method must never return null. This method will fail if an entity with the same name exists in this location.- Specified by:
createLocation
in interfaceContentLocation
- Parameters:
name
- the name of the new entity.- Returns:
- the newly created entity, never null.
- Throws:
ContentCreationException
- if the item could not be created.
-
getName
public String getName()
Description copied from interface:ContentEntity
Returns the name of the entry.- Specified by:
getName
in interfaceContentEntity
- Returns:
- the name, never null.
-
getContentId
public Object getContentId()
Description copied from interface:ContentEntity
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:
getContentId
in interfaceContentEntity
- Returns:
- the unique content ID.
-
getAttribute
public Object getAttribute(String domain, String key)
Description copied from interface:ContentEntity
Returns a attribute value for the given domain (namespace) and attribute-name. Some generic attribute domains and names are defined as constants in theLibRepositoryBoot
class.- Specified by:
getAttribute
in interfaceContentEntity
- 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)
Description copied from interface:ContentEntity
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:
setAttribute
in interfaceContentEntity
- Parameters:
domain
- the attribute domain.key
- the attribute namevalue
- the new attribute value.- Returns:
- true, if the update was successful, false otherwise.
-
getParent
public ContentLocation getParent()
Description copied from interface:ContentEntity
Returns a reference to the parent location. If this entity represents the root directory, this method will return null.- Specified by:
getParent
in interfaceContentEntity
- Returns:
- the parent or null, if this is the root-directory.
-
getRepository
public Repository getRepository()
Description copied from interface:ContentEntity
Returns the current repository, to which tis entity belongs.- Specified by:
getRepository
in interfaceContentEntity
- Returns:
- the repository.
-
delete
public boolean delete()
Description copied from interface:ContentEntity
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:
delete
in interfaceContentEntity
- Returns:
- true, if the entity was deleted and detached from the repository, false otherwise.
-
removeEntity
public boolean removeEntity(ContentEntity entity)
-
-