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

Java AssertionSet类代码示例

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

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



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

示例1: getAssertion

import com.sun.xml.internal.ws.policy.AssertionSet; //导入依赖的package包/类
/**
 * Return ManagementAssertion if one can be found in the policy map under
 * the given service and port name.
 *
 * @param <T> The implementation class of the assertion.
 * @param name The fully qualified name of the server or client assertion.
 * @param policyMap The policy map. May be null.
 * @param serviceName The WSDL service name. May not be null.
 * @param portName The WSDL port name. May not be null.
 * @param type The implementation class of the assertion.
 * @return An instance of ManagementAssertion or null.
 * @throws WebServiceException If computing the effective policy of the endpoint scope failed.
 */
protected static <T extends ManagementAssertion> T getAssertion(final QName name,
        final PolicyMap policyMap, QName serviceName, QName portName, Class<T> type)
        throws WebServiceException {
    try {
        PolicyAssertion assertion = null;
        if (policyMap != null) {
            final PolicyMapKey key = PolicyMap.createWsdlEndpointScopeKey(serviceName, portName);
            final Policy policy = policyMap.getEndpointEffectivePolicy(key);
            if (policy != null) {
                final Iterator<AssertionSet> assertionSets = policy.iterator();
                if (assertionSets.hasNext()) {
                    final AssertionSet assertionSet = assertionSets.next();
                    final Iterator<PolicyAssertion> assertions = assertionSet.get(name).iterator();
                    if (assertions.hasNext()) {
                        assertion = assertions.next();
                    }
                }
            }
        }
        return assertion == null ? null : assertion.getImplementation(type);
    } catch (PolicyException ex) {
        throw LOGGER.logSevereException(new WebServiceException(
                ManagementMessages.WSM_1001_FAILED_ASSERTION(name), ex));
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:39,代码来源:ManagementAssertion.java


示例2: validateServerPolicyMap

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


示例3: getFeatures

import com.sun.xml.internal.ws.policy.AssertionSet; //导入依赖的package包/类
/**
 * Process FastInfoset policy assertions.
 *
 * @param key Key to identify the endpoint scope.
 * @param policyMap the policy map.
 * @throws PolicyException If retrieving the policy triggered an exception.
 */
 public Collection<WebServiceFeature> getFeatures(final PolicyMapKey key, final PolicyMap policyMap) throws PolicyException {
    final Collection<WebServiceFeature> features = new LinkedList<WebServiceFeature>();
    if ((key != null) && (policyMap != null)) {
        Policy policy = policyMap.getEndpointEffectivePolicy(key);
        if (null!=policy && policy.contains(OPTIMIZED_FI_SERIALIZATION_ASSERTION)) {
            Iterator <AssertionSet> assertions = policy.iterator();
            while(assertions.hasNext()){
                AssertionSet assertionSet = assertions.next();
                Iterator<PolicyAssertion> policyAssertion = assertionSet.iterator();
                while(policyAssertion.hasNext()){
                    PolicyAssertion assertion = policyAssertion.next();
                    if(OPTIMIZED_FI_SERIALIZATION_ASSERTION.equals(assertion.getName())){
                        String value = assertion.getAttributeValue(enabled);
                        boolean isFastInfosetEnabled = Boolean.valueOf(value.trim());
                        features.add(new FastInfosetFeature(isFastInfosetEnabled));
                    } // end-if non optional fast infoset assertion found
                } // next assertion
            } // next alternative
        } // end-if policy contains fast infoset assertion
    }
    return features;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:FastInfosetFeatureConfigurator.java


示例4: getFeatures

import com.sun.xml.internal.ws.policy.AssertionSet; //导入依赖的package包/类
/**
 * process Mtom policy assertions and if found and is not optional then mtom is enabled on the
 * {@link WSDLBoundPortType}
 *
 * @param key Key that identifies the endpoint scope
 * @param policyMap Must be non-null
 * @throws PolicyException If retrieving the policy triggered an exception
 */
public Collection<WebServiceFeature> getFeatures(PolicyMapKey key, PolicyMap policyMap) throws PolicyException {
    final Collection<WebServiceFeature> features = new LinkedList<WebServiceFeature>();
    if ((key != null) && (policyMap != null)) {
        Policy policy = policyMap.getEndpointEffectivePolicy(key);
        if (null!=policy && policy.contains(OPTIMIZED_MIME_SERIALIZATION_ASSERTION)) {
            Iterator <AssertionSet> assertions = policy.iterator();
            while(assertions.hasNext()){
                AssertionSet assertionSet = assertions.next();
                Iterator<PolicyAssertion> policyAssertion = assertionSet.iterator();
                while(policyAssertion.hasNext()){
                    PolicyAssertion assertion = policyAssertion.next();
                    if(OPTIMIZED_MIME_SERIALIZATION_ASSERTION.equals(assertion.getName())){
                        features.add(new MTOMFeature(true));
                    } // end-if non optional mtom assertion found
                } // next assertion
            } // next alternative
        } // end-if policy contains mtom assertion
    }
    return features;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:29,代码来源:MtomFeatureConfigurator.java


示例5: getFeatures

import com.sun.xml.internal.ws.policy.AssertionSet; //导入依赖的package包/类
/**
 * Process SelectOptimalEncoding policy assertions.
 *
 * @param key Key that identifies the endpoint scope.
 * @param policyMap The policy map.
 * @throws PolicyException If retrieving the policy triggered an exception.
 */
public Collection<WebServiceFeature> getFeatures(PolicyMapKey key, PolicyMap policyMap) throws PolicyException {
    final Collection<WebServiceFeature> features = new LinkedList<WebServiceFeature>();
    if ((key != null) && (policyMap != null)) {
        Policy policy = policyMap.getEndpointEffectivePolicy(key);
        if (null!=policy && policy.contains(SELECT_OPTIMAL_ENCODING_ASSERTION)) {
            Iterator <AssertionSet> assertions = policy.iterator();
            while(assertions.hasNext()){
                AssertionSet assertionSet = assertions.next();
                Iterator<PolicyAssertion> policyAssertion = assertionSet.iterator();
                while(policyAssertion.hasNext()){
                    PolicyAssertion assertion = policyAssertion.next();
                    if(SELECT_OPTIMAL_ENCODING_ASSERTION.equals(assertion.getName())){
                        String value = assertion.getAttributeValue(enabled);
                        boolean isSelectOptimalEncodingEnabled = value == null || Boolean.valueOf(value.trim());
                        features.add(new SelectOptimalEncodingFeature(isSelectOptimalEncodingEnabled));
                    }
                }
            }
        }
    }
    return features;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:SelectOptimalEncodingFeatureConfigurator.java


示例6: translate

import com.sun.xml.internal.ws.policy.AssertionSet; //导入依赖的package包/类
/**
 * The method translates {@link PolicySourceModel} structure into normalized {@link Policy} expression. The resulting Policy
 * is disconnected from its model, thus any additional changes in model will have no effect on the Policy expression.
 *
 * @param model the model to be translated into normalized policy expression. Must not be {@code null}.
 * @return translated policy expression in it's normalized form.
 * @throws PolicyException in case of translation failure
 */
public Policy translate(final PolicySourceModel model) throws PolicyException {
    LOGGER.entering(model);

    if (model == null) {
        throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0043_POLICY_MODEL_TRANSLATION_ERROR_INPUT_PARAM_NULL()));
    }

    PolicySourceModel localPolicyModelCopy;
    try {
        localPolicyModelCopy = model.clone();
    } catch (CloneNotSupportedException e) {
        throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0016_UNABLE_TO_CLONE_POLICY_SOURCE_MODEL(), e));
    }

    final String policyId = localPolicyModelCopy.getPolicyId();
    final String policyName = localPolicyModelCopy.getPolicyName();

    final Collection<AssertionSet> alternatives = createPolicyAlternatives(localPolicyModelCopy);
    LOGGER.finest(LocalizationMessages.WSP_0052_NUMBER_OF_ALTERNATIVE_COMBINATIONS_CREATED(alternatives.size()));

    Policy policy = null;
    if (alternatives.size() == 0) {
        policy = Policy.createNullPolicy(model.getNamespaceVersion(), policyName, policyId);
        LOGGER.finest(LocalizationMessages.WSP_0055_NO_ALTERNATIVE_COMBINATIONS_CREATED());
    } else if (alternatives.size() == 1 && alternatives.iterator().next().isEmpty()) {
        policy = Policy.createEmptyPolicy(model.getNamespaceVersion(), policyName, policyId);
        LOGGER.finest(LocalizationMessages.WSP_0026_SINGLE_EMPTY_ALTERNATIVE_COMBINATION_CREATED());
    } else {
        policy = Policy.createPolicy(model.getNamespaceVersion(), policyName, policyId, alternatives);
        LOGGER.finest(LocalizationMessages.WSP_0057_N_ALTERNATIVE_COMBINATIONS_M_POLICY_ALTERNATIVES_CREATED(alternatives.size(), policy.getNumberOfAssertionSets()));
    }

    LOGGER.exiting(policy);
    return policy;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:44,代码来源:PolicyModelTranslator.java


示例7: createPolicyAlternatives

import com.sun.xml.internal.ws.policy.AssertionSet; //导入依赖的package包/类
/**
 * Method creates policy alternatives according to provided model. The model structure is modified in the process.
 *
 * @return created policy alternatives resulting from policy source model.
 */
private Collection<AssertionSet> createPolicyAlternatives(final PolicySourceModel model) throws PolicyException {
    // creating global method variables
    final ContentDecomposition decomposition = new ContentDecomposition();

    // creating processing queue and starting the processing iterations
    final Queue<RawPolicy> policyQueue = new LinkedList<RawPolicy>();
    final Queue<Collection<ModelNode>> contentQueue = new LinkedList<Collection<ModelNode>>();

    final RawPolicy rootPolicy = new RawPolicy(model.getRootNode(), new LinkedList<RawAlternative>());
    RawPolicy processedPolicy = rootPolicy;
    do {
        Collection<ModelNode> processedContent = processedPolicy.originalContent;
        do {
            decompose(processedContent, decomposition);
            if (decomposition.exactlyOneContents.isEmpty()) {
                final RawAlternative alternative = new RawAlternative(decomposition.assertions);
                processedPolicy.alternatives.add(alternative);
                if (!alternative.allNestedPolicies.isEmpty()) {
                    policyQueue.addAll(alternative.allNestedPolicies);
                }
            } else { // we have a non-empty collection of exactly ones
                final Collection<Collection<ModelNode>> combinations = PolicyUtils.Collections.combine(decomposition.assertions, decomposition.exactlyOneContents, false);
                if (combinations != null && !combinations.isEmpty()) {
                    // processed alternative was split into some new alternatives, which we need to process
                    contentQueue.addAll(combinations);
                }
            }
        } while ((processedContent = contentQueue.poll()) != null);
    } while ((processedPolicy = policyQueue.poll()) != null);

    // normalize nested policies to contain single alternative only
    final Collection<AssertionSet> assertionSets = new LinkedList<AssertionSet>();
    for (RawAlternative rootAlternative : rootPolicy.alternatives) {
        final Collection<AssertionSet> normalizedAlternatives = normalizeRawAlternative(rootAlternative);
        assertionSets.addAll(normalizedAlternatives);
    }

    return assertionSets;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:45,代码来源:PolicyModelTranslator.java


示例8: normalizeRawAlternative

import com.sun.xml.internal.ws.policy.AssertionSet; //导入依赖的package包/类
private List<AssertionSet> normalizeRawAlternative(final RawAlternative alternative) throws AssertionCreationException, PolicyException {
    final List<PolicyAssertion> normalizedContentBase = new LinkedList<PolicyAssertion>();
    final Collection<List<PolicyAssertion>> normalizedContentOptions = new LinkedList<List<PolicyAssertion>>();
    if (!alternative.nestedAssertions.isEmpty()) {
        final Queue<RawAssertion> nestedAssertionsQueue = new LinkedList<RawAssertion>(alternative.nestedAssertions);
        RawAssertion rawAssertion;
        while((rawAssertion = nestedAssertionsQueue.poll()) != null) {
            final List<PolicyAssertion> normalized = normalizeRawAssertion(rawAssertion);
            // if there is only a single result, we can add it direclty to the content base collection
            // more elements in the result indicate that we will have to create combinations
            if (normalized.size() == 1) {
                normalizedContentBase.addAll(normalized);
            } else {
                normalizedContentOptions.add(normalized);
            }
        }
    }

    final List<AssertionSet> options = new LinkedList<AssertionSet>();
    if (normalizedContentOptions.isEmpty()) {
        // we do not have any options to combine => returning this assertion
        options.add(AssertionSet.createAssertionSet(normalizedContentBase));
    } else {
        // we have some options to combine => creating assertion options based on content combinations
        final Collection<Collection<PolicyAssertion>> contentCombinations = PolicyUtils.Collections.combine(normalizedContentBase, normalizedContentOptions, true);
        for (Collection<PolicyAssertion> contentOption : contentCombinations) {
            options.add(AssertionSet.createAssertionSet(contentOption));
        }
    }
    return options;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:32,代码来源:PolicyModelTranslator.java


示例9: normalizeRawAssertion

import com.sun.xml.internal.ws.policy.AssertionSet; //导入依赖的package包/类
private List<PolicyAssertion> normalizeRawAssertion(final RawAssertion assertion) throws AssertionCreationException, PolicyException {
    List<PolicyAssertion> parameters;
    if (assertion.parameters.isEmpty()) {
        parameters = null;
    } else {
        parameters = new ArrayList<PolicyAssertion>(assertion.parameters.size());
        for (ModelNode parameterNode : assertion.parameters) {
            parameters.add(createPolicyAssertionParameter(parameterNode));
        }
    }

    final List<AssertionSet> nestedAlternatives = new LinkedList<AssertionSet>();
    if (assertion.nestedAlternatives != null && !assertion.nestedAlternatives.isEmpty()) {
        final Queue<RawAlternative> nestedAlternativeQueue = new LinkedList<RawAlternative>(assertion.nestedAlternatives);
        RawAlternative rawAlternative;
        while((rawAlternative = nestedAlternativeQueue.poll()) != null) {
            nestedAlternatives.addAll(normalizeRawAlternative(rawAlternative));
        }
        // if there is only a single result, we can add it direclty to the content base collection
        // more elements in the result indicate that we will have to create combinations
    }

    final List<PolicyAssertion> assertionOptions = new LinkedList<PolicyAssertion>();
    final boolean nestedAlternativesAvailable = !nestedAlternatives.isEmpty();
    if (nestedAlternativesAvailable) {
        for (AssertionSet nestedAlternative : nestedAlternatives) {
            assertionOptions.add(createPolicyAssertion(assertion.originalNode.getNodeData(), parameters, nestedAlternative));
        }
    } else {
        assertionOptions.add(createPolicyAssertion(assertion.originalNode.getNodeData(), parameters, null));
    }
    return assertionOptions;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:34,代码来源:PolicyModelTranslator.java


示例10: createPolicyAssertion

import com.sun.xml.internal.ws.policy.AssertionSet; //导入依赖的package包/类
private PolicyAssertion createPolicyAssertion(final AssertionData data, final Collection<PolicyAssertion> assertionParameters, final AssertionSet nestedAlternative) throws AssertionCreationException {
    final String assertionNamespace = data.getName().getNamespaceURI();
    final PolicyAssertionCreator domainSpecificPAC = assertionCreators.get(assertionNamespace);


    if (domainSpecificPAC == null) {
        return defaultCreator.createAssertion(data, assertionParameters, nestedAlternative, null);
    } else {
        return domainSpecificPAC.createAssertion(data, assertionParameters, nestedAlternative, defaultCreator);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:PolicyModelTranslator.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java JMeterProperty类代码示例发布时间:2022-05-23
下一篇:
Java BluetoothSPP类代码示例发布时间: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