org.systinet.wasp.policy
Class PolicyManager

java.lang.Object
  extended byorg.systinet.wasp.policy.PolicyManager

public class PolicyManager
extends java.lang.Object

Policy Manager represents powerful part of the policy framework. It provides support for:

  • Creating and loading PolicyAttachment
  • Creating and loading Policy
  • Getting EffectivePolicy

    For instance:
     Policy policy = PolicyManager.createPolicy();
     InactivityTimeoutAssertion assertion = new InactivityTimeoutAssertion(5000);
     assertion.setPreference(100);
     policy.add(assertion);
     PolicyManager.createPolicyAttachment(new EndpointReference("http://localhost:6060/demo/basic/HelloService"), policy);
     

    Since:
    5.0
    See Also:
    Policy, PolicyAttachment, EffectivePolicy, DomainExpression
    Component:
    Core

    Method Summary
    static PolicyAttachment attachPolicy(DomainExpression domainExpression, Policy policy)
              Creates an instance of PolicyAttachment, which attaches given Policy to given DomainExpression.
    static Policy createPolicy()
              Creates an instance Policy.
    static Policy createPolicy(QName name)
              Creates an instance of Policy with given qualified name (Name, TargetNamespace) attributes.
    static PolicyAttachment createPolicyAttachment(DomainExpression domainExpression, Policy policy)
              Creates an instance of PolicyAttachment, which attaches given Policy to given DomainExpression.
    static PolicyAttachment createPolicyAttachment(DomainExpression domainExpression, Policy[] policies)
              Creates an instance of PolicyAttachment, which attaches given array of Policys to given DomainExpression.
    static EffectivePolicy getEffectivePolicy(DomainExpression domainExpression)
              Gets the EffectivePolicy for given DomainExpression.
    static Policy[] getPolices()
              Gets all Policys registered in policy manager.
    static Policy getPolicy(QName name)
              Gets the Policy of given qualified name or null if doesn't exist.
    static PolicyAttachment getPolicyAttachment(DomainExpression domainExpression)
              Gets the PolicyAttachment indetifies by given {DomainExpression or null if any doesn't exist.
    static PolicyAttachment[] getPolicyAttachments()
              Gets all PolicyAttachments registered in policy manager.
    static Policy loadPolicy(javax.xml.transform.Source source)
              Loads Policy from given Source.
    static PolicyAttachment[] loadPolicyAttachment(javax.xml.transform.Source source)
              Loads PolicyAttachments from given Source.
    static void removePolicy(Policy policy)
              Removes given Policy from policy manager.
    static void removePolicyAttachment(PolicyAttachment policyAttachment)
              Removes given PolicyAttachment from policy manager.
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Method Detail

    createPolicyAttachment

    public static PolicyAttachment createPolicyAttachment(DomainExpression domainExpression,
                                                          Policy[] policies)
                                                   throws PolicyException
    Creates an instance of PolicyAttachment, which attaches given array of Policys to given DomainExpression. When a policy attachment already exists to given domain expression PolicyException is thrown.

    Parameters:
    domainExpression - domain expression specified the scope of attachment
    policies - array of policies to attach
    Returns:
    created PolicyAttachment
    Throws:
    PolicyException - when an error occurs during creating

    createPolicyAttachment

    public static PolicyAttachment createPolicyAttachment(DomainExpression domainExpression,
                                                          Policy policy)
                                                   throws PolicyException
    Creates an instance of PolicyAttachment, which attaches given Policy to given DomainExpression. When a policy attachment already exists to given domain expression PolicyException is thrown.

    Parameters:
    domainExpression - domain expression specified the scope of attachment
    policy - policy to attach
    Returns:
    created PolicyAttachment
    Throws:
    PolicyException - when an error occurs during creating

    attachPolicy

    public static PolicyAttachment attachPolicy(DomainExpression domainExpression,
                                                Policy policy)
    Creates an instance of PolicyAttachment, which attaches given Policy to given DomainExpression. When a policy attachment already exists to given domain expression the policy is added to this instance and this isntance is returned.

    Parameters:
    domainExpression - domain expression specified the scope of attachment
    policy - policy to attach
    Returns:
    created or found PolicyAttachment

    getPolicyAttachment

    public static PolicyAttachment getPolicyAttachment(DomainExpression domainExpression)
    Gets the PolicyAttachment indetifies by given {DomainExpression or null if any doesn't exist.

    Parameters:
    domainExpression - domain expresion to get policy attachment
    Returns:
    PolicyAttachment or null if any doesn't exist.

    getPolicyAttachments

    public static PolicyAttachment[] getPolicyAttachments()
    Gets all PolicyAttachments registered in policy manager.

    Returns:
    an array of policy attachments

    removePolicyAttachment

    public static void removePolicyAttachment(PolicyAttachment policyAttachment)
    Removes given PolicyAttachment from policy manager.

    Parameters:
    policyAttachment - policy attachment to remove

    loadPolicyAttachment

    public static PolicyAttachment[] loadPolicyAttachment(javax.xml.transform.Source source)
                                                   throws PolicyException
    Loads PolicyAttachments from given Source. Because of source can contain more then one domain expression, an array is returned.

    Parameters:
    source - source to load
    Returns:
    an array of policy attachments from the source
    Throws:
    PolicyException - when an error occurs during loading

    createPolicy

    public static Policy createPolicy()
    Creates an instance Policy.

    Returns:
    an instance Policy

    createPolicy

    public static Policy createPolicy(QName name)
                               throws PolicyException
    Creates an instance of Policy with given qualified name (Name, TargetNamespace) attributes. If the policy with given name already exists, PolicyException is thrown.

    Parameters:
    name - qualified name of policy to create
    Returns:
    created Policy
    Throws:
    PolicyException - when when an error occurs during creating

    getPolicy

    public static Policy getPolicy(QName name)
    Gets the Policy of given qualified name or null if doesn't exist.

    Parameters:
    name - qualified name of policy to get
    Returns:
    Policy of given qualified name or null if doesn't exist

    getPolices

    public static Policy[] getPolices()
    Gets all Policys registered in policy manager.

    Returns:
    an array of policy attachments

    removePolicy

    public static void removePolicy(Policy policy)
    Removes given Policy from policy manager.

    Parameters:
    policy - policy to remove

    loadPolicy

    public static Policy loadPolicy(javax.xml.transform.Source source)
                             throws PolicyException
    Loads Policy from given Source.

    Parameters:
    source - source to load
    Returns:
    an policy from the source
    Throws:
    PolicyException - when an error occurs during loading

    getEffectivePolicy

    public static EffectivePolicy getEffectivePolicy(DomainExpression domainExpression)
    Gets the EffectivePolicy for given DomainExpression.

    Parameters:
    domainExpression - domain expression, for which eefective policy is get
    Returns:
    EffectivePolicy