All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sun.xml.ws.config.management.policy.ManagementAssertionCreator Maven / Gradle / Ivy

There is a newer version: 4.0.3
Show newest version
/*
 * Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Distribution License v. 1.0, which is available at
 * http://www.eclipse.org/org/documents/edl-v10.php.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

package com.sun.xml.ws.config.management.policy;

import com.sun.xml.ws.api.config.management.policy.ManagedClientAssertion;
import com.sun.xml.ws.api.config.management.policy.ManagedServiceAssertion;
import com.sun.xml.ws.policy.AssertionSet;
import com.sun.xml.ws.policy.PolicyAssertion;
import com.sun.xml.ws.policy.PolicyConstants;
import com.sun.xml.ws.policy.sourcemodel.AssertionData;
import com.sun.xml.ws.policy.spi.AssertionCreationException;
import com.sun.xml.ws.policy.spi.PolicyAssertionCreator;

import java.util.Collection;
import javax.xml.namespace.QName;

/**
 * Instantiates a PolicyAssertion of type ManagedServiceAssertion or ManagedClientAssertion.
 *
 * @author Fabian Ritzmann
 */
public class ManagementAssertionCreator implements PolicyAssertionCreator {

    @Override
    public String[] getSupportedDomainNamespaceURIs() {
        return new String[] { PolicyConstants.SUN_MANAGEMENT_NAMESPACE };
    }

    @Override
    public PolicyAssertion createAssertion(AssertionData data, Collection assertionParameters,
                                           AssertionSet nestedAlternative, PolicyAssertionCreator defaultCreator) throws AssertionCreationException {
        final QName name = data.getName();
        if (ManagedServiceAssertion.MANAGED_SERVICE_QNAME.equals(name)) {
            return new ManagedServiceAssertion(data, assertionParameters);
        }
        else if (ManagedClientAssertion.MANAGED_CLIENT_QNAME.equals(name)) {
            return new ManagedClientAssertion(data, assertionParameters);
        }
        else {
            return defaultCreator.createAssertion(data, assertionParameters, nestedAlternative, null);
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy