KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > activemq > security > SimpleAuthorizationMap


1 /**
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one or more
4  * contributor license agreements. See the NOTICE file distributed with
5  * this work for additional information regarding copyright ownership.
6  * The ASF licenses this file to You under the Apache License, Version 2.0
7  * (the "License"); you may not use this file except in compliance with
8  * the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18 package org.apache.activemq.security;
19
20 import org.apache.activemq.command.ActiveMQDestination;
21 import org.apache.activemq.filter.DestinationMap;
22
23 import java.util.Set JavaDoc;
24
25 /**
26  * An AuthorizationMap which is configured with individual DestinationMaps for
27  * each operation.
28  *
29  * @org.apache.xbean.XBean
30  *
31  * @version $Revision: 479639 $
32  */

33 public class SimpleAuthorizationMap implements AuthorizationMap {
34
35     private DestinationMap writeACLs;
36     private DestinationMap readACLs;
37     private DestinationMap adminACLs;
38
39     private TempDestinationAuthorizationEntry tempDestinationAuthorizationEntry;
40     
41     public SimpleAuthorizationMap() {
42     }
43
44     public SimpleAuthorizationMap(DestinationMap writeACLs, DestinationMap readACLs, DestinationMap adminACLs) {
45         this.writeACLs = writeACLs;
46         this.readACLs = readACLs;
47         this.adminACLs = adminACLs;
48     }
49
50     /*
51      * Need to think how to retrieve the ACLs for temporary destinations since they are not map
52      * to a specific destination. For now we'll just retrieve it from a TempDestinationAuthorizationEntry
53      * same way as the DefaultAuthorizationMap. The ACLs retrieved here will be map to all temp destinations
54      */

55     
56     public void setTempDestinationAuthorizationEntry(TempDestinationAuthorizationEntry tempDestinationAuthorizationEntry) {
57         this.tempDestinationAuthorizationEntry = tempDestinationAuthorizationEntry;
58     }
59     
60     public TempDestinationAuthorizationEntry getTempDestinationAuthorizationEntry() {
61         return this.tempDestinationAuthorizationEntry;
62     }
63
64     
65     public Set JavaDoc getTempDestinationAdminACLs() {
66         if(tempDestinationAuthorizationEntry != null)
67             return tempDestinationAuthorizationEntry.getAdminACLs();
68         else
69             return null;
70     }
71     
72     public Set JavaDoc getTempDestinationReadACLs() {
73         if(tempDestinationAuthorizationEntry != null)
74             return tempDestinationAuthorizationEntry.getReadACLs();
75         else
76             return null;
77     }
78     
79     public Set JavaDoc getTempDestinationWriteACLs() {
80         if(tempDestinationAuthorizationEntry != null)
81             return tempDestinationAuthorizationEntry.getWriteACLs();
82         else
83             return null;
84     }
85         
86     public Set JavaDoc getAdminACLs(ActiveMQDestination destination) {
87         return adminACLs.get(destination);
88     }
89
90     public Set JavaDoc getReadACLs(ActiveMQDestination destination) {
91         return readACLs.get(destination);
92     }
93
94     public Set JavaDoc getWriteACLs(ActiveMQDestination destination) {
95         return writeACLs.get(destination);
96     }
97
98     public DestinationMap getAdminACLs() {
99         return adminACLs;
100     }
101
102     public void setAdminACLs(DestinationMap adminACLs) {
103         this.adminACLs = adminACLs;
104     }
105
106     public DestinationMap getReadACLs() {
107         return readACLs;
108     }
109
110     public void setReadACLs(DestinationMap readACLs) {
111         this.readACLs = readACLs;
112     }
113
114     public DestinationMap getWriteACLs() {
115         return writeACLs;
116     }
117
118     public void setWriteACLs(DestinationMap writeACLs) {
119         this.writeACLs = writeACLs;
120     }
121
122 }
123
Popular Tags