• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java PolicyMessages类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getPolicies

import com.sun.xml.internal.ws.resources.PolicyMessages; //导入依赖的package包/类
final Collection<Policy> getPolicies() throws PolicyException {
    if (null == policyURIs) {
        throw LOGGER.logSevereException(new PolicyException(PolicyMessages.WSP_1004_POLICY_URIS_CAN_NOT_BE_NULL()));
    }
    if (null == policyStore) {
        throw LOGGER.logSevereException(new PolicyException(PolicyMessages.WSP_1010_NO_POLICIES_DEFINED()));
    }

    final Collection<Policy> result = new ArrayList<Policy>(policyURIs.size());

    for (String policyURI : policyURIs) {
        final PolicySourceModel sourceModel = policyStore.get(policyURI);
        if (sourceModel == null) {
            throw LOGGER.logSevereException(new PolicyException(PolicyMessages.WSP_1005_POLICY_REFERENCE_DOES_NOT_EXIST(policyURI)));
        } else {
            result.add(ModelTranslator.getTranslator().translate(sourceModel));
        }
    }

    return result;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:BuilderHandler.java


示例2: readPolicyReferenceElement

import com.sun.xml.internal.ws.resources.PolicyMessages; //导入依赖的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: validateServerPolicyMap

import com.sun.xml.internal.ws.resources.PolicyMessages; //导入依赖的package包/类
/**
 * Checks if the PolicyMap has only single alternative in the scope.
 *
 * @param policyMap
 *      PolicyMap that needs to be validated.
 */
private void validateServerPolicyMap(PolicyMap policyMap) {
    try {
        final ValidationProcessor validationProcessor = ValidationProcessor.getInstance();

        for (Policy policy : policyMap) {

            // TODO:  here is a good place to check if the actual policy has only one alternative...

            for (AssertionSet assertionSet : policy) {
                for (PolicyAssertion assertion : assertionSet) {
                    Fitness validationResult = validationProcessor.validateServerSide(assertion);
                    if (validationResult != Fitness.SUPPORTED) {
                        throw new PolicyException(PolicyMessages.WSP_1015_SERVER_SIDE_ASSERTION_VALIDATION_FAILED(
                                assertion.getName(),
                                validationResult));
                    }
                }
            }
        }
    } catch (PolicyException e) {
        throw new WebServiceException(e);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:DefaultPolicyResolver.java


示例4: writePolicyOrReferenceIt

import com.sun.xml.internal.ws.resources.PolicyMessages; //导入依赖的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


示例5: populate

import com.sun.xml.internal.ws.resources.PolicyMessages; //导入依赖的package包/类
final void populate(final PolicyMapExtender policyMapExtender) throws PolicyException {
    if (null == policyMapExtender) {
        throw LOGGER.logSevereException(new PolicyException(PolicyMessages.WSP_1006_POLICY_MAP_EXTENDER_CAN_NOT_BE_NULL()));
    }

    doPopulate(policyMapExtender);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:BuilderHandler.java


示例6: start

import com.sun.xml.internal.ws.resources.PolicyMessages; //导入依赖的package包/类
@Override
public void start(final WSDLGenExtnContext context) {
    LOGGER.entering();
    try {
        this.seiModel = context.getModel();

        final PolicyMapConfigurator[] policyMapConfigurators = loadConfigurators();
        final PolicyMapExtender[] extenders = new PolicyMapExtender[policyMapConfigurators.length];
        for (int i = 0; i < policyMapConfigurators.length; i++) {
            extenders[i] = PolicyMapExtender.createPolicyMapExtender();
        }
        // Read policy config file
        policyMap = PolicyResolverFactory.create().resolve(
                new PolicyResolver.ServerContext(policyMap, context.getContainer(), context.getEndpointClass(), false, extenders));

        if (policyMap == null) {
            LOGGER.fine(PolicyMessages.WSP_1019_CREATE_EMPTY_POLICY_MAP());
            policyMap = PolicyMap.createPolicyMap(Arrays.asList(extenders));
        }

        final WSBinding binding = context.getBinding();
        try {
            final Collection<PolicySubject> policySubjects = new LinkedList<PolicySubject>();
            for (int i = 0; i < policyMapConfigurators.length; i++) {
                policySubjects.addAll(policyMapConfigurators[i].update(policyMap, seiModel, binding));
                extenders[i].disconnect();
            }
            PolicyMapUtil.insertPolicies(policyMap, policySubjects, this.seiModel.getServiceQName(), this.seiModel.getPortName());
        } catch (PolicyException e) {
            throw LOGGER.logSevereException(new WebServiceException(PolicyMessages.WSP_1017_MAP_UPDATE_FAILED(), e));
        }
        final TypedXmlWriter root = context.getRoot();
        root._namespace(NamespaceVersion.v1_2.toString(), NamespaceVersion.v1_2.getDefaultNamespacePrefix());
        root._namespace(NamespaceVersion.v1_5.toString(), NamespaceVersion.v1_5.getDefaultNamespacePrefix());
        root._namespace(PolicyConstants.WSU_NAMESPACE_URI, PolicyConstants.WSU_NAMESPACE_PREFIX);

    } finally {
        LOGGER.exiting();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:41,代码来源:PolicyWSDLGeneratorExtension.java



注:本文中的com.sun.xml.internal.ws.resources.PolicyMessages类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BackendlessFault类代码示例发布时间:2022-05-23
下一篇:
Java JAXBDispatch类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap