Java Code Examples for com.sun.xml.internal.ws.policy.sourcemodel.wspolicy.XmlToken#PolicyReference

The following examples show how to use com.sun.xml.internal.ws.policy.sourcemodel.wspolicy.XmlToken#PolicyReference . 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: SafePolicyReader.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Reads policy reference element <wsp:PolicyReference/> and returns referenced policy URI as String
 *
 * @param reader The XMLStreamReader should be in START_ELEMENT state and point to the PolicyReference element.
 * @return The URI contained in the PolicyReference
 */
public String readPolicyReferenceElement(final XMLStreamReader reader) {
    try {
        if (NamespaceVersion.resolveAsToken(reader.getName()) == XmlToken.PolicyReference) {     // "PolicyReference" element interests me
            for (int i = 0; i < reader.getAttributeCount(); i++) {
                if (XmlToken.resolveToken(reader.getAttributeName(i).getLocalPart()) == XmlToken.Uri) {
                    final String uriValue = reader.getAttributeValue(i);
                    reader.next();
                    return uriValue;
                }
            }
        }
        reader.next();
        return null;
    } catch(XMLStreamException e) {
        throw LOGGER.logSevereException(new WebServiceException(PolicyMessages.WSP_1001_XML_EXCEPTION_WHEN_PROCESSING_POLICY_REFERENCE(), e));
    }
}
 
Example 2
Source File: PolicyWSDLParserExtension.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private boolean processSubelement(
        final WSDLObject element, final XMLStreamReader reader, final Map<WSDLObject, Collection<PolicyRecordHandler>> map) {
    if (NamespaceVersion.resolveAsToken(reader.getName()) == XmlToken.PolicyReference) {     // "PolicyReference" element interests us
        processReferenceUri(policyReader.readPolicyReferenceElement(reader), element, reader, map);
        return true;
    } else if (NamespaceVersion.resolveAsToken(reader.getName()) == XmlToken.Policy) {   // policy could be defined here
        final PolicyRecordHandler handler =
                readSinglePolicy(
                policyReader.readPolicyElement(
                reader,
                (null == reader.getLocation().getSystemId()) ? // baseUrl
                    "" : reader.getLocation().getSystemId()),
                true);
        if (null != handler) {           // only policies with an Id can work for us
            addHandlerToMap(map, element, handler);
        } // endif null != handler
        return true; // element consumed
    }//end if Policy element found
    return false;
}
 
Example 3
Source File: SafePolicyReader.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Reads policy reference element <wsp:PolicyReference/> and returns referenced policy URI as String
 *
 * @param reader The XMLStreamReader should be in START_ELEMENT state and point to the PolicyReference element.
 * @return The URI contained in the PolicyReference
 */
public String readPolicyReferenceElement(final XMLStreamReader reader) {
    try {
        if (NamespaceVersion.resolveAsToken(reader.getName()) == XmlToken.PolicyReference) {     // "PolicyReference" element interests me
            for (int i = 0; i < reader.getAttributeCount(); i++) {
                if (XmlToken.resolveToken(reader.getAttributeName(i).getLocalPart()) == XmlToken.Uri) {
                    final String uriValue = reader.getAttributeValue(i);
                    reader.next();
                    return uriValue;
                }
            }
        }
        reader.next();
        return null;
    } catch(XMLStreamException e) {
        throw LOGGER.logSevereException(new WebServiceException(PolicyMessages.WSP_1001_XML_EXCEPTION_WHEN_PROCESSING_POLICY_REFERENCE(), e));
    }
}
 
Example 4
Source File: PolicyWSDLParserExtension.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private boolean processSubelement(
        final WSDLObject element, final XMLStreamReader reader, final Map<WSDLObject, Collection<PolicyRecordHandler>> map) {
    if (NamespaceVersion.resolveAsToken(reader.getName()) == XmlToken.PolicyReference) {     // "PolicyReference" element interests us
        processReferenceUri(policyReader.readPolicyReferenceElement(reader), element, reader, map);
        return true;
    } else if (NamespaceVersion.resolveAsToken(reader.getName()) == XmlToken.Policy) {   // policy could be defined here
        final PolicyRecordHandler handler =
                readSinglePolicy(
                policyReader.readPolicyElement(
                reader,
                (null == reader.getLocation().getSystemId()) ? // baseUrl
                    "" : reader.getLocation().getSystemId()),
                true);
        if (null != handler) {           // only policies with an Id can work for us
            addHandlerToMap(map, element, handler);
        } // endif null != handler
        return true; // element consumed
    }//end if Policy element found
    return false;
}
 
