com.arsdigita.cms
Class BinaryAsset

java.lang.Object
  extended bycom.arsdigita.domain.DomainObject
      extended bycom.arsdigita.domain.ObservableDomainObject
          extended bycom.arsdigita.kernel.ACSObject
              extended bycom.arsdigita.versioning.VersionedACSObject
                  extended bycom.arsdigita.cms.ContentItem
                      extended bycom.arsdigita.cms.Asset
                          extended bycom.arsdigita.cms.BinaryAsset
All Implemented Interfaces:
com.arsdigita.auditing.Audited, CustomCopy
Direct Known Subclasses:
FileAsset, ImageAsset

public abstract class BinaryAsset
extends Asset

An abstract class for an asset which represents some binary data, such as an image, an audio clip, etc. Contains utility methods for reading and writing bytes. Child classes must override the getBaseDataObjectType(), getContent() and setContent(byte[]) methods.

Version:
$Revision: #12 $ $DateTime: 2004/04/07 16:07:11 $
Author:
Jack Chung, Stanislav Freidin

Field Summary
static String versionId
           
 
Fields inherited from class com.arsdigita.cms.Asset
BASE_DATA_OBJECT_TYPE, DESCRIPTION, MIME_TYPE, NAME
 
Fields inherited from class com.arsdigita.cms.ContentItem
ANCESTORS, AUDITING, CHILDREN, CONTENT_SECTION, CONTENT_TYPE, DRAFT, DRAFT_VERSION, LANGUAGE, LIVE, PARENT, PENDING, VERSION, VERSIONS
 
Fields inherited from class com.arsdigita.versioning.VersionedACSObject
IS_DELETED, MASTER
 
Fields inherited from class com.arsdigita.kernel.ACSObject
CONTAINER, DEFAULT_DOMAIN_CLASS, DISPLAY_NAME, ID, OBJECT_TYPE
 
Constructor Summary
  BinaryAsset(com.arsdigita.persistence.DataObject obj)
           
protected BinaryAsset(com.arsdigita.persistence.OID oid)
           
protected BinaryAsset(String type)
           
 
Method Summary
abstract  String getBaseDataObjectType()
           
protected abstract  byte[] getContent()
          All derived classes must implement this method.
 long getSize()
          Fetch the size of the content.
 long readBytes(InputStream is)
          Reads a stream of data into the content object.
protected abstract  void setContent(byte[] content)
          All derived classes must implement this method.
 long writeBytes(OutputStream os)
          Writes data from the content object to the specified output stream.
 
Methods inherited from class com.arsdigita.cms.Asset
getDescription, getMimeType, setDescription, setMimeType, writeToFile
 
Methods inherited from class com.arsdigita.cms.ContentItem
addCategory, addPendingVersion, afterSave, assertDraft, assertLive, assertMaster, assertPending, beforeDelete, beforeSave, canPublishToFS, copy, copy, copyProperty, copyProperty, copyServices, copyServicesFrom, createLiveVersion, createPendingVersion, get, getCategories, getCategoryCollection, getChildren, getContentSection, getContentType, getCreationDate, getCreationIP, getCreationUser, getDisplayName, getDraftVersion, getLanguage, getLastModifiedDate, getLastModifiedIP, getLastModifiedUser, getLifecycle, getLiveVersion, getLocale, getName, getParent, getPath, getPathInfo, getPathInfo, getPathNoJsp, getPendingVersions, getPublicVersion, getVersion, getWorkingVersion, initialize, isDraftVersion, isLive, isLiveVersion, isPendingVersion, isPublished, makeCopy, promotePendingVersion, publish, publishToFS, removeCategory, removeLifecycle, removePendingVersion, set, setContentSection, setContentType, setDefaultCategory, setLanguage, setLifecycle, setLive, setLiveVersion, setName, setParent, setVersion, setVersionRecursively, unpublish, unpublishFromFS
 
Methods inherited from class com.arsdigita.versioning.VersionedACSObject
applyTag, applyUniqueTag, autoPropagateMaster, getMaster, getRolledBackTo, getTransactions, getTransactions, isMaster, isRolledBack, isSubtype, permanentlyDelete, propagateMaster, recordAttributeChange, rollBackTo, rollBackTo, rollForward, save, setMaster, trackChanges
 
Methods inherited from class com.arsdigita.kernel.ACSObject
assertPrivilege, checkPrivilege, doCreateCheck, doWriteCheck, getContainer, getDefaultDomainClass, getID, getSpecificObjectType, getSpecificOID, gimmeContainer, isContainerModified, setID, setID
 
Methods inherited from class com.arsdigita.domain.ObservableDomainObject
addObserver, getObservers
 
Methods inherited from class com.arsdigita.domain.DomainObject
add, add, addToAssociation, afterDelete, clear, delete, disconnect, equals, getObjectType, getOID, getSession, hashCode, isDeleted, isDisconnected, isModified, isNew, isPropertyModified, isValid, remove, remove, remove, removeFromAssociation, save, setAssociation, setAssociation, specializeDataObject, specializeDataObject, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

versionId

public static final String versionId
See Also:
Constant Field Values
Constructor Detail

BinaryAsset

protected BinaryAsset(com.arsdigita.persistence.OID oid)
               throws com.arsdigita.domain.DataObjectNotFoundException

BinaryAsset

protected BinaryAsset(String type)

BinaryAsset

public BinaryAsset(com.arsdigita.persistence.DataObject obj)
Method Detail

getBaseDataObjectType

public abstract String getBaseDataObjectType()
Overrides:
getBaseDataObjectType in class Asset
Returns:
the base PDL object type for this item. Child classes should override this method to return the correct value

readBytes

public long readBytes(InputStream is)
               throws IOException
Reads a stream of data into the content object.

Parameters:
is - A input stream
Returns:
the number of bytes read
Throws:
IOException

writeBytes

public long writeBytes(OutputStream os)
                throws IOException
Writes data from the content object to the specified output stream.

Parameters:
os - The output stream
Returns:
the number of bytes written
Throws:
IOException

getContent

protected abstract byte[] getContent()
All derived classes must implement this method. This method retrieves the Blob content.

Returns:
the Blob content

setContent

protected abstract void setContent(byte[] content)
All derived classes must implement this method. This method sets the Blob content.

Parameters:
content - the binary data to be put into the Blob

getSize

public long getSize()
Fetch the size of the content.

Returns:
The size of the content


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 21 2004:2352 UTC