|
||||||||||
PREV CLASS (src) NEXT CLASS (src) | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This basic interface extends the Media
(src) interface with
behavior common to all kinds of media objects that are persistent and can be
altered. It also extends EJBLocalObject
and therefore
represents the local interface of a media entity EJB.
Media Entity EJBs consist of the five basic alterable properties:
null
.null
.
null
.null
.null
, but unless both the
mimeType and name properties are null
the mimeType accessor
will provide a format specific default mime type.
Field Summary |
Fields inherited from interface javax.emb.Media (src) |
MIME_TYPE_UNKNOWN |
Method Summary | |
void |
addListener(MediaListener (src) listener)
Adds the given listener to the list of persistent observers that are notified of important state changes or activities inside the receiver. |
void |
addMetaData(MetaDataEntityLocal (src) metaData)
Adds the given metadata to the receiver's list of associated metadata. |
void |
convert(MediaConverterSpec (src) [] specifications)
This operation updates the receiver's content after performing a series of transformations on the original content, as defined in the given specifications array. |
java.net.URL |
exportMedia(java.net.URL targetDirectoryLocation)
Copies the receiver's content to the given target directory location, a URL pointing to a directory. |
MediaEntityLocal (src) [] |
getChildren()
Returns the receiver's children as an array of media entities. |
java.lang.String |
getDescription()
Returns the receiver's description as a String or null . |
long |
getLastModified()
Returns a timestamp stating when the receiver's persistent state was last modified. |
MediaListener (src) [] |
getListeners()
Returns an array containing the media listeners associated with the receiver. |
java.net.URL |
getLocation()
Returns the location of the media content as an instance of URL or null if no location has been set. |
MetaDataEntityLocal (src) [] |
getMetaData()
Returns the receiver's associated metadata as an array of MetaDataEntity EJBs. |
MediaEntityLocal (src) |
getNextVersion()
Returns the succeeding version of the receiver, which allows querying and a history chain of media objects that represent the same thing. |
MediaEntityLocal (src) [] |
getParents()
Returns the receiver's parents as an array of media entities. |
MediaEntityLocal (src) |
getPreviousVersion()
Returns the previous version of the receiver, which allows querying a history of media objects that represent the same logical thing. |
void |
importMedia(java.net.URL sourceLocation,
java.lang.String name)
Alters the content of the receiver with the one read from the given source location, a URL of type "file" or any other protocol type supported by the implementation pointing to a piece of content. |
void |
removeListener(MediaListener (src) listener)
Removes the given listener from the list of persistent observers that are notified of important state changes or activities inside the receiver. |
void |
removeMetaData(MetaDataEntityLocal (src) metaData)
Removes the given metadata from the receiver's list of associated metadata. |
void |
setChildren(MediaEntityLocal (src) [] children)
This operation sets the children of the receiver to an array of media entity EJBs. |
void |
setContent(byte[] content)
This operation offers a convenient way to alter the content of the receiver for small and embedded media content. |
void |
setContent(java.io.InputStream content)
This operation offers a convenient way to alter the content of the receiver for all kinds of embedded media formats. |
void |
setDescription(java.lang.String description)
Alters the receiver's description. |
void |
setLocation(java.net.URL location)
Sets the location of the receiver to the given location URL or null . |
void |
setMimeType(java.lang.String mimeType)
Alters the receiver's MIME type that allows media content to be written directly to a Servlet output stream. |
void |
setName(java.lang.String name)
Sets the receiver's non-unique name as a String . |
void |
setPreviousVersion(MediaEntityLocal (src) mediaEntity)
Defines the given media entity to be the preceding version of the receiver, which allows querying a history chain of media objects that represent the same logical thing. |
void |
setProxy(MediaEntityLocal (src) mediaEntity)
Sets the given media entity as the receiver's persistent proxy, e.g. |
Methods inherited from interface javax.ejb.EJBLocalObject (src) |
getEJBLocalHome, getPrimaryKey, isIdentical, remove |
Methods inherited from interface javax.emb.Media (src) |
getContent, getFormat, getHeader, getMimeType, getName, getProxy, getSize, readContent, readContent |
Method Detail |
public void addListener(MediaListener (src) listener) throws MediaException (src)
listener
- the listener.
java.lang.NullPointerException
- if the value passed is null
.
MediaException (src)
public void addMetaData(MetaDataEntityLocal (src) metaData) throws MediaException (src)
metaData
- metadata.
java.lang.NullPointerException
- if the value passed is null
.
MediaException (src)
public void convert(MediaConverterSpec (src) [] specifications) throws MediaException (src)
specifications
- array of MediaConverterSpec
s.
java.lang.NullPointerException
- if the value passed is null
.
ContentAccessException (src)
- if the content cannot be
accessed.
ContentUnmutableException (src)
- if the location
property is not null
.
MediaFormatException (src)
- if a problem occurs handling the
different media formats involved.
ConversionException (src)
- if one of the conversions fails.
ListenerVetoException (src)
- if a media listener vetoes the
change.
ContentTooLargeException (src)
- if the content generated is
larger than supported by the implementation.
MediaException (src)
public java.net.URL exportMedia(java.net.URL targetDirectoryLocation) throws MediaException (src)
null
is passed, the
content is exported to a default directory. The URL must be of protocol
type "file" or any additional protocol supported by the implementation.
In case of non-embedded media formats, the content of related children is
also recursively copied into the same directory or one of its
subdirectories. Implementations must guarantee that no existing files are
overwritten during execution, i.e. they must resolve naming conflicts by
generating file names and adjusting parent content if necessary.
The location returned points to the file exported for the receiver, which is necessary to know in case a directory location was given, or the location given pointed to an existing file.
targetDirectoryLocation
- a URL pointing to a directory. Must be of
protocol type "file".
ContentAccessException (src)
- if the content cannot be stored
at the given target location, or if the content transfer fails.
MalformedLocationException (src)
- if the given target location
is malformed or the given protocol is not supported.
MediaFormatException (src)
- is thrown if there is a problem
dealing with one of the media formats involved.
MediaException (src)
public MediaEntityLocal (src) [] getChildren() throws MediaException (src)
Note that in case of non-embedded media formats a change of the media content can implicitly alter the set of children. Also note that altering the resulting array content will not alter the persisted set of children, i.e. no persistent relationship collection is exposed. The reason for this is that the number of children depends on the content.
MediaException (src)
public java.lang.String getDescription() throws MediaException (src)
null
.
The string is not guaranteed to have any structure, and is primarily
designed to allow storing a descriptive label without the need to model
an EJB relation to another entity bean describing the receiver.
MediaException (src)
public long getLastModified() throws MediaException (src)
MediaException (src)
public MediaListener (src) [] getListeners() throws MediaException (src)
MediaException (src)
public java.net.URL getLocation() throws MediaException (src)
URL
or null
if no location has been set.
MediaException (src)
public MetaDataEntityLocal (src) [] getMetaData() throws MediaException (src)
MediaException (src)
public MediaEntityLocal (src) getNextVersion() throws MediaException (src)
null
is returned if no next version exists.
MediaException (src)
public MediaEntityLocal (src) [] getParents() throws MediaException (src)
MediaException (src)
public MediaEntityLocal (src) getPreviousVersion() throws MediaException (src)
null
is returned if no previous version exists.
MediaException (src)
public void importMedia(java.net.URL sourceLocation, java.lang.String name) throws MediaException (src)
null
, the name property is also set to
match the given name. It may only contain characters that are valid in
file names. If both the name property and the name given are null
the name property is updated with a generated name, possibly based on the
given source location.
In case the media content is non-embedded, the operation recursively creates media entity EJBs for the children, with their respective names being derived from the child links within the content. Note that the operation identifies children that are referenced from multiple parents in the operation's context and avoids creating multiple media entity EJBs in this case.
Please note that passing a sourceLocation that is equal to the receiver's current location is allowed and can trigger the recursive recreation of all children. Additionally the receiver's format can change due to this operation if the file extension passed with the given name differs from the one set for the receiver. Also note that this operation implicitly updates the receiver's lastModified property, and it will fail if the location property is set.
sourceLocation
- name
-
java.lang.NullPointerException
- if the value passed is null
.
java.lang.IllegalArgumentException
- if the name argument passed
contains invalid characters.
ContentAccessException (src)
- if the content cannot be
accessed at the given source location, or if the content transfer
fails.
ContentUnmutableException (src)
- is thrown if the location
property is not null
.
CreateException (src)
- if the creation of a child EJB fails.
MediaFormatException (src)
- if a format related problem
occurs.
MalformedLocationException (src)
- if the given source location
is malformed.
ListenerVetoException (src)
- if a media listener vetoes the
change.
ContentTooLargeException (src)
- if the content given is larger
than supported by the implementation.
MediaException (src)
public void removeListener(MediaListener (src) listener) throws MediaException (src)
listener
- the listener.
java.lang.NullPointerException
- if the value passed is null
.
MediaException (src)
public void removeMetaData(MetaDataEntityLocal (src) metaData) throws MediaException (src)
Note that this operation will not remove the MetaDataEntity EJB from the persistent store, but rather disassociate the metadata from the Media Entity on which the method was invoked.
metaData
- metadata
java.lang.NullPointerException
- if the value passed is null
.
MediaException (src)
public void setChildren(MediaEntityLocal (src) [] children) throws MediaException (src)
children
- children
java.lang.NullPointerException
- if the value passed or one of its
elements is null
.
java.lang.IllegalArgumentException
- if the value passed has more
or fewer elements than the receiver's existing number of
children.
ContentUnmutableException (src)
- if the location
property is set.
ContentAccessException (src)
- if the content
has not been set.
MediaException (src)
public void setContent(byte[] content) throws MediaException (src)
importMedia(URL, String)
operation
should be used instead, as this method only modifies the receiver's
content and no child content is affected. The same is true if the content
is rather large.
If both the value passed and the receiver's existing content property
are not null
, no format change may occur during this
operation. If the location property is not null
then this
operation is not permitted. Note that the location property may not be
set while the content property contains a value different from null
.
Note that this operation implicitly updates the receive's lastModified
property. Also note that this operation will fail if the location
property is set.
content
- content.
ContentAccessException (src)
- if content transfer fails.
FormatNotFoundException (src)
- if the name property is null
.
FormatSyntaxException (src)
- if the system notices a format
change.
ContentUnmutableException (src)
- if the location property is
not null
.
ContentTooLargeException (src)
- if the content given is larger
than supported by the implementation.
MediaException (src)
public void setContent(java.io.InputStream content) throws MediaException (src)
importMedia(URL, String)
operation
should be used instead, as this method only modifies the receiver's
content and no child content is affected. The same is true if the content
is rather large.
If both the value passed and the receiver's existing content property
are not null
, no format change may occur during this
operation. If the location property is not null
, this
operation is not permitted. The location property may not be set while
the content property contains a value different from null
.
Note that this operation implicitly updates the receiver's lastModified
property. Also note that this operation will fail if the location
property is set.
content
- content.
java.lang.NullPointerException
- if the value passed is null
.
ContentAccessException (src)
- if content transfer fails.
FormatNotFoundException (src)
- if the name property is null
.
FormatSyntaxException (src)
- if the system notices a format
change.
ContentUnmutableException (src)
- if the location property is
not null
.
ListenerVetoException (src)
- if a media listener vetoes the
change.
ContentTooLargeException (src)
- if the content given is larger
than supported by the implementation.
MediaException (src)
public void setDescription(java.lang.String description) throws MediaException (src)
null
causes the description field to be reset to null
.
Note that this operation implicitly updates the receiver's lastModified
property.
description
- description.
ListenerVetoException (src)
- if a media listener vetoes the
change.
MediaException (src)
public void setLocation(java.net.URL location) throws MediaException (src)
null
.
The purpose of this method is to provide a mechanism for read access to
externally managed content. For example, content that is hosted by an
external content provider.
Note that if the content property is not null
, this
operation is not permitted. Note that the content property may not be set
while the location
property contains a value different
from null
. Also note that this operation implicitly
updates the receiver's lastModified
property.
location
- location URL.
ContentAccessException (src)
- if the media content cannot be
accessed under the new location, or if the given location URL
points to a directory.
LocationUnmutableException (src)
- if the content property is
not null
.
ListenerVetoException (src)
- if a media listener vetoes the
change.
MediaException (src)
public void setMimeType(java.lang.String mimeType) throws MediaException (src)
lastModified
property. Note that
passing null
will cause the getMimeType()
method to return a format specific default. Also note that this operation
implicitly updates the receiver's lastModified
property.
mimeType
- MIME type.
ListenerVetoException (src)
- if a media listener vetoes the
change.
MediaException (src)
public void setName(java.lang.String name) throws MediaException (src)
String
. The name
is used as a file name hint in case the media content is to be stored or
published in a file system and therefore may only contain characters that
are valid in file names. Also, it must contain a file extension that
represents the receiver's media format. Note that this operation
implicitly updates the receiver's lastModified
property.
name
- name.
java.lang.NullPointerException
- if the value passed is null
.
java.lang.IllegalArgumentException
- if the name argument passed
contains invalid characters.
FormatNotFoundException (src)
- if the format cannot be
determined from the file extension.
ListenerVetoException (src)
- is thrown if a media listener
vetoes the change.
MediaException (src)
public void setPreviousVersion(MediaEntityLocal (src) mediaEntity) throws MediaException (src)
null
causes the receiver not to have a previous version
anymore. The operation is only allowed if version chain integrity is
preserved:
null
: A
javax.emb.VersionChainIntegrityException is thrown if the receiver has a
successor.
MediaException (src)
public void setProxy(MediaEntityLocal (src) mediaEntity) throws MediaException (src)
null
is passed, the relation to any existing
persistent proxy is broken up and getProxy()
will return a
generated transient proxy.
mediaEntity
- media entity.
MediaException (src)
|
||||||||||
PREV CLASS (src) NEXT CLASS (src) | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |