当前位置: 首页>>代码示例>>Java>>正文


Java NamespaceVersion类代码示例

本文整理汇总了Java中com.sun.xml.internal.ws.policy.sourcemodel.wspolicy.NamespaceVersion的典型用法代码示例。如果您正苦于以下问题:Java NamespaceVersion类的具体用法?Java NamespaceVersion怎么用?Java NamespaceVersion使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NamespaceVersion类属于com.sun.xml.internal.ws.policy.sourcemodel.wspolicy包,在下文中一共展示了NamespaceVersion类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initializeNewModel

import com.sun.xml.internal.ws.policy.sourcemodel.wspolicy.NamespaceVersion; //导入依赖的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: Policy

import com.sun.xml.internal.ws.policy.sourcemodel.wspolicy.NamespaceVersion; //导入依赖的package包/类
/**
 * 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);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:Policy.java

示例3: readPolicyReferenceElement

import com.sun.xml.internal.ws.policy.sourcemodel.wspolicy.NamespaceVersion; //导入依赖的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

示例4: processSubelement

import com.sun.xml.internal.ws.policy.sourcemodel.wspolicy.NamespaceVersion; //导入依赖的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.NamespaceVersion; //导入依赖的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.NamespaceVersion; //导入依赖的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.NamespaceVersion类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。