Top Description Inners Fields Constructors Methods
org.apache.derby.shared.common.security

public final Class SystemPermission

extends BasicPermission
Class Inheritance
Imports
java.io.IOException, .ObjectInputStream, .ObjectOutputStream, java.security.BasicPermission, .Permission, .PermissionCollection, java.util.ArrayList, .Collections, .Enumeration, .HashMap, .HashSet, .List, .Locale, .Set, .StringTokenizer

This class represents access to system-wide Derby privileges.

Permission Description Risk
"jmx" "control" Controls the ability of JMX clients to control Derby and view security sensitive attributes through Derby's MBeans. JMX clients may be able to change the state of the running system
"jmx" "monitor" Controls the ability of JMX clients to monitor Derby through Derby's MBeans, such as viewing number of current connections and configuration settings. Note: security related settings require control action on jmx JMX clients can see information about a runing system including software versions.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
SystemPermission.SystemPermissionCollection

A collection of SystemPermission objects.

Field Summary

Modifier and TypeField and Description
private transient int
actionMask

Bit mask representing the actions.

private String
actions

Actions for this permission.

public static final String
CONTROL

Action ("control") to perform control actions through JMX on engine, server or jmx.

public static final String
ENGINE

Permission target name ("engine") for actions applicable to the core database engine.

public static final SystemPermission
ENGINE_MONITOR

