org.ocap.hn.content
Interface ContentItem

All Superinterfaces:
ContentEntry
All Known Implementing Classes:
RecordingContentItem

public interface ContentItem
extends ContentEntry

This class represents a piece of content. This can be audio, video or still image content. It is not directly linked to any file. This is done via the ContentResources. A ContentItem can have multiple ContentResources. The class itself implements Metadata but the real Metadata is stored in the MetadataNode. That means a call to getMetadata("foo") will be translated to getMetadataRoot().getMetadata("foo");


Field Summary
static int AUDIO_ITEM
          Represents the base audio content.
static int AUDIO_ITEM_BOOK
          In addition to being an AUDIO_ITEM content MAY be an audio book.
static int AUDIO_ITEM_BROADCAST
          In addition to being an AUDIO_ITEM content MAY be broadcast on a radio station.
static int AUDIO_ITEM_TRACK
          In addition to being an AUDIO_ITEM content MAY be a track such as a song.
static int IMAGE_ITEM
          Base image item.
static int IMAGE_ITEM_PHOTO
          In addition to being an IMAGE_ITEM content MAY be a photo.
static int VIDEO_ITEM
          Represents the base video item.
static int VIDEO_ITEM_BROADCAST
          In addition to being a VIDEO_ITEM content MAY be a video broadcast.
static int VIDEO_ITEM_MOVIE
          In addition to being a VIDEO_ITEM content MAY be a movie.
static int VIDEO_ITEM_MUSIC_CLIP
          In addition to being a VIDEO_ITEM content MAY be a music video clip, e.g.
 
Method Summary
 boolean containsResource(ContentResource entry)
          Checks whether the given ContentResource is part of this ContentItem..
 boolean delete()
          Deletes this ContentItem.
 int getContentClass()
          Returns the content class of this content item.
 MetadataNode getMetadataRoot()
          Gets the Metadata root object for this content.
 MetadataNode getParentNode()
          Gets the parent node of this Metadata.
 ContentResource getResource(int n)
          Returns the nth ContentResource of this ContentItem.
 int getResourceCount()
          Returns the number of ContentResources which are associated with this ContentItem.
 int getResourceIndex(ContentResource r)
          Returns the index of the specified ContentResource or -1 if the ContentResource does not exist in this ContentItem.
 ContentResource[] getResources()
          Gets an array copy of ContentResources which are part of this ContentItem.
 Service getService()
          If this ContentItem is presentable as a JavaTV Service than this method returns a javax.tv.service.Service, or derivative of a Service, e.g.
 boolean hasAudio()
          Returns a boolean indicating if this content has audio.
 boolean hasStillImage()
          Returns a boolean indicating if the ContentItem has a still image.
 boolean hasVideo()
          Returns a boolean indicating if the ContentItem has video associated with it.
 
Methods inherited from interface org.ocap.hn.content.ContentEntry
getContentSize, getCreationDate, getExtendedFileAccessPermissions, getMetadata, getName, getParent, getServer
 

Field Detail

AUDIO_ITEM

static final int AUDIO_ITEM
Represents the base audio content.

See Also:
Constant Field Values

AUDIO_ITEM_TRACK

static final int AUDIO_ITEM_TRACK
In addition to being an AUDIO_ITEM content MAY be a track such as a song.

See Also:
Constant Field Values

AUDIO_ITEM_BROADCAST

static final int AUDIO_ITEM_BROADCAST
In addition to being an AUDIO_ITEM content MAY be broadcast on a radio station.

See Also:
Constant Field Values

AUDIO_ITEM_BOOK

static final int AUDIO_ITEM_BOOK
In addition to being an AUDIO_ITEM content MAY be an audio book.

See Also:
Constant Field Values

VIDEO_ITEM

static final int VIDEO_ITEM
Represents the base video item.

See Also:
Constant Field Values

VIDEO_ITEM_MOVIE

static final int VIDEO_ITEM_MOVIE
In addition to being a VIDEO_ITEM content MAY be a movie.

See Also:
Constant Field Values

VIDEO_ITEM_BROADCAST

