KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > j2ee > deployment > EARContext


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.geronimo.j2ee.deployment;
18
19 import java.io.File JavaDoc;
20 import java.util.Collection JavaDoc;
21 import java.util.HashMap JavaDoc;
22 import java.util.Map JavaDoc;
23
24 import org.apache.geronimo.common.DeploymentException;
25 import org.apache.geronimo.deployment.DeploymentContext;
26 import org.apache.geronimo.gbean.AbstractName;
27 import org.apache.geronimo.gbean.AbstractNameQuery;
28 import org.apache.geronimo.kernel.Naming;
29 import org.apache.geronimo.kernel.config.ConfigurationManager;
30 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
31 import org.apache.geronimo.kernel.repository.Environment;
32
33 /**
34  * @version $Rev:386276 $ $Date: 2006-11-16 23:35:17 -0500 (Thu, 16 Nov 2006) $
35  */

36 public class EARContext extends DeploymentContext {
37
38     private final AbstractNameQuery serverName;
39     private final AbstractNameQuery transactionManagerObjectName;
40     private final AbstractNameQuery connectionTrackerObjectName;
41     private final AbstractNameQuery transactedTimerName;
42     private final AbstractNameQuery nonTransactedTimerName;
43     private final AbstractNameQuery corbaGBeanObjectName;
44
45     private final Map JavaDoc contextIDToPermissionsMap = new HashMap JavaDoc();
46     private AbstractName jaccManagerName;
47     private Object JavaDoc securityConfiguration;
48
49     private final Map JavaDoc messageDestinations = new HashMap JavaDoc();
50
51     public EARContext(File JavaDoc baseDir,
52             File JavaDoc inPlaceConfigurationDir,
53             Environment environment,
54             ConfigurationModuleType moduleType,
55             Naming naming,
56             ConfigurationManager configurationManager, Collection JavaDoc repositories,
57             AbstractNameQuery serverName,
58             AbstractName baseName,
59             AbstractNameQuery transactionManagerObjectName,
60             AbstractNameQuery connectionTrackerObjectName,
61             AbstractNameQuery transactedTimerName,
62             AbstractNameQuery nonTransactedTimerName,
63             AbstractNameQuery corbaGBeanObjectName
64     ) throws DeploymentException {
65         super(baseDir, inPlaceConfigurationDir, environment, baseName, moduleType, naming, configurationManager, repositories);
66
67         this.serverName = serverName;
68         this.transactionManagerObjectName = transactionManagerObjectName;
69         this.connectionTrackerObjectName = connectionTrackerObjectName;
70         this.transactedTimerName = transactedTimerName;
71         this.nonTransactedTimerName = nonTransactedTimerName;
72         this.corbaGBeanObjectName = corbaGBeanObjectName;
73     }
74
75     public EARContext(File JavaDoc baseDir,
76             File JavaDoc inPlaceConfigurationDir,
77             Environment environment,
78             ConfigurationModuleType moduleType,
79             Naming naming,
80             ConfigurationManager configurationManager,
81             AbstractNameQuery serverName,
82             AbstractName baseName,
83             AbstractNameQuery transactionManagerObjectName,
84             AbstractNameQuery connectionTrackerObjectName,
85             AbstractNameQuery transactedTimerName,
86             AbstractNameQuery nonTransactedTimerName,
87             AbstractNameQuery corbaGBeanObjectName
88     ) throws DeploymentException {
89         super(baseDir, inPlaceConfigurationDir, environment, baseName, moduleType, naming, configurationManager);
90
91         this.serverName = serverName;
92
93         this.transactionManagerObjectName = transactionManagerObjectName;
94         this.connectionTrackerObjectName = connectionTrackerObjectName;
95         this.transactedTimerName = transactedTimerName;
96         this.nonTransactedTimerName = nonTransactedTimerName;
97         this.corbaGBeanObjectName = corbaGBeanObjectName;
98     }
99
100     public EARContext(File JavaDoc baseDir, File JavaDoc inPlaceConfigurationDir, Environment environment, ConfigurationModuleType moduleType, AbstractName baseName, EARContext parent) throws DeploymentException {
101         super(baseDir, inPlaceConfigurationDir, environment, baseName, moduleType, parent.getNaming(), parent.getConfigurationManager());
102         this.serverName = parent.getServerName();
103
104         this.transactionManagerObjectName = parent.getTransactionManagerName();
105         this.connectionTrackerObjectName = parent.getConnectionTrackerName();
106         this.transactedTimerName = parent.getTransactedTimerName();
107         this.nonTransactedTimerName = parent.getNonTransactedTimerName();
108         this.corbaGBeanObjectName = parent.getCORBAGBeanName();
109     }
110
111     public AbstractNameQuery getServerName() {
112         return serverName;
113     }
114
115     public AbstractNameQuery getTransactionManagerName() {
116         return transactionManagerObjectName;
117     }
118
119     public AbstractNameQuery getConnectionTrackerName() {
120         return connectionTrackerObjectName;
121     }
122
123     public AbstractNameQuery getTransactedTimerName() {
124         return transactedTimerName;
125     }
126
127     public AbstractNameQuery getNonTransactedTimerName() {
128         return nonTransactedTimerName;
129     }
130
131     public AbstractNameQuery getCORBAGBeanName() {
132         return corbaGBeanObjectName;
133     }
134
135     public Map JavaDoc getContextIDToPermissionsMap() {
136         return contextIDToPermissionsMap;
137     }
138
139     public void addSecurityContext(String JavaDoc contextID, Object JavaDoc componentPermissions) throws DeploymentException {
140         Object JavaDoc old = contextIDToPermissionsMap.put(contextID, componentPermissions);
141         if (old != null) {
142             throw new DeploymentException("Duplicate contextID registered! " + contextID);
143         }
144     }
145
146     public void setJaccManagerName(AbstractName jaccManagerName) {
147         this.jaccManagerName = jaccManagerName;
148     }
149
150     public AbstractName getJaccManagerName() {
151         return jaccManagerName;
152     }
153
154     public void setSecurityConfiguration(Object JavaDoc securityConfiguration) throws DeploymentException {
155         if (this.securityConfiguration != null) {
156             throw new DeploymentException("Only one security configuration allowed per application");
157         }
158         this.securityConfiguration = securityConfiguration;
159     }
160
161     public Object JavaDoc getSecurityConfiguration() {
162         return securityConfiguration;
163     }
164
165     public void registerMessageDestionations(String JavaDoc moduleName, Map JavaDoc nameMap) throws DeploymentException {
166         messageDestinations.put(moduleName, nameMap);
167     }
168
169     public Map JavaDoc getMessageDestinations() {
170         return messageDestinations;
171     }
172
173 }
174
Popular Tags