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.geronimo.j2ee.deployment; 19 20 import java.io.File; 21 import java.util.Collection; 22 import java.util.HashMap; 23 import java.util.Map; 24 25 import org.apache.geronimo.common.DeploymentException; 26 import org.apache.geronimo.deployment.DeploymentContext; 27 import org.apache.geronimo.gbean.AbstractName; 28 import org.apache.geronimo.gbean.AbstractNameQuery; 29 import org.apache.geronimo.kernel.Naming; 30 import org.apache.geronimo.kernel.config.ConfigurationManager; 31 import org.apache.geronimo.kernel.config.ConfigurationModuleType; 32 import org.apache.geronimo.kernel.repository.Environment; 33 34 /** 35 * @version $Rev:386276 $ $Date: 2006-11-02 15:30:55 -0800 (Thu, 02 Nov 2006) $ 36 */ 37 public class EARContext extends DeploymentContext { 38 39 private final AbstractNameQuery serverName; 40 private final AbstractNameQuery transactionManagerObjectName; 41 private final AbstractNameQuery connectionTrackerObjectName; 42 private final AbstractNameQuery transactedTimerName; 43 private final AbstractNameQuery nonTransactedTimerName; 44 private final AbstractNameQuery corbaGBeanObjectName; 45 46 private final Map contextIDToPermissionsMap = new HashMap(); 47 private AbstractName jaccManagerName; 48 private Object securityConfiguration; 49 50 private final Map messageDestinations = new HashMap(); 51 52 public EARContext(File baseDir, 53 File inPlaceConfigurationDir, 54 Environment environment, 55 ConfigurationModuleType moduleType, 56 Naming naming, 57 ConfigurationManager configurationManager, Collection repositories, 58 AbstractNameQuery serverName, 59 AbstractName baseName, 60 AbstractNameQuery transactionManagerObjectName, 61 AbstractNameQuery connectionTrackerObjectName, 62 AbstractNameQuery transactedTimerName, 63 AbstractNameQuery nonTransactedTimerName, 64 AbstractNameQuery corbaGBeanObjectName 65 ) throws DeploymentException { 66 super(baseDir, inPlaceConfigurationDir, environment, baseName, moduleType, naming, configurationManager, repositories); 67 68 this.serverName = serverName; 69 this.transactionManagerObjectName = transactionManagerObjectName; 70 this.connectionTrackerObjectName = connectionTrackerObjectName; 71 this.transactedTimerName = transactedTimerName; 72 this.nonTransactedTimerName = nonTransactedTimerName; 73 this.corbaGBeanObjectName = corbaGBeanObjectName; 74 } 75 76 public EARContext(File baseDir, 77 File inPlaceConfigurationDir, 78 Environment environment, 79 ConfigurationModuleType moduleType, 80 Naming naming, 81 ConfigurationManager configurationManager, 82 AbstractNameQuery serverName, 83 AbstractName baseName, 84 AbstractNameQuery transactionManagerObjectName, 85 AbstractNameQuery connectionTrackerObjectName, 86 AbstractNameQuery transactedTimerName, 87 AbstractNameQuery nonTransactedTimerName, 88 AbstractNameQuery corbaGBeanObjectName 89 ) throws DeploymentException { 90 super(baseDir, inPlaceConfigurationDir, environment, baseName, moduleType, naming, configurationManager); 91 92 this.serverName = serverName; 93 94 this.transactionManagerObjectName = transactionManagerObjectName; 95 this.connectionTrackerObjectName = connectionTrackerObjectName; 96 this.transactedTimerName = transactedTimerName; 97 this.nonTransactedTimerName = nonTransactedTimerName; 98 this.corbaGBeanObjectName = corbaGBeanObjectName; 99 } 100 101 public EARContext(File baseDir, File inPlaceConfigurationDir, Environment environment, ConfigurationModuleType moduleType, AbstractName baseName, EARContext parent) throws DeploymentException { 102 super(baseDir, inPlaceConfigurationDir, environment, baseName, moduleType, parent.getNaming(), parent.getConfigurationManager()); 103 this.serverName = parent.getServerName(); 104 105 this.transactionManagerObjectName = parent.getTransactionManagerName(); 106 this.connectionTrackerObjectName = parent.getConnectionTrackerName(); 107 this.transactedTimerName = parent.getTransactedTimerName(); 108 this.nonTransactedTimerName = parent.getNonTransactedTimerName(); 109 this.corbaGBeanObjectName = parent.getCORBAGBeanName(); 110 } 111 112 public AbstractNameQuery getServerName() { 113 return serverName; 114 } 115 116 public AbstractNameQuery getTransactionManagerName() { 117 return transactionManagerObjectName; 118 } 119 120 public AbstractNameQuery getConnectionTrackerName() { 121 return connectionTrackerObjectName; 122 } 123 124 public AbstractNameQuery getTransactedTimerName() { 125 return transactedTimerName; 126 } 127 128 public AbstractNameQuery getNonTransactedTimerName() { 129 return nonTransactedTimerName; 130 } 131 132 public AbstractNameQuery getCORBAGBeanName() { 133 return corbaGBeanObjectName; 134 } 135 136 public Map getContextIDToPermissionsMap() { 137 return contextIDToPermissionsMap; 138 } 139 140 public void addSecurityContext(String contextID, Object componentPermissions) throws DeploymentException { 141 Object old = contextIDToPermissionsMap.put(contextID, componentPermissions); 142 if (old != null) { 143 throw new DeploymentException("Duplicate contextID registered! " + contextID); 144 } 145 } 146 147 public void setJaccManagerName(AbstractName jaccManagerName) { 148 this.jaccManagerName = jaccManagerName; 149 } 150 151 public AbstractName getJaccManagerName() { 152 return jaccManagerName; 153 } 154 155 public void setSecurityConfiguration(Object securityConfiguration) throws DeploymentException { 156 if (this.securityConfiguration != null) { 157 throw new DeploymentException("Only one security configuration allowed per application"); 158 } 159 this.securityConfiguration = securityConfiguration; 160 } 161 162 public Object getSecurityConfiguration() { 163 return securityConfiguration; 164 } 165 166 public void registerMessageDestionations(String moduleName, Map nameMap) throws DeploymentException { 167 messageDestinations.put(moduleName, nameMap); 168 } 169 170 public Map getMessageDestinations() { 171 return messageDestinations; 172 } 173 174 }