Constant representing SystemPermission("engine, "monitor").

public static final String
JMX

Permission target name ("jmx") for actions applicable to management of Derby's JMX MBeans.

public static final String
MONITOR

Action ("monitor") to perform monitoring actions through JMX on engine and server.

private static final long
public static final String
SERVER

Permission target name ("server") for actions applicable to the network server.

public static final String
SHUTDOWN

The server and engine shutdown action ("shutdown").

public static final String
USE_DERBY_INTERNALS

Action ("useDerbyInternals") by the engine to lookup Derby contexts.

Constructor Summary

AccessConstructor and Description
public
SystemPermission(String
the name of the SystemPermission
name
,
String actions)

Creates a new SystemPermission with the specified name.

Method Summary

Modifier and TypeMethod and Description
public static String

Returns:

comma-separated string with the actions
buildActionsString
(Iterable<String>
the list of actions
actions
)

Build a comma-separated actions string suitable for returning from getActions().

private String
public boolean
equals(Object
the object we are testing for equality with this object.
other
)

Overrides java.security.BasicPermission.equals.

Does this permission equal another object.
private static int
getActionMask(String actions)

Get a mask of bits that represents the actions and can be used for the implies method.

public String
getActions()

Overrides java.security.BasicPermission.getActions.

Return the permission's actions in a canonical form.
private static String
getCanonicalForm(String actions)

Return a canonical form of the passed in actions.

public boolean
implies(Permission
the permission to check against.
permission
)

Overrides java.security.BasicPermission.implies.

Does this permission imply another.
public PermissionCollection
newPermissionCollection()

Overrides java.security.BasicPermission.newPermissionCollection.

Returns a new PermissionCollection object for storing BasicPermission objects.
public static Set<String>

Returns:

a set of all the specified actions
parseActions
(String
the specified actions string
actions
)

Get a set of all actions specified in a string.

private void
readObject(ObjectInputStream
the ObjectInputStream from which data is read
s
)

Hides java.security.BasicPermission.readObject.

Called upon deserialization for restoring the state of this SystemPermission from a stream.
public String
toString()

Overrides java.security.Permission.toString.

Returns a string describing this Permission.
private void
validateNameAndActions(String
the name of the permission
name
,
String
the actions of the permission
actions
)

Check if name and actions are valid, normalize the actions string, and calculate the actions mask.

Inherited from java.security.BasicPermission:
hashCode

Field Detail

actionMaskback to summary
private transient int actionMask

Bit mask representing the actions. It is not serialized, and has to be recalculated when the object is deserialized.

actionsback to summary
private String actions

Actions for this permission.

CONTROLback to summary
public static final String CONTROL

Action ("control") to perform control actions through JMX on engine, server or jmx.

For JMX control permission is required to get attributes that are deemed sensiive from a security aspect, such as the network server's port number, security mechanisms and any information about the file system.

ENGINEback to summary
public static final String ENGINE

Permission target name ("engine") for actions applicable to the core database engine.

ENGINE_MONITORback to summary
public static final SystemPermission ENGINE_MONITOR

Constant representing SystemPermission("engine, "monitor").

JMXback to summary
public static final String JMX

Permission target name ("jmx") for actions applicable to management of Derby's JMX MBeans.

MONITORback to summary
public static final String MONITOR

Action ("monitor") to perform monitoring actions through JMX on engine and server.

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.security.BasicPermission.serialVersionUID.

SERVERback to summary
public static final String SERVER

Permission target name ("server") for actions applicable to the network server.

SHUTDOWNback to summary
public static final String SHUTDOWN

The server and engine shutdown action ("shutdown").

USE_DERBY_INTERNALSback to summary
public static final String USE_DERBY_INTERNALS

Action ("useDerbyInternals") by the engine to lookup Derby contexts.

Constructor Detail

SystemPermissionback to summary
public SystemPermission(String name, String actions)

Creates a new SystemPermission with the specified name.

Parameters
name:String

the name of the SystemPermission

Exceptions
NullPointerException:
if name or actions is null
IllegalArgumentException:
if name is empty or not a legal SystemPermission
See Also
BasicPermission#BasicPermission(String)

Method Detail

buildActionsStringback to summary
public static String buildActionsString(Iterable<String> actions)

Build a comma-separated actions string suitable for returning from getActions().

Parameters
actions:Iterable<String>

the list of actions

Returns:String

comma-separated string with the actions

doubleQuoteback to summary
private String doubleQuote(String raw)
equalsback to summary
public boolean equals(Object other)

Overrides java.security.BasicPermission.equals.

Does this permission equal another object. True if its and identical class with same name and (canonical) actions.

Parameters
other:Object

Doc from java.security.BasicPermission.equals.

the object we are testing for equality with this object.

Returns:boolean

Doc from java.security.BasicPermission.equals.

true if obj's class is the same as this object's class and has the same name as this BasicPermission object, false otherwise.

getActionMaskback to summary
private static int getActionMask(String actions)

Get a mask of bits that represents the actions and can be used for the implies method.

getActionsback to summary
public String getActions()

Overrides java.security.BasicPermission.getActions.

Return the permission's actions in a canonical form.

Returns:String

Doc from java.security.BasicPermission.getActions.

the empty string "".

getCanonicalFormback to summary
private static String getCanonicalForm(String actions)

Return a canonical form of the passed in actions. Actions are lower-cased, in the order of LEGAL_ACTIONS and only appear once.

impliesback to summary
public boolean implies(Permission permission)

Overrides java.security.BasicPermission.implies.

Does this permission imply another. Only true if the other permission is a SystemPermission with the same name and all the actions of the permission are present in this. Note that none of the actions imply any other with this SystemPermission.

Parameters
permission:Permission

Doc from java.security.BasicPermission.implies.

the permission to check against.

Returns:boolean

Doc from java.security.BasicPermission.implies.

true if the passed permission is equal to or implied by this permission, false otherwise.

newPermissionCollectionback to summary
public PermissionCollection newPermissionCollection()

Overrides java.security.BasicPermission.newPermissionCollection.

Doc from java.security.BasicPermission.newPermissionCollection.

Returns a new PermissionCollection object for storing BasicPermission objects.

BasicPermission objects must be stored in a manner that allows them to be inserted in any order, but that also enables the PermissionCollection#implies method to be implemented in an efficient (and consistent) manner.

Returns:PermissionCollection

a new PermissionCollection object suitable for storing BasicPermission objects.

Annotations
@Override
parseActionsback to summary
public static Set<String> parseActions(String actions)

Get a set of all actions specified in a string. Actions are transformed to lower-case, and leading and trailing blanks are stripped off.

Parameters
actions:String

the specified actions string

Returns:Set<String>

a set of all the specified actions

readObjectback to summary
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException

Hides java.security.BasicPermission.readObject.

Called upon deserialization for restoring the state of this SystemPermission from a stream.

Parameters
s:ObjectInputStream

Doc from java.security.BasicPermission.readObject.

the ObjectInputStream from which data is read

Exceptions
IOException:

Doc from java.security.BasicPermission.readObject.

if an I/O error occurs

ClassNotFoundException:

Doc from java.security.BasicPermission.readObject.

if a serialized class cannot be loaded

toStringback to summary
public String toString()

Overrides java.security.Permission.toString.

Doc from java.security.Permission.toString.

Returns a string describing this Permission. The convention is to specify the class name, the permission name, and the actions in the following format: '("ClassName" "name" "actions")', or '("ClassName" "name")' if actions list is null or empty.

Returns:String

information about this Permission.

Annotations
@Override
validateNameAndActionsback to summary
private void validateNameAndActions(String name, String actions)

Check if name and actions are valid, normalize the actions string, and calculate the actions mask.

Parameters
name:String

the name of the permission

actions:String

the actions of the permission

Exceptions
NullPointerException:
if actions is null
IllegalArgumentException:
if name is not a legal SystemPermission
org.apache.derby.shared.common.security back to summary

private Class SystemPermission.SystemPermissionCollection

extends PermissionCollection
Class Inheritance

A collection of SystemPermission objects. Instances of this class must be thread-safe and serializable, per the specification of java.security.PermissionCollection.

Field Summary

Modifier and TypeField and Description
private HashMap<String, Permission>
private static final long

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
add(Permission
the Permission object to add.
permission
)

Implements abstract java.security.PermissionCollection.add.

Adds a permission object to the current collection of permission objects.
public synchronized Enumeration<Permission>
elements()

Implements abstract java.security.PermissionCollection.elements.

Returns an enumeration of all the Permission objects in the collection.
public boolean
implies(Permission
the Permission object to compare.
permission
)

Implements abstract java.security.PermissionCollection.implies.

Checks to see if the specified permission is implied by the collection of Permission objects held in this PermissionCollection.
private void
readObject(ObjectInputStream s)

Called upon deserialization for restoring the state of this SystemPermissionCollection from a stream.

private void
writeObject(ObjectOutputStream s)

Called upon Serialization for saving the state of this SystemPermissionCollection to a stream.

Inherited from java.security.PermissionCollection:
elementsAsStreamisReadOnlysetReadOnlytoString

Field Detail

permissionsback to summary
private HashMap<String, Permission> permissions
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.security.PermissionCollection.serialVersionUID.

Constructor Detail

SystemPermissionCollectionback to summary
private SystemPermissionCollection()

Method Detail

addback to summary
public void add(Permission permission)

Implements abstract java.security.PermissionCollection.add.

Doc from java.security.PermissionCollection.add.

Adds a permission object to the current collection of permission objects.

Parameters
permission:Permission

the Permission object to add.

Annotations
@Override
elementsback to summary
public synchronized Enumeration<Permission> elements()

Implements abstract java.security.PermissionCollection.elements.

Doc from java.security.PermissionCollection.elements.

Returns an enumeration of all the Permission objects in the collection.

Returns:Enumeration<Permission>

an enumeration of all the Permissions.

Annotations
@Override
impliesback to summary
public boolean implies(Permission permission)

Implements abstract java.security.PermissionCollection.implies.

Doc from java.security.PermissionCollection.implies.

Checks to see if the specified permission is implied by the collection of Permission objects held in this PermissionCollection.

Parameters
permission:Permission

the Permission object to compare.

Returns:boolean

true if "permission" is implied by the permissions in the collection, false if not.

Annotations
@Override
readObjectback to summary
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException

Called upon deserialization for restoring the state of this SystemPermissionCollection from a stream.

writeObjectback to summary
private void writeObject(ObjectOutputStream s) throws IOException

Called upon Serialization for saving the state of this SystemPermissionCollection to a stream.