com.ibm.wsspi.security.policy

Class AbstractPolicies

  1. java.lang.Object
  2. extended bycom.ibm.wsspi.security.policy.AbstractPolicies
All implemented interfaces:
Extensible, WSPolicy, java.io.Serializable, java.lang.Iterable<WSPolicy>

  1. public abstract class AbstractPolicies
  2. extends java.lang.Object
  3. implements WSPolicy
This is the default implementation of the WSPolicy interface. Subclasses may override isComplete() to implement the appropriate semantics for the policy domain of concern, e.g. role-based access control, rule-based authorization, etc.
Since:
WAS 7.0
Version:
WAS 7.0
See Also:
Serialized Form

Field Summary

Modifier and Type Field and Description
  1. protected
  2. java.util.Map<java.lang.Class,java.lang.Object>
adapterCache

Constructor Summary

Constructor and Description
AbstractPolicies()

Method Summary

Modifier and Type Method and Description
  1. void
add(WSPolicy policy)
  1. java.lang.Object
getExtensionAdapter(java.lang.Class clz)
  1. boolean
isComplete()
Default implementation returns true if isComplete() in all nested WSPolicy instances of this WSPolicy return true.
  1. java.util.Iterator<WSPolicy>
iterator()
  1. void
remove(WSPolicy policy)
Removes the given WSPolicy from the list of immediate child WSPolicy instances.
  1. java.lang.String
toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Field Detail

adapterCache

  1. protected java.util.Map<java.lang.Class,java.lang.Object> adapterCache

Constructor Detail

AbstractPolicies

  1. public AbstractPolicies()

Method Detail

add

  1. public void add(WSPolicy policy)
Description copied from interface: WSPolicy
Adds the given policy to this WSPolicy instance.
Specified by:
add in interface WSPolicy
Parameters:
policy - to be added to this WSPolicy instance.

getExtensionAdapter

  1. public java.lang.Object getExtensionAdapter( java.lang.Class clz)
Description copied from interface: Extensible
Returns an object that is an instance of the given class/interface or null if no such extension adapter is available.
Specified by:
Parameters:
clz - the adapter class to be found.
Returns:
an object that is an instance of the given class or null if no such extension adapter is available.

isComplete

  1. public boolean isComplete()
Default implementation returns true if isComplete() in all nested WSPolicy instances of this WSPolicy return true.

Subclasses should override this operation to provide appropriate semantics as required. A WSPolicy is generally considered to be complete when all metadata necessary to evaluate or process the policy has been collected. The metadata is collected from annotations or XML documents. For example, if a SCDL document for a component contains "RunAs" and "PermitAll" definitions, it is not necessary to retrieve the corresponding language annotations from the component implementation class or any of the methods because SCDL definitions override language annotations. In this case, the WSPolicy instance is logically complete, regardless of whether or not all the child WSPolicy instances are complete or not.

Specified by:
isComplete in interface WSPolicy
Returns:
true if isComplete() in all contained WSPolicy instances returns true.

iterator

  1. public java.util.Iterator<WSPolicy> iterator( )
Specified by:
iterator in interface java.lang.Iterable<WSPolicy>

remove

  1. public void remove(WSPolicy policy)
Removes the given WSPolicy from the list of immediate child WSPolicy instances.

Default implementation removes only the immediate child policy instances found in the policies member List. If it is desirable to remove all nested policy instances, subclasses can override this method, and iterate thru all child policies and remove all policies found using the iterator.remove() method, as illustrated below.

 Iterator<WSPolicy> iter = this.iterator();
 while (iter.hasNext()) {
     WSPolicy child = iter.next();
     if (child.equals(policy)) {
         iter.remove();
     }
 }
 
Specified by:
remove in interface WSPolicy
Parameters:
policy - to be removed from this WSPolicy instance.

toString

  1. public java.lang.String toString( )
Overrides:
toString in class java.lang.Object