com.sun.xml.internal.ws.api.policy.ModelGenerator Java Examples

The following examples show how to use com.sun.xml.internal.ws.api.policy.ModelGenerator. 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: PolicyWSDLGeneratorExtension.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Adds a PolicyReference element that points to the policy of the element,
 * if the policy does not have any id or name. Writes policy inside the element otherwise.
 *
 * @param subject
 *      PolicySubject to be referenced or marshalled
 * @param writer
 *      A TXW on to which we shall add the PolicyReference
 */
private void writePolicyOrReferenceIt(final PolicySubject subject, final TypedXmlWriter writer) {
    final Policy policy;
    try {
        policy = subject.getEffectivePolicy(merger);
    } catch (PolicyException e) {
        throw LOGGER.logSevereException(new WebServiceException(PolicyMessages.WSP_1011_FAILED_TO_RETRIEVE_EFFECTIVE_POLICY_FOR_SUBJECT(subject.toString()), e));
    }
    if (policy != null) {
        if (null == policy.getIdOrName()) {
            final PolicyModelGenerator generator = ModelGenerator.getGenerator();
            try {
                final PolicySourceModel policyInfoset = generator.translate(policy);
                marshaller.marshal(policyInfoset, writer);
            } catch (PolicyException pe) {
                throw LOGGER.logSevereException(new WebServiceException(PolicyMessages.WSP_1002_UNABLE_TO_MARSHALL_POLICY_OR_POLICY_REFERENCE(), pe));
            }
        } else {
            final TypedXmlWriter policyReference = writer._element(policy.getNamespaceVersion().asQName(XmlToken.PolicyReference), TypedXmlWriter.class);
            policyReference._attribute(XmlToken.Uri.toString(), '#' + policy.getIdOrName());
        }
    }
}
 
Example #2
Source File: PolicyWSDLGeneratorExtension.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Adds a PolicyReference element that points to the policy of the element,
 * if the policy does not have any id or name. Writes policy inside the element otherwise.
 *
 * @param subject
 *      PolicySubject to be referenced or marshalled
 * @param writer
 *      A TXW on to which we shall add the PolicyReference
 */
private void writePolicyOrReferenceIt(final PolicySubject subject, final TypedXmlWriter writer) {
    final Policy policy;
    try {
        policy = subject.getEffectivePolicy(merger);
    } catch (PolicyException e) {
        throw LOGGER.logSevereException(new WebServiceException(PolicyMessages.WSP_1011_FAILED_TO_RETRIEVE_EFFECTIVE_POLICY_FOR_SUBJECT(subject.toString()), e));
    }
    if (policy != null) {
        if (null == policy.getIdOrName()) {
            final PolicyModelGenerator generator = ModelGenerator.getGenerator();
            try {
                final PolicySourceModel policyInfoset = generator.translate(policy);
                marshaller.marshal(policyInfoset, writer);
            } catch (PolicyException pe) {
                throw LOGGER.logSevereException(new WebServiceException(PolicyMessages.WSP_1002_UNABLE_TO_MARSHALL_POLICY_OR_POLICY_REFERENCE(), pe));
            }
        } else {
            final TypedXmlWriter policyReference = writer._element(policy.getNamespaceVersion().asQName(XmlToken.PolicyReference), TypedXmlWriter.class);
            policyReference._attribute(XmlToken.Uri.toString(), '#' + policy.getIdOrName());
        }
    }
}
 
Example #3
Source File: PolicyWSDLGeneratorExtension.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Adds a PolicyReference element that points to the policy of the element,
 * if the policy does not have any id or name. Writes policy inside the element otherwise.
 *
 * @param subject
 *      PolicySubject to be referenced or marshalled
 * @param writer
 *      A TXW on to which we shall add the PolicyReference
 */
