ConnectorPermission (Java Card API, Connected Edition)
Date: 2009-12-11

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javacardx.io
Class ConnectorPermission

    java.lang.Object
      java.security.Permission
          javacardx.security.URIPermission
              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:

- if the URL includes a server-based authority component, the server-based authority may be a server-based authority pattern whose DNS hostname - if one specified - starts with "*." or equals "*" or whose port number - if one specified - equals "*". The host specification may include a wildcard "*" once in the DNS name host specification. If included, it must be in the leftmost position, as in "*.sun.com" or "*". The port specification may be "*", in which case it designates any port.
- if the URL includes a path component, the path may be an exact path pattern or a path-prefix pattern ending with a "/*"
- URL patterns that designate on-card resources such as files may include an application-generic-path pattern starting with "/~" , or a registry-based authority pattern whose registry name equals "*".

See `URIPermission` for a detailed list of supported URL patterns.

Examples of valid URL patterns are:

- `file:///transit/pos/logs/transaction.txt`
- `file:///transit/pos/logs/*`
- `http://java.sun.com/index.html`
- `http://*:*/*`
- `socket://*.sun.com:80`

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.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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