Example 5
Source File: SafePolicyReader.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Reads policy reference element <wsp:PolicyReference/> and returns referenced policy URI as String
 *
 * @param reader The XMLStreamReader should be in START_ELEMENT state and point to the PolicyReference element.
 * @return The URI contained in the PolicyReference
 */
public String readPolicyReferenceElement(final XMLStreamReader reader) {
    try {
        if (NamespaceVersion.resolveAsToken(reader.getName()) == XmlToken.PolicyReference) {     // "PolicyReference" element interests me
            for (int i = 0; i < reader.getAttributeCount(); i++) {
                if (XmlToken.resolveToken(reader.getAttributeName(i).getLocalPart()) == XmlToken.Uri) {
                    final String uriValue = reader.getAttributeValue(i);
                    reader.next();
                    return uriValue;
                }
            }
        }
        reader.next();
        return null;
    } catch(XMLStreamException e) {
        throw LOGGER.logSevereException(new WebServiceException(PolicyMessages.WSP_1001_XML_EXCEPTION_WHEN_PROCESSING_POLICY_REFERENCE(), e));
    }
}
 
Example 6
Source File: PolicyWSDLParserExtension.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private boolean processSubelement(
        final WSDLObject element, final XMLStreamReader reader, final Map<WSDLObject, Collection<PolicyRecordHandler>> map) {
    if (NamespaceVersion.resolveAsToken(reader.getName()) == XmlToken.PolicyReference) {     // "PolicyReference" element interests us
        processReferenceUri(policyReader.readPolicyReferenceElement(reader), element, reader, map);
        return true;
    } else if (NamespaceVersion.resolveAsToken(reader.getName()) == XmlToken.Policy) {   // policy could be defined here
        final PolicyRecordHandler handler =
                readSinglePolicy(
                policyReader.readPolicyElement(
                reader,
                (null == reader.getLocation().getSystemId()) ? // baseUrl
                    "" : reader.getLocation().getSystemId()),
                true);
        if (null != handler) {           // only policies with an Id can work for us
            addHandlerToMap(map, element, handler);
        } // endif null != handler
        return true; // element consumed
    }//end if Policy element found
    return false;
}
 
Example 7
Source File: SafePolicyReader.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Reads policy reference element <wsp:PolicyReference/> and returns referenced policy URI as String
 *
 * @param reader The XMLStreamReader should be in START_ELEMENT state and point to the PolicyReference element.
 * @return The URI contained in the PolicyReference
 */
public String readPolicyReferenceElement(final XMLStreamReader reader) {
    try {
        if (NamespaceVersion.resolveAsToken(reader.getName()) == XmlToken.PolicyReference) {     // "PolicyReference" element interests me
            for (int i = 0; i < reader.getAttributeCount(); i++) {
                if (XmlToken.resolveToken(reader.getAttributeName(i).getLocalPart()) == XmlToken.Uri) {
                    final String uriValue = reader.getAttributeValue(i);
                    reader.next();
                    return uriValue;
                }
            }
        }
        reader.next();
        return null;
    } catch(XMLStreamException e) {
        throw LOGGER.logSevereException(new WebServiceException(PolicyMessages.WSP_1001_XML_EXCEPTION_WHEN_PROCESSING_POLICY_REFERENCE(), e));
    }
}
 
Example 8
Source File: PolicyWSDLParserExtension.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private boolean processSubelement(
        final WSDLObject element, final XMLStreamReader reader, final Map<WSDLObject, Collection<PolicyRecordHandler>> map) {
    if (NamespaceVersion.resolveAsToken(reader.getName()) == XmlToken.PolicyReference) {     // "PolicyReference" element interests us
        processReferenceUri(policyReader.readPolicyReferenceElement(reader), element, reader, map);
        return true;
    } else if (NamespaceVersion.resolveAsToken(reader.getName()) == XmlToken.Policy) {   // policy could be defined here
        final PolicyRecordHandler handler =
                readSinglePolicy(
                policyReader.readPolicyElement(
                reader,
                (null == reader.getLocation().getSystemId()) ? // baseUrl
                    "" : reader.getLocation().getSystemId()),
                true);
        if (null != handler) {           // only policies with an Id can work for us
            addHandlerToMap(map, element, handler);
        } // endif null != handler
        return true; // element consumed
    }//end if Policy element found
    return false;
}
 
