View Javadoc

1   /*
2   * Licensed to the Apache Software Foundation (ASF) under one or more
3   * contributor license agreements.  See the NOTICE file distributed with
4   * this work for additional information regarding copyright ownership.
5   * The ASF licenses this file to You under the Apache License, Version 2.0
6   * (the "License"); you may not use this file except in compliance with
7   * the License.  You may obtain a copy of the License at
8   *
9   *     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  {
32      /*** The serial version uid.  */
33      private static final long serialVersionUID = 3386468724328997598L;
34  
35      /*** The policy. */
36      private transient Policy policy;
37  
38      /*** Whether to use as a policy. */
39      private boolean useAsPolicy = false;
40  
41      /*** Whether to use as a default policy. */
42      private boolean defaultPolicy = false;
43  
44      /***
45       * @param policy
46       * @param useAsPolicy
47       * @param defaultPolicy
48       */
49      public PolicyWrapper(Policy policy, boolean useAsPolicy, boolean defaultPolicy)
50      {
51          this.policy = policy;
52          this.useAsPolicy = useAsPolicy;
53          this.defaultPolicy = defaultPolicy;
54      }
55  
56      /***
57       * @return Returns the policy.
58       */
59      public Policy getPolicy()
60      {
61          return this.policy;
62      }
63  
64      /***
65       * @param policy The policy to set.
66       */
67      public void setPolicy(Policy policy)
68      {
69          this.policy = policy;
70      }
71  
72      /***
73       * @return Returns the defaultPolicy.
74       */
75      public boolean isDefaultPolicy()
76      {
77          return defaultPolicy;
78      }
79  
80      /***
81       * @param defaultPolicy The defaultPolicy to set.
82       */
83      public void setDefaultPolicy(boolean defaultPolicy)
84      {
85          this.defaultPolicy = defaultPolicy;
86      }
87  
88      /***
89       * @return Returns the useAsPolicy.
90       */
91      public boolean isUseAsPolicy()
92      {
93          return useAsPolicy;
94      }
95  
96      /***
97       * @param useAsPolicy The useAsPolicy to set.
98       */
99      public void setUseAsPolicy(boolean useAsPolicy)
100     {
101         this.useAsPolicy = useAsPolicy;
102     }
103 
104 }