com.ibm.wsspi.security.policy

Class AbstractPolicies

  • java.lang.Object
    • com.ibm.wsspi.security.policy.AbstractPolicies
  • All Implemented Interfaces:
    Extensible, WSPolicy, java.io.Serializable, java.lang.Iterable<WSPolicy>


    public abstract class AbstractPolicies
    extends java.lang.Object
    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

      Fields 
      Modifier and Type Field and Description
      protected java.util.Map<java.lang.Class,java.lang.Object> adapterCache 
    • Constructor Summary

      Constructors 
      Constructor and Description
      AbstractPolicies() 
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      void add(WSPolicy policy)
      Adds the given policy to this WSPolicy instance.
      java.lang.Object getExtensionAdapter(java.lang.Class clz)
      Returns an object that is an instance of the given class/interface or null if no such extension adapter is available.
      boolean isComplete()
      Default implementation returns true if isComplete() in all nested WSPolicy instances of this WSPolicy return true.
      java.util.Iterator<WSPolicy> iterator() 
      void remove(WSPolicy policy)
      Removes the given WSPolicy from the list of immediate child WSPolicy instances.
      java.lang.String toString() 
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • adapterCache

        protected java.util.Map<java.lang.Class,java.lang.Object> adapterCache
    • Constructor Detail

      • AbstractPolicies

        public AbstractPolicies()
    • Method Detail

      • add

        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

        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:
        getExtensionAdapter in interface Extensible
        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

        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

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

        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

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
IBM WebSphere Application ServerTM
Release 8.5