PackagePermission

Syntax

public final class PackagePermission extends java.security.BasicPermission

java.lang.Object
  |
  +--java.security.Permission
        |
        +--java.security.BasicPermission
              |
              +--org.osgi.framework.PackagePermission
					

All Implemented Interfaces: java.security.Guard, java.io.Serializable

Description

PackagePermission indicates a bundle's right to import or export a package. A package is a dot-separated string that defines a fully qualified Java package, e.g., org.osgi.service.http.

PackagePermission has two actions: “export” and “import.” The export action also implies the import action.

Member Summary
Fields
public static finalEXPORT
 The action string “export.”
public static finalIMPORT
 The action string “import.”
Constructors
publicPackagePermission(String, String)
 Define the permission to import and/or export a package.
Methods
public booleanequals(Object)
 Checks two PackagePermission for equality.
public StringgetActions()
 Return the canonical string representation of the actions.
public inthashCode()
 Returns the hash code value for this object.
public booleanimplies(Permission)
 Checks if the specified permission is “implied” by this object.

Fields

EXPORT
public static final java.lang.String EXPORT
						

The action string “export.”

IMPORT
public static final java.lang.String IMPORT
						

The action string “import.”

Constructors

PackagePermission(String, String)
public PackagePermission(java.lang.String name,
            java.lang.String actions)

Define the permission to import and/or export a package. The name is specified as a normal Java package name, with dots separating the parts. Wildcards may be used. For example,

org.osgi.service.http
javax.servlet.*
*

Package Permissions are granted over all possible versions of a package. A bundle that wants to export a package must have the PackagePermission for “export” on that package. Similarly, a bundle that wants to import a package must have the PackagePermission for “import” on that package.

Access permission is granted for both classes and resources.

Parameters:

name— Package name.

actions— “export,” “import” (canonical order)

Methods

equals(Object)
public boolean equals(java.lang.Object obj)

Checks two PackagePermission for equality. Checks that obj has the same package name and actions as this PackagePermission.

Overrides: java.security.BasicPermission.equals(java.lang.Object) in class java.security.BasicPermission

Parameters:

obj— the object to test for equality.

Returns: true if obj is a PackagePermission, and has the same package name and actions as this PackagePermission object. Otherwise, return false.

getActions()
public java.lang.String getActions()

Return the canonical string representation of the actions. Always returns present actions in the following order: export, import.

Overrides: java.security.BasicPermission.getActions() in class java.security.BasicPermission

Returns: The canonical string representation of the actions

hashCode()
public int hashCode()

Returns the hash code value for this object.

Overrides: java.security.BasicPermission.hashCode() in class java.security.BasicPermission

Returns: a hash code value for this object.

implies(Permission)
public boolean implies(java.security.Permission p)

Checks if the specified permission is “implied” by this object. This method checks that the package name of the target is implied by the package name of this object. The list of actions must either match or allow for the list for the target object to imply the target permission. The permission to export a package implies the permission to import the named package.

 x.y.*,"export" -> x.y.z,"export" is true
 *,"import" -> x.y, "import"      is true
 *,"export" -> x.y, "import"      is true
 x.y,"export" -> x.y.z, "export"  is false

Overrides: java.security.BasicPermission.implies(java.security.Permission) in class java.security.BasicPermission

Parameters:

p— the target permission to check.

Returns: true if the specified permission is implied by this object, false if not.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.173.238