|
1 /* |
|
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. |
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 * |
|
5 * This code is free software; you can redistribute it and/or modify it |
|
6 * under the terms of the GNU General Public License version 2 only, as |
|
7 * published by the Free Software Foundation. Oracle designates this |
|
8 * particular file as subject to the "Classpath" exception as provided |
|
9 * by Oracle in the LICENSE file that accompanied this code. |
|
10 * |
|
11 * This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 * version 2 for more details (a copy is included in the LICENSE file that |
|
15 * accompanied this code). |
|
16 * |
|
17 * You should have received a copy of the GNU General Public License version |
|
18 * 2 along with this work; if not, write to the Free Software Foundation, |
|
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 * |
|
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 * or visit www.oracle.com if you need additional information or have any |
|
23 * questions. |
|
24 */ |
|
25 |
|
26 package com.sun.xml.internal.ws.policy.spi; |
|
27 |
|
28 import com.sun.xml.internal.ws.policy.AssertionSet; |
|
29 import com.sun.xml.internal.ws.policy.PolicyAssertion; |
|
30 import com.sun.xml.internal.ws.policy.sourcemodel.AssertionData; |
|
31 import java.util.Collection; |
|
32 |
|
33 /** |
|
34 * The interface defines contract for custom (domain specific) policy assertion |
|
35 * factories. The implementations are discovered using service provider mechanism |
|
36 * described in the |
|
37 * <a href="http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#Service%20Provider">J2SE JAR File Specification</a>. |
|
38 *<p/> |
|
39 * Every implementation of policy assertion creator is expected to <b>fully</b> |
|
40 * handle the creation of assertions for the domain (namespace) it claims to |
|
41 * support by returning the namespace string from the {link #getSupportedDomainNamespaceUri()} |
|
42 * method. To handle creation of domain-specific assertions that are not intended |
|
43 * to be customized, the default policy assertion creator (passed as one of the |
|
44 * input parameters into the {@link #createAssertion(AssertionData, Collection, AssertionSet, PolicyAssertionCreator)} method) |
|
45 * shall be used. |
|
46 * |
|
47 * @author Marek Potociar |
|
48 */ |
|
49 public interface PolicyAssertionCreator { |
|
50 |
|
51 /** |
|
52 * This method returns the namespace URIs of the domains that are supported by the implementation of |
|
53 * this inteface. There can be multiple URIs supported per single implementation. |
|
54 * <p/> |
|
55 * Supporting domain namespace URI means that particular {@code PolicyAssertionCreator} implementation |
|
56 * is able to create assertion instances for the domains identified by the namespace URIs returned from this |
|
57 * method. It is required that each {@code PolicyAssertionCreator} implementation handles the policy |
|
58 * assertion creation for <b>each</b> assertion in every domain it claims to support. |
|
59 * |
|
60 * @return string array representing the namespace URIs of the supported domains. It is expected that multiple calls on this method return the |
|
61 * 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} |
|
62 * nor empty.</b> |
|
63 * |
|
64 */ |
|
65 String[] getSupportedDomainNamespaceURIs(); |
|
66 |
|
67 /** |
|
68 * Creates domain-specific policy assertion instance according to assertion data provided. For the provided |
|
69 * assertion data and this policy assertion creator instance, it will allways be true that assertion namespace |
|
70 * URI equals to one of supported domain namespace URIs. |
|
71 *<p/> |
|
72 * Additional method parameter (which must not be {@code null}) supplied by the policy framework specifies a default policy |
|
73 * assertion creator that might be used to handle creation of unsupported domain assertion in the default way. This is |
|
74 * to give policy assertion creator a chance to handle also creation of "unsupported" domain assertions and to encourage |
|
75 * implemetors to use class composition instad of class inheritance. |
|
76 * |
|
77 * @param data assertion creation data specifying the details of newly created assertion |
|
78 * @param assertionParameters collection of assertions parameters of this policy assertion. May be {@code null}. |
|
79 * @param nestedAlternative assertion set specifying nested policy alternative. May be {@code null}. |
|
80 * @param defaultCreator default policy assertion creator implementation that shall be used to handle creation of assertions |
|
81 * which are not explicitly supported by this policy assertion creator implementation |
|
82 * @return domain specific policy assertion implementation according to assertion data provided. |
|
83 * |
|
84 * @throws AssertionCreationException in case of assertion creation failure |
|
85 */ |
|
86 PolicyAssertion createAssertion(AssertionData data, Collection<PolicyAssertion> assertionParameters, AssertionSet nestedAlternative, PolicyAssertionCreator defaultCreator) throws AssertionCreationException; |
|
87 } |