javacardx.io
Class ConnectorPermission

java.lang.Object
  extended by java.security.Permission
      extended by javacardx.security.URIPermission
          extended by javacardx.io.ConnectorPermission

@TransactionType(value=NOT_SUPPORTED)
public final class ConnectorPermission
extends URIPermission

This class is for connector permissions. The ConnectorPermission extends the URIPermission and defines specific actions. A ConnectorPermission consists of a URL and a set of actions valid for that URL.

The URL may be of any of the protocols supported by the javax.microedition.io.Connector class from the Generic Connection Framework.

URLs must be absolute - that is they must include the protocol (URL scheme). URL are normalized before interpretation.

The special URL target name consisting of a single "*" matches any connection URL (over whatever protocol).

A URL may be either an exact URL pattern which designates exactly one resource or a pattern which may designate a collection of resources:

See URIPermission for a detailed list of supported URL patterns.

Examples of valid URL patterns are:

The actions to be granted are passed to the constructor in a string containing a list of one or more comma-separated keywords. The possible keywords are "connect", "listen", "accept", "read", and "write". Their meaning is defined as follows:

connect
client connection open permission. Allows an application to open a network connection to a server.
listen
server connection listen permission. Allows an application to open a server connection endpoint and listen for client connections.
accept
server connection accept permission. Allows an application accept client connections on a server connection endpoint.
read
connection stream read permission. Allows an application to read from a connection input stream.
write
connection stream write permission. Allows an application to write to a connection output stream.

The actions string is converted to lowercase before processing.

Since:
Java Card 3.0
See Also:
URIPermission, Permission, AccessController, AccessControlException

Field Summary
static String ACTION_ACCEPT
          The "accept" action.
static String ACTION_CONNECT
          The "connect" action.
static String ACTION_LISTEN
          The "listen" action.
static String ACTION_READ
          The "read" action.
static String ACTION_WRITE
          The "write" action.
 
Constructor Summary
ConnectorPermission(String url, String actions)
          Creates a new ConnectorPermission object with the specified actions.
 
Method Summary
protected  String[] getPossibleActions()
          Returns the possible actions in the following order: "accept", "connect", "listen", "read", and "write".
 
Methods inherited from class javacardx.security.URIPermission
equals, getActions, hashCode, implies
 
Methods inherited from class java.security.Permission
getName, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ACTION_CONNECT

public static final String ACTION_CONNECT
The "connect" action.

See Also:
Constant Field Values

ACTION_LISTEN

public static final String ACTION_LISTEN
The "listen" action.

See Also:
Constant Field Values

ACTION_ACCEPT

public static final String ACTION_ACCEPT
The "accept" action.

See Also:
Constant Field Values

ACTION_READ

public static final String ACTION_READ
The "read" action.

See Also:
Constant Field Values

ACTION_WRITE

public static final String ACTION_WRITE
The "write" action.

See Also:
Constant Field Values
Constructor Detail

ConnectorPermission

public ConnectorPermission(String url,
                           String actions)
Creates a new ConnectorPermission object with the specified actions. url is the connection URL, and actions contains a comma-separated list of the desired actions granted on the designated connection. Possible actions are "connect", "listen", "accept", "read", and "write".

Parameters:
url - a URL pattern.
actions - the action string.
Throws:
NullPointerException - if url or actions is null.
IllegalArgumentException -
  • if url is not the special URL target name "*" or a well-formed absolute URL
  • or, if actions is empty or contains an action other than the specified possible actions.
SecurityException - if url or actions is not accessible in the caller's context.
Method Detail

getPossibleActions

protected String[] getPossibleActions()
Returns the possible actions in the following order: "accept", "connect", "listen", "read", and "write".

Note: this method returns a different array (a defensive copy) upon each call in order to guarantee the immutability of this permission object.

Overrides:
getPossibleActions in class URIPermission
Returns:
an array with all possible actions.


Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.