org.ocap.hn.content.ContentResource Maven / Gradle / Ivy
/*
* Created on 06-Jan-2005 by
* Dr. Immo Benjes , Philips Digital Systems Labs, Redhill, UK
*
*/
package org.ocap.hn.content;
import java.io.IOException;
import java.util.Date;
import javax.tv.locator.Locator;
import org.ocap.storage.ExtendedFileAccessPermissions;
/**
* Abstract class representing a media stream/file. Subclasses of this class
* can implement {@link AudioResource} and/or {@link VideoResource} depending on whether
* the content represents audio and/or video.
*/
public interface ContentResource
{
/**
* Constant for an unknown MIME type.
*/
public static final String UNKNOWN_MIME_TYPE = "unknown";
/**
* Deletes the binary representation of this ContentResource and the
* ContentResource is removed from any containing ContentEntry. The
* ContentResource is not valid anymore after this call.
* This method deletes a local ContentResource only. If the #isLocal
* method returns false an exception is thrown. Does not delete the content
* associated with this ContentResource; see #getLocator.
*
* @return True if this ContentResource was deleted, otherwise returns
* false.
*
* @throws java.lang.SecurityException if the application is does not have
* a write ExtendedFileAccessPermission.
* @throws java.io.IOException if the ContentResource is not local.
*
*/
public boolean delete() throws IOException;
/**
* Gets the ContentItem this resource belongs to.
*
* @return The ContentItem parent of this resource or null if this
* ContentResource is an independent ContentEntry.
*/
public ContentItem getContentItem();
/**
* Gets the size of the content in bytes or -1 if not known.
*
* @return the content size in bytes
*/
public long getContentSize();
/**
* Gets the creation date of the content or NULL if not known.
*
* @return The Date the content was created.
*/
public Date getCreationDate();
/**
* Gets an OcapLocator to the content associated with this ContentResource
* if the content can be located with that Locator type, otherwise
* returns an implementation specific Locator to the content.
*
* @return Locator to the content associated with this entry.
*/
public Locator getLocator();
/**
* Returns the file permissions of a ContentResource.
*
* @return the extended file access permissions of the ContentEntry.
*/
public ExtendedFileAccessPermissions getExtendedFileAccessPermissions();
/**
* Returns the protocol which can be used to retrieve the content.
* The returned String can be a wild card "*".
*
Possible protocols are
*
* - "http-get"
* - "rtsp-rtp-udp"
* - "internal"
* - "iec61883"
* - Registered ICANN domain name of vendor
*
*
* @return String representation of the protocol
*/
public String getProtocol();
/**
* Returns the network on which the content is available. The returned
* String can be a wild card "*".
*
*
* <protocol>
* <network>
*
*
* "http-get"
* "*"
*
*
* "rtsp-rtp-udp"
* "*"
*
*
* "internal"
* IP address of the device hosting the Connection manager
*
*
* "iec61883"
* GUID of the 1394 bus Isochronous Resource Manager
*
*
* ICANN domain
* Vendor-defined, may be "*"
*
*
*
* @return String describing the network on which the resource is
* available.
*/
public String getNetwork();
/**
* Returns the content format. The returned String can be a wild card "*".
*
*
* <protocol>
* <network>
*
*
* "http-get"
* MIME-type
*
*
* "rtsp-rtp-udp"
* Name of RTP payload type
*
*
* "internal"
* Vendor-defined, may be "*"
*
*
* "iec61883"
* Name standardised by IEC61883
*
*
* ICANN domain
* Vendor-defined, may be "*"
*
*
*
* @return String describing the content format.
*/
public String getContentFormat();
/**
* Returns properties of the resource. There is a set of defined properties
* which can be accessed via the methods in {@link AudioResource} and
* {@link VideoResource}. This method allows for custom or new properties.
*
* @param key The key of the property.
*
* @return The value of the property, or null if the key parameter does
* not match any property.
*/
public Object getResourceProperty(String key);
/**
* Checks whether the local device has the capabilities to render this
* content resource. This includes the ability to negotiate media protocol with
* the host device, the ability of the local device to render this
* content item's media format, and sufficient access permissions
* for the calling application.
*
* This call does not consider immediate availability of resources required
* for presentation of this content.
*
* @return true if this content is renderable on the local device, false
* otherwise.
*/
public boolean isRenderable();
}