private void writePolicyOrReferenceIt(final PolicySubject subject, final TypedXmlWriter writer) {
    final Policy policy;
    try {
        policy = subject.getEffectivePolicy(merger);
    } catch (PolicyException e) {
        throw LOGGER.logSevereException(new WebServiceException(PolicyMessages.WSP_1011_FAILED_TO_RETRIEVE_EFFECTIVE_POLICY_FOR_SUBJECT(subject.toString()), e));
    }
    if (policy != null) {
        if (null == policy.getIdOrName()) {
            final PolicyModelGenerator generator = ModelGenerator.getGenerator();
            try {
                final PolicySourceModel policyInfoset = generator.translate(policy);
                marshaller.marshal(policyInfoset, writer);
            } catch (PolicyException pe) {
                throw LOGGER.logSevereException(new WebServiceException(PolicyMessages.WSP_1002_UNABLE_TO_MARSHALL_POLICY_OR_POLICY_REFERENCE(), pe));
            }
        } else {
            final TypedXmlWriter policyReference = writer._element(policy.getNamespaceVersion().asQName(XmlToken.PolicyReference), TypedXmlWriter.class);
            policyReference._attribute(XmlToken.Uri.toString(), '#' + policy.getIdOrName());
        }
    }
}
 
Example #4
Source File: PolicyWSDLGeneratorExtension.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Adds a PolicyReference element that points to the policy of the element,
 * if the policy does not have any id or name. Writes policy inside the element otherwise.
 *
 * @param subject
 *      PolicySubject to be referenced or marshalled
 * @param writer
 *      A TXW on to which we shall add the PolicyReference
 */
private void writePolicyOrReferenceIt(final PolicySubject subject, final TypedXmlWriter writer) {
    final Policy policy;
    try {
        policy = subject.getEffectivePolicy(merger);
    } catch (PolicyException e) {
        throw LOGGER.logSevereException(new WebServiceException(PolicyMessages.WSP_1011_FAILED_TO_RETRIEVE_EFFECTIVE_POLICY_FOR_SUBJECT(subject.toString()), e));
    }
    if (policy != null) {
        if (null == policy.getIdOrName()) {
            final PolicyModelGenerator generator = ModelGenerator.getGenerator();
            try {
                final PolicySourceModel policyInfoset = generator.translate(policy);
                marshaller.marshal(policyInfoset, writer);
            } catch (PolicyException pe) {
                throw LOGGER.logSevereException(new WebServiceException(PolicyMessages.WSP_1002_UNABLE_TO_MARSHALL_POLICY_OR_POLICY_REFERENCE(), pe));
            }
        } else {
            final TypedXmlWriter policyReference = writer._element(policy.getNamespaceVersion().asQName(XmlToken.PolicyReference), TypedXmlWriter.class);
            policyReference._attribute(XmlToken.Uri.toString(), '#' + policy.getIdOrName());
        }
    }
}
 
Example #5
Source File: PolicyWSDLGeneratorExtension.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Adds a PolicyReference element that points to the policy of the element,
 * if the policy does not have any id or name. Writes policy inside the element otherwise.
 *
 * @param subject
 *      PolicySubject to be referenced or marshalled
 * @param writer
 *      A TXW on to which we shall add the PolicyReference
 */
private void writePolicyOrReferenceIt(final PolicySubject subject, final TypedXmlWriter writer) {
    final Policy policy;
    try {
        policy = subject.getEffectivePolicy(merger);
    } catch (PolicyException e) {
        throw LOGGER.logSevereException(new WebServiceException(PolicyMessages.WSP_1011_FAILED_TO_RETRIEVE_EFFECTIVE_POLICY_FOR_SUBJECT(subject.toString()), e));
    }
    if (policy != null) {
        if (null == policy.getIdOrName()) {
            final PolicyModelGenerator generator = ModelGenerator.getGenerator();
            try {
                final PolicySourceModel policyInfoset = generator.translate(policy);
                marshaller.marshal(policyInfoset, writer);
            } catch (PolicyException pe) {
                throw LOGGER.logSevereException(new WebServiceException(PolicyMessages.WSP_1002_UNABLE_TO_MARSHALL_POLICY_OR_POLICY_REFERENCE(), pe));
            }
        } else {
            final TypedXmlWriter policyReference = writer._element(policy.getNamespaceVersion().asQName(XmlToken.PolicyReference), TypedXmlWriter.class);
            policyReference._attribute(XmlToken.Uri.toString(), '#' + policy.getIdOrName());
        }
    }
}
 
Example #6
Source File: PolicyWSDLGeneratorExtension.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Adds a PolicyReference element that points to the policy of the element,
 * if the policy does not have any id or name. Writes policy inside the element otherwise.
 *
 * @param subject
 *      PolicySubject to be referenced or marshalled
 * @param writer
 *      A TXW on to which we shall add the PolicyReference
 */
