Java Code Examples for com.sun.xml.internal.ws.policy.Policy#createNullPolicy()

The following examples show how to use com.sun.xml.internal.ws.policy.Policy#createNullPolicy() . 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: PolicyModelTranslator.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 2
Source File: PolicyModelTranslator.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 3
Source File: PolicyModelTranslator.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 4
Source File: PolicyModelTranslator.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 5
Source File: PolicyModelTranslator.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 6
Source File: PolicyModelTranslator.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 7
Source File: PolicyModelTranslator.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 8
Source File: PolicyModelTranslator.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}