01: /*
02: * $Id: MLSPolicy.java,v 1.3 2006/09/29 12:04:58 kumarjayanti Exp $
03: */
04:
05: /*
06: * The contents of this file are subject to the terms
07: * of the Common Development and Distribution License
08: * (the License). You may not use this file except in
09: * compliance with the License.
10: *
11: * You can obtain a copy of the license at
12: * https://glassfish.dev.java.net/public/CDDLv1.0.html.
13: * See the License for the specific language governing
14: * permissions and limitations under the License.
15: *
16: * When distributing Covered Code, include this CDDL
17: * Header Notice in each file and include the License file
18: * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
19: * If applicable, add the following below the CDDL Header,
20: * with the fields enclosed by brackets [] replaced by
21: * you own identifying information:
22: * "Portions Copyrighted [year] [name of copyright owner]"
23: *
24: * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
25: */
26:
27: package com.sun.xml.wss.impl.policy;
28:
29: /**
30: * Represents a base class for Message Level Security (MLS) Policies.
31: * Any MLSPolicy can be epxressed as being composed of one or both of
32: * two SecurityPolicy components called FeatureBinding and KeyBinding.
33: * This generic structure for an MLSPolicy allows for representing complex,
34: * concrete Message Level Security Policies.
35: */
36: public abstract class MLSPolicy implements SecurityPolicy {
37:
38: protected boolean readonly = false;
39:
40: /**
41: * Get FeatureBinding component
42: * @return FeatureBinding component of this MLSPolicy
43: * @exception PolicyGenerationException if a FeatureBinding component is invalid for this MLSPolicy
44: */
45: public abstract MLSPolicy getFeatureBinding()
46: throws PolicyGenerationException;
47:
48: /**
49: * Get KeyBinding component
50: * @return KeyBinding component of this MLSPolicy
51: * @exception PolicyGenerationException if a KeyBinding component is invalid for this MLSPolicy
52: */
53: public abstract MLSPolicy getKeyBinding()
54: throws PolicyGenerationException;
55:
56: /**
57: * @param readonly set the readonly status of the policy.
58: *
59: */
60: public void isReadOnly(boolean readonly) {
61: this .readonly = readonly;
62: try {
63: MLSPolicy featureBinding = getFeatureBinding();
64: if (featureBinding != null) {
65: featureBinding.isReadOnly(readonly);
66: }
67:
68: MLSPolicy keybinding = getKeyBinding();
69: if (keybinding != null) {
70: keybinding.isReadOnly(readonly);
71: }
72: } catch (PolicyGenerationException e) {
73: }
74: }
75:
76: /**
77: * @return true if policy is readonly.
78: *
79: */
80: public boolean isReadOnly() {
81: return readonly;
82: }
83:
84: }
|