org.pentaho.reporting.libraries.repository.dummy

Class DummyContentItem

public class DummyContentItem extends Object implements ContentItem, Serializable

A dummy content item, that does not provide any input and that does swallow all content fed into it.

Author: Thomas Morgner

Constructor Summary
DummyContentItem(ContentLocation parent, String name)
Creates a new dummy item for the given parent and having the given name.
Method Summary
booleandelete()
A dummy location does not have content and therefore does not support the delete command.
ObjectgetAttribute(String domain, String key)
Dummy locations do not have attributes, therefore this method always returns null.
ObjectgetContentId()
Returns the full pathname of the location.
InputStreamgetInputStream()
Returns an new empty input stream that does not allow to read a single byte from it.
StringgetMimeType()
Returns the mime type for the content entity.
StringgetName()
Returns the name of the entry.
OutputStreamgetOutputStream()
Returns a NullOutputStream that ignores all content given to it.
ContentLocationgetParent()
Returns the parent, if there is any.
RepositorygetRepository()
Returns the parent repository for this location.
booleanisReadable()
Claims that the item is readable.
booleanisWriteable()
Claims that the item is writable.
booleansetAttribute(String domain, String key, Object value)
Dummy locations do not allow to set attributes, therefore this method always returns false.

Constructor Detail

DummyContentItem

public DummyContentItem(ContentLocation parent, String name)
Creates a new dummy item for the given parent and having the given name.

Parameters: parent the parent. name the name of the new item.

Method Detail

delete

public boolean delete()
A dummy location does not have content and therefore does not support the delete command.

Returns: always false.

getAttribute

public Object getAttribute(String domain, String key)
Dummy locations do not have attributes, therefore this method always returns null.

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.

getContentId

public Object getContentId()
Returns the full pathname of the location.

Returns: the full pathname.

getInputStream

public InputStream getInputStream()
Returns an new empty input stream that does not allow to read a single byte from it.

Returns: the input stream.

getMimeType

public String getMimeType()
Returns the mime type for the content entity. If the repository does not store mimetypes, this call usually uses the repositories MimeRegistry to resolve the mimetype.

Returns: the mime type.

Throws: ContentIOException if an error occured.

getName

public String getName()
Returns the name of the entry.

Returns: the name, never null.

getOutputStream

public OutputStream getOutputStream()
Returns a NullOutputStream that ignores all content given to it.

Returns: the output stream.

getParent

public ContentLocation getParent()
Returns the parent, if there is any.

Returns: the parent.

getRepository

public Repository getRepository()
Returns the parent repository for this location.

Returns: the repository.

isReadable

public boolean isReadable()
Claims that the item is readable.

Returns: true.

isWriteable

public boolean isWriteable()
Claims that the item is writable.

Returns: true.

setAttribute

public boolean setAttribute(String domain, String key, Object value)
Dummy locations do not allow to set attributes, therefore this method always returns false.

Parameters: domain the attribute domain. key the attribute name value the new attribute value.

Returns: false.