1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/policy/spi/PolicyAssertionCreator.java Wed Apr 27 01:27:09 2016 +0800 1.3 @@ -0,0 +1,87 @@ 1.4 +/* 1.5 + * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. Oracle designates this 1.11 + * particular file as subject to the "Classpath" exception as provided 1.12 + * by Oracle in the LICENSE file that accompanied this code. 1.13 + * 1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.17 + * version 2 for more details (a copy is included in the LICENSE file that 1.18 + * accompanied this code). 1.19 + * 1.20 + * You should have received a copy of the GNU General Public License version 1.21 + * 2 along with this work; if not, write to the Free Software Foundation, 1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.23 + * 1.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.25 + * or visit www.oracle.com if you need additional information or have any 1.26 + * questions. 1.27 + */ 1.28 + 1.29 +package com.sun.xml.internal.ws.policy.spi; 1.30 + 1.31 +import com.sun.xml.internal.ws.policy.AssertionSet; 1.32 +import com.sun.xml.internal.ws.policy.PolicyAssertion; 1.33 +import com.sun.xml.internal.ws.policy.sourcemodel.AssertionData; 1.34 +import java.util.Collection; 1.35 + 1.36 +/** 1.37 + * The interface defines contract for custom (domain specific) policy assertion 1.38 + * factories. The implementations are discovered using service provider mechanism 1.39 + * described in the 1.40 + * <a href="http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#Service%20Provider">J2SE JAR File Specification</a>. 1.41 + *<p/> 1.42 + * Every implementation of policy assertion creator is expected to <b>fully</b> 1.43 + * handle the creation of assertions for the domain (namespace) it claims to 1.44 + * support by returning the namespace string from the {link #getSupportedDomainNamespaceUri()} 1.45 + * method. To handle creation of domain-specific assertions that are not intended 1.46 + * to be customized, the default policy assertion creator (passed as one of the 1.47 + * input parameters into the {@link #createAssertion(AssertionData, Collection, AssertionSet, PolicyAssertionCreator)} method) 1.48 + * shall be used. 1.49 + * 1.50 + * @author Marek Potociar 1.51 + */ 1.52 +public interface PolicyAssertionCreator { 1.53 + 1.54 + /** 1.55 + * This method returns the namespace URIs of the domains that are supported by the implementation of 1.56 + * this inteface. There can be multiple URIs supported per single implementation. 1.57 + * <p/> 1.58 + * Supporting domain namespace URI means that particular {@code PolicyAssertionCreator} implementation 1.59 + * is able to create assertion instances for the domains identified by the namespace URIs returned from this 1.60 + * method. It is required that each {@code PolicyAssertionCreator} implementation handles the policy 1.61 + * assertion creation for <b>each</b> assertion in every domain it claims to support. 1.62 + * 1.63 + * @return string array representing the namespace URIs of the supported domains. It is expected that multiple calls on this method return the 1.64 + * 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} 1.65 + * nor empty.</b> 1.66 + * 1.67 + */ 1.68 + String[] getSupportedDomainNamespaceURIs(); 1.69 + 1.70 + /** 1.71 + * Creates domain-specific policy assertion instance according to assertion data provided. For the provided 1.72 + * assertion data and this policy assertion creator instance, it will allways be true that assertion namespace 1.73 + * URI equals to one of supported domain namespace URIs. 1.74 + *<p/> 1.75 + * Additional method parameter (which must not be {@code null}) supplied by the policy framework specifies a default policy 1.76 + * assertion creator that might be used to handle creation of unsupported domain assertion in the default way. This is 1.77 + * to give policy assertion creator a chance to handle also creation of "unsupported" domain assertions and to encourage 1.78 + * implemetors to use class composition instad of class inheritance. 1.79 + * 1.80 + * @param data assertion creation data specifying the details of newly created assertion 1.81 + * @param assertionParameters collection of assertions parameters of this policy assertion. May be {@code null}. 1.82 + * @param nestedAlternative assertion set specifying nested policy alternative. May be {@code null}. 1.83 + * @param defaultCreator default policy assertion creator implementation that shall be used to handle creation of assertions 1.84 + * which are not explicitly supported by this policy assertion creator implementation 1.85 + * @return domain specific policy assertion implementation according to assertion data provided. 1.86 + * 1.87 + * @throws AssertionCreationException in case of assertion creation failure 1.88 + */ 1.89 + PolicyAssertion createAssertion(AssertionData data, Collection<PolicyAssertion> assertionParameters, AssertionSet nestedAlternative, PolicyAssertionCreator defaultCreator) throws AssertionCreationException; 1.90 +}