Java 2 Platform, Micro Edition Content Handler API v1.0.1

javax.microedition.content
Class ContentHandlerPermission

java.lang.Object
  extended byjava.security.Permission
      extended byjavax.microedition.content.ContentHandlerPermission

public class ContentHandlerPermission
extends java.security.Permission

This class is for Content Handler permissions. The ContentHandlerPermission class must be present if the class java.security.Permission class is present. A ContentHandlerPermission uses only actions. The resource name is unused, the getName returns null.

The permissible actions, description and risks are listed in the table below:

Action Description Risks
register_static Allows registration of a content handler in the packaging of the application. The application may be called to handle content. There is a risk of confusion or ambiguity in the selection of the application to handle content of a particular type, suffix, or ID.
register_dynamic Allows registration of a content handler using Registry.register. The application may be called to handle content. There is a risk of confusion or ambiguity in the selection of the application to handle content of a particular type, suffix, or ID.

Since:
CHAPI 1.0.1
See Also:
Registry.register, Permission

Constructor Summary
ContentHandlerPermission(java.lang.String actions)
          Creates a new instance of ContentHandlerPermission.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Checks two ContentHandlerPermission objects for equality.
 java.lang.String getActions()
          Returns the canonical string representation of the actions.
 int hashCode()
          Returns the hash code value for this object.
 boolean implies(java.security.Permission p)
          Checks if the specified permission is "implied" by this object.
 
Methods inherited from class java.security.Permission
getName, newPermissionCollection, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ContentHandlerPermission

public ContentHandlerPermission(java.lang.String actions)
Creates a new instance of ContentHandlerPermission.

Parameters:
actions - one or more actions separated by comma (","). Valid actions are listed in the Actions Table. Duplicate actions are ignored.
Throws:
java.lang.IllegalArgumentException - if actions is empty or contains actions that are not listed in the Actions Table.
java.lang.NullPointerException - if actions is null.
Method Detail

getActions

public java.lang.String getActions()
Returns the canonical string representation of the actions. This method always returns actions in the following order: register_static, register_dynamic. For example, if this permission object allows both register_static and register_dynamic actions, a call to getActions returns the string "register_static,register_dynamic".

Returns:
the canonical form of the actions.

hashCode

public int hashCode()
Returns the hash code value for this object. The hash code used is the hash code of the actions, that is, getActions().hashCode().

Returns:
a hash code value for this object.

equals

public boolean equals(java.lang.Object obj)
Checks two ContentHandlerPermission objects for equality. Checks that obj's class is the same as this object's class and obj.getActions() is equal to this.getActions() and obj.getName() is equal to this.getName().

Parameters:
obj - the object we are testing for equality with this object.
Returns:
true if obj is a ContentHandlerPermission, and has the same actions and name as this ContentHandlerPermission object, false otherwise.

implies

public boolean implies(java.security.Permission p)
Checks if the specified permission is "implied" by this object.

More specifically, this method returns true if:

Parameters:
p - the object to check against.
Returns:
true if the passed permission is implied by this permission, false otherwise.

Maintenance Release
September 17, 2009

Submit a comment or suggestion on this specification. This specification is protected under the JSPA version 2.6.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries. Copyright © 2006-2009 Sun Microsystems, Inc. 4150 Network Circle, California, 95054, U.S.A.
All Rights Reserved. Use is subject to license terms.