org.knopflerfish.framework.permissions
Class ConditionalPermissionAdminImpl

java.lang.Object
  extended by org.knopflerfish.framework.permissions.ConditionalPermissionAdminImpl
All Implemented Interfaces:
ConditionalPermissionAdmin

public class ConditionalPermissionAdminImpl
extends java.lang.Object
implements ConditionalPermissionAdmin

Framework service to administer Conditional Permissions. Conditional Permissions can be added to, retrieved from, and removed from the framework.


Field Summary
static java.lang.String SPEC_VERSION
           
 
Constructor Summary
ConditionalPermissionAdminImpl(org.knopflerfish.framework.permissions.ConditionalPermissionInfoStorage cpis)
           
 
Method Summary
 ConditionalPermissionInfo addConditionalPermissionInfo(ConditionInfo[] conds, PermissionInfo[] perms)
          Create a new Conditional Permission Info.
 java.security.AccessControlContext getAccessControlContext(java.lang.String[] signers)
          Returns the Access Control Context that corresponds to the specified signers.
 ConditionalPermissionInfo getConditionalPermissionInfo(java.lang.String name)
          Return the Conditional Permission Info with the specified name.
 java.util.Enumeration getConditionalPermissionInfos()
          Returns the Conditional Permission Infos that are currently managed by Conditional Permission Admin.
 ConditionalPermissionInfo setConditionalPermissionInfo(java.lang.String name, ConditionInfo[] conds, PermissionInfo[] perms)
          Set or create a Conditional Permission Info with a specified name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SPEC_VERSION

public static final java.lang.String SPEC_VERSION
See Also:
Constant Field Values
Constructor Detail

ConditionalPermissionAdminImpl

public ConditionalPermissionAdminImpl(org.knopflerfish.framework.permissions.ConditionalPermissionInfoStorage cpis)
Method Detail

addConditionalPermissionInfo

public ConditionalPermissionInfo addConditionalPermissionInfo(ConditionInfo[] conds,
                                                              PermissionInfo[] perms)
Create a new Conditional Permission Info. The Conditional Permission Info will be given a unique, never reused name.

Specified by:
addConditionalPermissionInfo in interface ConditionalPermissionAdmin
Parameters:
conds - The Conditions that need to be satisfied to enable the corresponding Permissions.
perms - The Permissions that are enable when the corresponding Conditions are satisfied.
Returns:
The ConditionalPermissionInfo for the specified Conditions and Permissions.
Throws:
java.lang.SecurityException - If the caller does not have AllPermission.

setConditionalPermissionInfo

public ConditionalPermissionInfo setConditionalPermissionInfo(java.lang.String name,
                                                              ConditionInfo[] conds,
                                                              PermissionInfo[] perms)
Set or create a Conditional Permission Info with a specified name. If the specified name is null, a new Conditional Permission Info must be created and will be given a unique, never reused name. If there is currently no Conditional Permission Info with the specified name, a new Conditional Permission Info must be created with the specified name. Otherwise, the Conditional Permission Info with the specified name must be updated with the specified Conditions and Permissions.

Specified by:
setConditionalPermissionInfo in interface ConditionalPermissionAdmin
Parameters:
name - The name of the Conditional Permission Info, or null.
conds - The Conditions that need to be satisfied to enable the corresponding Permissions.
perms - The Permissions that are enable when the corresponding Conditions are satisfied.
Returns:
The ConditionalPermissionInfo that for the specified name, Conditions and Permissions.
Throws:
java.lang.SecurityException - If the caller does not have AllPermission.

getConditionalPermissionInfos

public java.util.Enumeration getConditionalPermissionInfos()
Returns the Conditional Permission Infos that are currently managed by Conditional Permission Admin. Calling ConditionalPermissionInfo.delete() will remove the Conditional Permission Info from Conditional Permission Admin.

Specified by:
getConditionalPermissionInfos in interface ConditionalPermissionAdmin
Returns:
An enumeration of the Conditional Permission Infos that are currently managed by Conditional Permission Admin.

getConditionalPermissionInfo

public ConditionalPermissionInfo getConditionalPermissionInfo(java.lang.String name)
Return the Conditional Permission Info with the specified name.

Specified by:
getConditionalPermissionInfo in interface ConditionalPermissionAdmin
Parameters:
name - The name of the Conditional Permission Info to be returned.
Returns:
The Conditional Permission Info with the specified name.

getAccessControlContext

public java.security.AccessControlContext getAccessControlContext(java.lang.String[] signers)
Returns the Access Control Context that corresponds to the specified signers.

Specified by:
getAccessControlContext in interface ConditionalPermissionAdmin
Parameters:
signers - The signers for which to return an Access Control Context.
Returns:
An AccessControlContext that has the Permissions associated with the signer.