org.apache.ws.policy
Class Policy

java.lang.Object
  extended byorg.apache.ws.policy.AbstractAssertion
      extended byorg.apache.ws.policy.Policy
All Implemented Interfaces:
Assertion, CompositeAssertion

public class Policy
extends AbstractAssertion
implements CompositeAssertion

Policy class is the runtime representation of a policy. It provides a convenient model to store process any policy. Policy object requires that all its terms are met.


Field Summary
 
Fields inherited from class org.apache.ws.policy.AbstractAssertion
childTerms, flag, lineNo, parent, source
 
Fields inherited from interface org.apache.ws.policy.Assertion
COMPOSITE_AND_TYPE, COMPOSITE_POLICY_TYPE, COMPOSITE_XOR_TYPE, POLIY_REFERCE_TYPE, PRIMITIVE_TYPE
 
Constructor Summary
Policy()
          Creates a policy object
Policy(java.lang.String id)
          Creates a policy object with the specified Id
Policy(java.lang.String xmlBase, java.lang.String id)
          Creates a policy object with the specified xml-base and id.
 
Method Summary
 java.lang.String getBase()
          Returns the xml-base of the policy object.
 java.lang.String getId()
          Returns the Id of the Policy object.
 java.lang.String getPolicyURI()
          Returns a String which uniquely identify the policy object.
 short getType()
          Returns a short value which indicates this is a Policy.
 Assertion intersect(Assertion assertion, PolicyRegistry reg)
          Returns an assertion which is equivalent of intersect of self and argument.
 Assertion merge(Assertion assertion, PolicyRegistry reg)
          Returns the equivalent of merge of self and argument.
 Assertion normalize()
          Returns a new assertion which is the normalized form of this assertion.
 Assertion normalize(PolicyRegistry reg)
          Returns a new assertion which is the normalized form of this assertion.
 void setBase(java.lang.String xmlBase)
          Set the xml-base of the policy object
 void setId(java.lang.String id)
          Sets the id of the Policy object
 
Methods inherited from class org.apache.ws.policy.AbstractAssertion
addTerm, addTerms, getLineNo, getParent, getSource, getTerms, hasParent, intersect, isEmpty, isNormalized, merge, remove, setLineNo, setNormalized, setParent, setSource, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.ws.policy.Assertion
addTerm, addTerms, getLineNo, getParent, getSource, getTerms, hasParent, intersect, isEmpty, isNormalized, merge, remove, setLineNo, setNormalized, setParent, setSource, size
 

Constructor Detail

Policy

public Policy()
Creates a policy object


Policy

public Policy(java.lang.String id)
Creates a policy object with the specified Id

Parameters:
id - a string as the id

Policy

public Policy(java.lang.String xmlBase,
              java.lang.String id)
Creates a policy object with the specified xml-base and id.

Parameters:
xmlBase - the xml-base
id - a string as the id
Method Detail

setBase

public void setBase(java.lang.String xmlBase)
Set the xml-base of the policy object

Parameters:
xmlBase - the xml base of the policy object

getBase

public java.lang.String getBase()
Returns the xml-base of the policy object. Returns null if no xml-base is set.

Returns:
xml base of the policy object

setId

public void setId(java.lang.String id)
Sets the id of the Policy object

Parameters:
id -

getId

public java.lang.String getId()
Returns the Id of the Policy object. Returns null if no Id is set.

Returns:
the Id of the policy object.

getPolicyURI

public java.lang.String getPolicyURI()
Returns a String which uniquely identify the policy object. It has the format of {$xmlBase}#{$id}. If the xmlBase is null it will return #{$id} as the URI String. If the Id is null, this will return.

Returns:
a String which uniquely identify the policy object.

normalize

public Assertion normalize()
Description copied from interface: Assertion
Returns a new assertion which is the normalized form of this assertion.

Specified by:
normalize in interface Assertion
Overrides:
normalize in class AbstractAssertion
Returns:
an assertion which is the normalized format of this assertion.

normalize

public Assertion normalize(PolicyRegistry reg)
Description copied from interface: Assertion
Returns a new assertion which is the normalized form of this assertion.

Specified by:
normalize in interface Assertion
Parameters:
reg - the registry which is used to resolve any policy references in the process of normalization.
Returns:

intersect

public Assertion intersect(Assertion assertion,
                           PolicyRegistry reg)
Description copied from interface: Assertion
Returns an assertion which is equivalent of intersect of self and argument. Here the external policy are resolved via a policy registry that is supplied as an argument.

Specified by:
intersect in interface Assertion
Parameters:
assertion - the assertion to intersect with
Returns:
the equivalent of intersection of self and argument

merge

public Assertion merge(Assertion assertion,
                       PolicyRegistry reg)
Description copied from interface: Assertion
Returns the equivalent of merge of self and argument. The rules to construct argument are specified in WS Policy specification 1.0 Here the external policy references are resolved via a policy registry that is supplied as an argument

Specified by:
merge in interface Assertion
Parameters:
assertion - the assertion to merge with
reg - the policy registry that should be used to resolve external policy references
Returns:
the equivalent of merge of self and argument

getType

public final short getType()
Returns a short value which indicates this is a Policy.

Specified by:
getType in interface Assertion
Returns:
a short value of one of following values: PRIMITIVE_TYPE : if the assertion is a PrimitiveAssertion COMPOSITE_AND_TYPE : if the assertion is a AndCompositeAssertion COMPOSITE_XOR_TYPE : if the assertion is a XorCompositeAssertion COMPOSITE_POLICY_TYPE : if the assertion is a Policy POLICY_REFERENCE_TYPE : if the assertion is a PolicyReferece


Copyright © 2002-2006 Apache Software Foundation. All Rights Reserved.