001: /**
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */package org.apache.geronimo.j2ee.deployment;
017:
018: import java.io.File;
019: import java.util.Collection;
020: import java.util.HashMap;
021: import java.util.Map;
022:
023: import org.apache.geronimo.common.DeploymentException;
024: import org.apache.geronimo.deployment.DeploymentContext;
025: import org.apache.geronimo.gbean.AbstractName;
026: import org.apache.geronimo.gbean.AbstractNameQuery;
027: import org.apache.geronimo.kernel.Naming;
028: import org.apache.geronimo.kernel.config.ConfigurationManager;
029: import org.apache.geronimo.kernel.config.ConfigurationModuleType;
030: import org.apache.geronimo.kernel.repository.Environment;
031:
032: /**
033: * @version $Rev:386276 $ $Date: 2007-05-05 04:12:52 -0700 (Sat, 05 May 2007) $
034: */
035: public class EARContext extends DeploymentContext {
036:
037: private final AbstractNameQuery serverName;
038: private final AbstractNameQuery transactionManagerObjectName;
039: private final AbstractNameQuery connectionTrackerObjectName;
040: private final AbstractNameQuery transactedTimerName;
041: private final AbstractNameQuery nonTransactedTimerName;
042: private final AbstractNameQuery corbaGBeanObjectName;
043:
044: private final Map contextIDToPermissionsMap = new HashMap();
045: private AbstractName jaccManagerName;
046: private Object securityConfiguration;
047:
048: private final Map messageDestinations;
049:
050: private final Map<Object, Object> generalData = new HashMap<Object, Object>();
051:
052: public EARContext(File baseDir, File inPlaceConfigurationDir,
053: Environment environment,
054: ConfigurationModuleType moduleType, Naming naming,
055: ConfigurationManager configurationManager,
056: Collection repositories, AbstractNameQuery serverName,
057: AbstractName baseName,
058: AbstractNameQuery transactionManagerObjectName,
059: AbstractNameQuery connectionTrackerObjectName,
060: AbstractNameQuery transactedTimerName,
061: AbstractNameQuery nonTransactedTimerName,
062: AbstractNameQuery corbaGBeanObjectName)
063: throws DeploymentException {
064: super (baseDir, inPlaceConfigurationDir, environment, baseName,
065: moduleType, naming, configurationManager, repositories);
066:
067: this .serverName = serverName;
068: this .transactionManagerObjectName = transactionManagerObjectName;
069: this .connectionTrackerObjectName = connectionTrackerObjectName;
070: this .transactedTimerName = transactedTimerName;
071: this .nonTransactedTimerName = nonTransactedTimerName;
072: this .corbaGBeanObjectName = corbaGBeanObjectName;
073: this .messageDestinations = new HashMap();
074: }
075:
076: public EARContext(File baseDir, File inPlaceConfigurationDir,
077: Environment environment,
078: ConfigurationModuleType moduleType, Naming naming,
079: ConfigurationManager configurationManager,
080: AbstractNameQuery serverName, AbstractName baseName,
081: AbstractNameQuery transactionManagerObjectName,
082: AbstractNameQuery connectionTrackerObjectName,
083: AbstractNameQuery transactedTimerName,
084: AbstractNameQuery nonTransactedTimerName,
085: AbstractNameQuery corbaGBeanObjectName,
086: Map messageDestinations) throws DeploymentException {
087: super (baseDir, inPlaceConfigurationDir, environment, baseName,
088: moduleType, naming, configurationManager);
089:
090: this .serverName = serverName;
091:
092: this .transactionManagerObjectName = transactionManagerObjectName;
093: this .connectionTrackerObjectName = connectionTrackerObjectName;
094: this .transactedTimerName = transactedTimerName;
095: this .nonTransactedTimerName = nonTransactedTimerName;
096: this .corbaGBeanObjectName = corbaGBeanObjectName;
097: this .messageDestinations = messageDestinations;
098: }
099:
100: public EARContext(File baseDir, File inPlaceConfigurationDir,
101: Environment environment,
102: ConfigurationModuleType moduleType, AbstractName baseName,
103: EARContext parent) throws DeploymentException {
104: super (baseDir, inPlaceConfigurationDir, environment, baseName,
105: moduleType, parent.getNaming(), parent
106: .getConfigurationManager());
107: this .serverName = parent.getServerName();
108:
109: this .transactionManagerObjectName = parent
110: .getTransactionManagerName();
111: this .connectionTrackerObjectName = parent
112: .getConnectionTrackerName();
113: this .transactedTimerName = parent.getTransactedTimerName();
114: this .nonTransactedTimerName = parent
115: .getNonTransactedTimerName();
116: this .corbaGBeanObjectName = parent.getCORBAGBeanName();
117: this .messageDestinations = new HashMap();
118: }
119:
120: public AbstractNameQuery getServerName() {
121: return serverName;
122: }
123:
124: public AbstractNameQuery getTransactionManagerName() {
125: return transactionManagerObjectName;
126: }
127:
128: public AbstractNameQuery getConnectionTrackerName() {
129: return connectionTrackerObjectName;
130: }
131:
132: public AbstractNameQuery getTransactedTimerName() {
133: return transactedTimerName;
134: }
135:
136: public AbstractNameQuery getNonTransactedTimerName() {
137: return nonTransactedTimerName;
138: }
139:
140: public AbstractNameQuery getCORBAGBeanName() {
141: return corbaGBeanObjectName;
142: }
143:
144: public Map getContextIDToPermissionsMap() {
145: return contextIDToPermissionsMap;
146: }
147:
148: public void addSecurityContext(String contextID,
149: Object componentPermissions) throws DeploymentException {
150: Object old = contextIDToPermissionsMap.put(contextID,
151: componentPermissions);
152: if (old != null) {
153: throw new DeploymentException(
154: "Duplicate contextID registered! " + contextID);
155: }
156: }
157:
158: public void setJaccManagerName(AbstractName jaccManagerName) {
159: this .jaccManagerName = jaccManagerName;
160: }
161:
162: public AbstractName getJaccManagerName() {
163: return jaccManagerName;
164: }
165:
166: public void setSecurityConfiguration(Object securityConfiguration)
167: throws DeploymentException {
168: if (this .securityConfiguration != null) {
169: throw new DeploymentException(
170: "Only one security configuration allowed per application");
171: }
172: this .securityConfiguration = securityConfiguration;
173: }
174:
175: public Object getSecurityConfiguration() {
176: return securityConfiguration;
177: }
178:
179: public void registerMessageDestionations(String moduleName,
180: Map nameMap) throws DeploymentException {
181: messageDestinations.put(moduleName, nameMap);
182: }
183:
184: public Map getMessageDestinations() {
185: return messageDestinations;
186: }
187:
188: public Map<Object, Object> getGeneralData() {
189: return generalData;
190: }
191: }
|