FileDocCategorySizeDatePackage
PolicyScope.javaAPI DocExample5592Tue May 29 16:56:34 BST 2007com.sun.xml.ws.policy

PolicyScope

public final class PolicyScope extends Object
A policy scope is a collection of equally ranked elements or subjects that hold policies

Fields Summary
private static final com.sun.xml.ws.policy.privateutil.PolicyLogger
LOGGER
private final List
subjects
Constructors Summary
PolicyScope(List initialSubjects)

    
       
        if (initialSubjects != null && !initialSubjects.isEmpty()) {
            this.subjects.addAll(initialSubjects);
        }
    
Methods Summary
voidattach(PolicySubject subject)

        if (subject == null) {
            throw LOGGER.logSevereException(new IllegalArgumentException(LocalizationMessages.WSP_0020_SUBJECT_PARAM_MUST_NOT_BE_NULL()));
        }
        
        subjects.add(subject);
    
voiddettachAllSubjects()

        subjects.clear();
    
PolicygetEffectivePolicy(PolicyMerger merger)
Returns all policies of the scope merged into one policy

return
effective policy of the scope

        final LinkedList<Policy> policies = new LinkedList<Policy>();
        for (PolicySubject subject : subjects) {
            policies.add(subject.getEffectivePolicy(merger));
        }
        return merger.merge(policies);
    
PolicygetEffectivePolicy(java.util.Collection namespaces, PolicyMerger merger)
Returns policies of the scope merged into one policy.

Only policies with vocabulary containing the namespaces provided are merged into effective policy.

return
effective policy with respect to the provided namespaces.

        final LinkedList<Policy> policies = new LinkedList<Policy>();
        for (PolicySubject subject: subjects) {
            policies.add(subject.getEffectivePolicy(namespaces, merger));
        }
        return merger.merge(policies);
    
java.util.CollectiongetPolicySubjects()
Returns all subjects contained by this scope

return
The subjects contained by this scope

        return this.subjects;
    
public java.lang.StringtoString()
An {@code Object.toString()} method override.

        return toString(0, new StringBuffer()).toString();
    
java.lang.StringBuffertoString(int indentLevel, java.lang.StringBuffer buffer)
A helper method that appends indented string representation of this instance to the input string buffer.

param
indentLevel indentation level to be used.
param
buffer buffer to be used for appending string representation of this instance
return
modified buffer containing new string representation of the instance

        final String indent = PolicyUtils.Text.createIndent(indentLevel);
        
        buffer.append(indent).append("policy scope {").append(PolicyUtils.Text.NEW_LINE);
        for (PolicySubject policySubject : subjects) {
            policySubject.toString(indentLevel + 1, buffer).append(PolicyUtils.Text.NEW_LINE);
        }        
        buffer.append(indent).append('}");
        
        return buffer;