Example 9
Source File: SafePolicyReader.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Reads policy reference element <wsp:PolicyReference/> and returns referenced policy URI as String
 *
 * @param reader The XMLStreamReader should be in START_ELEMENT state and point to the PolicyReference element.
 * @return The URI contained in the PolicyReference
 */
public String readPolicyReferenceElement(final XMLStreamReader reader) {
    try {
        if (NamespaceVersion.resolveAsToken(reader.getName()) == XmlToken.PolicyReference) {     // "PolicyReference" element interests me
            for (int i = 0; i < reader.getAttributeCount(); i++) {
                if (XmlToken.resolveToken(reader.getAttributeName(i).getLocalPart()) == XmlToken.Uri) {
                    final String uriValue = reader.getAttributeValue(i);
                    reader.next();
                    return uriValue;
                }
            }
        }
        reader.next();
        return null;
    } catch(XMLStreamException e) {
        throw LOGGER.logSevereException(new WebServiceException(PolicyMessages.WSP_1001_XML_EXCEPTION_WHEN_PROCESSING_POLICY_REFERENCE(), e));
    }
}
 
Example 10
Source File: PolicyWSDLParserExtension.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private boolean processSubelement(
        final WSDLObject element, final XMLStreamReader reader, final Map<WSDLObject, Collection<PolicyRecordHandler>> map) {
    if (NamespaceVersion.resolveAsToken(reader.getName()) == XmlToken.PolicyReference) {     // "PolicyReference" element interests us
        processReferenceUri(policyReader.readPolicyReferenceElement(reader), element, reader, map);
        return true;
    } else if (NamespaceVersion.resolveAsToken(reader.getName()) == XmlToken.Policy) {   // policy could be defined here
        final PolicyRecordHandler handler =
                readSinglePolicy(
                policyReader.readPolicyElement(
                reader,
                (null == reader.getLocation().getSystemId()) ? // baseUrl
                    "" : reader.getLocation().getSystemId()),
                true);
        if (null != handler) {           // only policies with an Id can work for us
            addHandlerToMap(map, element, handler);
        } // endif null != handler
        return true; // element consumed
    }//end if Policy element found
    return false;
}
 
Example 11
Source File: SafePolicyReader.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Reads policy reference element <wsp:PolicyReference/> and returns referenced policy URI as String
 *
 * @param reader The XMLStreamReader should be in START_ELEMENT state and point to the PolicyReference element.
 * @return The URI contained in the PolicyReference
 */
public String readPolicyReferenceElement(final XMLStreamReader reader) {
    try {
        if (NamespaceVersion.resolveAsToken(reader.getName()) == XmlToken.PolicyReference) {     // "PolicyReference" element interests me
            for (int i = 0; i < reader.getAttributeCount(); i++) {
                if (XmlToken.resolveToken(reader.getAttributeName(i).getLocalPart()) == XmlToken.Uri) {
                    final String uriValue = reader.getAttributeValue(i);
                    reader.next();
                    return uriValue;
                }
            }
        }
        reader.next();
        return null;
    } catch(XMLStreamException e) {
        throw LOGGER.logSevereException(new WebServiceException(PolicyMessages.WSP_1001_XML_EXCEPTION_WHEN_PROCESSING_POLICY_REFERENCE(), e));
    }
}
 
Example 12
Source File: PolicyWSDLParserExtension.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private boolean processSubelement(
        final WSDLObject element, final XMLStreamReader reader, final Map<WSDLObject, Collection<PolicyRecordHandler>> map) {
    if (NamespaceVersion.resolveAsToken(reader.getName()) == XmlToken.PolicyReference) {     // "PolicyReference" element interests us
        processReferenceUri(policyReader.readPolicyReferenceElement(reader), element, reader, map);
        return true;
    } else if (NamespaceVersion.resolveAsToken(reader.getName()) == XmlToken.Policy) {   // policy could be defined here
        final PolicyRecordHandler handler =
                readSinglePolicy(
                policyReader.readPolicyElement(
                reader,
                (null == reader.getLocation().getSystemId()) ? // baseUrl
                    "" : reader.getLocation().getSystemId()),
                true);
        if (null != handler) {           // only policies with an Id can work for us
            addHandlerToMap(map, element, handler);
        } // endif null != handler
        return true; // element consumed
    }//end if Policy element found
    return false;
}
 
