Java Code Examples for com.sun.xml.internal.ws.policy.sourcemodel.wspolicy.XmlToken#Policy
The following examples show how to use
com.sun.xml.internal.ws.policy.sourcemodel.wspolicy.XmlToken#Policy .
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: PolicyWSDLParserExtension.java From hottub with GNU General Public License v2.0 | 6 votes |
@Override public boolean definitionsElements(final XMLStreamReader reader){ LOGGER.entering(); if (NamespaceVersion.resolveAsToken(reader.getName()) == XmlToken.Policy) { // Only "Policy" element interests me readSinglePolicy( policyReader.readPolicyElement( reader, (null == reader.getLocation().getSystemId()) ? // baseUrl "" : reader.getLocation().getSystemId()), false); LOGGER.exiting(); return true; } LOGGER.exiting(); return false; }
Example 2
Source File: PolicyWSDLParserExtension.java From openjdk-8-source 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 3
Source File: PolicyWSDLParserExtension.java From hottub 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 4
Source File: PolicyWSDLParserExtension.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
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: PolicyWSDLParserExtension.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
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 6
Source File: PolicyWSDLParserExtension.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
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: 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 8
Source File: PolicyWSDLParserExtension.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
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: PolicyWSDLParserExtension.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
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 10
Source File: PolicyWSDLParserExtension.java From hottub with GNU General Public License v2.0 | 6 votes |
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: 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 12
Source File: PolicyWSDLParserExtension.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Override public boolean definitionsElements(final XMLStreamReader reader){ LOGGER.entering(); if (NamespaceVersion.resolveAsToken(reader.getName()) == XmlToken.Policy) { // Only "Policy" element interests me readSinglePolicy( policyReader.readPolicyElement( reader, (null == reader.getLocation().getSystemId()) ? // baseUrl "" : reader.getLocation().getSystemId()), false); LOGGER.exiting(); return true; } LOGGER.exiting(); return false; }
Example 13
Source File: PolicyWSDLParserExtension.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
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 14
Source File: XmlPolicyModelUnmarshaller.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * See {@link PolicyModelUnmarshaller#unmarshalModel(Object) base method documentation}. */ public PolicySourceModel unmarshalModel(final Object storage) throws PolicyException { final XMLEventReader reader = createXMLEventReader(storage); PolicySourceModel model = null; loop: while (reader.hasNext()) { try { final XMLEvent event = reader.peek(); switch (event.getEventType()) { case XMLStreamConstants.START_DOCUMENT: case XMLStreamConstants.COMMENT: reader.nextEvent(); break; // skipping the comments and start document events case XMLStreamConstants.CHARACTERS: processCharacters(ModelNode.Type.POLICY, event.asCharacters(), null); // we advance the reader only if there is no exception thrown from // the processCharacters(...) call. Otherwise we don't modify the stream reader.nextEvent(); break; case XMLStreamConstants.START_ELEMENT: if (NamespaceVersion.resolveAsToken(event.asStartElement().getName()) == XmlToken.Policy) { StartElement rootElement = reader.nextEvent().asStartElement(); model = initializeNewModel(rootElement); unmarshalNodeContent(model.getNamespaceVersion(), model.getRootNode(), rootElement.getName(), reader); break loop; } else { throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0048_POLICY_ELEMENT_EXPECTED_FIRST())); } default: throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0048_POLICY_ELEMENT_EXPECTED_FIRST())); } } catch (XMLStreamException e) { throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0068_FAILED_TO_UNMARSHALL_POLICY_EXPRESSION(), e)); } } return model; }
Example 15
Source File: XmlPolicyModelUnmarshaller.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * See {@link PolicyModelUnmarshaller#unmarshalModel(Object) base method documentation}. */ public PolicySourceModel unmarshalModel(final Object storage) throws PolicyException { final XMLEventReader reader = createXMLEventReader(storage); PolicySourceModel model = null; loop: while (reader.hasNext()) { try { final XMLEvent event = reader.peek(); switch (event.getEventType()) { case XMLStreamConstants.START_DOCUMENT: case XMLStreamConstants.COMMENT: reader.nextEvent(); break; // skipping the comments and start document events case XMLStreamConstants.CHARACTERS: processCharacters(ModelNode.Type.POLICY, event.asCharacters(), null); // we advance the reader only if there is no exception thrown from // the processCharacters(...) call. Otherwise we don't modify the stream reader.nextEvent(); break; case XMLStreamConstants.START_ELEMENT: if (NamespaceVersion.resolveAsToken(event.asStartElement().getName()) == XmlToken.Policy) { StartElement rootElement = reader.nextEvent().asStartElement(); model = initializeNewModel(rootElement); unmarshalNodeContent(model.getNamespaceVersion(), model.getRootNode(), rootElement.getName(), reader); break loop; } else { throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0048_POLICY_ELEMENT_EXPECTED_FIRST())); } default: throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0048_POLICY_ELEMENT_EXPECTED_FIRST())); } } catch (XMLStreamException e) { throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0068_FAILED_TO_UNMARSHALL_POLICY_EXPRESSION(), e)); } } return model; }
Example 16
Source File: XmlPolicyModelUnmarshaller.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * See {@link PolicyModelUnmarshaller#unmarshalModel(Object) base method documentation}. */ public PolicySourceModel unmarshalModel(final Object storage) throws PolicyException { final XMLEventReader reader = createXMLEventReader(storage); PolicySourceModel model = null; loop: while (reader.hasNext()) { try { final XMLEvent event = reader.peek(); switch (event.getEventType()) { case XMLStreamConstants.START_DOCUMENT: case XMLStreamConstants.COMMENT: reader.nextEvent(); break; // skipping the comments and start document events case XMLStreamConstants.CHARACTERS: processCharacters(ModelNode.Type.POLICY, event.asCharacters(), null); // we advance the reader only if there is no exception thrown from // the processCharacters(...) call. Otherwise we don't modify the stream reader.nextEvent(); break; case XMLStreamConstants.START_ELEMENT: if (NamespaceVersion.resolveAsToken(event.asStartElement().getName()) == XmlToken.Policy) { StartElement rootElement = reader.nextEvent().asStartElement(); model = initializeNewModel(rootElement); unmarshalNodeContent(model.getNamespaceVersion(), model.getRootNode(), rootElement.getName(), reader); break loop; } else { throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0048_POLICY_ELEMENT_EXPECTED_FIRST())); } default: throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0048_POLICY_ELEMENT_EXPECTED_FIRST())); } } catch (XMLStreamException e) { throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0068_FAILED_TO_UNMARSHALL_POLICY_EXPRESSION(), e)); } } return model; }
Example 17
Source File: XmlPolicyModelUnmarshaller.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * See {@link PolicyModelUnmarshaller#unmarshalModel(Object) base method documentation}. */ public PolicySourceModel unmarshalModel(final Object storage) throws PolicyException { final XMLEventReader reader = createXMLEventReader(storage); PolicySourceModel model = null; loop: while (reader.hasNext()) { try { final XMLEvent event = reader.peek(); switch (event.getEventType()) { case XMLStreamConstants.START_DOCUMENT: case XMLStreamConstants.COMMENT: reader.nextEvent(); break; // skipping the comments and start document events case XMLStreamConstants.CHARACTERS: processCharacters(ModelNode.Type.POLICY, event.asCharacters(), null); // we advance the reader only if there is no exception thrown from // the processCharacters(...) call. Otherwise we don't modify the stream reader.nextEvent(); break; case XMLStreamConstants.START_ELEMENT: if (NamespaceVersion.resolveAsToken(event.asStartElement().getName()) == XmlToken.Policy) { StartElement rootElement = reader.nextEvent().asStartElement(); model = initializeNewModel(rootElement); unmarshalNodeContent(model.getNamespaceVersion(), model.getRootNode(), rootElement.getName(), reader); break loop; } else { throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0048_POLICY_ELEMENT_EXPECTED_FIRST())); } default: throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0048_POLICY_ELEMENT_EXPECTED_FIRST())); } } catch (XMLStreamException e) { throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0068_FAILED_TO_UNMARSHALL_POLICY_EXPRESSION(), e)); } } return model; }
Example 18
Source File: XmlPolicyModelUnmarshaller.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * See {@link PolicyModelUnmarshaller#unmarshalModel(Object) base method documentation}. */ public PolicySourceModel unmarshalModel(final Object storage) throws PolicyException { final XMLEventReader reader = createXMLEventReader(storage); PolicySourceModel model = null; loop: while (reader.hasNext()) { try { final XMLEvent event = reader.peek(); switch (event.getEventType()) { case XMLStreamConstants.START_DOCUMENT: case XMLStreamConstants.COMMENT: reader.nextEvent(); break; // skipping the comments and start document events case XMLStreamConstants.CHARACTERS: processCharacters(ModelNode.Type.POLICY, event.asCharacters(), null); // we advance the reader only if there is no exception thrown from // the processCharacters(...) call. Otherwise we don't modify the stream reader.nextEvent(); break; case XMLStreamConstants.START_ELEMENT: if (NamespaceVersion.resolveAsToken(event.asStartElement().getName()) == XmlToken.Policy) { StartElement rootElement = reader.nextEvent().asStartElement(); model = initializeNewModel(rootElement); unmarshalNodeContent(model.getNamespaceVersion(), model.getRootNode(), rootElement.getName(), reader); break loop; } else { throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0048_POLICY_ELEMENT_EXPECTED_FIRST())); } default: throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0048_POLICY_ELEMENT_EXPECTED_FIRST())); } } catch (XMLStreamException e) { throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0068_FAILED_TO_UNMARSHALL_POLICY_EXPRESSION(), e)); } } return model; }
Example 19
Source File: XmlPolicyModelUnmarshaller.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * See {@link PolicyModelUnmarshaller#unmarshalModel(Object) base method documentation}. */ public PolicySourceModel unmarshalModel(final Object storage) throws PolicyException { final XMLEventReader reader = createXMLEventReader(storage); PolicySourceModel model = null; loop: while (reader.hasNext()) { try { final XMLEvent event = reader.peek(); switch (event.getEventType()) { case XMLStreamConstants.START_DOCUMENT: case XMLStreamConstants.COMMENT: reader.nextEvent(); break; // skipping the comments and start document events case XMLStreamConstants.CHARACTERS: processCharacters(ModelNode.Type.POLICY, event.asCharacters(), null); // we advance the reader only if there is no exception thrown from // the processCharacters(...) call. Otherwise we don't modify the stream reader.nextEvent(); break; case XMLStreamConstants.START_ELEMENT: if (NamespaceVersion.resolveAsToken(event.asStartElement().getName()) == XmlToken.Policy) { StartElement rootElement = reader.nextEvent().asStartElement(); model = initializeNewModel(rootElement); unmarshalNodeContent(model.getNamespaceVersion(), model.getRootNode(), rootElement.getName(), reader); break loop; } else { throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0048_POLICY_ELEMENT_EXPECTED_FIRST())); } default: throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0048_POLICY_ELEMENT_EXPECTED_FIRST())); } } catch (XMLStreamException e) { throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0068_FAILED_TO_UNMARSHALL_POLICY_EXPRESSION(), e)); } } return model; }
Example 20
Source File: XmlPolicyModelUnmarshaller.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * See {@link PolicyModelUnmarshaller#unmarshalModel(Object) base method documentation}. */ public PolicySourceModel unmarshalModel(final Object storage) throws PolicyException { final XMLEventReader reader = createXMLEventReader(storage); PolicySourceModel model = null; loop: while (reader.hasNext()) { try { final XMLEvent event = reader.peek(); switch (event.getEventType()) { case XMLStreamConstants.START_DOCUMENT: case XMLStreamConstants.COMMENT: reader.nextEvent(); break; // skipping the comments and start document events case XMLStreamConstants.CHARACTERS: processCharacters(ModelNode.Type.POLICY, event.asCharacters(), null); // we advance the reader only if there is no exception thrown from // the processCharacters(...) call. Otherwise we don't modify the stream reader.nextEvent(); break; case XMLStreamConstants.START_ELEMENT: if (NamespaceVersion.resolveAsToken(event.asStartElement().getName()) == XmlToken.Policy) { StartElement rootElement = reader.nextEvent().asStartElement(); model = initializeNewModel(rootElement); unmarshalNodeContent(model.getNamespaceVersion(), model.getRootNode(), rootElement.getName(), reader); break loop; } else { throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0048_POLICY_ELEMENT_EXPECTED_FIRST())); } default: throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0048_POLICY_ELEMENT_EXPECTED_FIRST())); } } catch (XMLStreamException e) { throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0068_FAILED_TO_UNMARSHALL_POLICY_EXPRESSION(), e)); } } return model; }