org.apache.neethi
Class Policy

java.lang.Object
  extended by org.apache.neethi.AbstractPolicyOperator
      extended by org.apache.neethi.All
          extended by org.apache.neethi.Policy
All Implemented Interfaces:
PolicyComponent, PolicyOperator

public class Policy
extends All

Policy is a PolicyOperator that requires to satisfy all of its PolicyComponents. It is always the outermost component of a Policy.


Field Summary
 
Fields inherited from class org.apache.neethi.AbstractPolicyOperator
policyComponents
 
Constructor Summary
Policy()
           
Policy(PolicyOperator parent)
           
Policy(PolicyRegistry r)
           
Policy(PolicyRegistry r, String ns)
           
 
Method Summary
 void addAttribute(QName name, String value)
          Adds an attribute to self.
 Iterator<List<Assertion>> getAlternatives()
          Returns an Iterator that will return a list of assertions correspond to a Policy alternative if any.
 Iterator<List<Assertion>> getAlternatives(PolicyRegistry reg)
           
 String getAttribute(QName name)
          Returns the value of the attribute specified by the QName.
 Map<QName,String> getAttributes()
          Returns a Map of all attributes of self.
 String getId()
          Returns the Id attribute of self.
 String getName()
          Returns the Name attribute of self.
 String getNamespace()
           
 PolicyRegistry getPolicyRegistry()
           
 short getType()
          Returns Constants.TYPE_POLICY
 Policy intersect(Policy policy)
           
 Policy intersect(Policy policy, boolean strict)
           
 Policy merge(Policy policy)
          Returns a Policy that is the merge of specified Policy and self.
 Policy normalize(boolean deep)
          Returns a Normalized version of self.
 Policy normalize(PolicyRegistry reg, boolean deep)
          Returns a normalized version of self.If deep is set false then the assertions are not normalized and it returns a partially normalized version of self.
 void serialize(javax.xml.stream.XMLStreamWriter writer)
          Serializes the Policy to a XMLStreamWriter.
 void setId(String id)
          Sets the wsu:Id attribute of self.
 void setName(String name)
          Sets the Name attribute of self.
 void setPolicyRegistry(PolicyRegistry reg)
           
 
Methods inherited from class org.apache.neethi.All
addAssertion, getAssertions
 
Methods inherited from class org.apache.neethi.AbstractPolicyOperator
addPolicyComponent, addPolicyComponents, equal, getFirstPolicyComponent, getPolicyComponents, isEmpty, normalize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Policy

public Policy()

Policy

public Policy(PolicyRegistry r)

Policy

public Policy(PolicyRegistry r,
              String ns)

Policy

public Policy(PolicyOperator parent)
Method Detail

getPolicyRegistry

public PolicyRegistry getPolicyRegistry()

setPolicyRegistry

public void setPolicyRegistry(PolicyRegistry reg)

getNamespace

public String getNamespace()

normalize

public Policy normalize(boolean deep)
Returns a Normalized version of self. If deep is set false then the assertions are not normalized and it returns a partially normalized version of self.

Parameters:
deep - a flag to indicate whether to normalize the assertions
Returns:
a Policy that is normalized version of self

normalize

public Policy normalize(PolicyRegistry reg,
                        boolean deep)
Returns a normalized version of self.If deep is set false then the assertions are not normalized and it returns a partially normalized version of self.

Parameters:
reg - a PolicyRegistry from which the PolicyReferences are resolved
deep - a flag to indicate whether to normalize the assertions
Returns:
a normalized version of self

merge

public Policy merge(Policy policy)
Returns a Policy that is the merge of specified Policy and self.

Parameters:
policy - the Policy to be merged with self
Returns:
a Policy that is the merge of the specified Policy and self

intersect

public Policy intersect(Policy policy)

intersect

public Policy intersect(Policy policy,
                        boolean strict)

serialize

public void serialize(javax.xml.stream.XMLStreamWriter writer)
               throws javax.xml.stream.XMLStreamException
Serializes the Policy to a XMLStreamWriter.

Specified by:
serialize in interface PolicyComponent
Overrides:
serialize in class All
Parameters:
writer - the writer that the component should write itself
Throws:
javax.xml.stream.XMLStreamException - if an errors in the process of serialization of the PolicyComponent.

getType

public short getType()
Returns Constants.TYPE_POLICY

Specified by:
getType in interface PolicyComponent
Overrides:
getType in class All
Returns:
Constants.TYPE_POLICY for Policy type PolicyComponent Constants.TYPE_EXACTLYONE for ExactlyOne type PolicyComponent Constants.TYPE_ALL for All type PolicyComponent Constants.TYPE_ASSERTION for Assertion type PolicyComponent

getAlternatives

public Iterator<List<Assertion>> getAlternatives()
Returns an Iterator that will return a list of assertions correspond to a Policy alternative if any. The iterator.next() will return a list of assertions correspond to a Policy alternative if any and iterator.hasNext() will indicates whether there is another Policy alternative.

Returns:

getAlternatives

public Iterator<List<Assertion>> getAlternatives(PolicyRegistry reg)

addAttribute

public void addAttribute(QName name,
                         String value)
Adds an attribute to self.

Parameters:
name - the name of the attribute
value - the value of the attribute

getAttribute

public String getAttribute(QName name)
Returns the value of the attribute specified by the QName. Returns null if not present.

Parameters:
name - the QName of the attribute
Returns:
the value of the attribute specified by the QName

getAttributes

public Map<QName,String> getAttributes()
Returns a Map of all attributes of self.

Returns:
a Map of all attributes of self

setName

public void setName(String name)
Sets the Name attribute of self.

Parameters:
name - the Name attribute of self

getName

public String getName()
Returns the Name attribute of self.

Returns:
the Name attribute of self

setId

public void setId(String id)
Sets the wsu:Id attribute of self.

Parameters:
id - the Id attribute of self

getId

public String getId()
Returns the Id attribute of self.

Returns:
the Id attribute of self


Copyright © 2004-2012 The Apache Software Foundation. All Rights Reserved.