org.jboss.shotoku
Interface Node

All Superinterfaces:
Resource

public interface Node
extends Resource

An interface which should be implemented by classes representing a node, that is a resource, which is versionable and has some text content.

Author:
Adam Warski (adamw@aster.pl), Damon Sicore (damon@sicore.com)

Method Summary
 void copyToFile(java.lang.String filename)
          Copies this node's content to the given file.
 java.lang.String getContent()
          Gets the content of this node, represented as a string.
 byte[] getContentByteArray()
          Gets the content of this node as a byte array.
 java.io.InputStream getContentInputStream()
          Gets the content of this node as an input stream.
 long getCreated()
          Gets the time of creation of this node.
 java.util.Date getCreatedDate()
          Gets the time of creation of this node, represented as a date object.
 History getHistory()
          Gets a history of this node.
 long getLength()
          Gets the length of this node's content.
 java.lang.String getLogMessage()
          Gets a log message with which this node/ directory was saved.
 java.lang.String getMimeType()
          Gets the mime type of this node.
 java.io.OutputStream getOutputStream()
          Gets an output stream for writing data to the node.
 int getRevisionNumber()
          Gets the revision number of this node.
 void setContent(byte[] bytes)
          Sets this node's content, given as an array of bytes.
 void setContent(java.io.InputStream is)
          Sets this node's content, reading from the given input stream.
 void setContent(java.lang.String content)
          Sets the content of this node.
 
Methods inherited from interface org.jboss.shotoku.Resource
copyTo, delete, deleteProperty, getContentManager, getFullName, getLastModification, getLastModificationDate, getName, getParent, getProperties, getProperty, hasModifications, moveTo, save, setProperty
 

Method Detail

getContent

java.lang.String getContent()
                            throws RepositoryException
Gets the content of this node, represented as a string.

Returns:
Content of this node.
Throws:
RepositoryException

setContent

void setContent(java.lang.String content)
Sets the content of this node. Only after saving this change will be persisted.

Parameters:
content - New content of this node.

setContent

void setContent(java.io.InputStream is)
Sets this node's content, reading from the given input stream.

Parameters:
is - Input stream to read from.

setContent

void setContent(byte[] bytes)
Sets this node's content, given as an array of bytes.

Parameters:
bytes - Byte array of new content.

getOutputStream

java.io.OutputStream getOutputStream()
Gets an output stream for writing data to the node. The stream will be automatically closed upon invocation of any of the getContent...() methods, getLenght() or the save() method. Using this method for setting content instead of the other ones, is an indication to the implementation that the content will be large, so a temporary file could be used instead of a in-memory object.

Returns:
An output stream for writing data to the node.

getHistory

History getHistory()
                   throws RepositoryException
Gets a history of this node.

Returns:
A history of this node.
Throws:
RepositoryException

getRevisionNumber

int getRevisionNumber()
                      throws RepositoryException
Gets the revision number of this node.

Returns:
Revision number of this node.
Throws:
RepositoryException

getLogMessage

java.lang.String getLogMessage()
                               throws RepositoryException
Gets a log message with which this node/ directory was saved.

Returns:
Log message with which this node/ directory was saved. Null, if the resource is not yet saved or contains modifications.
Throws:
RepositoryException

copyToFile

void copyToFile(java.lang.String filename)
                throws RepositoryException
Copies this node's content to the given file.

Parameters:
filename - Name of the file to which to copy this node's content.
Throws:
RepositoryException

getContentInputStream

java.io.InputStream getContentInputStream()
                                          throws RepositoryException
Gets the content of this node as an input stream.

Returns:
Content of this node as an input stream.
Throws:
RepositoryException

getContentByteArray

byte[] getContentByteArray()
                           throws RepositoryException
Gets the content of this node as a byte array.

Returns:
Content of this node as a byte array.
Throws:
RepositoryException

getLength

long getLength()
               throws RepositoryException
Gets the length of this node's content.

Returns:
Length of this node's content.
Throws:
RepositoryException

getMimeType

java.lang.String getMimeType()
Gets the mime type of this node.

Returns:
Mime type of this node.

getCreated

long getCreated()
                throws RepositoryException
Gets the time of creation of this node.

Returns:
Time of creation of this node.
Throws:
RepositoryException

getCreatedDate

java.util.Date getCreatedDate()
                              throws RepositoryException
Gets the time of creation of this node, represented as a date object.

Returns:
Time of creation of this node, represented as a date.
Throws:
RepositoryException


Copyright © -2006 . All Rights Reserved.