Example 13
Source File: SafePolicyReader.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Reads policy reference element <wsp:PolicyReference/> and returns referenced policy URI as String
 *
 * @param reader The XMLStreamReader should be in START_ELEMENT state and point to the PolicyReference element.
 * @return The URI contained in the PolicyReference
 */
public String readPolicyReferenceElement(final XMLStreamReader reader) {
    try {
        if (NamespaceVersion.resolveAsToken(reader.getName()) == XmlToken.PolicyReference) {     // "PolicyReference" element interests me
            for (int i = 0; i < reader.getAttributeCount(); i++) {
                if (XmlToken.resolveToken(reader.getAttributeName(i).getLocalPart()) == XmlToken.Uri) {
                    final String uriValue = reader.getAttributeValue(i);
                    reader.next();
                    return uriValue;
                }
            }
        }
        reader.next();
        return null;
    } catch(XMLStreamException e) {
        throw LOGGER.logSevereException(new WebServiceException(PolicyMessages.WSP_1001_XML_EXCEPTION_WHEN_PROCESSING_POLICY_REFERENCE(), e));
    }
}
 
Example 14
Source File: PolicyWSDLParserExtension.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private boolean processSubelement(
        final WSDLObject element, final XMLStreamReader reader, final Map<WSDLObject, Collection<PolicyRecordHandler>> map) {
    if (NamespaceVersion.resolveAsToken(reader.getName()) == XmlToken.PolicyReference) {     // "PolicyReference" element interests us
        processReferenceUri(policyReader.readPolicyReferenceElement(reader), element, reader, map);
        return true;
    } else if (NamespaceVersion.resolveAsToken(reader.getName()) == XmlToken.Policy) {   // policy could be defined here
        final PolicyRecordHandler handler =
                readSinglePolicy(
                policyReader.readPolicyElement(
                reader,
                (null == reader.getLocation().getSystemId()) ? // baseUrl
                    "" : reader.getLocation().getSystemId()),
                true);
        if (null != handler) {           // only policies with an Id can work for us
            addHandlerToMap(map, element, handler);
        } // endif null != handler
        return true; // element consumed
    }//end if Policy element found
    return false;
}
 
Example 15
Source File: SafePolicyReader.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Reads policy reference element <wsp:PolicyReference/> and returns referenced policy URI as String
 *
 * @param reader The XMLStreamReader should be in START_ELEMENT state and point to the PolicyReference element.
 * @return The URI contained in the PolicyReference
 */
public String readPolicyReferenceElement(final XMLStreamReader reader) {
    try {
        if (NamespaceVersion.resolveAsToken(reader.getName()) == XmlToken.PolicyReference) {     // "PolicyReference" element interests me
            for (int i = 0; i < reader.getAttributeCount(); i++) {
                if (XmlToken.resolveToken(reader.getAttributeName(i).getLocalPart()) == XmlToken.Uri) {
                    final String uriValue = reader.getAttributeValue(i);
                    reader.next();
                    return uriValue;
                }
            }
        }
        reader.next();
        return null;
    } catch(XMLStreamException e) {
        throw LOGGER.logSevereException(new WebServiceException(PolicyMessages.WSP_1001_XML_EXCEPTION_WHEN_PROCESSING_POLICY_REFERENCE(), e));
    }
}
 
Example 16
Source File: PolicyWSDLParserExtension.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private boolean processSubelement(
        final WSDLObject element, final XMLStreamReader reader, final Map<WSDLObject, Collection<PolicyRecordHandler>> map) {
    if (NamespaceVersion.resolveAsToken(reader.getName()) == XmlToken.PolicyReference) {     // "PolicyReference" element interests us
        processReferenceUri(policyReader.readPolicyReferenceElement(reader), element, reader, map);
        return true;
    } else if (NamespaceVersion.resolveAsToken(reader.getName()) == XmlToken.Policy) {   // policy could be defined here
        final PolicyRecordHandler handler =
                readSinglePolicy(
                policyReader.readPolicyElement(
                reader,
                (null == reader.getLocation().getSystemId()) ? // baseUrl
                    "" : reader.getLocation().getSystemId()),
                true);
        if (null != handler) {           // only policies with an Id can work for us
            addHandlerToMap(map, element, handler);
        } // endif null != handler
        return true; // element consumed
    }//end if Policy element found
    return false;
}