static final int VIDEO_ITEM_BROADCAST
In addition to being a VIDEO_ITEM content MAY be a video broadcast.

See Also:
Constant Field Values

VIDEO_ITEM_MUSIC_CLIP

static final int VIDEO_ITEM_MUSIC_CLIP
In addition to being a VIDEO_ITEM content MAY be a music video clip, e.g. music video.

See Also:
Constant Field Values

IMAGE_ITEM

static final int IMAGE_ITEM
Base image item.

See Also:
Constant Field Values

IMAGE_ITEM_PHOTO

static final int IMAGE_ITEM_PHOTO
In addition to being an IMAGE_ITEM content MAY be a photo.

See Also:
Constant Field Values
Method Detail

hasAudio

boolean hasAudio()
Returns a boolean indicating if this content has audio.

Returns:
True if the content type has audio, otherwise returns false.

hasVideo

boolean hasVideo()
Returns a boolean indicating if the ContentItem has video associated with it.

Returns:
True if the ContentItem contains video, otherwise returns false.

hasStillImage

boolean hasStillImage()
Returns a boolean indicating if the ContentItem has a still image.

Returns:
True if the ContentItem has a still image, otherwise returns false.

getMetadataRoot

MetadataNode getMetadataRoot()
Gets the Metadata root object for this content.

Returns:
the Metadata root object.

getService

Service getService()
If this ContentItem is presentable as a JavaTV Service than this method returns a javax.tv.service.Service, or derivative of a Service, e.g. RecordedService, which can be used to play this ContentItem. If the ContentItem is not local the returned Service SHALL be a RemoteService.

Returns:
A JavaTV service if this content is presentable as a Service, null otherwise.

getParentNode

MetadataNode getParentNode()
Gets the parent node of this Metadata.

Returns:
Parent MetadataNode of this content.
See Also:
MetadataNode.getParentNode()

getContentClass

int getContentClass()
Returns the content class of this content item.

Returns:
The content class of this item.
See Also:
AUDIO_ITEM, AUDIO_ITEM_BOOK, AUDIO_ITEM_BROADCAST, AUDIO_ITEM_TRACK, IMAGE_ITEM, VIDEO_ITEM, VIDEO_ITEM_BROADCAST, VIDEO_ITEM_MOVIE, VIDEO_ITEM_MUSIC_CLIP, IMAGE_ITEM_PHOTO

delete

boolean delete()
               throws IOException,
                      SecurityException
Deletes this ContentItem. Calls the ContentResource.delete() method on each ContentResource contained in this ContentItem. Deletes a local ContentItem only. If the #isLocal method returns false a exception is thrown.

Note: this overrides the definition of ContentEntry

The ContentEntry is not valid anymore after this call.

Specified by:
delete in interface ContentEntry
Returns:
True if the ContentEntry was deleted, otherwise returns false.
Throws:
SecurityException - if the application does not have write ExtendedFileAccessPermission.
IOException - if the ContentItem is not local.

getResourceCount

int getResourceCount()
Returns the number of ContentResources which are associated with this ContentItem.

Returns:
number of ContentResources.

getResource

ContentResource getResource(int n)
                            throws ArrayIndexOutOfBoundsException
Returns the nth ContentResource of this ContentItem.

Parameters:
n - the index of the ContentResource
Returns:
the nthThrows:
ArrayIndexOutOfBoundsException - if the nth value does not exist.

getResourceIndex

int getResourceIndex(ContentResource r)
Returns the index of the specified ContentResource or -1 if the ContentResource does not exist in this ContentItem.

Parameters:
r - The ContentResource to check for.
Returns:
The index of the ContentResource or -1 if it doesn't exist in this ContentItem.

containsResource

boolean containsResource(ContentResource entry)
Checks whether the given ContentResource is part of this ContentItem..

Parameters:
entry - The ContentResource to check for.
Returns:
True if the ContentResource is part of this ContentItem, otherwise returns false.

getResources

ContentResource[] getResources()
Gets an array copy of ContentResources which are part of this ContentItem.

Returns:
Array of ContentResources.