本文整理汇总了Java中com.sun.xml.internal.ws.policy.sourcemodel.wspolicy.XmlToken类的典型用法代码示例。如果您正苦于以下问题:Java XmlToken类的具体用法?Java XmlToken怎么用?Java XmlToken使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmlToken类属于com.sun.xml.internal.ws.policy.sourcemodel.wspolicy包,在下文中一共展示了XmlToken类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: initializeNewModel
import com.sun.xml.internal.ws.policy.sourcemodel.wspolicy.XmlToken; //导入依赖的package包/类
private PolicySourceModel initializeNewModel(final StartElement element) throws PolicyException, XMLStreamException {
PolicySourceModel model;
final NamespaceVersion nsVersion = NamespaceVersion.resolveVersion(element.getName().getNamespaceURI());
final Attribute policyName = getAttributeByName(element, nsVersion.asQName(XmlToken.Name));
final Attribute xmlId = getAttributeByName(element, PolicyConstants.XML_ID);
Attribute policyId = getAttributeByName(element, PolicyConstants.WSU_ID);
if (policyId == null) {
policyId = xmlId;
} else if (xmlId != null) {
throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0058_MULTIPLE_POLICY_IDS_NOT_ALLOWED()));
}
model = createSourceModel(nsVersion,
(policyId == null) ? null : policyId.getValue(),
(policyName == null) ? null : policyName.getValue());
return model;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:XmlPolicyModelUnmarshaller.java
示例2: readPolicyReferenceElement
import com.sun.xml.internal.ws.policy.sourcemodel.wspolicy.XmlToken; //导入依赖的package包/类
/**
* 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));
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:SafePolicyReader.java
示例3: writePolicyOrReferenceIt
import com.sun.xml.internal.ws.policy.sourcemodel.wspolicy.XmlToken; //导入依赖的package包/类
/**
* 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());
}
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:32,代码来源:PolicyWSDLGeneratorExtension.java
示例4: processSubelement
import com.sun.xml.internal.ws.policy.sourcemodel.wspolicy.XmlToken; //导入依赖的package包/类
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;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:PolicyWSDLParserExtension.java
示例5: definitionsElements
import com.sun.xml.internal.ws.policy.sourcemodel.wspolicy.XmlToken; //导入依赖的package包/类
@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;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:PolicyWSDLParserExtension.java
示例6: readExternalFile
import com.sun.xml.internal.ws.policy.sourcemodel.wspolicy.XmlToken; //导入依赖的package包/类
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);
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:PolicyWSDLParserExtension.java
注:本文中的com.sun.xml.internal.ws.policy.sourcemodel.wspolicy.XmlToken类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论