Package org.pentaho.reporting.libraries.repository.dummy

# Class DummyContentItem

java.lang.Object
org.pentaho.reporting.libraries.repository.dummy.DummyContentItem

All Implemented Interfaces:
  `Serializable`, `ContentEntity`, `ContentItem`

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
See Also:
  - Serialized Form

## Constructor Summary

Constructors
Constructor
Description
`DummyContentItem(ContentLocation parent, String name)`
Creates a new dummy item for the given parent and having the given name.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`delete()`
A dummy location does not have content and therefore does not support the delete command.
`Object`
`getAttribute(String domain, String key)`
Dummy locations do not have attributes, therefore this method always returns null.
`Object`
`getContentId()`
Returns the full pathname of the location.
`InputStream`
`getInputStream()`
Returns an new empty input stream that does not allow to read a single byte from it.
`String`
`getMimeType()`
Returns the mime type for the content entity.
`String`
`getName()`
Returns the name of the entry.
`OutputStream`
`getOutputStream()`
Returns a NullOutputStream that ignores all content given to it.
`ContentLocation`
`getParent()`
Returns the parent, if there is any.
`Repository`
`getRepository()`
Returns the parent repository for this location.
`boolean`
`isReadable()`
Claims that the item is readable.
`boolean`
`isWriteable()`
Claims that the item is writable.
`boolean`
`setAttribute(String domain, String key, Object value)`
Dummy locations do not allow to set attributes, therefore this method always returns false.

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### 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 Details

### getMimeType

public String getMimeType() throws ContentIOException
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.

Specified by:
  `getMimeType` in interface `ContentItem`
Returns:
  the mime type.
Throws:
  `ContentIOException` - if an error occured.

### getOutputStream

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

Specified by:
  `getOutputStream` in interface `ContentItem`
Returns:
  the output stream.

### getInputStream

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

Specified by:
  `getInputStream` in interface `ContentItem`
Returns:
  the input stream.

### isReadable

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

Specified by:
  `isReadable` in interface `ContentItem`
Returns:
  true.

### isWriteable

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

Specified by:
  `isWriteable` in interface `ContentItem`
Returns:
  true.

### getName

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

Specified by:
  `getName` in interface `ContentEntity`
Returns:
  the name, never null.

### getContentId

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

Specified by:
  `getContentId` in interface `ContentEntity`
Returns:
  the full pathname.

### getAttribute

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

Specified by:
  `getAttribute` in interface `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)
Dummy locations do not allow to set attributes, therefore this method always returns false.

Specified by:
  `setAttribute` in interface `ContentEntity`
Parameters:
  `domain` - the attribute domain.
  `key` - the attribute name
  `value` - the new attribute value.
Returns:
  false.

### getParent

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

Specified by:
  `getParent` in interface `ContentEntity`
Returns:
  the parent.

### getRepository

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

Specified by:
  `getRepository` in interface `ContentEntity`
Returns:
  the repository.

### delete

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

Specified by:
  `delete` in interface `ContentEntity`
Returns:
  always false.