org.ocap.service.ServiceTypePermission Maven / Gradle / Ivy
/*
* ServiceTypePermission.java
*
*
*/
package org.ocap.service;
import java.security.BasicPermission;
import java.security.Permission;
// Imports for javadoc.
import javax.tv.service.selection.ServiceContext;
import javax.tv.service.selection.SelectPermission;
/**
* ServiceTypePermission
represents application permission to
* select a specific service type using a {@link ServiceContext} accessible by the
* application.
*
* When this permission is evaluated, the SecurityManager.checkPermission
* method must not fail when checking for
* {@link javax.tv.service.selection.SelectPermission} on the accessed
* ServiceContext
. Otherwise, the security manager check for this permission
* will also fail.
*
* Note that undefined service type strings may be provided to the constructor
* of this class, but subsequent calls to SecurityManager.checkPermission()
* with the resulting ServiceTypePermission
object will fail.
*
*/
public final class ServiceTypePermission extends BasicPermission
{
/**
* Indicates an abstract service provided by the Host device manufacturer.
*/
public static final String MFR = "abstract.manufacturer";
/**
* Indicates an abstract service provided by the HFC network provider (i.e., MSO).
*/
public static final String MSO = "abstract.mso";
/**
* Indicates an inband broadcast service provided by a content provider.
*/
public static final String BROADCAST = "broadcast";
/**
* Creates a new ServiceTypePermission object with the specified
* service type name.
*
* @param type The name of the service type that can be selected. Supported service
* types include "abstract.manufacturer", "abstract.mso", and "broadcast". An
* asterisk may be used to signify a wildcard match.
* @param actions The actions String is either "own" or "*". The string "own" means
* the permission applies to your own service context, acquired via the
* ServiceContextFactory.createServiceContext
or
* ServiceContextFactory.getServiceContext
methods. The string "*"
* implies permission to these, plus permission for service contexts obtained from
* all other sources.
*/
public ServiceTypePermission(String type, String actions)
{
super(type, actions);
}
/**
* Checks if the specified permission is "implied" by this object.
*
* Specifically, implies(Permission p) returns true if:
*
p is an instance of ServiceTypePermission and
* p's action string matches this object's, or this object or p
* has "*" as an action string, and p's type string matches this
* object's, or this object has "*" as a type string.
* In addition, implies(Permission p) returns true if:
*
p is an instance of SelectPermission and,
* p's locator contains an actual or implied source_id value which
* corresponds to the type string in this object where [26] ISO/IEC 13818-1 defines
* broadcast source_id values that correspond to a broadcast type string and table 11-4
* defines abstract service values that correspond to abstract MSO and abstract manufacturer
* type strings.
* p?s action string matches this object?s, or this object has "*" as an action string.
*
* @param p The permission against which to test.
*
* @return true
if the specified permission is equal
* to or implied by this permission; false
otherwise.
*
*/
public boolean implies(Permission p)
{
return false;
}
/**
* Tests two ServiceTypePermission
objects for equality.
* Returns true
if and only if obj
's class is the
* same as the class of this object, and obj
has the same name
* and actions string as this object.
*
* @param obj The object to test for equality.
*
* @return true
if the two permissions are equal;
* false
otherwise.
*/
public boolean equals(Object obj)
{
return false;
}
/**
* Provides the hash code value of this object. Two
* ServiceTypePermission
objects that are equal will
* return the same hash code.
*
* @return The hash code value of this object.
*/
public int hashCode()
{
return 0;
}
/**
* Returns the canonical representation of the actions string.
*
* @return The actions string of this permission.
*/
public String getActions()
{
return null;
}
}