org.sakaiproject.metaobj.shared.mgt
Class ContentEntityWrapper

java.lang.Object
  extended byorg.sakaiproject.metaobj.shared.mgt.ContentEntityWrapper
All Implemented Interfaces:
ContentResource, Entity

public class ContentEntityWrapper
extends Object
implements ContentResource

Created by IntelliJ IDEA. User: John Ellis Date: Nov 7, 2005 Time: 3:12:50 PM To change this template use File | Settings | File Templates.


Field Summary
 
Fields inherited from interface org.sakaiproject.service.legacy.entity.Entity
SEPARATOR
 
Constructor Summary
ContentEntityWrapper(ContentResource base, String reference)
           
 
Method Summary
 ContentResource getBase()
           
 byte[] getContent()
          Access an array of the bytes of the resource.
 int getContentLength()
          Access the content byte length.
 String getContentType()
          Access the resource MIME type.
 String getId()
          Access the id of the entity.
 ResourceProperties getProperties()
          Access the entity's properties.
 String getReference()
          Access the internal reference which can be used to access the entity from within the system.
 String getReference(String rootProperty)
          Access the alternate internal reference which can be used to access the entity from within the system.
 String getUrl()
          Access the URL which can be used to access the entity.
 String getUrl(String rootProperty)
          Access the alternate URL which can be used to access the entity.
 void setBase(ContentResource base)
           
 InputStream streamContent()
          Access the content as a stream.
 Element toXml(Document doc, Stack stack)
          Serialize the entity into XML, adding an element to the doc under the top of the stack element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContentEntityWrapper

public ContentEntityWrapper(ContentResource base,
                            String reference)
Method Detail

getContentLength

public int getContentLength()
Description copied from interface: ContentResource
Access the content byte length.

Specified by:
getContentLength in interface ContentResource
Returns:
The content byte length.

getContentType

public String getContentType()
Description copied from interface: ContentResource
Access the resource MIME type.

Specified by:
getContentType in interface ContentResource
Returns:
The resource MIME type.

getContent

public byte[] getContent()
                  throws ServerOverloadException
Description copied from interface: ContentResource
Access an array of the bytes of the resource.

Specified by:
getContent in interface ContentResource
Returns:
An array containing the bytes of the resource's content.
Throws:
ServerOverloadException - if server is configured to save resource body in filesystem and an error occurs while trying to access the filesystem.

streamContent

public InputStream streamContent()
                          throws ServerOverloadException
Description copied from interface: ContentResource
Access the content as a stream. Please close the stream when done as it may be holding valuable system resources.

Specified by:
streamContent in interface ContentResource
Returns:
an InputStream through which the bytes of the resource can be read.
Throws:
ServerOverloadException - if the server cannot produce the content stream at this time.

getUrl

public String getUrl()
Description copied from interface: Entity
Access the URL which can be used to access the entity.

Specified by:
getUrl in interface Entity
Returns:
The URL which can be used to access the entity.

getReference

public String getReference()
Description copied from interface: Entity
Access the internal reference which can be used to access the entity from within the system.

Specified by:
getReference in interface Entity
Returns:
The the internal reference which can be used to access the entity from within the system.

getId

public String getId()
Description copied from interface: Entity
Access the id of the entity.

Specified by:
getId in interface Entity
Returns:
The id.

getProperties

public ResourceProperties getProperties()
Description copied from interface: Entity
Access the entity's properties.

Specified by:
getProperties in interface Entity
Returns:
The entity's properties.

toXml

public Element toXml(Document doc,
                     Stack stack)
Description copied from interface: Entity
Serialize the entity into XML, adding an element to the doc under the top of the stack element.

Specified by:
toXml in interface Entity
Parameters:
doc - The DOM doc to contain the XML (or null for a string return).
stack - The DOM elements, the top of which is the containing element of the new "entity" element.
Returns:
The newly added element.

getUrl

public String getUrl(String rootProperty)
Description copied from interface: Entity
Access the alternate URL which can be used to access the entity.

Specified by:
getUrl in interface Entity
Parameters:
rootProperty - The name of the entity property whose value controls which alternate reference URL is requested. If null, the native 'raw' URL is requested.
Returns:
The alternate URL which can be used to access the entity.

getReference

public String getReference(String rootProperty)
Description copied from interface: Entity
Access the alternate internal reference which can be used to access the entity from within the system.

Specified by:
getReference in interface Entity
Parameters:
rootProperty - The name of the entity property whose value controls which alternate reference is requested. If null, the native 'raw' reference is requested.
Returns:
The the alternate internal reference which can be used to access the entity from within the system.

getBase

public ContentResource getBase()

setBase

public void setBase(ContentResource base)