01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.jetspeed.security;
18:
19: import java.io.Serializable;
20: import java.security.Policy;
21:
22: /**
23: * <p>
24: * Simple wrapper for security policy providing the ability to add attribute on Policy and how they
25: * should be used by the application.
26: * </p>
27: *
28: * @author <a href="mailto:LeStrat_David@emc.com">David Le Strat</a>
29: */
30: public class PolicyWrapper implements Serializable {
31: /** The serial version uid. */
32: private static final long serialVersionUID = 3386468724328997598L;
33:
34: /** The policy. */
35: private transient Policy policy;
36:
37: /** Whether to use as a policy. */
38: private boolean useAsPolicy = false;
39:
40: /** Whether to use as a default policy. */
41: private boolean defaultPolicy = false;
42:
43: /**
44: * @param policy
45: * @param useAsPolicy
46: * @param defaultPolicy
47: */
48: public PolicyWrapper(Policy policy, boolean useAsPolicy,
49: boolean defaultPolicy) {
50: this .policy = policy;
51: this .useAsPolicy = useAsPolicy;
52: this .defaultPolicy = defaultPolicy;
53: }
54:
55: /**
56: * @return Returns the policy.
57: */
58: public Policy getPolicy() {
59: return this .policy;
60: }
61:
62: /**
63: * @param policy The policy to set.
64: */
65: public void setPolicy(Policy policy) {
66: this .policy = policy;
67: }
68:
69: /**
70: * @return Returns the defaultPolicy.
71: */
72: public boolean isDefaultPolicy() {
73: return defaultPolicy;
74: }
75:
76: /**
77: * @param defaultPolicy The defaultPolicy to set.
78: */
79: public void setDefaultPolicy(boolean defaultPolicy) {
80: this .defaultPolicy = defaultPolicy;
81: }
82:
83: /**
84: * @return Returns the useAsPolicy.
85: */
86: public boolean isUseAsPolicy() {
87: return useAsPolicy;
88: }
89:
90: /**
91: * @param useAsPolicy The useAsPolicy to set.
92: */
93: public void setUseAsPolicy(boolean useAsPolicy) {
94: this.useAsPolicy = useAsPolicy;
95: }
96:
97: }
|