Commit c811235c authored by (no author)'s avatar (no author)

This commit was manufactured by cvs2svn to create tag

'OCAP10-I14-050119'.
parent 2a8e72a2
package org.ocap.hn;
/**
* This class represents an event generated in response to an action.
* ActionDoneEvent instances can only be created by the implementation.
*/
public class ActionDoneEvent extends java.util.EventObject
{
// Begin event type constants.
/**
* Successful completion of the action.
*/
public final int COMPLETED_SUCCESSFULLY = 0;
/**
* Failed due to no response. This event MAY be used for a single
* time-out or retries with a time-out.
*/
public final int FAILED_NO_RESPONSE = 1;
/**
* Failed due to lack of authorization. This event MAY be used when the
* action receiver rejects the action for any security issue.
*/
public final int FAILED_NO_AUTHORIZATION = 2;
/**
* Failed due to invalid action. This event MAY be used to indicate
* any problem with the request such as improper format.
*/
public final int FAILED_INVALID_ACTION = 3;
/**
* Failed due to no action support. This event MAY be used when the
* receiver does not support the action requested.
*/
public final int FAILED_ACTION_NOT_SUPPORTED = 4;
/**
* Failed for unknown reason. This event MAY be used when none of the
* other failure events apply.
*/
public final int FAILED_UNKNOWN = 5;
// End event type constants.
/**
* Two argument constructor.
*
* @param source Action that instigated the response.
* @param eventType Unique code identifying the event. See constants in
* this class.
*
* @throws SecurityException if an application attempts to call this
* constructor.
*/
public ActionDoneEvent(Object source, int eventType)
{
super(source);
}
/**
* Three argument constructor.
*
* @param source Action that instigated the response.
* @param eventType Unique code identifying the event. See constants in
* this class.
* @param response An object representing the response to the action and
* which is specific to the action.
*
* @throws SecurityException if an application attempts to call this
* constructor.
*/
public ActionDoneEvent(Object source, int eventType, Object response)
{
super(source);
}
/**
* Gets the source of the event.
*
* @return Souce of the event.
*/
public Object getSource()
{
return null;
}
/**
* Gets the event type. Possible return values include all event
* type constants in this class.
*
* @return Event type.
*/
public int getEventType()
{
return 0;
}
/**
* Gets the response for the action. May return null if for example
* an error was encountered during the action.
*
* @return Response for the action.
*/
public Object getResponse()
{
return null;
}
/**
* Gets the request created by the implementation and returned from
* the method that initiated the action.
*
* @return Action request.
*/
public ActionRequest getActionRequest()
{
return null;
}
}
package org.ocap.hn;
/**
* This interface represents a handler passed to the
* {@link HnModule.execute} method.
*/
public interface ActionHandler
{
/**
* Notifies the application of a network action completed event. This
* method is called by the implementation when a response to an action
* or a failure for the action is detected.
*/
public void notify(ActionDoneEvent event);
}
/*
* Created on 28-Oct-2004
*
*/
package org.ocap.hn;
/**
* All asynchronous actions in the Home networking API return an
* HnActionRequest. The ActionRequest can be used to cancel any
* pending action, to identify which Action got completed, or to
* notify the application of an action event.
*/
public interface ActionRequest
{
/**
* Cancels the Action associated with this ActionRequest. Returns false if
* the action can't be canceled.
* @return false if action can't be canceled.
*/
public boolean cancel();
/**
* Returns the progress of the action in percent (0.0 - 1.0).
* If the progress of an action can't be determinated -1.0 shall be
* returned.
*
* @return the progress of the action (0.0 - 1.0) or -1.0 if the
* progress can't be determinated.
*/
public float getProgress();
/**
* Returns the current status of the requested action
* @return the current action status
*/
public int getActionStatus();
}
package org.ocap.hn;
import javax.tv.locator.Locator;
import org.ocap.storage.ExtendedFileAccessPermissions;
/**
* This interface represents an HN Module that provides content
* management capabilities for the purposes of network copying, moving,
* deleting, and renaming directories, files, or all components of a
* recorded service. In addition, this module allows volumes to be
* allocated or deleted remotely.
* </p><p>
* All methods in this interface are asynchronous. The implementation
* SHALL generate an {@link ActionEvent} when an asyncrhonous method
* completes or times out. Time outs are implementation specific.
* Each event SHALL contain an event type defined in <code>ActionEvent</code>.
* </p>
*/
public interface ContentManagementModule extends HnModule
{
/**
* Copies a file or a recorded service from one device to another.
* Possible action item types that can be generated by this method
* include; <code>ActionEvent.COMPLETED</code>,
* <code>ActionEvent.ERROR_TIMED_OUT</code>,
* <code>ActionEvent.ERROR_INVALID_PARAMETER</code>,
* and <code>ActionEvent.ERROR_UNAUTHORIZED</code>.
*
* @param source Location where the item is to be copied from.
* @param dest Location where the item is to be copied to.
* @param handler Action response will be notified to this handler.
*
* @return Action request for app query and control of a pending
* transaction.
*
* @throws SecurityException if the application does not have
* NetworkPermission("hncontentmanagement") permission in its
* permission request file, or if the application does not have
* ExtendedFileAccessPermission for reading from the source or
* writing to the destination.
* @throws IllegalArgumentException if the source or destination
* locators are not valid.
*/
public ActionRequest copy(Locator source, Locator dest,
ActionHandler handler)
throws SecurityException;
/**
* Moves a file or a recorded service from one device to another.
* Possible action event types that can be generated by this method
* include; <code>ActionEvent.COMPLETED</code>,
* <code>ActionEvent.ERROR_TIMED_OUT</code>,
* <code>ActionEvent.ERROR_INVALID_PARAMETER</code>,
* and <code>ERROR_UNAUTHORIZED</code>.
*
* @param source Location where the item is to be moved from.
* @param dest Location where the item is to be moved to.
* @param handler Action response will be notified to this handler.
*
* @return Action request for app query and control of a pending
* transaction.
*
* @throws SecurityException if the application does not have
* NetworkPermission("hncontentmanagement") permission in its
* permission request file, or if the application does not have
* ExtendedFileAccessPermission for reading from the source or
* writing to the destination.
* @throws IllegalArgumentException if the source or destination
* locators are not valid.
*/
public ActionRequest move(Locator source, Locator dest,
ActionHandler handler)
throws SecurityException;
/**
* Deletes a file or a recorded service on a remote device.
* Possible action event types that can be generated by this method
* include; <code>ActionEvent.COMPLETED</code>,
* <code>ActionEvent.ERROR_TIMED_OUT</code>,
* <code>ActionEvent.ERROR_INVALID_PARAMETER</code>,
* and <code>ERROR_UNAUTHORIZED</code>.
*
* @param target Location of the item is to be deleted.
* @param handler Action response will be notified to this handler.
*
* @return Action request for app query and control of a pending
* transaction.
*
* @throws SecurityException if the application does not have
* NetworkPermission("hncontentmanagement") permission in its
* permission request file, or if the application does not have
* ExtendedFileAccessPermission for writing to the target.
* @throws IllegalArgumentException if the target locator is not valid.
*/
public ActionRequest delete(Locator target, ActionHandler handler)
throws SecurityException;
/**
* Renames a file or a recorded service on a remote device.
* Possible action event types that can be generated by this method
* include; <code>ActionEvent.COMPLETED</code>,
* <code>ActionEvent.ERROR_TIMED_OUT</code>,
* <code>ActionEvent.ERROR_INVALID_PARAMETER</code>,
* and <code>ERROR_UNAUTHORIZED</code>.
*
* @param target Location of the item to be renamed.
* @param handler Action response will be notified to this handler.
*
* @return Action request for app query and control of a pending
* transaction.
*
* @throws SecurityException if the application does not have
* NetworkPermission("contentmanagement") permission in its
* permission request file, or if the application does not have
* ExtendedFileAccessPermission for writing to the target.
.
* @throws IllegalArgumentException if the target locator is not valid.
*/
public ActionRequest rename(Locator target, ActionHandler handler)
throws SecurityException;
/**
* Allocates a volume on a remote device.
* Possible action event types that can be generated by this method
* include; <code>ActionEvent.COMPLETED</code>,
* <code>ActionEvent.ERROR_TIMED_OUT</code>,
* <code>ActionEvent.ERROR_INVALID_PARAMETER</code>,
* and <code>ERROR_UNAUTHORIZED</code>.
*
* @param device Locator of the <code>org.ocap.storage.StorageProxy</code>
* the storage volume will be created on.
* @param name Name of the new storage volume.
* @param access Access permissions for the new volume.
* @param handler Action response will be notified to this handler.
*
* @return Action request for app query and control of a pending
* transaction.
*
* @throws SecurityException if the application does not have
* NetworkPermission("volumemanagement") permission in its
* permission request file, or is not doubly signed by the
* MSO or Host device manufacturer.
* @throws IllegalArgumentException if the device locator or
* volume name are not valid.
*/
public ActionRequest allocateLogicalVolume(
Locator device,
String name,
ExtendedFileAccessPermissions access,
ActionHandler handler)
throws SecurityException;
/**
* Deletes a volume on a remote device.
* Possible action event types that can be generated by this method
* include; <code>ActionEvent.COMPLETED</code>,
* <code>ActionEvent.ERROR_TIMED_OUT</code>,
* <code>ActionEvent.ERROR_INVALID_PARAMETER</code>,
* and <code>ERROR_UNAUTHORIZED</code>.
*
* @param volume Locator of the
* <code>org.ocap.storage.LogicalVolumeStorage</code> to be deleted.
* @param handler Action response will be notified to this handler.
*
* @throws SecurityException if the application does not have
* HnPermission("volumemanagement") permission in its permission
* request file, or if the application does not have
* ExtendedFileAccessPermission for writing to the volume.
* @throws IllegalArgumentException if the volume locator is not valid.
*/
public ActionRequest deleteLogicalVolume(Locator volume,
ActionHandler handler)
throws SecurityException;
}
/*
* Copyright Matsushita Electric Industrial Co., Ltd.2004
* All Rights Reserved
*/
package org.ocap.hn;
/**
* Device
*
* @author Luyang Li (lly@research.panasonic.com)
* @version 1.0
*
*/
/**
* This interface represents an HN device that supports homenetwork HNModules.
* A HN Device may support one or more HNModule(s). A device can use this interface
* to announce its connected/disconnected state. Applications can retrieve capabilities
* , properties and list of supported HNModules from this device. An application may also
* enable/disable security connection with a device.
*/
public interface Device {
public final static String SECURITY_SUPPORT = "SecuritySupport";
public final static String CONTENT_LIST = "ContentList";
public final static String CONTENT_MANAGER = "ContentManager";
public final static String CONTENT_RENDERER = "ContentRenderer";
/**
* Returns capabilities of device in <code>Enumeration</code>, for example,
* security support, content listing, content management, etc.
* @return capabilities of the device in <code>Enumeration</code>
*/
public java.util.Enumeration getCapabilities();
/**
* Returns the name of the device
* @return name of the device
*/
public String getName();
/**
* Returns property of the device specified by a key. For example,
* "location", "manufacturer", "version", "model number", etc.
* @param key
* key of the property
* @return property value specified by the key
*/
public String getProperty(String key);
/**
* Returns all property keys for the device
* @return property keys for this service
*/
public java.util.Enumeration getKeys();
/**
* Returns OcapLocator for this device
* @return OcapLocator for this device
*/
public org.ocap.net.OcapLocator getLocator();
/**
* Returns the list of HNModules supported by this device
* @return HNModuleList supported by this device
*/
public HNList getHNModuleList();
/**
* Returns the HNModule by name
* @param name
* name of the HNModule
* @return HNModule by name, if the device does not support that HNModule,
* null is returned.
*/
public HNModule getHNModule(String name);
/**
* Returns the sub-device list of this device
* @return sub-device list of this device
*/
public HNList getSubDevices();
/**
* Returns the type of the device, for example, MediaRenderer, MediaServer, etc.
* @return type of the device
*/
public int getType();
/**
* Returns the secure-connecton state between device and this application
* @return state of the secure-connection between device and this application
*/
public boolean getEnableSecurity();
/**
* An application can use this method to enable/disable security for its HN actions.
* When an application enables security with a remote device, only the actions taken
* by that application are affected.
* Implementation should keep track of caller application information and apply
* same security rule to that application later on.
* @param securityOn
* true to turn on security; false to turn off security.
* @return state of the secure-connection
* @exception SecurityException
* if application does not have permission to enable/disable security,
* a SecurityException is thrown.
* @exception UnsupportedOperationException
* if device does not support secure connection, an
* UnsupportedOperationException is thrown.
*/
public boolean setEnableSecurity(boolean securityOn) throws SecurityException
, UnsupportedOperationException;
}
\ No newline at end of file
/**
* Java Stubs Generated by Doc2Java (c) Immo Benjes, IfN, TU Braunschweig
* Doc2Java is a tool which generates Java stubs out of Javadoc HTML pages (Version 1.2 only)
*/
package org.ocap.hn;
/**
*
* This class represents an event generated in response to an action.
* HNActionEvent instances can only be created by the implementation.
* Renamed to HNActionEvent as there is already an ActionEvent in java.awt.event
*
*
* @see Serialized Form
* @author Patrick Ladd, Vidiom
* @author Dr. Immo Benjes <immo.benjes@philips.com>, Philips Digital Systems Labs, Redhill, UK
*/
public class HNActionEvent extends java.util.EventObject
{
/**
* Error code returned when the operation timed out.
* <it>From Pat's ContentManagementModule proposal</it>
*/
public static final int ERROR_TIMED_OUT = 4;
/**
* Error code returned when an action was created with invalid parameters.
* <it>From Pat's ContentManagementModule proposal</it>
*/
public static final int ERROR_INVALID_PARAMETER = 5;
/**
* Error code returned when the requested action couldn't be executed because of missing permissions.
* <it>From Pat's ContentManagementModule proposal</it>
*/
public static final int ERROR_UNAUTHORIZED = 6;
/**
* Action status for a completed action
* @see #getActionStatus()
*/
public static final int ACTION_COMPLETED = 0;
/**
* <code>ACTION_CANCELED</code> is returned by {@link #getActionStatus()}
* when the action has been canceled.
* @see #getActionStatus()
*/
public static final int ACTION_CANCELED = 1;
/**
* <code>ACTION_FAILED</code> is returned by {@link #getActionStatus()}
* when the action has failed.
* @see #getActionStatus()
*/
public static final int ACTION_FAILED = 2;
/**
* <code>ACTION_NEEDS_MORE_TIME</code> is returned by {@link #getActionStatus()}
* when the action needs more time to complete. This event should be send after <i>tbd</i>
* seconds to indicate that the action is still executed but might need more time. It is up to the application to cancel
* the action or wait.
* @see #getActionStatus()
*/
public static final int ACTION_NEEDS_MORE_TIME = 3;
/**
* Two argument constructor.
* @param source - Action that instigated the response.response - An object representing the response to the action and which is specific to the action.
* @throw java.lang.SecurityException - if an application attempts to call this constructor.
*
*/
protected HNActionEvent(java.lang.Object source, HNActionRequest request,java.lang.Object response)
{
super(source);
}
/**
* Returns the response of the Action. Object is dependent on the Action.
* @return The response to an asynchronous action.
*/
public Object getResponse(){
return null;
}
/**
* Returns the ActionRequest which identifies the action instance
* @return the ActionRequest
*/
public HNActionRequest getActionRequest(){
return null;
}
/**
* Returns the state of the requested action
* @see #ACTION_CANCELED
* @see #ACTION_COMPLETED
* @see #ACTION_FAILED
* @see #ACTION_NEEDS_MORE_TIME
* @return
*/
public int getActionStatus(){
return 0;
}
}
/**
* Java Stubs Generated by Doc2Java (c) Immo Benjes, IfN, TU Braunschweig
* Doc2Java is a tool which generates Java stubs out of Javadoc HTML pages (Version 1.2 only)
*/
package org.ocap.hn;
/**
*
* This interface represents a handler passed to the
* HnModule.execute method.
* @author Patrick Ladd, Vidiom
*
*/
public interface HNActionHandler
{
/**
* Notifies the application of an action event. This method is called
* by the implementation when a response to an action or a failure for
* the action is detected.
*/
public void notify(HNActionEvent event);
}