Java DTV API 1.3
18-Nov-2009

com.sun.dtv.net
Class NetworkDevicePermission

java.lang.Object
  extended by java.security.Permission
      extended by java.security.BasicPermission
          extended by com.sun.dtv.net.NetworkDevicePermission
All Implemented Interfaces:
Serializable, Guard

public final class NetworkDevicePermission
extends BasicPermission

This class is used for various permissions related to the network device scarce resources. A NetworkDevicePermission contains a name (also referred to as a "target name") and a list of actions.

Name

Supported target name by this specification is "networkdevice.any" and allows to define actions on all types of network devices. The target names defined here are in line with those used for ScarceResourcePermission to define actions on network devices represented by NetworkDevice. Consequently, the NetworkDevicePermission target name domain starting with "networkdevice." is reserved by this specification for future purposes.

The naming rules also follow those defined in BasicPermission from which this class inherits, in particular the rules concerning the "*" wildcard.

Actions

The actions to be granted are passed to the constructor in a string containing a list of zero or more comma-separated keywords or filters (i.e. field and value pairs). The possible filter is "dial" and has the following format and meaning:

dial=numberFilter
May be used multiple times in the action string.
Defines a filter of permissible numbers that are allowed to be dialed by NetworkDevice.connect(). This action and filter value only makes sense for network devices that uses dial ups.

The actions string is converted to lowercase before processing. Canonical representation of the list of granted actions is defined to be the list of present actions in the alphabetic order.

numberFilter is defined to be a string representing a full or partial phone number that may include any characters. In addition, an asterisk may appear by itself, or at the end of a number, to signify a wildcard match. Please note that although DTMF-* is a valid digit for a dial up number, it cannot be used within this filter mechanism.

During the matching process between numberFilter and the number requested to be dialed at connection time, the implementation must ignore any non-digit characters possibly after having replaced the international access code "+" with the corresponding digits and compare the two resulting string values. Numbers do match and the dial up is granted if the string values matches.

Examples

dial=*
Matching: *
Valid; Permits any numbers to be dialed.
dial=0123*
Matching: 0123*
Valid; Permits any numbers starting with "0123" to be dialed.
dial=+1-234-*
Matching: +1234*
Valid; Permits any numbers prefixed with either "+" or the equivalent digits (for example "00") followed by "1234" to be dialed. Note the prefix for international country code as well as the - visual separation character.
dial=001234567890
Matching: 001234567890*
Valid; Permits only the above number to be dialed as well as "+1234567890" in countries where "+" is equivalent to "00".
dial=+1-234-567-890p12*
Matching: +123456789012*
Valid; Permits only the above full number to be dialed (as well as the variant with the international dialing prefix variant as previously) followed by a pause followed by DTMF-1 and DTMF-2, then any other digit. This allows accessing specific services that are behind AVR and are DTMF menu driven.
dial=123*,dial=456*
Matching: 123* and 456*
Valid; Permits dialing of any numbers starting with either "123" or "456".
dial=123*4
Invalid; Asterisk are only allowed at the end of given number.
dial=12+34
Invalid; The "+" is only allowed as a first character of a phone number.

Canonical Representation

The canonical representation of dial permission is defined to be the minimal string representation:

  1. for that permission that follow the format description above,
  2. which is fully consistent with the intent,

The following table lists different examples and their standardized canonical representation:

Permission Canonical Description
"dial=123*" "dial=123*" Is already minimal.
"dial=123*,dial=456*" "dial=123*,dial=456*" Is already minimal.
"dial=12345*,dial=123*" "dial=123*" Numbers that comply to the first filter also pass the second filter therefore the canonical representation is actually the second filter.

Imply Rules

The same rule as previously applies also to the imply rule. That is, given two numberFilters, if one is naturally included in the second, then the second implies the one. For example, "123*" implies "123456789".

Code Sample

 NetworkDevicePermission("networkdevice.any", "dial=+1234*");
 

See Also:
Serialized Form

Constructor Summary
NetworkDevicePermission(String name, String actions)
          Creates a new NetworkDevicePermission object with the specified name and actions.
 
Method Summary
 String getActions()
          Returns the "Canonical string representation" of the actions.
 boolean implies(Permission p)
          Checks if the NetworkDevicePermission object "implies" the specified permission.
 
Methods inherited from class java.security.BasicPermission
equals, hashCode, newPermissionCollection
 
Methods inherited from class java.security.Permission
checkGuard, getName, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NetworkDevicePermission

public NetworkDevicePermission(String name,
                               String actions)
Creates a new NetworkDevicePermission object with the specified name and actions. A NetworkDevicePermission contains a name (also referred to as a "target name") and may require an action list depending on the target name.

Parameters:
name - The name of the ScarceResourcePermission.
actions - The actions string.
Method Detail

getActions

public String getActions()
Returns the "Canonical string representation" of the actions. That is, this method always returns present actions in the alphabetic order: force, reserve. For example, if this ScarceResourcePermission object allows both reserve, force actions, a call to getActions will return the string "force,reserve".

Overrides:
getActions in class BasicPermission
Returns:
The canonical string representation of the actions.

implies

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

More specifically, this method returns true if:

  1. p is an instance of NetworkDevicePermission,
  2. p's actions are a proper subset of this object's actions (refer to the Imply Rules section), and
  3. p's name is implied by this object's name. For example, "network.*" implies "network.any".

Overrides:
implies in class BasicPermission
Parameters:
p - The permission to check against.
Returns:
true if the specified permission is implied by this object, false if not.

Java DTV API 1.3
18-Nov-2009

Copyright © 2008-2009 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A. All rights reserved.

U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements. Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.Products covered by and information contained in this service manual are controlled by U.S. Export Control laws and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited. Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.

DOCUMENTATION IS PROVIDED AS IS AND ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD TO BE LEGALLY INVALID.

Use of this document is subject to license terms.