001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common Development
008: * and Distribution License("CDDL") (collectively, the "License"). You
009: * may not use this file except in compliance with the License. You can obtain
010: * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
011: * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
012: * language governing permissions and limitations under the License.
013: *
014: * When distributing the software, include this License Header Notice in each
015: * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
016: * Sun designates this particular file as subject to the "Classpath" exception
017: * as provided by Sun in the GPL Version 2 section of the License file that
018: * accompanied this code. If applicable, add the following below the License
019: * Header, with the fields enclosed by brackets [] replaced by your own
020: * identifying information: "Portions Copyrighted [year]
021: * [name of copyright owner]"
022: *
023: * Contributor(s):
024: *
025: * If you wish your version of this file to be governed by only the CDDL or
026: * only the GPL Version 2, indicate your decision by adding "[Contributor]
027: * elects to include this software in this distribution under the [CDDL or GPL
028: * Version 2] license." If you don't indicate a single choice of license, a
029: * recipient has the option to distribute your version of this file under
030: * either the CDDL, the GPL Version 2 or to extend the choice of license to
031: * its licensees as provided above. However, if you add GPL Version 2 code
032: * and therefore, elected the GPL Version 2 license, then the option applies
033: * only if the new code is made subject to such option by the copyright
034: * holder.
035: */
036:
037: package com.sun.xml.ws.policy.spi;
038:
039: import com.sun.xml.ws.policy.AssertionSet;
040: import com.sun.xml.ws.policy.PolicyAssertion;
041: import com.sun.xml.ws.policy.sourcemodel.AssertionData;
042: import java.util.Collection;
043:
044: /**
045: * The interface defines contract for custom (domain specific) policy assertion
046: * factories. The implementations are discovered using service provider mechanism
047: * described in the
048: * <a href="http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#Service%20Provider">J2SE JAR File Specification</a>.
049: *<p/>
050: * Every implementation of policy assertion creator is expected to <b>fully</b>
051: * handle the creation of assertions for the domain (namespace) it claims to
052: * support by returning the namespace string from the {link #getSupportedDomainNamespaceUri()}
053: * method. To handle creation of domain-specific assertions that are not intended
054: * to be customized, the default policy assertion creator (passed as one of the
055: * input parameters into the {@link #createAssertion(AssertionData, Collection, AssertionSet, PolicyAssertionCreator)} method)
056: * shall be used.
057: *
058: * @author Marek Potociar
059: */
060: public interface PolicyAssertionCreator {
061:
062: /**
063: * This method returns the namespace URIs of the domains that are supported by the implementation of
064: * this inteface. There can be multiple URIs supported per single implementation.
065: * <p/>
066: * Supporting domain namespace URI means that particular {@code PolicyAssertionCreator} implementation
067: * is able to create assertion instances for the domains identified by the namespace URIs returned from this
068: * method. It is required that each {@code PolicyAssertionCreator} implementation handles the policy
069: * assertion creation for <b>each</b> assertion in every domain it claims to support.
070: *
071: * @return string array representing the namespace URIs of the supported domains. It is expected that multiple calls on this method return the
072: * same value each time. <b>Returned string array must be neither {@code null} nor empty. Also each string value in the array must not be {@code null}
073: * nor empty.</b>
074: *
075: */
076: String[] getSupportedDomainNamespaceURIs();
077:
078: /**
079: * Creates domain-specific policy assertion instance according to assertion data provided. For the provided
080: * assertion data and this policy assertion creator instance, it will allways be true that assertion namespace
081: * URI equals to one of supported domain namespace URIs.
082: *<p/>
083: * Additional method parameter (which must not be {@code null}) supplied by the policy framework specifies a default policy
084: * assertion creator that might be used to handle creation of unsupported domain assertion in the default way. This is
085: * to give policy assertion creator a chance to handle also creation of "unsupported" domain assertions and to encourage
086: * implemetors to use class composition instad of class inheritance.
087: *
088: * @param data assertion creation data specifying the details of newly created assertion
089: * @param assertionParameters collection of assertions parameters of this policy assertion. May be {@code null}.
090: * @param nestedAlternative assertion set specifying nested policy alternative. May be {@code null}.
091: * @param defaultCreator default policy assertion creator implementation that shall be used to handle creation of assertions
092: * which are not explicitly supported by this policy assertion creator implementation
093: * @return domain specific policy assertion implementation according to assertion data provided.
094: *
095: * @throws AssertionCreationException in case of assertion creation failure
096: */
097: PolicyAssertion createAssertion(AssertionData data,
098: Collection<PolicyAssertion> assertionParameters,
099: AssertionSet nestedAlternative,
100: PolicyAssertionCreator defaultCreator)
101: throws AssertionCreationException;
102: }
|