com.bea.ales.management
Class AbstractPolicy

java.lang.Object
  |
  +--com.bea.ales.management.AbstractPolicy
Direct Known Subclasses:
AuthorizationPolicy, MembershipRule

public abstract class AbstractPolicy
extends java.lang.Object

Base class of AuthorizationPolicy and MembershipRule. It abstracts all common properties for an ALES policy. Users should not inherit from this class to implement your own policies.


Field Summary
static java.util.List builtinDecls
           
 
Method Summary
 void addResource(Resource resource)
          Add a resource to the policy.
 void addResources(java.util.List resources)
          Add a list of resources to the policy
 void addSubject(java.lang.Object subject)
          Add a subject to the policy.
 void addSubjects(java.util.List subjects)
          Add a list of subjects to the policy.
 java.lang.String getConstraint()
          Get the constraint of the policy. if the policy has no constraint, null will be return.
 User getDelegator()
          Get the delegator.
 java.lang.String getDelegatorString()
          Get the name of delegator.
 java.lang.String getDescription()
          Get the description of the policy
 java.lang.String getDisplayName()
          Get the display name of the policy
 PolicyEffectType getEffect()
          Get the effect of the policy.
 java.lang.String getHtmlSourceOfResources()
          Deprecated.  
 java.lang.String getHtmlSourceOfSubjects()
          Deprecated.  
 java.util.List getResources()
          Get all resources of the policy.
 java.util.List getSubjects()
          Get all subjects of the policy.
 void removeResource(Resource resource)
          Remove a resource from the policy.
 void removeResources(java.util.List resources)
          Remove resources from the policy.
 void removeSubject(java.lang.Object subject)
          Remove a subject from the policy.
 void removeSubjects(java.util.List subjects)
          Remove subjects from the policy.
 void setConstraint(java.lang.String constraint)
          Set the constrain to the policy.
 void setDelegator(User delegator)
          Set the delegator of the policy.
 void setDescription(java.lang.String description)
          Set the description of the policy
 void setDisplayName(java.lang.String displayName)
          Set the display name of the policy
 void setEffect(PolicyEffectType effect)
          Set the effect of the policy.
 void setResources(java.util.List resources)
          Set resources to the policy.
 void setSubjects(java.util.List subjects)
          Set subjects of the policy.
abstract  java.lang.String toScopedString()
          Converts the policy to a scoped string value.
abstract  java.lang.String toString()
          Converts the policy to a string value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

builtinDecls

public static final java.util.List builtinDecls
Method Detail

getEffect

public PolicyEffectType getEffect()
Get the effect of the policy.

Returns:
effect of the policy.

setEffect

public void setEffect(PolicyEffectType effect)
               throws java.lang.IllegalArgumentException,
                      ManagementException
Set the effect of the policy.

Parameters:
effect - desired effect of this policy. This method only accepts grant or deny effects. To set delegate effect, use setDelegator method.
Throws:
java.lang.IllegalArgumentException - if effect is not grant or deny.
ManagementException - if failed to set the new effect.

getResources

public java.util.List getResources()
Get all resources of the policy.

Returns:
list of resources as Resource.

setResources

public void setResources(java.util.List resources)
                  throws java.lang.IllegalArgumentException,
                         ManagementException
Set resources to the policy. All existing resources will be removed.

Parameters:
resources - list of resources as Resource.
Throws:
java.lang.IllegalArgumentException - if 'resources' is null or empty list or the element type of list is not Resource.
ManagementException - if failed to set the new resources.

addResources

public void addResources(java.util.List resources)
                  throws java.lang.IllegalArgumentException,
                         ManagementException
Add a list of resources to the policy

Parameters:
resources - list of resources as Resource. It can not be null or empty.
Throws:
java.lang.IllegalArgumentException - if the resources is null or empty or its element type is not Resource
ManagementException - if failed to add resources

removeResources

public void removeResources(java.util.List resources)
                     throws java.lang.IllegalArgumentException,
                            ManagementException
Remove resources from the policy.

Parameters:
resources - list of resources as Resource to be removed. It can not be null or empty.
Throws:
java.lang.IllegalArgumentException - if the resources is null or empty or its element type is not Resource
ManagementException - if failed to remove resources

addResource

public void addResource(Resource resource)
                 throws java.lang.IllegalArgumentException,
                        ManagementException
Add a resource to the policy.

Parameters:
resource - the resource to be added.
Throws:
java.lang.IllegalArgumentException - if resource is null.
ManagementException - if failed to add the new resource.

removeResource

public void removeResource(Resource resource)
                    throws java.lang.IllegalArgumentException,
                           ManagementException
Remove a resource from the policy.

Parameters:
resource - the resource to be removed.
Throws:
java.lang.IllegalArgumentException - if resource is null.
ManagementException - if failed to remove the resource.

getSubjects

public java.util.List getSubjects()
Get all subjects of the policy.

Returns:
list of subjects. The type of elements in the returned list can be User, Group or com.bea.ales.management.RBAC_Role

setSubjects

public void setSubjects(java.util.List subjects)
                 throws java.lang.IllegalArgumentException,
                        ManagementException
Set subjects of the policy. All existing subjects will be removed.

Parameters:
subjects - list of subjects. The type of elements can be User, Group or Role. But all elements in 'subjects' list must have the same type.
Throws:
java.lang.IllegalArgumentException - if subjects is null or empty list or the element type is invalid.
ManagementException - if failed to set the new subjects.

addSubjects

public void addSubjects(java.util.List subjects)
                 throws java.lang.IllegalArgumentException,
                        ManagementException
Add a list of subjects to the policy.

Parameters:
subjects - List of subjects. The type of elements can be User, Group or Role.
Throws:
java.lang.IllegalArgumentException - if the subjects is null or empty or its element type is invalid.
ManagementException - if failed to add subjects

removeSubjects

public void removeSubjects(java.util.List subjects)
                    throws java.lang.IllegalArgumentException,
                           ManagementException
Remove subjects from the policy.

Parameters:
subjects - List of subjects to be removed. The type of elements can be User, Group or Role.
Throws:
java.lang.IllegalArgumentException - if the subjects is null or empty or its element type is invalid.
ManagementException - if failed to remove subjects

addSubject

public void addSubject(java.lang.Object subject)
                throws java.lang.IllegalArgumentException,
                       ManagementException
Add a subject to the policy.

Parameters:
subject - the subject to be added. The type of the subject can be User, Group or Role.
Throws:
java.lang.IllegalArgumentException - if subject is null or its type is invalid.
ManagementException - if failed to add the subject.

removeSubject

public void removeSubject(java.lang.Object subject)
                   throws java.lang.IllegalArgumentException,
                          ManagementException
Remove a subject from the policy.

Parameters:
subject - the subject to be removed. The type of subject can be User, Group or Role.
Throws:
java.lang.IllegalArgumentException - if subject is null or its type is invalid.
ManagementException - if failed to remove the subject.

getDelegator

public User getDelegator()
                  throws java.lang.IllegalStateException
Get the delegator. If the policy effect type is not PolicyEffectType.DELEGATE, an IllegalStateException will be thrown.

Returns:
the delegator.
Throws:
java.lang.IllegalStateException - If the policy effect type is not PolicyEffectType.DELEGATE.

getDelegatorString

public java.lang.String getDelegatorString()
Get the name of delegator.

Returns:
Empty string if delegator not set. Otherwise returns the delegator.

setDelegator

public void setDelegator(User delegator)
                  throws java.lang.IllegalStateException,
                         java.lang.IllegalArgumentException,
                         ManagementException
Set the delegator of the policy. If the policy effect type is not PolicyEffectType.DELEGATE, an IllegalStateException will be thrown.

Parameters:
delegator - delegator to be set.
Throws:
java.lang.IllegalStateException - if the policy effect type is not PolicyEffectType.DELEGATE.
java.lang.IllegalArgumentException - if delegator is null.
ManagementException - if failed to set the new delegator.

getConstraint

public java.lang.String getConstraint()
Get the constraint of the policy. if the policy has no constraint, null will be return.

Returns:
the constraint of the policy.

setConstraint

public void setConstraint(java.lang.String constraint)
                   throws ManagementException
Set the constrain to the policy.

Parameters:
constraint - the constraint to be set. If it is null or empty string, the existing constraint will be removed.
Throws:
ManagementException - if failed to set the new effect.

toString

public abstract java.lang.String toString()
                                   throws java.lang.IllegalStateException
Converts the policy to a string value.

Returns:
string representation of the policy.
Overrides:
toString in class java.lang.Object

toScopedString

public abstract java.lang.String toScopedString()
                                         throws java.lang.IllegalStateException
Converts the policy to a scoped string value.

Returns:
string representation of the scoped policy.

setDisplayName

public void setDisplayName(java.lang.String displayName)
                    throws ManagementException
Set the display name of the policy

Parameters:
displayName -  
Throws:
ManagementException -  

getDisplayName

public java.lang.String getDisplayName()
                                throws ManagementException
Get the display name of the policy

Returns:
 
Throws:
ManagementException -  

setDescription

public void setDescription(java.lang.String description)
                    throws ManagementException
Set the description of the policy

Parameters:
description -  
Throws:
ManagementException -  

getDescription

public java.lang.String getDescription()
                                throws ManagementException
Get the description of the policy

Returns:
 
Throws:
ManagementException -  

getHtmlSourceOfResources

public java.lang.String getHtmlSourceOfResources()
Deprecated.  

getHtmlSourceOfSubjects

public java.lang.String getHtmlSourceOfSubjects()
Deprecated.  


Copyright © 2004-2008, Oracle and/or its affiliates. All rights reserved.