CLDC 1.1.1

javax.microedition.io
Class CommProtocolPermission

java.lang.Object
  extended byjava.security.Permission
      extended byjavax.microedition.io.GCFPermission
          extended byjavax.microedition.io.CommProtocolPermission

public final class CommProtocolPermission
extends GCFPermission

This class represents access rights to connections via the "comm" protocol. A CommProtocolPermission consists of a URI string but no actions list.

The URI string specifies a logical serial port connection and optional parameters. It takes the following general form:

 comm:{port identifier}[{optional parameters}]
 
The detailed syntax for the CommProtocolPermission URI is provided by this BNF. In addition, an asterisk may terminate the URI string within the {port identifier} field to indicate a wildcard match of 0 or more characters. Valid examples include "comm:*" and "comm:port*".

See Also:
Connector.open(java.lang.String), "javax.microedition.io.CommConnection" in MIDP 3.0 Specification

Constructor Summary
CommProtocolPermission(String uri)
          Creates a new CommProtocolPermission with the specified URI as its name.
 
Method Summary
 boolean equals(Object obj)
          Checks two CommProtocolPermission objects for equality.
 String getActions()
          Returns the canonical string representation of the actions, which currently is the empty string "", since there are no actions defined for CommProtocolPermission.
 int hashCode()
          Returns the hash code value for this object.
 boolean implies(Permission p)
          Checks if this CommProtocolPermission object "implies" the specified permission.
 PermissionCollection newPermissionCollection()
          Returns a new PermissionCollection for storing CommProtocolPermission objects.
 
Methods inherited from class javax.microedition.io.GCFPermission
getProtocol, getURI
 
Methods inherited from class java.security.Permission
getName, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CommProtocolPermission

public CommProtocolPermission(String uri)
Creates a new CommProtocolPermission with the specified URI as its name. The URI string must conform to the specification given above, and is normalized to facilitate subsequent comparisons.

Parameters:
uri - the URI string.
Throws:
IllegalArgumentException - if uri is malformed.
NullPointerException - if uri is null.
See Also:
Permission.getName()
Method Detail

implies

public boolean implies(Permission p)
Checks if this CommProtocolPermission object "implies" the specified permission.

More specifically, this method returns true if all of the following are true:


equals

public boolean equals(Object obj)
Checks two CommProtocolPermission objects for equality.

Specified by:
equals in class Permission
Parameters:
obj - the object we are testing for equality with this object.
Returns:
true if obj is a CommProtocolPermission and has the same URI string as this CommProtocolPermission object.

hashCode

public int hashCode()
Returns the hash code value for this object.

Specified by:
hashCode in class Permission
Returns:
a hash code value for this object.

getActions

public String getActions()
Returns the canonical string representation of the actions, which currently is the empty string "", since there are no actions defined for CommProtocolPermission.

Specified by:
getActions in class Permission
Returns:
the empty string "".

newPermissionCollection

public PermissionCollection newPermissionCollection()
Returns a new PermissionCollection for storing CommProtocolPermission objects.

CommProtocolPermission objects must be stored in a manner that allows them to be inserted into the collection in any order, but that also enables the PermissionCollection implies method to be implemented in an efficient (and consistent) manner.

Overrides:
newPermissionCollection in class Permission
Returns:
a new PermissionCollection suitable for storing CommProtocolPermission objects.

CLDC 1.1.1

Copyright 2000-2007 Sun Microsystems, Inc. All Rights Reserved. Use of this specification is subject to license terms.