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;
038:
039: /**
040: * The class serves as a policy map mutator that allows for replacement of current effective policies
041: * stored in the policy map with new effective policy provided by the mutator user.
042: *
043: * @author Marek Potociar (marek.potociar@sun.com)
044: */
045: public final class EffectivePolicyModifier extends PolicyMapMutator {
046: public static EffectivePolicyModifier createEffectivePolicyModifier() {
047: return new EffectivePolicyModifier();
048: }
049:
050: /**
051: * Ensures that direct instantiation is not possible from outside of the class
052: */
053: private EffectivePolicyModifier() {
054: // no initialization required
055: }
056:
057: /**
058: * Replaces current effective policy on the service scope (identified by a {@code key} parameter) with the new efective
059: * policy provided as a second input parameter. If no policy was defined for the presented key, the new policy is simply
060: * stored with the key.
061: *
062: * @param key identifier of the scope the effective policy should be replaced with the new one. Must not be {@code null}.
063: * @param newEffectivePolicy the new policy to replace the old effective policy of the scope. Must not be {@code null}.
064: *
065: * @throws IllegalArgumentException in case any of the input parameters is {@code null}
066: */
067: public void setNewEffectivePolicyForServiceScope(
068: final PolicyMapKey key, final Policy newEffectivePolicy) {
069: getMap().setNewEffectivePolicyForScope(
070: PolicyMap.ScopeType.SERVICE, key, newEffectivePolicy);
071: }
072:
073: /**
074: * Replaces current effective policy on the endpoint scope (identified by a {@code key} parameter) with the new efective
075: * policy provided as a second input parameter.
076: *
077: * @param key identifier of the scope the effective policy should be replaced with the new one. Must not be {@code null}.
078: * @param newEffectivePolicy the new policy to replace the old effective policy of the scope. Must not be {@code null}.
079: *
080: * @throws IllegalArgumentException in case any of the input parameters is {@code null}
081: */
082: public void setNewEffectivePolicyForEndpointScope(
083: final PolicyMapKey key, final Policy newEffectivePolicy) {
084: getMap().setNewEffectivePolicyForScope(
085: PolicyMap.ScopeType.ENDPOINT, key, newEffectivePolicy);
086: }
087:
088: /**
089: * Replaces current effective policy on the operation scope (identified by a {@code key} parameter) with the new efective
090: * policy provided as a second input parameter. If no policy was defined for the presented key, the new policy is simply
091: * stored with the key.
092: *
093: * @param key identifier of the scope the effective policy should be replaced with the new one. Must not be {@code null}.
094: * @param newEffectivePolicy the new policy to replace the old effective policy of the scope. Must not be {@code null}.
095: *
096: * @throws IllegalArgumentException in case any of the input parameters is {@code null}
097: */
098: public void setNewEffectivePolicyForOperationScope(
099: final PolicyMapKey key, final Policy newEffectivePolicy) {
100: getMap().setNewEffectivePolicyForScope(
101: PolicyMap.ScopeType.OPERATION, key, newEffectivePolicy);
102: }
103:
104: /**
105: * Replaces current effective policy on the input message scope (identified by a {@code key} parameter) with the new efective
106: * policy provided as a second input parameter. If no policy was defined for the presented key, the new policy is simply
107: * stored with the key.
108: *
109: * @param key identifier of the scope the effective policy should be replaced with the new one. Must not be {@code null}.
110: * @param newEffectivePolicy the new policy to replace the old effective policy of the scope. Must not be {@code null}.
111: *
112: * @throws IllegalArgumentException in case any of the input parameters is {@code null}
113: */
114: public void setNewEffectivePolicyForInputMessageScope(
115: final PolicyMapKey key, final Policy newEffectivePolicy) {
116: getMap().setNewEffectivePolicyForScope(
117: PolicyMap.ScopeType.INPUT_MESSAGE, key,
118: newEffectivePolicy);
119: }
120:
121: /**
122: * Replaces current effective policy on the output message scope (identified by a {@code key} parameter) with the new efective
123: * policy provided as a second input parameter. If no policy was defined for the presented key, the new policy is simply
124: * stored with the key.
125: *
126: * @param key identifier of the scope the effective policy should be replaced with the new one. Must not be {@code null}.
127: * @param newEffectivePolicy the new policy to replace the old effective policy of the scope. Must not be {@code null}.
128: *
129: * @throws IllegalArgumentException in case any of the input parameters is {@code null}
130: */
131: public void setNewEffectivePolicyForOutputMessageScope(
132: final PolicyMapKey key, final Policy newEffectivePolicy) {
133: getMap().setNewEffectivePolicyForScope(
134: PolicyMap.ScopeType.OUTPUT_MESSAGE, key,
135: newEffectivePolicy);
136: }
137:
138: /**
139: * Replaces current effective policy on the fault message scope (identified by a {@code key} parameter) with the new efective
140: * policy provided as a second input parameter. If no policy was defined for the presented key, the new policy is simply
141: * stored with the key.
142: *
143: * @param key identifier of the scope the effective policy should be replaced with the new one. Must not be {@code null}.
144: * @param newEffectivePolicy the new policy to replace the old effective policy of the scope. Must not be {@code null}.
145: *
146: * @throws IllegalArgumentException in case any of the input parameters is {@code null}
147: */
148: public void setNewEffectivePolicyForFaultMessageScope(
149: final PolicyMapKey key, final Policy newEffectivePolicy) {
150: getMap().setNewEffectivePolicyForScope(
151: PolicyMap.ScopeType.FAULT_MESSAGE, key,
152: newEffectivePolicy);
153: }
154: }
|