org.apache.ws.policy
Class PolicyReference

java.lang.Object
  extended byorg.apache.ws.policy.PolicyReference
All Implemented Interfaces:
Assertion

public class PolicyReference
extends java.lang.Object
implements Assertion

PolicyReference class has implicit reference to a external policy. It is used as a way to include an extenal policy object within another policy object. These objects are replaced with the actual policies when a Policy object is being normalized. Sanka Samaranayake (sanka@apache.org)


Field Summary
protected  int lineNo
          To store the line no of the assertion in the file
protected  java.lang.String source
          To store the description of the origin of the assertion
 
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
PolicyReference(java.lang.String policyURIString)
          Constructs a PolicyReferece object which refers to the Policy which is uniquely identified by policyURIString.
 
Method Summary
 void addTerm(Assertion assertion)
          Adds an assertion as a term of this assertion.
 void addTerms(java.util.List assertions)
          Adds a list of assertions as terms of this assertion.
 int getLineNo()
          Returns the line no of the assertion which is line no of the assertion in the file where the assertion is first read.
 Assertion getParent()
          Returns the parent of self or null if a parent non-exists
 java.lang.String getPolicyURIString()
          Returns a string which uniquely identified the referring Policy.
 java.lang.String getSource()
          Returns a string which describes the source of the assertion.
 java.util.List getTerms()
          Returns the list of terms of this assertion.
 short getType()
          Returns a short value which indicate this is a PolicyReference.
 boolean hasParent()
          Returns ture if the assertion has a parent
 Assertion intersect(Assertion assertion)
          Returns an assertion which is the equivalent of intersect of self and argument.
 Assertion intersect(Assertion assertion, PolicyRegistry reg)
          Returns an assertion which is equivalent of intersect of self and argument.
 boolean isEmpty()
          Returns true if there are no terms in this assertion.
 boolean isNormalized()
          Returns true if the assertion is in normalized form.
 Assertion merge(Assertion assertion)
          Returns the equivalent of merge 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.
 boolean remove(Assertion assertion)
          Removes the specified assertion from the terms list.
 void setLineNo(int lineNo)
          Sets the line no of the assertion which should be the line no of the assertion in the file where the assertion is first read.
 void setNormalized(boolean flag)
          Marks this assertion as in normalized form.
 void setParent(Assertion parent)
          Sets the parent to argument
 void setSource(java.lang.String source)
          Sets specified string as the source of the assertion.
 int size()
          Returns the number of terms of this assertion.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

source

protected java.lang.String source
To store the description of the origin of the assertion


lineNo

protected int lineNo
To store the line no of the assertion in the file

Constructor Detail

PolicyReference

public PolicyReference(java.lang.String policyURIString)
Constructs a PolicyReferece object which refers to the Policy which is uniquely identified by policyURIString.

Parameters:
policyURIString -
Method Detail

getPolicyURIString

public java.lang.String getPolicyURIString()
Returns a string which uniquely identified the referring Policy. For instance the referring policy object p, p.getPolicyURI() should return the same string

Returns:
a String which uniquely identifies the referring 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
Returns:
an assertion which is normalized form of this.

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)
Description copied from interface: Assertion
Returns an assertion which is the equivalent of intersect of self and argument. The rules to construct the equivalent assertion are specified in WS Policy 1.0 specification.

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

intersect

public Assertion intersect(Assertion assertion,
                           PolicyRegistry reg)
                    throws java.lang.UnsupportedOperationException
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
Throws:
java.lang.UnsupportedOperationException - if the operation is not meaningful

merge

public Assertion merge(Assertion assertion,
                       PolicyRegistry reg)
                throws java.lang.UnsupportedOperationException
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
Throws:
java.lang.UnsupportedOperationException - if the merge is not meaningful

merge

public Assertion merge(Assertion assertion)
Description copied from interface: Assertion
Returns the equivalent of merge of self and argument. The rules to construct the equivalent of merge are defined in WS Policy specification 1.0

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

hasParent

public boolean hasParent()
Description copied from interface: Assertion
Returns ture if the assertion has a parent

Specified by:
hasParent in interface Assertion
Returns:
true if a parent exists , false otherwise

getParent

public Assertion getParent()
Description copied from interface: Assertion
Returns the parent of self or null if a parent non-exists

Specified by:
getParent in interface Assertion
Returns:
the parent of self

setParent

public void setParent(Assertion parent)
Description copied from interface: Assertion
Sets the parent to argument

Specified by:
setParent in interface Assertion
Parameters:
parent - the parent that should be parent of self

isNormalized

public boolean isNormalized()
Description copied from interface: Assertion
Returns true if the assertion is in normalized form.

Specified by:
isNormalized in interface Assertion
Returns:
true if the assertion is in normalized form.

setNormalized

public void setNormalized(boolean flag)
Description copied from interface: Assertion
Marks this assertion as in normalized form.

Specified by:
setNormalized in interface Assertion
Parameters:
flag -

addTerm

public void addTerm(Assertion assertion)
Description copied from interface: Assertion
Adds an assertion as a term of this assertion.

Specified by:
addTerm in interface Assertion
Parameters:
assertion - the assertion to add as a term

addTerms

public void addTerms(java.util.List assertions)
Description copied from interface: Assertion
Adds a list of assertions as terms of this assertion.

Specified by:
addTerms in interface Assertion
Parameters:
assertions - the list of assertions to add as terms

getTerms

public java.util.List getTerms()
Description copied from interface: Assertion
Returns the list of terms of this assertion.

Specified by:
getTerms in interface Assertion
Returns:
list of terms

isEmpty

public boolean isEmpty()
Description copied from interface: Assertion
Returns true if there are no terms in this assertion.

Specified by:
isEmpty in interface Assertion
Returns:
true if there are no terms.

remove

public boolean remove(Assertion assertion)
Description copied from interface: Assertion
Removes the specified assertion from the terms list.

Specified by:
remove in interface Assertion
Parameters:
assertion - the assertion to remove from the terms list.
Returns:
true if it is removed from the child list.

size

public int size()
Description copied from interface: Assertion
Returns the number of terms of this assertion.

Specified by:
size in interface Assertion
Returns:
the no of terms of this assertion.

getType

public final short getType()
Returns a short value which indicate this is a PolicyReference.

Specified by:
getType in interface Assertion
Returns:
a short value to indicate that this is a PolicyReference.

setSource

public void setSource(java.lang.String source)
Description copied from interface: Assertion
Sets specified string as the source of the assertion.

Specified by:
setSource in interface Assertion
Parameters:
source - the string which describe the source of the origin of the assertion

getSource

public java.lang.String getSource()
Description copied from interface: Assertion
Returns a string which describes the source of the assertion. For instance name of the policy file that contains the assertion. Returns null if it is not set.

Specified by:
getSource in interface Assertion
Returns:
a string that describe the origin of the assertion.

setLineNo

public void setLineNo(int lineNo)
Description copied from interface: Assertion
Sets the line no of the assertion which should be the line no of the assertion in the file where the assertion is first read.

Specified by:
setLineNo in interface Assertion
Parameters:
lineNo -

getLineNo

public int getLineNo()
Description copied from interface: Assertion
Returns the line no of the assertion which is line no of the assertion in the file where the assertion is first read. came from. Returns -1 if it is not set.

Specified by:
getLineNo in interface Assertion
Returns:
the line no of the assertion in file where the assertion is first read.


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