com.waveset.policy
Class PolicyManager

java.lang.Object
  extended bycom.waveset.policy.PolicyManager

public class PolicyManager
extends java.lang.Object

A class encapsulating operations related to policies. This includes a catalog of available PolicyImplementation objects.

A singleton PolicyManager will typically be created by the singleton Server object which manages the pool of resources used by code in the server. The Provisioner object will use the policy manager to load the PolicyImplemenation objects. The LocalSession object may use the PolicyManager to return a list of available policy "types" to applications. // *

// * UPDATE: Now that we're using a .jar file, we've got a problem using // * the file system hack to locate policy plugins. There doesn't // * appear to be a way to discover package contents through reflection. // * For now, we'll maintain a static array containing the class names // * of the "builtin" policies, we will continue to look on the file system // * for user defined policies.


Field Summary
static java.lang.String CLASS
           
static java.lang.String code_id
           
static java.lang.String DEFAULT_POLICY_ID
          The repository ID of a Policy object that serves as the default policy for a user.
protected static Trace trace
           
 
Constructor Summary
PolicyManager(LighthouseContext ctx)
           
 
Method Summary
 Policy getEffectivePolicy(WSUser user, java.lang.String policyType)
          Find the effective policy of a given type for a user.
 Policy getEffectivePolicy(WSUser user, java.lang.String policyName, java.lang.String policyType)
           
 Policy getEffectivePolicy(WSUser user, java.lang.String policyName, java.lang.String orgName, java.util.List roleNames, java.lang.String policyType)
          Find the named effective policy for this user.
 PolicyImplementation getImplementation(Policy p)
          Locate an implementation object for the given policy definition object.
 Policy[] getPolicyTypes()
          Return an array of prototype Policy instances for all registered policy types.
 java.lang.Object getPolicyValue(Policy policy, WSUser user, java.lang.String requestedValue)
          Given a user map and a policy, get a requested value
 java.lang.Object getPolicyValue(Policy policy, WSUser user, java.lang.String loginInterface, java.lang.String requestedValue)
          Given a user map and a policy, get a requested value
 java.lang.Object getPolicyValue(java.lang.String policyName, WSUser user, java.lang.String requestedValue)
           
 java.lang.Object getPolicyValue(java.lang.String policyName, WSUser user, java.lang.String loginInterface, java.lang.String requestedValue)
           
 java.lang.Object getPolicyValue(WSUser user, java.util.Map params)
          Find the named effective policy for this user and get the specified policy value.
 java.lang.Object getPolicyValue(WSUser user, java.lang.String policyType, java.lang.String requestedValue)
          Find the named effective policy for this user and get the specified policy value.
 java.lang.Object getPolicyValue(WSUser user, java.lang.String policyType, java.lang.String loginInterface, java.lang.String requestedValue)
          Find the named effective policy for this user and get the specified policy value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

code_id

public static final java.lang.String code_id
See Also:
Constant Field Values

CLASS

public static final java.lang.String CLASS
See Also:
Constant Field Values

trace

protected static final Trace trace

DEFAULT_POLICY_ID

public static final java.lang.String DEFAULT_POLICY_ID
The repository ID of a Policy object that serves as the default policy for a user.

See Also:
Constant Field Values
Constructor Detail

PolicyManager

public PolicyManager(LighthouseContext ctx)
              throws WavesetException
Method Detail

getImplementation

public PolicyImplementation getImplementation(Policy p)
                                       throws WavesetException
Locate an implementation object for the given policy definition object.

Note that we will cache and return the same implementation object on subsequent calls. If the PolicyImplementation needs to maintain thread specific state during its operation, then we would have to return a clone here. This is not currently an issue.

Throws:
WavesetException

getPolicyTypes

public Policy[] getPolicyTypes()
                        throws WavesetException
Return an array of prototype Policy instances for all registered policy types.

Throws:
WavesetException

getEffectivePolicy

public Policy getEffectivePolicy(WSUser user,
                                 java.lang.String policyType)
                          throws WavesetException
Find the effective policy of a given type for a user. This will walk up the organization hierarcy until it finds a suitable policy.
The returned policy is cloned and a description is made of where the assigned policy came from (organization, role compatibility, directly assigned, or default).

Parameters:
user - - the user to get the policy for
policyType - - String policy type. One of ...
Throws:
WavesetException

getEffectivePolicy

public Policy getEffectivePolicy(WSUser user,
                                 java.lang.String policyName,
                                 java.lang.String orgName,
                                 java.util.List roleNames,
                                 java.lang.String policyType)
                          throws WavesetException
Find the named effective policy for this user. This will walk up the organization hierarcy until it finds the named policy type assigned. The user's orgName and roleNames may abe passed in The returned policy is cloned and a description is made of where the assigned policy came from (organization, role compatibility, directly assigned, or default).

Parameters:
user - - the user to get the policy for
orgName - - an organization, if user is null
roleNames - - a List of Strings, the names of the assigned roles.
policyName - - directly assigned policy (from the view)
policyType - - String policy type. One of ...
Throws:
WavesetException

getEffectivePolicy

public Policy getEffectivePolicy(WSUser user,
                                 java.lang.String policyName,
                                 java.lang.String policyType)
                          throws WavesetException
Throws:
WavesetException

getPolicyValue

public java.lang.Object getPolicyValue(WSUser user,
                                       java.util.Map params)
                                throws WavesetException
Find the named effective policy for this user and get the specified policy value. Replaces Role.getXXX.

Parameters:
user - - the user to get the policy for
params - - set of params including: loginInterface - String Lighthouse login interface policyType - String policy type. One of ... requestedValue - String policy value
Throws:
WavesetException

getPolicyValue

public java.lang.Object getPolicyValue(WSUser user,
                                       java.lang.String policyType,
                                       java.lang.String requestedValue)
                                throws WavesetException
Find the named effective policy for this user and get the specified policy value. Replaces Role.getXXX.

Parameters:
user - - the user to get the policy for
policyType - - String policy type. One of ...
requestedValue - - String policy value
Throws:
WavesetException

getPolicyValue

public java.lang.Object getPolicyValue(WSUser user,
                                       java.lang.String policyType,
                                       java.lang.String loginInterface,
                                       java.lang.String requestedValue)
                                throws WavesetException
Find the named effective policy for this user and get the specified policy value. Replaces Role.getXXX.

Parameters:
user - - the user to get the policy for
policyType - - String policy type. One of ...
requestedValue - - String policy value
Throws:
WavesetException

getPolicyValue

public java.lang.Object getPolicyValue(Policy policy,
                                       WSUser user,
                                       java.lang.String requestedValue)
                                throws WavesetException
Given a user map and a policy, get a requested value

Parameters:
policy - - policy to check
requestedValue - - String policy value
Throws:
WavesetException

getPolicyValue

public java.lang.Object getPolicyValue(Policy policy,
                                       WSUser user,
                                       java.lang.String loginInterface,
                                       java.lang.String requestedValue)
                                throws WavesetException
Given a user map and a policy, get a requested value

Parameters:
policy - - policy to check
loginInterface - - login interface
requestedValue - - String policy value
Throws:
WavesetException

getPolicyValue

public java.lang.Object getPolicyValue(java.lang.String policyName,
                                       WSUser user,
                                       java.lang.String requestedValue)
                                throws WavesetException
Throws:
WavesetException

getPolicyValue

public java.lang.Object getPolicyValue(java.lang.String policyName,
                                       WSUser user,
                                       java.lang.String loginInterface,
                                       java.lang.String requestedValue)
                                throws WavesetException
Throws:
WavesetException