All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ocap.application.OcapIxcPermission Maven / Gradle / Ivy

There is a newer version: 1.3.1
Show newest version
package org.ocap.application;

import java.security.BasicPermission;
import java.security.Permission;
import java.security.PermissionCollection;

import javax.microedition.xlet.ixc.IxcPermission;

import org.dvb.application.AppID;
import org.dvb.io.ixc.IxcRegistry;

/**
 * This class represents access to the inter-xlet communication registry. 
 * An OcapIxcPermission consists of a name specification and a action specifying 
 * what can be done with those names.
 * 

* The name specification is a superset of the name passed into the {@link IxcRegistry} * methods such as {@link IxcRegistry#bind} and {@link IxcRegistry#lookup}. * Valid names are composed of fields delimited by "/" characters, with each field * specifying a particular value (e.g., OID). The following grammar defines the name * format: *

 * NAME      = "*" | "/" SCOPE "/" SIGNED "/" OID "/" AID "/" BINDNAME
 * SCOPE     = "*" | "global" | "ixc" | "service-" CONTEXT
 * CONTEXT   = "*" | context-id
 * SIGNED    = "*" | "signed" | "unsigned"
 * OID       = "*" | oid
 * AID       = "*" | aid
 * BINDNAME  = "*" | bindname | bindname "*"
 * 
* Where "*" specifies a wildcard character. * Where context-id is a platform-specific unique identifier for a service * context; * oid and aid are the {@link AppID#getOID() organization} and * {@link AppID#getAID() application} identifiers of the binding application as * converted by {@link Integer#toHexString}; * and bindname is the application-defined name given at bind-time. *

*

    *
  • "*" as the entire name string will match any other name *
  • "/*/*/*/*/* is equivalent to "*" *
  • "/*/*/1a/4abc/*" will match names in any scope, * published by an application with an OID of 1a and AID of 4abc. *
  • "/*/signed/*/VODApi" will match any object bound by a signed application * with an ixcname of "VODApi". *
* * The actions specification is comprised of a single action specified by one of two * keywords: "bind" or "lookup". These correspond to the bind and * lookup methods of IxcRegistry. * The actions string is converted to lowercase before processing. *

* * @author Aaron Kamienski */ public final class OcapIxcPermission extends BasicPermission { /** * Creates a new OcapIxcPermission object with the specified name and actions. * The name specification is a superset of the name passed into the {@link IxcRegistry} * methods such as {@link IxcRegistry#bind} and {@link IxcRegistry#lookup}. * See the {@link OcapIxcPermission class description} for the specification of the name string. *

* The actions specification is comprised of a single action specified by one of two * keywords: "bind" or "lookup". These correspond to the bind and * lookup methods of IxcRegistry. * The actions string is converted to lowercase before processing. * * @param name The name specification for exported/imported objects * @param actions The action string */ public OcapIxcPermission(String name, String actions) { super(name, actions); } /** * Checks two OcapIxcPermission objects for equality. * Check that other is an OcapIxcPermission, and has the same name and actions as this object. * * @param obj the object we are testing for equality with this object * @return true if obj is an OcapIxcPermission, and has the same name and actions as this OcapIxcPermission object. */ public boolean equals(Object obj) { return false; } /** * Returns the "canonical string representation" of the actions. * That is, this method always returns present actions in the following order: bind, lookup. * For example, if this OcapIxcPermission object allows both bind and lookup actions, a call * to getActions will return the string "bind,lookup". * * @return the canonical string representation of the actions */ public String getActions() { return null; } /** * Returns the hash code value for this object. * * @return a hash code value for this object. */ public int hashCode() { return 0; } /** * Checks if this OcapIxcPermission "implies" the specified permission. *

* More specifically, this method returns true if: *

    *
  • p is an instanceof OcapIxcPermission *
  • p's actions are a proper subset of this object's actions, and *
  • p's name is implied by this object's name. *
*

* The rules for determining if this object's name implies p's name are * as follows: *

    *
  • Where p's name is exactly the same as this object's name, * then it is implied. *
  • The name "*" and "/*/*/*/*/*" both imply * all possible names. *
  • Where this object's name includes a wildcard for a field ("*"), * then all possible values for that field are implied. *
  • Where this object's name includes a field that ends in a wildcard (e.g., * service-*) then all possible values for that field * starting with the non-wildcard portion are implied. *
*

* For example, "/service-*/signed/abc/4001/*" implies * "/service-1234/signed/abc/4001/VODObject". * *

* An OcapIxcPermission may also imply an {@link IxcPermission}. * That is, this method will also return true if: *

    *
  • p is an instanceof IxcPermission *
  • p's actions are a proper subset of this object's actions, and *
  • p's name is implied by this object's name. *
*

* The rules for determining if this object's name implies an IxcPermission * name are the same as detailed above except that a translation of the IxcPermission * name to the OcapIxcPermission is applied first. The following table * shows how such a mapping SHALL be applied: *

*

* * * * * * * * * * * * * * * *
IxcPermission name OcapIxcPermission name
"*" "*"
"dvb:/*" "*"
"dvb:/signed/*" "/global/signed/*/*/*
"dvb:/service/id/signed/*" "/service-id/signed/*/*/*
"dvb:/ixc/*" "/ixc/*/*/*/*
"dvb:/signed/OID/*" "/global/signed/OID/*/*
"dvb:/service/id/signed/OID/*" "/service-id/signed/OID/*/*
"dvb:/ixc/OID/*" "/ixc/*/OID/*/*
"dvb:/signed/OID/AID/*" "/global/signed/OID/AID/*
"dvb:/service/id/signed/OID/AID/*" "/service-id/signed/OID/AID/*
"dvb:/ixc/OID/AID/*" "/ixc/*/OID/AID/*
"dvb:/signed/OID/AID/name*" "/global/signed/OID/AID/name*
"dvb:/service/id/signed/OID/AID/name*" "/service-id/signed/OID/AID/name*
"dvb:/ixc/OID/AID/name*" "/ixc/*/OID/AID/name*
*

* Any IxcPermission name that cannot be mapped cannot be implied. * * @param p the permission to check against * @return true if the specified permission is implied by this object, false if not. */ public boolean implies(Permission p) { return false; } /** * Returns a new PermissionCollection object for storing OcapIxcPermission objects. *

* OcapIxcPermission 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. * * @return a new PermissionCollection object suitable for storing OcapIxcPermissions. */ public PermissionCollection newPermissionCollection() { return null; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy