org.pentaho.platform.web.http
Class HttpContentItem

java.lang.Object
  extended by org.pentaho.platform.web.http.HttpContentItem
All Implemented Interfaces:
IMimeTypeListener, IContentItem

public class HttpContentItem
extends Object
implements IContentItem


Field Summary
 
Fields inherited from interface org.pentaho.platform.api.repository.IContentItem
WRITEMODE_APPEND, WRITEMODE_KEEPVERSIONS, WRITEMODE_OVERWRITE
 
Constructor Summary
HttpContentItem(OutputStream outputStream, HttpOutputHandler outputHandler)
           
 
Method Summary
 void closeOutputStream()
           
 String getActionName()
           
 IPentahoStreamSource getDataSource()
          Returns a reader from the content item.
 Date getFileDateTime()
           
 String getFileId()
           
 long getFileSize()
           
 List getFileVersions()
           
 String getId()
           
 InputStream getInputStream()
          Gets an input stream from the Content item.
 String getMimeType()
           
 IMimeTypeListener getMimeTypeListener()
           
 String getName()
           
 OutputStream getOutputStream(String actionName)
          The behavior of this method depends upon it's write mode (defined only at construction).
 String getPath()
           
 Reader getReader()
           
 String getTitle()
           
 String getUrl()
           
 void makeTransient()
          Removes all versions of this item from the repository and removes this item from underlying persistence layer.
 void removeAllVersions()
          Removes all the version from Hibernate
 void removeVersion(String fileId)
          Removes the file with the id specified
 void setMimeType(String mimeType)
          Sets the mime type
 void setMimeTypeListener(IMimeTypeListener mimeTypeListener)
           
 void setName(String name)
           
 void setOutputStream(OutputStream outputStream)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpContentItem

public HttpContentItem(OutputStream outputStream,
                       HttpOutputHandler outputHandler)
Method Detail

closeOutputStream

public void closeOutputStream()
Specified by:
closeOutputStream in interface IContentItem

getId

public String getId()
Specified by:
getId in interface IContentItem
Returns:
The ContentItem Id

getPath

public String getPath()
Specified by:
getPath in interface IContentItem
Returns:
The ContentItem path

getName

public String getName()
Specified by:
getName in interface IContentItem
Returns:
The name of the content item

getTitle

public String getTitle()
Specified by:
getTitle in interface IContentItem
Returns:
The title of the content item

getMimeType

public String getMimeType()
Specified by:
getMimeType in interface IContentItem
Returns:
The MimeType of the content item.

setMimeType

public void setMimeType(String mimeType)
Description copied from interface: IContentItem
Sets the mime type

Specified by:
setMimeType in interface IMimeTypeListener
Specified by:
setMimeType in interface IContentItem
Parameters:
mimeType - The mime type to set.

setName

public void setName(String name)
Specified by:
setName in interface IMimeTypeListener

getUrl

public String getUrl()
Specified by:
getUrl in interface IContentItem
Returns:
The URL (optional) of the content item

getFileVersions

public List getFileVersions()
Specified by:
getFileVersions in interface IContentItem
Returns:
If this is a multiple-versioned style of content item, return the whole list for admin purposes

removeAllVersions

public void removeAllVersions()
Description copied from interface: IContentItem
Removes all the version from Hibernate

Specified by:
removeAllVersions in interface IContentItem

removeVersion

public void removeVersion(String fileId)
Description copied from interface: IContentItem
Removes the file with the id specified

Specified by:
removeVersion in interface IContentItem

getInputStream

public InputStream getInputStream()
                           throws ContentException
Description copied from interface: IContentItem
Gets an input stream from the Content item. If the content item doesn't exist on disk, throws an exception

Specified by:
getInputStream in interface IContentItem
Returns:
An input stream from the file system that is represented by this content item
Throws:
ContentException

getDataSource

public IPentahoStreamSource getDataSource()
Description copied from interface: IContentItem
Returns a reader from the content item. If the content item doesn't exist an exception is thrown.

Specified by:
getDataSource in interface IContentItem
Returns:
A Reader from the file system that is pointed to by this content item.

getReader

public Reader getReader()
                 throws ContentException
Specified by:
getReader in interface IContentItem
Throws:
ContentException

getOutputStream

public OutputStream getOutputStream(String actionName)
Description copied from interface: IContentItem
The behavior of this method depends upon it's write mode (defined only at construction). If the write mode is WRITEMODE_KEEPVERSIONS, this method will create a new file on the disk, and add it to it's internal list of files, and return an output stream. If the write mode is WRITEMODE_OVERWRITE, this method will create an output stream and overwrite the existing file on the disk if it's found, or will create the file if it doesn't exist. If the write mode is WRITEMODE_APPEND, this method will append to the existing file on disk (if it exists), or create it if it doesn't exist.

Specified by:
getOutputStream in interface IContentItem
Parameters:
actionName - The name of the action that is obtaining the output stream.
Returns:
the OutputStream to write to

setOutputStream

public void setOutputStream(OutputStream outputStream)

getActionName

public String getActionName()
Specified by:
getActionName in interface IContentItem
Returns:
The name of the action from the latest ContentItemFile class that the ContentItem contains.

getFileId

public String getFileId()
Specified by:
getFileId in interface IContentItem
Returns:
This returns the Id of the ContentItemFile class that the ContentItem contains.

getFileSize

public long getFileSize()
Specified by:
getFileSize in interface IContentItem
Returns:
The file size from the latest ContentItemFile class that the ContentItem contains.

getFileDateTime

public Date getFileDateTime()
Specified by:
getFileDateTime in interface IContentItem
Returns:
The file date/time from the latest ContentItemFile class that the ContentItem contains.

makeTransient

public void makeTransient()
Description copied from interface: IContentItem
Removes all versions of this item from the repository and removes this item from underlying persistence layer.

Specified by:
makeTransient in interface IContentItem

getMimeTypeListener

public IMimeTypeListener getMimeTypeListener()

setMimeTypeListener

public void setMimeTypeListener(IMimeTypeListener mimeTypeListener)