private void writePolicyOrReferenceIt(final PolicySubject subject, final TypedXmlWriter writer) {
    final Policy policy;
    try {
        policy = subject.getEffectivePolicy(merger);
    } catch (PolicyException e) {
        throw LOGGER.logSevereException(new WebServiceException(PolicyMessages.WSP_1011_FAILED_TO_RETRIEVE_EFFECTIVE_POLICY_FOR_SUBJECT(subject.toString()), e));
    }
    if (policy != null) {
        if (null == policy.getIdOrName()) {
            final PolicyModelGenerator generator = ModelGenerator.getGenerator();
            try {
                final PolicySourceModel policyInfoset = generator.translate(policy);
                marshaller.marshal(policyInfoset, writer);
            } catch (PolicyException pe) {
                throw LOGGER.logSevereException(new WebServiceException(PolicyMessages.WSP_1002_UNABLE_TO_MARSHALL_POLICY_OR_POLICY_REFERENCE(), pe));
            }
        } else {
            final TypedXmlWriter policyReference = writer._element(policy.getNamespaceVersion().asQName(XmlToken.PolicyReference), TypedXmlWriter.class);
            policyReference._attribute(XmlToken.Uri.toString(), '#' + policy.getIdOrName());
        }
    }
}
 
Example #7
Source File: PolicyWSDLGeneratorExtension.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Adds a PolicyReference element that points to the policy of the element,
 * if the policy does not have any id or name. Writes policy inside the element otherwise.
 *
 * @param subject
 *      PolicySubject to be referenced or marshalled
 * @param writer
 *      A TXW on to which we shall add the PolicyReference
 */
private void writePolicyOrReferenceIt(final PolicySubject subject, final TypedXmlWriter writer) {
    final Policy policy;
    try {
        policy = subject.getEffectivePolicy(merger);
    } catch (PolicyException e) {
        throw LOGGER.logSevereException(new WebServiceException(PolicyMessages.WSP_1011_FAILED_TO_RETRIEVE_EFFECTIVE_POLICY_FOR_SUBJECT(subject.toString()), e));
    }
    if (policy != null) {
        if (null == policy.getIdOrName()) {
            final PolicyModelGenerator generator = ModelGenerator.getGenerator();
            try {
                final PolicySourceModel policyInfoset = generator.translate(policy);
                marshaller.marshal(policyInfoset, writer);
            } catch (PolicyException pe) {
                throw LOGGER.logSevereException(new WebServiceException(PolicyMessages.WSP_1002_UNABLE_TO_MARSHALL_POLICY_OR_POLICY_REFERENCE(), pe));
            }
        } else {
            final TypedXmlWriter policyReference = writer._element(policy.getNamespaceVersion().asQName(XmlToken.PolicyReference), TypedXmlWriter.class);
            policyReference._attribute(XmlToken.Uri.toString(), '#' + policy.getIdOrName());
        }
    }
}
 
Example #8
Source File: PolicyWSDLGeneratorExtension.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Adds a PolicyReference element that points to the policy of the element,
 * if the policy does not have any id or name. Writes policy inside the element otherwise.
 *
 * @param subject
 *      PolicySubject to be referenced or marshalled
 * @param writer
 *      A TXW on to which we shall add the PolicyReference
 */
private void writePolicyOrReferenceIt(final PolicySubject subject, final TypedXmlWriter writer) {
    final Policy policy;
    try {
        policy = subject.getEffectivePolicy(merger);
    } catch (PolicyException e) {
        throw LOGGER.logSevereException(new WebServiceException(PolicyMessages.WSP_1011_FAILED_TO_RETRIEVE_EFFECTIVE_POLICY_FOR_SUBJECT(subject.toString()), e));
    }
    if (policy != null) {
        if (null == policy.getIdOrName()) {
            final PolicyModelGenerator generator = ModelGenerator.getGenerator();
            try {
                final PolicySourceModel policyInfoset = generator.translate(policy);
                marshaller.marshal(policyInfoset, writer);
            } catch (PolicyException pe) {
                throw LOGGER.logSevereException(new WebServiceException(PolicyMessages.WSP_1002_UNABLE_TO_MARSHALL_POLICY_OR_POLICY_REFERENCE(), pe));
            }
        } else {
            final TypedXmlWriter policyReference = writer._element(policy.getNamespaceVersion().asQName(XmlToken.PolicyReference), TypedXmlWriter.class);
            policyReference._attribute(XmlToken.Uri.toString(), '#' + policy.getIdOrName());
        }
    }
}