public final class SWMPermission
extends java.security.BasicPermission
SWMPermission
provides permission handling for SWM API
permissions. An SWMPermission
object contains a scope and actions.
The scope is the scope of the permission. Valid scopes are
"client"
stands for permission to perform the listed
actions only for applications assigned to the same Client.
"crossClient"
stands for permission to perform the
listed actions also for applications assigned to other Clients. Usually
this is a permission reserved for the
Root Client. Granting this permissions to other Clients should be
figured out well in order to avoid security breaches.
The actions to be granted are passed to the constructor in a non-empty string,
containing a list of comma-separated keywords. Trailing and leading white
spaces as well as those between the keywords and commas in the list are not
allowed and lead to an IllegalArgumentException
. The possible
values can be seen in this
table in the Security Policy Provider chapter of the spec.
The actions string is converted to lowercase before processing.
Constructor and Description |
---|
SWMPermission(java.lang.String scope,
java.lang.String actions)
Creates a new
SWMPermission object with the specified
name and actions. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object object)
Checks if another object is "equal" to this one.
|
java.lang.String |
getActions()
Returns the permitted actions of this Permission as a comma separated
list in alphabetical order.
|
int |
hashCode()
Gets the hash code value for this object.
|
boolean |
implies(java.security.Permission p)
Checks if the specified permission is "implied" by this object.
|
java.security.PermissionCollection |
newPermissionCollection()
Creates a new
SWMPermissionCollection . |
public SWMPermission(java.lang.String scope, java.lang.String actions)
SWMPermission
object with the specified
name and actions. If an action is listed multiple times, the second and
following occurences are ignored, means
"installation,installation"
has the same effect as "installation"
.scope
- The scope of the permission (see class description for details).actions
- a comma seperated list of the permitted actions. For
possible values see this
table in the Security Policy Provider chapter of the spec.java.lang.NullPointerException
- if scope
or actions
is
null
.java.lang.IllegalArgumentException
- if actions
include any string other than those allowed, or if scope
argument is an empty string, or a string that consists of white
space(s) only.public boolean implies(java.security.Permission p)
true
if:
implies
in class java.security.BasicPermission
p
- the permission to check against.true
if the passed permission is equal to or
implied by this permission, false
otherwise.public java.security.PermissionCollection newPermissionCollection()
SWMPermissionCollection
.newPermissionCollection
in class java.security.BasicPermission
SWMPermissionCollection
instancepublic java.lang.String getActions()
getActions
in class java.security.BasicPermission
public boolean equals(java.lang.Object object)
equals
in class java.security.BasicPermission
object
- an object to comparetrue
if the objects are of the same type
and the event and action are equal.public int hashCode()
hashCode
in class java.security.BasicPermission
Copyright (c) 2014, Oracle and/or its affiliates. All Rights Reserved. Use of this specification is subject to license terms.