com.sun.xml.internal.ws.policy.privateutil.PolicyUtils Java Examples
The following examples show how to use
com.sun.xml.internal.ws.policy.privateutil.PolicyUtils.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AssertionSet.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * 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 */ StringBuffer toString(final int indentLevel, final StringBuffer buffer) { final String indent = PolicyUtils.Text.createIndent(indentLevel); final String innerIndent = PolicyUtils.Text.createIndent(indentLevel + 1); buffer.append(indent).append("assertion set {").append(PolicyUtils.Text.NEW_LINE); if (assertions.isEmpty()) { buffer.append(innerIndent).append("no assertions").append(PolicyUtils.Text.NEW_LINE); } else { for (PolicyAssertion assertion : assertions) { assertion.toString(indentLevel + 1, buffer).append(PolicyUtils.Text.NEW_LINE); } } buffer.append(indent).append('}'); return buffer; }
Example #2
Source File: AssertionSet.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * 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 */ StringBuffer toString(final int indentLevel, final StringBuffer buffer) { final String indent = PolicyUtils.Text.createIndent(indentLevel); final String innerIndent = PolicyUtils.Text.createIndent(indentLevel + 1); buffer.append(indent).append("assertion set {").append(PolicyUtils.Text.NEW_LINE); if (assertions.isEmpty()) { buffer.append(innerIndent).append("no assertions").append(PolicyUtils.Text.NEW_LINE); } else { for (PolicyAssertion assertion : assertions) { assertion.toString(indentLevel + 1, buffer).append(PolicyUtils.Text.NEW_LINE); } } buffer.append(indent).append('}'); return buffer; }
Example #3
Source File: AssertionSet.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * 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 */ StringBuffer toString(final int indentLevel, final StringBuffer buffer) { final String indent = PolicyUtils.Text.createIndent(indentLevel); final String innerIndent = PolicyUtils.Text.createIndent(indentLevel + 1); buffer.append(indent).append("assertion set {").append(PolicyUtils.Text.NEW_LINE); if (assertions.isEmpty()) { buffer.append(innerIndent).append("no assertions").append(PolicyUtils.Text.NEW_LINE); } else { for (PolicyAssertion assertion : assertions) { assertion.toString(indentLevel + 1, buffer).append(PolicyUtils.Text.NEW_LINE); } } buffer.append(indent).append('}'); return buffer; }
Example #4
Source File: PolicyReferenceData.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * 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 */ public StringBuffer toString(final int indentLevel, final StringBuffer buffer) { final String indent = PolicyUtils.Text.createIndent(indentLevel); final String innerIndent = PolicyUtils.Text.createIndent(indentLevel + 1); buffer.append(indent).append("reference data {").append(PolicyUtils.Text.NEW_LINE); buffer.append(innerIndent).append("referenced policy model URI = '").append(referencedModelUri).append('\'').append(PolicyUtils.Text.NEW_LINE); if (digest == null) { buffer.append(innerIndent).append("no digest specified").append(PolicyUtils.Text.NEW_LINE); } else { buffer.append(innerIndent).append("digest algorith URI = '").append(digestAlgorithmUri).append('\'').append(PolicyUtils.Text.NEW_LINE); buffer.append(innerIndent).append("digest = '").append(digest).append('\'').append(PolicyUtils.Text.NEW_LINE); } buffer.append(indent).append('}'); return buffer; }
Example #5
Source File: PolicyWSDLParserExtension.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private boolean readExternalFile(final String fileUrl) { InputStream ios = null; XMLStreamReader reader = null; try { final URL xmlURL = new URL(fileUrl); ios = xmlURL.openStream(); reader = XmlUtil.newXMLInputFactory(true).createXMLStreamReader(ios); while (reader.hasNext()) { if (reader.isStartElement() && NamespaceVersion.resolveAsToken(reader.getName()) == XmlToken.Policy) { readSinglePolicy(policyReader.readPolicyElement(reader, fileUrl), false); } reader.next(); } return true; } catch (IOException ioe) { return false; } catch (XMLStreamException xmlse) { return false; } finally { PolicyUtils.IO.closeResource(reader); PolicyUtils.IO.closeResource(ios); } }
Example #6
Source File: Policy.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Constructor that should be overridden by child implementation. The constructor allows for easy toString() output * customization. * * @param nsVersion Policy namespace version to be used when marshalling the policy expression * @param toStringName a general name of the object (such as 'policy' or 'nested policy') that will be used in the * toString() method to identify the object. * @param sets represents the collection of policy alternatives of the policy object created. During the creation of * the new policy object, the content of the alternatives collection is copied into an internal policy object structure, * thus any subsequent operations on the collection will have no impact on the newly constructed policy object. The * collection may be {@code null} or empty. In such case a 'NULL' policy object is constructed. */ Policy(final NamespaceVersion nsVersion, final String toStringName, final Collection<AssertionSet> sets) { this.nsVersion = nsVersion; this.toStringName = toStringName; if (sets == null || sets.isEmpty()) { this.assertionSets = NULL_POLICY_ASSERTION_SETS; this.vocabulary = EMPTY_VOCABULARY; this.immutableVocabulary = EMPTY_VOCABULARY; } else { this.assertionSets = new LinkedList<AssertionSet>(); this.vocabulary = new TreeSet<QName>(PolicyUtils.Comparison.QNAME_COMPARATOR); this.immutableVocabulary = Collections.unmodifiableCollection(this.vocabulary); addAll(sets); } }
Example #7
Source File: Policy.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Constructor that should be overridden by child implementation. The constructor allows for easy toString() output * customization. * * @param nsVersion Policy namespace version to be used when marshalling the policy expression * @param toStringName a general name of the object (such as 'policy' or 'nested policy') that will be used in the * toString() method to identify the object. * @param sets represents the collection of policy alternatives of the policy object created. During the creation of * the new policy object, the content of the alternatives collection is copied into an internal policy object structure, * thus any subsequent operations on the collection will have no impact on the newly constructed policy object. The * collection may be {@code null} or empty. In such case a 'NULL' policy object is constructed. */ Policy(final NamespaceVersion nsVersion, final String toStringName, final Collection<AssertionSet> sets) { this.nsVersion = nsVersion; this.toStringName = toStringName; if (sets == null || sets.isEmpty()) { this.assertionSets = NULL_POLICY_ASSERTION_SETS; this.vocabulary = EMPTY_VOCABULARY; this.immutableVocabulary = EMPTY_VOCABULARY; } else { this.assertionSets = new LinkedList<AssertionSet>(); this.vocabulary = new TreeSet<QName>(PolicyUtils.Comparison.QNAME_COMPARATOR); this.immutableVocabulary = Collections.unmodifiableCollection(this.vocabulary); addAll(sets); } }
Example #8
Source File: Policy.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Constructor that should be overridden by child implementation. The constructor allows for easy toString() output * customization. * * @param toStringName a general name of the object (such as 'policy' or 'nested policy') that will be used in the * toString() method to identify the object. * @param sets represents the collection of policy alternatives of the policy object created. During the creation of * the new policy object, the content of the alternatives collection is copied into an internal policy object structure, * thus any subsequent operations on the collection will have no impact on the newly constructed policy object. The * collection may be {@code null} or empty. In such case a 'NULL' policy object is constructed. */ Policy(final String toStringName, final Collection<AssertionSet> sets) { this.nsVersion = NamespaceVersion.getLatestVersion(); this.toStringName = toStringName; if (sets == null || sets.isEmpty()) { this.assertionSets = NULL_POLICY_ASSERTION_SETS; this.vocabulary = EMPTY_VOCABULARY; this.immutableVocabulary = EMPTY_VOCABULARY; } else { this.assertionSets = new LinkedList<AssertionSet>(); this.vocabulary = new TreeSet<QName>(PolicyUtils.Comparison.QNAME_COMPARATOR); this.immutableVocabulary = Collections.unmodifiableCollection(this.vocabulary); addAll(sets); } }
Example #9
Source File: PolicyWSDLParserExtension.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private boolean readExternalFile(final String fileUrl) { InputStream ios = null; XMLStreamReader reader = null; try { final URL xmlURL = new URL(fileUrl); ios = xmlURL.openStream(); reader = XmlUtil.newXMLInputFactory(true).createXMLStreamReader(ios); while (reader.hasNext()) { if (reader.isStartElement() && NamespaceVersion.resolveAsToken(reader.getName()) == XmlToken.Policy) { readSinglePolicy(policyReader.readPolicyElement(reader, fileUrl), false); } reader.next(); } return true; } catch (IOException ioe) { return false; } catch (XMLStreamException xmlse) { return false; } finally { PolicyUtils.IO.closeResource(reader); PolicyUtils.IO.closeResource(ios); } }
Example #10
Source File: Policy.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Constructor that should be overridden by child implementation. The constructor allows for easy toString() output * customization. * * @param toStringName a general name of the object (such as 'policy' or 'nested policy') that will be used in the * toString() method to identify the object. * @param sets represents the collection of policy alternatives of the policy object created. During the creation of * the new policy object, the content of the alternatives collection is copied into an internal policy object structure, * thus any subsequent operations on the collection will have no impact on the newly constructed policy object. The * collection may be {@code null} or empty. In such case a 'NULL' policy object is constructed. */ Policy(final String toStringName, final Collection<AssertionSet> sets) { this.nsVersion = NamespaceVersion.getLatestVersion(); this.toStringName = toStringName; if (sets == null || sets.isEmpty()) { this.assertionSets = NULL_POLICY_ASSERTION_SETS; this.vocabulary = EMPTY_VOCABULARY; this.immutableVocabulary = EMPTY_VOCABULARY; } else { this.assertionSets = new LinkedList<AssertionSet>(); this.vocabulary = new TreeSet<QName>(PolicyUtils.Comparison.QNAME_COMPARATOR); this.immutableVocabulary = Collections.unmodifiableCollection(this.vocabulary); addAll(sets); } }
Example #11
Source File: PolicyReferenceData.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * 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 */ public StringBuffer toString(final int indentLevel, final StringBuffer buffer) { final String indent = PolicyUtils.Text.createIndent(indentLevel); final String innerIndent = PolicyUtils.Text.createIndent(indentLevel + 1); buffer.append(indent).append("reference data {").append(PolicyUtils.Text.NEW_LINE); buffer.append(innerIndent).append("referenced policy model URI = '").append(referencedModelUri).append('\'').append(PolicyUtils.Text.NEW_LINE); if (digest == null) { buffer.append(innerIndent).append("no digest specified").append(PolicyUtils.Text.NEW_LINE); } else { buffer.append(innerIndent).append("digest algorith URI = '").append(digestAlgorithmUri).append('\'').append(PolicyUtils.Text.NEW_LINE); buffer.append(innerIndent).append("digest = '").append(digest).append('\'').append(PolicyUtils.Text.NEW_LINE); } buffer.append(indent).append('}'); return buffer; }
Example #12
Source File: PolicyReferenceData.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * 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 */ public StringBuffer toString(final int indentLevel, final StringBuffer buffer) { final String indent = PolicyUtils.Text.createIndent(indentLevel); final String innerIndent = PolicyUtils.Text.createIndent(indentLevel + 1); buffer.append(indent).append("reference data {").append(PolicyUtils.Text.NEW_LINE); buffer.append(innerIndent).append("referenced policy model URI = '").append(referencedModelUri).append('\'').append(PolicyUtils.Text.NEW_LINE); if (digest == null) { buffer.append(innerIndent).append("no digest specified").append(PolicyUtils.Text.NEW_LINE); } else { buffer.append(innerIndent).append("digest algorith URI = '").append(digestAlgorithmUri).append('\'').append(PolicyUtils.Text.NEW_LINE); buffer.append(innerIndent).append("digest = '").append(digest).append('\'').append(PolicyUtils.Text.NEW_LINE); } buffer.append(indent).append('}'); return buffer; }
Example #13
Source File: Policy.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Constructor that should be overridden by child implementation. The constructor allows for easy toString() output * customization. * * @param toStringName a general name of the object (such as 'policy' or 'nested policy') that will be used in the * toString() method to identify the object. * @param sets represents the collection of policy alternatives of the policy object created. During the creation of * the new policy object, the content of the alternatives collection is copied into an internal policy object structure, * thus any subsequent operations on the collection will have no impact on the newly constructed policy object. The * collection may be {@code null} or empty. In such case a 'NULL' policy object is constructed. */ Policy(final String toStringName, final Collection<AssertionSet> sets) { this.nsVersion = NamespaceVersion.getLatestVersion(); this.toStringName = toStringName; if (sets == null || sets.isEmpty()) { this.assertionSets = NULL_POLICY_ASSERTION_SETS; this.vocabulary = EMPTY_VOCABULARY; this.immutableVocabulary = EMPTY_VOCABULARY; } else { this.assertionSets = new LinkedList<AssertionSet>(); this.vocabulary = new TreeSet<QName>(PolicyUtils.Comparison.QNAME_COMPARATOR); this.immutableVocabulary = Collections.unmodifiableCollection(this.vocabulary); addAll(sets); } }
Example #14
Source File: PolicyWSDLParserExtension.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
private boolean readExternalFile(final String fileUrl) { InputStream ios = null; XMLStreamReader reader = null; try { final URL xmlURL = new URL(fileUrl); ios = xmlURL.openStream(); reader = XmlUtil.newXMLInputFactory(true).createXMLStreamReader(ios); while (reader.hasNext()) { if (reader.isStartElement() && NamespaceVersion.resolveAsToken(reader.getName()) == XmlToken.Policy) { readSinglePolicy(policyReader.readPolicyElement(reader, fileUrl), false); } reader.next(); } return true; } catch (IOException ioe) { return false; } catch (XMLStreamException xmlse) { return false; } finally { PolicyUtils.IO.closeResource(reader); PolicyUtils.IO.closeResource(ios); } }
Example #15
Source File: AssertionSet.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * 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 */ StringBuffer toString(final int indentLevel, final StringBuffer buffer) { final String indent = PolicyUtils.Text.createIndent(indentLevel); final String innerIndent = PolicyUtils.Text.createIndent(indentLevel + 1); buffer.append(indent).append("assertion set {").append(PolicyUtils.Text.NEW_LINE); if (assertions.isEmpty()) { buffer.append(innerIndent).append("no assertions").append(PolicyUtils.Text.NEW_LINE); } else { for (PolicyAssertion assertion : assertions) { assertion.toString(indentLevel + 1, buffer).append(PolicyUtils.Text.NEW_LINE); } } buffer.append(indent).append('}'); return buffer; }
Example #16
Source File: PolicyWSDLParserExtension.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private boolean readExternalFile(final String fileUrl) { InputStream ios = null; XMLStreamReader reader = null; try { final URL xmlURL = new URL(fileUrl); ios = xmlURL.openStream(); reader = XmlUtil.newXMLInputFactory(true).createXMLStreamReader(ios); while (reader.hasNext()) { if (reader.isStartElement() && NamespaceVersion.resolveAsToken(reader.getName()) == XmlToken.Policy) { readSinglePolicy(policyReader.readPolicyElement(reader, fileUrl), false); } reader.next(); } return true; } catch (IOException ioe) { return false; } catch (XMLStreamException xmlse) { return false; } finally { PolicyUtils.IO.closeResource(reader); PolicyUtils.IO.closeResource(ios); } }
Example #17
Source File: Policy.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Constructor that should be overridden by child implementation. The constructor allows for easy toString() output * customization. * * @param nsVersion Policy namespace version to be used when marshalling the policy expression * @param toStringName a general name of the object (such as 'policy' or 'nested policy') that will be used in the * toString() method to identify the object. * @param sets represents the collection of policy alternatives of the policy object created. During the creation of * the new policy object, the content of the alternatives collection is copied into an internal policy object structure, * thus any subsequent operations on the collection will have no impact on the newly constructed policy object. The * collection may be {@code null} or empty. In such case a 'NULL' policy object is constructed. */ Policy(final NamespaceVersion nsVersion, final String toStringName, final Collection<AssertionSet> sets) { this.nsVersion = nsVersion; this.toStringName = toStringName; if (sets == null || sets.isEmpty()) { this.assertionSets = NULL_POLICY_ASSERTION_SETS; this.vocabulary = EMPTY_VOCABULARY; this.immutableVocabulary = EMPTY_VOCABULARY; } else { this.assertionSets = new LinkedList<AssertionSet>(); this.vocabulary = new TreeSet<QName>(PolicyUtils.Comparison.QNAME_COMPARATOR); this.immutableVocabulary = Collections.unmodifiableCollection(this.vocabulary); addAll(sets); } }
Example #18
Source File: Policy.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Constructor that should be overridden by child implementation. The constructor allows for easy toString() output * customization. * * @param toStringName a general name of the object (such as 'policy' or 'nested policy') that will be used in the * toString() method to identify the object. * @param sets represents the collection of policy alternatives of the policy object created. During the creation of * the new policy object, the content of the alternatives collection is copied into an internal policy object structure, * thus any subsequent operations on the collection will have no impact on the newly constructed policy object. The * collection may be {@code null} or empty. In such case a 'NULL' policy object is constructed. */ Policy(final String toStringName, final Collection<AssertionSet> sets) { this.nsVersion = NamespaceVersion.getLatestVersion(); this.toStringName = toStringName; if (sets == null || sets.isEmpty()) { this.assertionSets = NULL_POLICY_ASSERTION_SETS; this.vocabulary = EMPTY_VOCABULARY; this.immutableVocabulary = EMPTY_VOCABULARY; } else { this.assertionSets = new LinkedList<AssertionSet>(); this.vocabulary = new TreeSet<QName>(PolicyUtils.Comparison.QNAME_COMPARATOR); this.immutableVocabulary = Collections.unmodifiableCollection(this.vocabulary); addAll(sets); } }
Example #19
Source File: PolicyReferenceData.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * 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 */ public StringBuffer toString(final int indentLevel, final StringBuffer buffer) { final String indent = PolicyUtils.Text.createIndent(indentLevel); final String innerIndent = PolicyUtils.Text.createIndent(indentLevel + 1); buffer.append(indent).append("reference data {").append(PolicyUtils.Text.NEW_LINE); buffer.append(innerIndent).append("referenced policy model URI = '").append(referencedModelUri).append('\'').append(PolicyUtils.Text.NEW_LINE); if (digest == null) { buffer.append(innerIndent).append("no digest specified").append(PolicyUtils.Text.NEW_LINE); } else { buffer.append(innerIndent).append("digest algorith URI = '").append(digestAlgorithmUri).append('\'').append(PolicyUtils.Text.NEW_LINE); buffer.append(innerIndent).append("digest = '").append(digest).append('\'').append(PolicyUtils.Text.NEW_LINE); } buffer.append(indent).append('}'); return buffer; }
Example #20
Source File: PolicyReferenceData.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * 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 */ public StringBuffer toString(final int indentLevel, final StringBuffer buffer) { final String indent = PolicyUtils.Text.createIndent(indentLevel); final String innerIndent = PolicyUtils.Text.createIndent(indentLevel + 1); buffer.append(indent).append("reference data {").append(PolicyUtils.Text.NEW_LINE); buffer.append(innerIndent).append("referenced policy model URI = '").append(referencedModelUri).append('\'').append(PolicyUtils.Text.NEW_LINE); if (digest == null) { buffer.append(innerIndent).append("no digest specified").append(PolicyUtils.Text.NEW_LINE); } else { buffer.append(innerIndent).append("digest algorith URI = '").append(digestAlgorithmUri).append('\'').append(PolicyUtils.Text.NEW_LINE); buffer.append(innerIndent).append("digest = '").append(digest).append('\'').append(PolicyUtils.Text.NEW_LINE); } buffer.append(indent).append('}'); return buffer; }
Example #21
Source File: Policy.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Constructor that should be overridden by child implementation. The constructor allows for easy toString() output * customization. * * @param toStringName a general name of the object (such as 'policy' or 'nested policy') that will be used in the * toString() method to identify the object. * @param sets represents the collection of policy alternatives of the policy object created. During the creation of * the new policy object, the content of the alternatives collection is copied into an internal policy object structure, * thus any subsequent operations on the collection will have no impact on the newly constructed policy object. The * collection may be {@code null} or empty. In such case a 'NULL' policy object is constructed. */ Policy(final String toStringName, final Collection<AssertionSet> sets) { this.nsVersion = NamespaceVersion.getLatestVersion(); this.toStringName = toStringName; if (sets == null || sets.isEmpty()) { this.assertionSets = NULL_POLICY_ASSERTION_SETS; this.vocabulary = EMPTY_VOCABULARY; this.immutableVocabulary = EMPTY_VOCABULARY; } else { this.assertionSets = new LinkedList<AssertionSet>(); this.vocabulary = new TreeSet<QName>(PolicyUtils.Comparison.QNAME_COMPARATOR); this.immutableVocabulary = Collections.unmodifiableCollection(this.vocabulary); addAll(sets); } }
Example #22
Source File: Policy.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Constructor that should be overridden by child implementation. The constructor allows for easy toString() output * customization. * * @param nsVersion Policy namespace version to be used when marshalling the policy expression * @param toStringName a general name of the object (such as 'policy' or 'nested policy') that will be used in the * toString() method to identify the object. * @param sets represents the collection of policy alternatives of the policy object created. During the creation of * the new policy object, the content of the alternatives collection is copied into an internal policy object structure, * thus any subsequent operations on the collection will have no impact on the newly constructed policy object. The * collection may be {@code null} or empty. In such case a 'NULL' policy object is constructed. */ Policy(final NamespaceVersion nsVersion, final String toStringName, final Collection<AssertionSet> sets) { this.nsVersion = nsVersion; this.toStringName = toStringName; if (sets == null || sets.isEmpty()) { this.assertionSets = NULL_POLICY_ASSERTION_SETS; this.vocabulary = EMPTY_VOCABULARY; this.immutableVocabulary = EMPTY_VOCABULARY; } else { this.assertionSets = new LinkedList<AssertionSet>(); this.vocabulary = new TreeSet<QName>(PolicyUtils.Comparison.QNAME_COMPARATOR); this.immutableVocabulary = Collections.unmodifiableCollection(this.vocabulary); addAll(sets); } }
Example #23
Source File: AssertionSet.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * 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 */ StringBuffer toString(final int indentLevel, final StringBuffer buffer) { final String indent = PolicyUtils.Text.createIndent(indentLevel); final String innerIndent = PolicyUtils.Text.createIndent(indentLevel + 1); buffer.append(indent).append("assertion set {").append(PolicyUtils.Text.NEW_LINE); if (assertions.isEmpty()) { buffer.append(innerIndent).append("no assertions").append(PolicyUtils.Text.NEW_LINE); } else { for (PolicyAssertion assertion : assertions) { assertion.toString(indentLevel + 1, buffer).append(PolicyUtils.Text.NEW_LINE); } } buffer.append(indent).append('}'); return buffer; }
Example #24
Source File: PolicyWSDLParserExtension.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private boolean readExternalFile(final String fileUrl) { InputStream ios = null; XMLStreamReader reader = null; try { final URL xmlURL = new URL(fileUrl); ios = xmlURL.openStream(); reader = XmlUtil.newXMLInputFactory(true).createXMLStreamReader(ios); while (reader.hasNext()) { if (reader.isStartElement() && NamespaceVersion.resolveAsToken(reader.getName()) == XmlToken.Policy) { readSinglePolicy(policyReader.readPolicyElement(reader, fileUrl), false); } reader.next(); } return true; } catch (IOException ioe) { return false; } catch (XMLStreamException xmlse) { return false; } finally { PolicyUtils.IO.closeResource(reader); PolicyUtils.IO.closeResource(ios); } }
Example #25
Source File: Policy.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Constructor that should be overridden by child implementation. The constructor allows for easy toString() output * customization. * * @param nsVersion Policy namespace version to be used when marshalling the policy expression * @param toStringName a general name of the object (such as 'policy' or 'nested policy') that will be used in the * toString() method to identify the object. * @param sets represents the collection of policy alternatives of the policy object created. During the creation of * the new policy object, the content of the alternatives collection is copied into an internal policy object structure, * thus any subsequent operations on the collection will have no impact on the newly constructed policy object. The * collection may be {@code null} or empty. In such case a 'NULL' policy object is constructed. */ Policy(final NamespaceVersion nsVersion, final String toStringName, final Collection<AssertionSet> sets) { this.nsVersion = nsVersion; this.toStringName = toStringName; if (sets == null || sets.isEmpty()) { this.assertionSets = NULL_POLICY_ASSERTION_SETS; this.vocabulary = EMPTY_VOCABULARY; this.immutableVocabulary = EMPTY_VOCABULARY; } else { this.assertionSets = new LinkedList<AssertionSet>(); this.vocabulary = new TreeSet<QName>(PolicyUtils.Comparison.QNAME_COMPARATOR); this.immutableVocabulary = Collections.unmodifiableCollection(this.vocabulary); addAll(sets); } }
Example #26
Source File: PolicyMerger.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Takes collection of policies and merges them into a single policy using algorithm described in * WS-PolicyAttachment specification. None of the original policies in the collection are modified in * any way. * * The newly created policy has an ID that is a concatentation of all merged policy IDs. * * @param policies collection of policies to be merged. The collection must not contain '{@code null}' elements! * @return merged policy containing combination of policy alternatives stored in all input policies. * If provided collection of policies is {@code null} or empty, returns {@code null}. If provided * collection of policies contains only single policy, the policy is returned. */ public Policy merge(final Collection<Policy> policies) { if (policies == null || policies.isEmpty()) { return null; } else if (policies.size() == 1) { return policies.iterator().next(); } final Collection<Collection<AssertionSet>> alternativeSets = new LinkedList<Collection<AssertionSet>>(); final StringBuilder id = new StringBuilder(); NamespaceVersion mergedVersion = policies.iterator().next().getNamespaceVersion(); for (Policy policy : policies) { alternativeSets.add(policy.getContent()); if (mergedVersion.compareTo(policy.getNamespaceVersion()) < 0) { mergedVersion = policy.getNamespaceVersion(); } final String policyId = policy.getId(); if (policyId != null) { if (id.length() > 0) { id.append('-'); } id.append(policyId); } } final Collection<Collection<AssertionSet>> combinedAlternatives = PolicyUtils.Collections.combine(null, alternativeSets, false); if (combinedAlternatives == null || combinedAlternatives.isEmpty()) { return Policy.createNullPolicy(mergedVersion, null, id.length() == 0 ? null : id.toString()); } else { final Collection<AssertionSet> mergedSetList = new ArrayList<AssertionSet>(combinedAlternatives.size()); for (Collection<AssertionSet> toBeMerged : combinedAlternatives) { mergedSetList.add(AssertionSet.createMergedAssertionSet(toBeMerged)); } return Policy.createPolicy(mergedVersion, null, id.length() == 0 ? null : id.toString(), mergedSetList); } }
Example #27
Source File: PolicySourceModel.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Returns a string representation of the object. In general, the <code>toString</code> method * returns a string that "textually represents" this object. * * @return a string representation of the object. */ @Override public String toString() { final String innerIndent = PolicyUtils.Text.createIndent(1); final StringBuffer buffer = new StringBuffer(60); buffer.append("Policy source model {").append(PolicyUtils.Text.NEW_LINE); buffer.append(innerIndent).append("policy id = '").append(policyId).append('\'').append(PolicyUtils.Text.NEW_LINE); buffer.append(innerIndent).append("policy name = '").append(policyName).append('\'').append(PolicyUtils.Text.NEW_LINE); rootNode.toString(1, buffer).append(PolicyUtils.Text.NEW_LINE).append('}'); return buffer.toString(); }
Example #28
Source File: PolicySubject.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * 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 */ StringBuffer toString(final int indentLevel, final StringBuffer buffer) { final String indent = PolicyUtils.Text.createIndent(indentLevel); final String innerIndent = PolicyUtils.Text.createIndent(indentLevel + 1); buffer.append(indent).append("policy subject {").append(PolicyUtils.Text.NEW_LINE); buffer.append(innerIndent).append("subject = '").append(subject).append('\'').append(PolicyUtils.Text.NEW_LINE); for (Policy policy : policies) { policy.toString(indentLevel + 1, buffer).append(PolicyUtils.Text.NEW_LINE); } buffer.append(indent).append('}'); return buffer; }
Example #29
Source File: AssertionData.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * 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 */ public StringBuffer toString(final int indentLevel, final StringBuffer buffer) { final String indent = PolicyUtils.Text.createIndent(indentLevel); final String innerIndent = PolicyUtils.Text.createIndent(indentLevel + 1); final String innerDoubleIndent = PolicyUtils.Text.createIndent(indentLevel + 2); buffer.append(indent); if (type == ModelNode.Type.ASSERTION) { buffer.append("assertion data {"); } else { buffer.append("assertion parameter data {"); } buffer.append(PolicyUtils.Text.NEW_LINE); buffer.append(innerIndent).append("namespace = '").append(name.getNamespaceURI()).append('\'').append(PolicyUtils.Text.NEW_LINE); buffer.append(innerIndent).append("prefix = '").append(name.getPrefix()).append('\'').append(PolicyUtils.Text.NEW_LINE); buffer.append(innerIndent).append("local name = '").append(name.getLocalPart()).append('\'').append(PolicyUtils.Text.NEW_LINE); buffer.append(innerIndent).append("value = '").append(value).append('\'').append(PolicyUtils.Text.NEW_LINE); buffer.append(innerIndent).append("optional = '").append(optional).append('\'').append(PolicyUtils.Text.NEW_LINE); buffer.append(innerIndent).append("ignorable = '").append(ignorable).append('\'').append(PolicyUtils.Text.NEW_LINE); synchronized (attributes) { if (attributes.isEmpty()) { buffer.append(innerIndent).append("no attributes"); } else { buffer.append(innerIndent).append("attributes {").append(PolicyUtils.Text.NEW_LINE); for(Map.Entry<QName, String> entry : attributes.entrySet()) { final QName aName = entry.getKey(); buffer.append(innerDoubleIndent).append("name = '").append(aName.getNamespaceURI()).append(':').append(aName.getLocalPart()); buffer.append("', value = '").append(entry.getValue()).append('\'').append(PolicyUtils.Text.NEW_LINE); } buffer.append(innerIndent).append('}'); } } buffer.append(PolicyUtils.Text.NEW_LINE).append(indent).append('}'); return buffer; }
Example #30
Source File: PolicySubject.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * 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 */ StringBuffer toString(final int indentLevel, final StringBuffer buffer) { final String indent = PolicyUtils.Text.createIndent(indentLevel); final String innerIndent = PolicyUtils.Text.createIndent(indentLevel + 1); buffer.append(indent).append("policy subject {").append(PolicyUtils.Text.NEW_LINE); buffer.append(innerIndent).append("subject = '").append(subject).append('\'').append(PolicyUtils.Text.NEW_LINE); for (Policy policy : policies) { policy.toString(indentLevel + 1, buffer).append(PolicyUtils.Text.NEW_LINE); } buffer.append(indent).append('}'); return buffer; }