You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2007/02/28 22:40:41 UTC
svn commit: r512993 - in /geronimo/server/trunk: configs/client/
modules/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/
modules/geronimo-client/
modules/geronimo-client/src/main/java/org/apache/geronimo/client/
modules/geroni...
Author: djencks
Date: Wed Feb 28 13:40:40 2007
New Revision: 512993
URL: http://svn.apache.org/viewvc?view=rev&rev=512993
Log:
GERONIMO-2827 some ee5 app client support: no dd required and some injection support. Also better support for no dd in ears, and help ejb module builder not object if its given a non-ejb module. Also refactor some naming builder stuff
Modified:
geronimo/server/trunk/configs/client/pom.xml
geronimo/server/trunk/modules/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
geronimo/server/trunk/modules/geronimo-client/pom.xml
geronimo/server/trunk/modules/geronimo-client/src/main/java/org/apache/geronimo/client/AppClientContainer.java
geronimo/server/trunk/modules/geronimo-client/src/main/java/org/apache/geronimo/client/AppClientPlugin.java
geronimo/server/trunk/modules/geronimo-client/src/main/java/org/apache/geronimo/client/StaticJndiContextPlugin.java
geronimo/server/trunk/modules/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/AdminObjectRefBuilder.java
geronimo/server/trunk/modules/geronimo-connector-builder/src/test/java/org/apache/geronimo/connector/deployment/MessageDestinationTest.java
geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/AppClientModule.java
geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/NamingBuilder.java
geronimo/server/trunk/modules/geronimo-jetty6-builder/src/main/java/org/apache/geronimo/jetty6/deployment/JettyModuleBuilder.java
geronimo/server/trunk/modules/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyWebAppContext.java
geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/AbstractNamingBuilder.java
geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/GBeanRefBuilder.java
geronimo/server/trunk/modules/geronimo-naming-builder/src/test/java/org/apache/geronimo/naming/deployment/EnvironmentEntryBuilderTest.java
geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java
geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
geronimo/server/trunk/modules/geronimo-persistence-jpa10-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceContextRefBuilder.java
geronimo/server/trunk/modules/geronimo-persistence-jpa10-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitRefBuilder.java
geronimo/server/trunk/modules/geronimo-tomcat6-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
Modified: geronimo/server/trunk/configs/client/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/configs/client/pom.xml?view=diff&rev=512993&r1=512992&r2=512993
==============================================================================
--- geronimo/server/trunk/configs/client/pom.xml (original)
+++ geronimo/server/trunk/configs/client/pom.xml Wed Feb 28 13:40:40 2007
@@ -120,6 +120,11 @@
<version>${version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.xbean</groupId>
+ <artifactId>xbean-reflect</artifactId>
+ </dependency>
+
<!-- geronimo-spec-corba, geronimo-j2ee_1.4_spec -->
<!-- openejb-core, tranql, asm, activemq,
Modified: geronimo/server/trunk/modules/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java?view=diff&rev=512993&r1=512992&r2=512993
==============================================================================
--- geronimo/server/trunk/modules/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java (original)
+++ geronimo/server/trunk/modules/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java Wed Feb 28 13:40:40 2007
@@ -29,6 +29,7 @@
import java.util.Map;
import java.util.StringTokenizer;
import java.util.HashMap;
+import java.util.List;
import java.util.jar.Attributes;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
@@ -66,6 +67,7 @@
import org.apache.geronimo.j2ee.deployment.ConnectorModule;
import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
import org.apache.geronimo.j2ee.management.impl.J2EEAppClientModuleImpl;
+import org.apache.geronimo.j2ee.annotation.Injection;
import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
import org.apache.geronimo.kernel.Naming;
import org.apache.geronimo.kernel.config.ConfigurationAlreadyExistsException;
@@ -200,8 +202,30 @@
assert !targetPath.endsWith("/"): "targetPath must not end with a '/'";
assert (earName == null) == (earEnvironment == null): "if earName is not null you must supply earEnvironment as well";
- String specDD = null;
- ApplicationClientType appClient = null;
+ boolean standAlone = earEnvironment == null;
+
+ // get the app client main class
+ String mainClass;
+ try {
+ Manifest manifest = moduleFile.getManifest();
+ if (manifest == null) {
+ throw new DeploymentException("App client module jar does not contain a manifest: " + moduleFile.getName());
+ }
+ mainClass = manifest.getMainAttributes().getValue(Attributes.Name.MAIN_CLASS);
+ if (mainClass == null) {
+ //not an app client
+ return null;
+ }
+ String classPath = manifest.getMainAttributes().getValue(Attributes.Name.CLASS_PATH);
+ if (standAlone && classPath != null) {
+ throw new DeploymentException("Manifest class path entry is not allowed in a standalone jar (JAVAEE 5 Section 8.2)");
+ }
+ } catch (IOException e) {
+ throw new DeploymentException("Could not get manifest from app client module: " + moduleFile.getName());
+ }
+
+ String specDD;
+ ApplicationClientType appClient = null;
try {
if (specDDUrl == null) {
specDDUrl = DeploymentUtil.createJarURL(moduleFile, "META-INF/application-client.xml");
@@ -210,29 +234,27 @@
// read in the entire specDD as a string, we need this for getDeploymentDescriptor
// on the J2ee management object
specDD = DeploymentUtil.readAll(specDDUrl);
-
- //we found application-client.xml, if it won't parse it's an error.
- XmlObject xmlObject = XmlBeansUtil.parse(specDD);
- ApplicationClientDocument appClientDoc = convertToApplicationClientSchema(xmlObject);
- appClient = appClientDoc.getApplicationClient();
- } catch (XmlException e) {
- throw new DeploymentException("Unable to parse application-client.xml", e);
} catch (Exception e) {
- //no application-client.xml
- try {
- Manifest manifest = moduleFile.getManifest();
- if(manifest == null || manifest.getMainAttributes().getValue(Attributes.Name.MAIN_CLASS) == null) {
- //not for us
- return null;
- }
- } catch (IOException e2) {
- throw new DeploymentException(e2);
- }
- //continue processing considering this as an annotated app-client module with no spec dd
+ //construct a default spec dd
+ ApplicationClientDocument appClientDoc = ApplicationClientDocument.Factory.newInstance();
+ appClientDoc.addNewApplicationClient();
+ appClient = appClientDoc.getApplicationClient();
+ specDD = appClientDoc.xmlText();
+ }
+
+ if (appClient == null) {
+ //we found application-client.xml, if it won't parse it's an error.
+ try {
+ // parse it
+ XmlObject xmlObject = XmlBeansUtil.parse(specDD);
+ ApplicationClientDocument appClientDoc = convertToApplicationClientSchema(xmlObject);
+ appClient = appClientDoc.getApplicationClient();
+ } catch (XmlException e) {
+ throw new DeploymentException("Unable to parse application-client.xml", e);
+ }
}
// parse vendor dd
- boolean standAlone = earEnvironment == null;
GerApplicationClientType gerAppClient = getGeronimoAppClient(plan, moduleFile, standAlone, targetPath, appClient, earEnvironment);
@@ -304,7 +326,7 @@
resourceModules.add(connectorModule);
}
- return new AppClientModule(standAlone, moduleName, clientBaseName, serverEnvironment, clientEnvironment, moduleFile, targetPath, appClient, gerAppClient, specDD, resourceModules);
+ return new AppClientModule(standAlone, moduleName, clientBaseName, serverEnvironment, clientEnvironment, moduleFile, targetPath, appClient, mainClass, gerAppClient, specDD, resourceModules);
}
GerApplicationClientType getGeronimoAppClient(Object plan, JarFile moduleFile, boolean standAlone, String targetPath, ApplicationClientType appClient, Environment environment) throws DeploymentException {
@@ -348,7 +370,7 @@
}
private GerApplicationClientType createDefaultPlan(String name, ApplicationClientType appClient, boolean standAlone, Environment environment) {
- /*String id = appClient.getId();
+ String id = appClient == null? null: appClient.getId();
if (id == null) {
id = name;
if (id.endsWith(".jar")) {
@@ -357,7 +379,7 @@
if (id.endsWith("/")) {
id = id.substring(0, id.length() - 1);
}
- }*/
+ }
GerApplicationClientType geronimoAppClient = GerApplicationClientType.Factory.newInstance();
EnvironmentType clientEnvironmentType = geronimoAppClient.addNewClientEnvironment();
@@ -483,30 +505,11 @@
public void addGBeans(EARContext earContext, Module module, ClassLoader earClassLoader, Collection repositories) throws DeploymentException {
AppClientModule appClientModule = (AppClientModule) module;
+ JarFile moduleFile = module.getModuleFile();
ApplicationClientType appClient = (ApplicationClientType) appClientModule.getSpecDD();
GerApplicationClientType geronimoAppClient = (GerApplicationClientType) appClientModule.getVendorDD();
- // get the app client main class
- JarFile moduleFile = module.getModuleFile();
- String mainClasss;
- try {
- Manifest manifest = moduleFile.getManifest();
- if (manifest == null) {
- throw new DeploymentException("App client module jar does not contain a manifest: " + moduleFile.getName());
- }
- mainClasss = manifest.getMainAttributes().getValue(Attributes.Name.MAIN_CLASS);
- if (mainClasss == null) {
- throw new DeploymentException("App client module jar does not have Main-Class defined in the manifest: " + moduleFile.getName());
- }
- String classPath = manifest.getMainAttributes().getValue(Attributes.Name.CLASS_PATH);
- if (module.isStandAlone() && classPath != null) {
- throw new DeploymentException("Manifest class path entry is not allowed in a standalone jar (JAVAEE 5 Section 8.2)");
- }
- } catch (IOException e) {
- throw new DeploymentException("Could not get manifest from app client module: " + moduleFile.getName());
- }
-
// generate the object name for the app client
AbstractName appClientModuleName = appClientModule.getModuleName();
@@ -564,18 +567,19 @@
}
}
+ Map<String, List<Injection>> injectionsMap;
// add the app client static jndi provider
//TODO track resource ref shared and app managed security
AbstractName jndiContextName = earContext.getNaming().createChildName(appClientDeploymentContext.getModuleName(), "StaticJndiContext", "StaticJndiContext");
GBeanData jndiContextGBeanData = new GBeanData(jndiContextName, StaticJndiContextPlugin.GBEAN_INFO);
try {
Map buildingContext = new HashMap();
- buildingContext.put(NamingBuilder.JNDI_KEY, new HashMap());
buildingContext.put(NamingBuilder.GBEAN_NAME_KEY, jndiContextName);
Configuration localConfiguration = appClientDeploymentContext.getConfiguration();
Configuration remoteConfiguration = earContext.getConfiguration();
namingBuilders.buildNaming(appClient, geronimoAppClient, localConfiguration, remoteConfiguration, appClientModule, buildingContext);
- jndiContextGBeanData.setAttribute("context", buildingContext.get(NamingBuilder.JNDI_KEY));
+ injectionsMap = NamingBuilder.INJECTION_KEY.get(buildingContext);
+ jndiContextGBeanData.setAttribute("context", NamingBuilder.JNDI_KEY.get(buildingContext));
} catch (DeploymentException e) {
throw e;
} catch (Exception e) {
@@ -587,7 +591,7 @@
AbstractName appClientContainerName = appClientDeploymentContext.getModuleName();
GBeanData appClientContainerGBeanData = new GBeanData(appClientContainerName, AppClientContainer.GBEAN_INFO);
try {
- appClientContainerGBeanData.setAttribute("mainClassName", mainClasss);
+ appClientContainerGBeanData.setAttribute("mainClassName", appClientModule.getMainClassName());
appClientContainerGBeanData.setAttribute("appClientModuleName", appClientModuleName);
String callbackHandlerClassName = null;
if (appClient.isSetCallbackHandler()) {
@@ -611,6 +615,15 @@
appClientContainerGBeanData.setAttribute("defaultPrincipal", defaultPrincipal);
}
appClientContainerGBeanData.setReferencePattern("JNDIContext", jndiContextName);
+ List<Injection> injections = injectionsMap.get(appClientModule.getMainClassName());
+ if (injections != null) {
+ appClientContainerGBeanData.setAttribute("injections", injections);
+ }
+ List<Injection> callbackHandlerInjections = injectionsMap.get(callbackHandlerClassName);
+ if (callbackHandlerInjections != null) {
+ appClientContainerGBeanData.setAttribute("callbackHandlerInjections", callbackHandlerInjections);
+ }
+
} catch (Exception e) {
throw new DeploymentException("Unable to initialize AppClientModule GBean", e);
}
Modified: geronimo/server/trunk/modules/geronimo-client/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-client/pom.xml?view=diff&rev=512993&r1=512992&r2=512993
==============================================================================
--- geronimo/server/trunk/modules/geronimo-client/pom.xml (original)
+++ geronimo/server/trunk/modules/geronimo-client/pom.xml Wed Feb 28 13:40:40 2007
@@ -73,7 +73,12 @@
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-j2ee-connector_1.5_spec</artifactId>
</dependency>
-
+
+ <dependency>
+ <groupId>org.apache.xbean</groupId>
+ <artifactId>xbean-reflect</artifactId>
+ </dependency>
+
</dependencies>
</project>
Modified: geronimo/server/trunk/modules/geronimo-client/src/main/java/org/apache/geronimo/client/AppClientContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-client/src/main/java/org/apache/geronimo/client/AppClientContainer.java?view=diff&rev=512993&r1=512992&r2=512993
==============================================================================
--- geronimo/server/trunk/modules/geronimo-client/src/main/java/org/apache/geronimo/client/AppClientContainer.java (original)
+++ geronimo/server/trunk/modules/geronimo-client/src/main/java/org/apache/geronimo/client/AppClientContainer.java Wed Feb 28 13:40:40 2007
@@ -20,21 +20,29 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.security.PrivilegedAction;
+import java.util.List;
+import java.util.Map;
import javax.security.auth.Subject;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.login.LoginContext;
import javax.security.auth.login.LoginException;
+import javax.naming.NamingException;
+import javax.naming.Context;
import org.apache.geronimo.gbean.AbstractName;
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.GBeanInfoBuilder;
import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.j2ee.annotation.Injection;
import org.apache.geronimo.kernel.Kernel;
import org.apache.geronimo.security.ContextManager;
import org.apache.geronimo.security.Callers;
import org.apache.geronimo.security.deploy.DefaultPrincipal;
import org.apache.geronimo.security.util.ConfigurationUtil;
+import org.apache.xbean.recipe.ObjectRecipe;
+import org.apache.xbean.recipe.Option;
+import org.apache.xbean.recipe.StaticRecipe;
/**
* @version $Rev$ $Date$
@@ -53,12 +61,16 @@
private final Method mainMethod;
private final ClassLoader classLoader;
private final Kernel kernel;
+ private final List<Injection> injections;
+ private final List<Injection> callbackHandlerinjections;
public AppClientContainer(String mainClassName,
AbstractName appClientModuleName,
String realmName,
String callbackHandlerClassName,
DefaultPrincipal defaultPrincipal,
+ List<Injection> injections,
+ List<Injection> callbackHandlerinjections,
AppClientPlugin jndiContext,
ClassLoader classLoader,
Kernel kernel
@@ -83,6 +95,8 @@
} else {
defaultSubject = null;
}
+ this.injections = injections;
+ this.callbackHandlerinjections = callbackHandlerinjections;
this.classLoader = classLoader;
this.kernel = kernel;
this.jndiContext = jndiContext;
@@ -136,6 +150,38 @@
}
ContextManager.setCallers(clientSubject, clientSubject);
jndiContext.startClient(appClientModuleName, kernel, classLoader);
+ Context componentContext = jndiContext.getJndiContext();
+ ObjectRecipe objectRecipe = new ObjectRecipe(mainClassName);
+ objectRecipe.allow(Option.FIELD_INJECTION);
+ objectRecipe.allow(Option.PRIVATE_PROPERTIES);
+ objectRecipe.allow(Option.IGNORE_MISSING_PROPERTIES);
+ if (injections != null) {
+ for (Injection injection : injections) {
+ try {
+ String jndiName = injection.getJndiName();
+ //our componentContext is attached to jndi at "java:comp" so we remove that when looking stuff up in it
+ Object object = componentContext.lookup("env/" + jndiName);
+ if (object instanceof String) {
+ String string = (String) object;
+ // Pass it in raw so it could be potentially converted to
+ // another data type by an xbean-reflect property editor
+ objectRecipe.setProperty(injection.getTargetName(), string);
+ } else {
+ objectRecipe.setProperty(injection.getTargetName(), new StaticRecipe(object));
+ }
+ } catch (NamingException e) {
+// log.warn("could not look up ", e);
+ }
+ }
+ }
+ objectRecipe.setStaticProperties(classLoader);
+ Map unsetProperties = objectRecipe.getUnsetProperties();
+ if (unsetProperties.size() > 0) {
+ for (Object property : unsetProperties.keySet()) {
+// log.warning("Injection: No such property '"+property+"' in class "+_class.getName());
+ }
+ }
+
if (clientSubject == null) {
mainMethod.invoke(null, new Object[]{args});
} else {
@@ -183,6 +229,8 @@
infoFactory.addAttribute("realmName", String.class, true);
infoFactory.addAttribute("callbackHandlerClassName", String.class, true);
infoFactory.addAttribute("defaultPrincipal", DefaultPrincipal.class, true);
+ infoFactory.addAttribute("injections", List.class, true);
+ infoFactory.addAttribute("callbackHandlerInjections", List.class, true);
infoFactory.addReference("JNDIContext", AppClientPlugin.class, NameFactory.GERONIMO_SERVICE);
@@ -195,6 +243,8 @@
"realmName",
"callbackHandlerClassName",
"defaultPrincipal",
+ "injections",
+ "callbackHandlerInjections",
"JNDIContext",
"classLoader",
"kernel"
Modified: geronimo/server/trunk/modules/geronimo-client/src/main/java/org/apache/geronimo/client/AppClientPlugin.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-client/src/main/java/org/apache/geronimo/client/AppClientPlugin.java?view=diff&rev=512993&r1=512992&r2=512993
==============================================================================
--- geronimo/server/trunk/modules/geronimo-client/src/main/java/org/apache/geronimo/client/AppClientPlugin.java (original)
+++ geronimo/server/trunk/modules/geronimo-client/src/main/java/org/apache/geronimo/client/AppClientPlugin.java Wed Feb 28 13:40:40 2007
@@ -16,6 +16,8 @@
*/
package org.apache.geronimo.client;
+import javax.naming.Context;
+
import org.apache.geronimo.gbean.AbstractName;
import org.apache.geronimo.kernel.Kernel;
@@ -26,5 +28,7 @@
public void startClient(AbstractName appClientModuleName, Kernel kernel, ClassLoader classLoader) throws Exception;
public void stopClient(AbstractName appClientModuleName) throws Exception;
+
+ public Context getJndiContext();
}
Modified: geronimo/server/trunk/modules/geronimo-client/src/main/java/org/apache/geronimo/client/StaticJndiContextPlugin.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-client/src/main/java/org/apache/geronimo/client/StaticJndiContextPlugin.java?view=diff&rev=512993&r1=512992&r2=512993
==============================================================================
--- geronimo/server/trunk/modules/geronimo-client/src/main/java/org/apache/geronimo/client/StaticJndiContextPlugin.java (original)
+++ geronimo/server/trunk/modules/geronimo-client/src/main/java/org/apache/geronimo/client/StaticJndiContextPlugin.java Wed Feb 28 13:40:40 2007
@@ -16,22 +16,18 @@
*/
package org.apache.geronimo.client;
-import java.util.Iterator;
import java.util.Map;
-import java.util.Collections;
+
import javax.naming.InitialContext;
import javax.naming.Context;
import javax.naming.NamingException;
import org.apache.geronimo.naming.java.RootContext;
-import org.apache.geronimo.naming.reference.KernelAwareReference;
-import org.apache.geronimo.naming.reference.ClassLoaderAwareReference;
import org.apache.geronimo.naming.enc.EnterpriseNamingContext;
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.GBeanInfoBuilder;
import org.apache.geronimo.gbean.AbstractName;
import org.apache.geronimo.kernel.Kernel;
-import org.apache.xbean.naming.context.ImmutableContext;
/**
* @version $Rev$ $Date$
@@ -52,12 +48,17 @@
RootContext.setComponentContext(null);
}
+ public Context getJndiContext() {
+ return context;
+ }
+
public static final GBeanInfo GBEAN_INFO;
static {
GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(StaticJndiContextPlugin.class);
infoFactory.addAttribute("context", Map.class, true);
+ infoFactory.addAttribute("jndiContext", Context.class, false);
infoFactory.addAttribute("kernel", Kernel.class, false);
infoFactory.addAttribute("classLoader", ClassLoader.class, false);
infoFactory.addInterface(AppClientPlugin.class);
Modified: geronimo/server/trunk/modules/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/AdminObjectRefBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/AdminObjectRefBuilder.java?view=diff&rev=512993&r1=512992&r2=512993
==============================================================================
--- geronimo/server/trunk/modules/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/AdminObjectRefBuilder.java (original)
+++ geronimo/server/trunk/modules/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/AdminObjectRefBuilder.java Wed Feb 28 13:40:40 2007
@@ -18,9 +18,8 @@
package org.apache.geronimo.connector.deployment;
import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
import java.util.List;
+import java.util.Map;
import javax.naming.Reference;
import javax.xml.namespace.QName;
@@ -42,6 +41,7 @@
import org.apache.geronimo.xbeans.geronimo.naming.GerPatternType;
import org.apache.geronimo.xbeans.geronimo.naming.GerResourceEnvRefDocument;
import org.apache.geronimo.xbeans.geronimo.naming.GerResourceEnvRefType;
+import org.apache.geronimo.xbeans.javaee.InjectionTargetType;
import org.apache.geronimo.xbeans.javaee.MessageDestinationRefType;
import org.apache.geronimo.xbeans.javaee.MessageDestinationType;
import org.apache.geronimo.xbeans.javaee.ResourceEnvRefType;
@@ -75,23 +75,23 @@
public void initContext(XmlObject specDD, XmlObject plan, Configuration localConfiguration, Configuration remoteConfiguration, Module module) throws DeploymentException {
List<MessageDestinationType> specDestinations = convert(specDD.selectChildren(messageDestinationQNameSet), JEE_CONVERTER, MessageDestinationType.class, MessageDestinationType.type);
XmlObject[] gerDestinations = plan.selectChildren(GER_MESSAGE_DESTINATION_QNAME_SET);
- Map nameMap = new HashMap();
- for (int i = 0; i < gerDestinations.length; i++) {
- GerMessageDestinationType destination = (GerMessageDestinationType) gerDestinations[i].copy().changeType(GerMessageDestinationType.type);
- String name = destination.getMessageDestinationName().trim();
- nameMap.put(name, destination);
- boolean found = false;
- for (MessageDestinationType specDestination: specDestinations) {
- if (specDestination.getMessageDestinationName().getStringValue().trim().equals(name)) {
- found = true;
- break;
- }
- }
- if (!found) {
- throw new DeploymentException("No spec DD message-destination for " + name);
+ Map<String, GerMessageDestinationType> nameMap = new HashMap<String, GerMessageDestinationType>();
+ for (XmlObject gerDestination : gerDestinations) {
+ GerMessageDestinationType destination = (GerMessageDestinationType) gerDestination.copy().changeType(GerMessageDestinationType.type);
+ String name = destination.getMessageDestinationName().trim();
+ nameMap.put(name, destination);
+ boolean found = false;
+ for (MessageDestinationType specDestination : specDestinations) {
+ if (specDestination.getMessageDestinationName().getStringValue().trim().equals(name)) {
+ found = true;
+ break;
}
}
- module.getRootEarContext().registerMessageDestionations(module.getName(), nameMap);
+ if (!found) {
+ throw new DeploymentException("No spec DD message-destination for " + name);
+ }
+ }
+ module.getRootEarContext().registerMessageDestionations(module.getName(), nameMap);
}
@@ -125,8 +125,24 @@
for (MessageDestinationRefType messageDestinationRef: messageDestinationRefsUntyped) {
String name = getStringValue(messageDestinationRef.getMessageDestinationRefName());
+ addInjections(name, messageDestinationRef.getInjectionTargetArray(), componentContext);
String linkName = getStringValue(messageDestinationRef.getMessageDestinationLink());
+ //TODO figure out something better to do here!
+ if (linkName == null) {
+ linkName = name;
+ }
String type = getStringValue(messageDestinationRef.getMessageDestinationType());
+ if (type == null) {
+ //must have an injection target to determine type EE5.8.1.3
+ InjectionTargetType[] targets = messageDestinationRef.getInjectionTargetArray();
+ if (targets.length == 0) {
+ throw new DeploymentException("No type for message-destination-ref can be determined from explicit specification or injection target: " + messageDestinationRef );
+ }
+ type = getStringValue(targets[0].getInjectionTargetClass());
+ if (type == null) {
+ throw new DeploymentException("no type for message destination ref in injection target: " + targets[0]);
+ }
+ }
Class iface;
try {
iface = cl.loadClass(type);
@@ -134,7 +150,7 @@
throw new DeploymentException("could not load class " + type, e);
}
String moduleURI = null;
- Map messageDestinations = module.getRootEarContext().getMessageDestinations();
+ Map<String, Map<String, GerMessageDestinationType>> messageDestinations = module.getRootEarContext().getMessageDestinations();
GerMessageDestinationType destination = getMessageDestination(linkName, messageDestinations);
if (destination != null) {
if (destination.isSetAdminObjectLink()) {
@@ -163,27 +179,26 @@
}
- public static GerMessageDestinationType getMessageDestination(String messageDestinationLink, Map messageDestinations) throws DeploymentException {
+ public static GerMessageDestinationType getMessageDestination(String messageDestinationLink, Map<String, Map<String, GerMessageDestinationType>> messageDestinations) throws DeploymentException {
GerMessageDestinationType destination = null;
int pos = messageDestinationLink.indexOf('#');
if (pos > -1) {
String targetModule = messageDestinationLink.substring(0, pos);
- Map destinations = (Map) messageDestinations.get(targetModule);
+ Map<String, GerMessageDestinationType> destinations = messageDestinations.get(targetModule);
// Hmmm...if we don't find the module then something is wrong in the deployment.
if (destinations == null) {
StringBuffer sb = new StringBuffer();
- for (Iterator mapIterator = messageDestinations.keySet().iterator(); mapIterator.hasNext();) {
- sb.append(mapIterator.next()).append("\n");
+ for (Object o : messageDestinations.keySet()) {
+ sb.append(o).append("\n");
}
throw new DeploymentException("Unknown module " + targetModule + " when processing message destination " + messageDestinationLink +
"\nKnown modules in deployable unit are:\n" + sb.toString());
}
messageDestinationLink = messageDestinationLink.substring(pos + 1);
- destination = (GerMessageDestinationType) destinations.get(messageDestinationLink);
+ destination = destinations.get(messageDestinationLink);
} else {
- for (Iterator iterator = messageDestinations.values().iterator(); iterator.hasNext();) {
- Map destinations = (Map) iterator.next();
- GerMessageDestinationType destinationTest = (GerMessageDestinationType) destinations.get(messageDestinationLink);
+ for (Map<String, GerMessageDestinationType> destinations : messageDestinations.values()) {
+ GerMessageDestinationType destinationTest = destinations.get(messageDestinationLink);
if (destinationTest != null) {
if (destination != null) {
throw new DeploymentException("Duplicate message destination " + messageDestinationLink + " accessed from a message-destination-link without a module");
@@ -225,11 +240,11 @@
return containerId;
}
- private static Map mapResourceEnvRefs(XmlObject[] refs) {
- Map refMap = new HashMap();
+ private static Map<String, XmlObject> mapResourceEnvRefs(XmlObject[] refs) {
+ Map<String, XmlObject> refMap = new HashMap<String, XmlObject>();
if (refs != null) {
- for (int i = 0; i < refs.length; i++) {
- GerResourceEnvRefType ref = (GerResourceEnvRefType) refs[i].copy().changeType(GerResourceEnvRefType.type);
+ for (XmlObject ref1 : refs) {
+ GerResourceEnvRefType ref = (GerResourceEnvRefType) ref1.copy().changeType(GerResourceEnvRefType.type);
refMap.put(ref.getRefName().trim(), ref);
}
}
@@ -242,14 +257,6 @@
public QNameSet getPlanQNameSet() {
return GER_ADMIN_OBJECT_REF_QNAME_SET;
- }
-
- private static String getStringValue(org.apache.geronimo.xbeans.j2ee.String string) {
- if (string == null) {
- return null;
- }
- String s = string.getStringValue();
- return s == null ? null : s.trim();
}
public static final GBeanInfo GBEAN_INFO;
Modified: geronimo/server/trunk/modules/geronimo-connector-builder/src/test/java/org/apache/geronimo/connector/deployment/MessageDestinationTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-connector-builder/src/test/java/org/apache/geronimo/connector/deployment/MessageDestinationTest.java?view=diff&rev=512993&r1=512992&r2=512993
==============================================================================
--- geronimo/server/trunk/modules/geronimo-connector-builder/src/test/java/org/apache/geronimo/connector/deployment/MessageDestinationTest.java (original)
+++ geronimo/server/trunk/modules/geronimo-connector-builder/src/test/java/org/apache/geronimo/connector/deployment/MessageDestinationTest.java Wed Feb 28 13:40:40 2007
@@ -71,7 +71,6 @@
protected void setUp() throws Exception {
super.setUp();
- componentContext.put(NamingBuilder.JNDI_KEY, new HashMap());
Artifact id = new Artifact("test", "test", "", "car");
configuration = new Configuration(Collections.EMPTY_LIST,
new ConfigurationData(id, naming),
@@ -262,7 +261,7 @@
configuration.addGBean(new GBeanData(n1, AdminObjectWrapperGBean.GBEAN_INFO));
configuration.addGBean(new GBeanData(n2, AdminObjectWrapperGBean.GBEAN_INFO));
adminObjectRefBuilder.buildNaming(specDD, plan, configuration, configuration, module, componentContext);
- assertEquals(2, ((Map)componentContext.get(NamingBuilder.JNDI_KEY)).size());
+ assertEquals(2, NamingBuilder.JNDI_KEY.get(componentContext).size());
}
private static final String PLAN2 = "<tmp xmlns=\"http://geronimo.apache.org/xml/ns/naming-1.2\">" +
@@ -286,7 +285,7 @@
configuration.addGBean(new GBeanData(n1, AdminObjectWrapperGBean.GBEAN_INFO));
configuration.addGBean(new GBeanData(n2, AdminObjectWrapperGBean.GBEAN_INFO));
adminObjectRefBuilder.buildNaming(specDD, plan, configuration, configuration, module, componentContext);
- assertEquals(2, ((Map)componentContext.get(NamingBuilder.JNDI_KEY)).size());
+ assertEquals(2, NamingBuilder.JNDI_KEY.get(componentContext).size());
}
private static final String SPECDD2 = "<tmp xmlns=\"http://java.sun.com/xml/ns/j2ee\">" +
Modified: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/AppClientModule.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/AppClientModule.java?view=diff&rev=512993&r1=512992&r2=512993
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/AppClientModule.java (original)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/AppClientModule.java Wed Feb 28 13:40:40 2007
@@ -37,13 +37,15 @@
private final Environment clientEnvironment;
private JarFile earFile;
private final AbstractName appClientName;
+ private final String mainClassName;
private final Collection resourceModules;
- public AppClientModule(boolean standAlone, AbstractName moduleName, AbstractName appClientName, Environment serverEnvironment, Environment clientEnvironment, JarFile moduleFile, String targetPath, XmlObject specDD, XmlObject vendorDD, String originalSpecDD, Collection resourceModules) {
+ public AppClientModule(boolean standAlone, AbstractName moduleName, AbstractName appClientName, Environment serverEnvironment, Environment clientEnvironment, JarFile moduleFile, String targetPath, XmlObject specDD, String mainClassName, XmlObject vendorDD, String originalSpecDD, Collection resourceModules) {
super(standAlone, moduleName, serverEnvironment, moduleFile, targetPath, specDD, vendorDD, originalSpecDD, null, new HashMap());
this.clientEnvironment = clientEnvironment;
this.appClientName = appClientName;
+ this.mainClassName = mainClassName;
this.resourceModules = resourceModules;
}
@@ -65,6 +67,10 @@
public AbstractName getAppClientName() {
return appClientName;
+ }
+
+ public String getMainClassName() {
+ return mainClassName;
}
public void addClass(URI location, String fqcn, byte[] bytes, DeploymentContext context) throws IOException, URISyntaxException {
Modified: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java?view=diff&rev=512993&r1=512992&r2=512993
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java (original)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java Wed Feb 28 13:40:40 2007
@@ -33,10 +33,10 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.jar.Attributes;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
+import java.util.jar.Attributes;
import java.util.zip.ZipEntry;
import javax.xml.namespace.QName;
@@ -308,6 +308,10 @@
throw new DeploymentException("Could not parse application.xml", e);
} catch (Exception e) {
//ee5 spec allows optional application.xml, continue with application == null
+ if (!earFile.getName().endsWith(".ear")) {
+ return null;
+ }
+ //TODO return application.xml that we can make metadata complete?
}
}
@@ -762,20 +766,35 @@
} else if (entry.getName().endsWith(".jar") && !isLibraryEntry(application, entry)) {
try {
NestedJarFile moduleFile = new NestedJarFile(earFile, entry.getName());
- Manifest manifest = moduleFile.getManifest();
- if (moduleFile.getEntry("META-INF/application-client.xml") != null || (manifest != null && manifest.getMainAttributes().getValue(Attributes.Name.MAIN_CLASS) != null)) {
+ Manifest mf = moduleFile.getManifest();
+
+ if (mf.getMainAttributes().getValue(Attributes.Name.MAIN_CLASS) != null) {
if (getAppClientConfigBuilder() == null) {
throw new DeploymentException("Cannot deploy app client; No app client deployer defined: " + entry.getName());
}
builder = getAppClientConfigBuilder();
moduleTypeName = "an application client";
- } else if (moduleFile.getEntry("META-INF/ejb-jar.xml") != null) {
+ } else {
+ //ask the ejb builder if its an ejb module
builder = getEjbConfigBuilder();
if (builder == null) {
- throw new DeploymentException("Cannot deploy ejb application; No ejb deployer defined: " + entry.getName());
+// throw new DeploymentException("Cannot deploy ejb application; No ejb deployer defined: " + entry.getName());
+ continue;
+ }
+
+ Module module = builder.createModule(altVendorDDs.get(entry.getName()),
+ moduleFile,
+ entry.getName(),
+ null,
+ environment,
+ moduleContextInfo,
+ earName,
+ naming, idBuilder);
+
+ if (module != null) {
+ moduleLocations.add(entry.getName());
+ modules.add(module);
}
- moduleTypeName = "an EJB";
- } else {
continue;
}
//TODO if no ejb-jar.xml inspect classes for EJB component annotations to identify as EJBJar module
Modified: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/NamingBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/NamingBuilder.java?view=diff&rev=512993&r1=512992&r2=512993
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/NamingBuilder.java (original)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/NamingBuilder.java Wed Feb 28 13:40:40 2007
@@ -18,11 +18,15 @@
package org.apache.geronimo.j2ee.deployment;
import java.util.Map;
+import java.util.List;
+import java.util.HashMap;
import org.apache.geronimo.common.DeploymentException;
import org.apache.geronimo.kernel.config.Configuration;
import org.apache.geronimo.kernel.repository.Environment;
import org.apache.geronimo.deployment.AbstractNamespaceBuilder;
+import org.apache.geronimo.j2ee.annotation.Injection;
+import org.apache.geronimo.gbean.AbstractName;
import org.apache.xmlbeans.QNameSet;
import org.apache.xmlbeans.XmlObject;
@@ -34,14 +38,45 @@
XmlObject[] NO_REFS = new XmlObject[] {};
String ENV = "env/";
- String JNDI_KEY = "JNDI_COMPONENT_CONTEXT";
- String INJECTION_KEY = "INJECTIONS";
- String GBEAN_NAME_KEY = "GBEAN_NAME";
+ Key<Map<String, Object>> JNDI_KEY = new Key<Map<String, Object>>() {
+
+ public Map<String, Object> get(Map context) {
+ Map<String, Object> result = (Map<String, Object>) context.get(this);
+ if (result == null) {
+ result = new HashMap<String, Object>();
+ context.put(this, result);
+ }
+ return result;
+ }
+ };
+ Key<Map<String, List<Injection>>> INJECTION_KEY = new Key<Map<String, List<Injection>>>() {
+
+ public Map<String, List<Injection>> get(Map context) {
+ Map<String, List<Injection>> result = (Map<String, List<Injection>>) context.get(this);
+ if (result == null) {
+ result = new HashMap<String, List<Injection>>();
+ context.put(this, result);
+ }
+ return result;
+ }
+ };
+ Key<AbstractName> GBEAN_NAME_KEY = new Key<AbstractName>() {
+
+ public AbstractName get(Map context) {
+ return (AbstractName) context.get(this);
+ }
+ };
void buildEnvironment(XmlObject specDD, XmlObject plan, Environment environment) throws DeploymentException;
void initContext(XmlObject specDD, XmlObject plan, Configuration localConfiguration, Configuration remoteConfiguration, Module module) throws DeploymentException;
void buildNaming(XmlObject specDD, XmlObject plan, Configuration localConfiguration, Configuration remoteConfiguration, Module module, Map componentContext) throws DeploymentException;
+
+ public interface Key<T> {
+ T get(Map context);
+ }
+
+
}
Modified: geronimo/server/trunk/modules/geronimo-jetty6-builder/src/main/java/org/apache/geronimo/jetty6/deployment/JettyModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-jetty6-builder/src/main/java/org/apache/geronimo/jetty6/deployment/JettyModuleBuilder.java?view=diff&rev=512993&r1=512992&r2=512993
==============================================================================
--- geronimo/server/trunk/modules/geronimo-jetty6-builder/src/main/java/org/apache/geronimo/jetty6/deployment/JettyModuleBuilder.java (original)
+++ geronimo/server/trunk/modules/geronimo-jetty6-builder/src/main/java/org/apache/geronimo/jetty6/deployment/JettyModuleBuilder.java Wed Feb 28 13:40:40 2007
@@ -318,14 +318,11 @@
//N.B. we use the ear context which has all the gbeans we could possibly be looking up from this ear.
Map buildingContext = new HashMap();
- buildingContext.put(NamingBuilder.JNDI_KEY, new HashMap<String, Object>());
buildingContext.put(NamingBuilder.GBEAN_NAME_KEY, moduleName);
- buildingContext.put(NamingBuilder.INJECTION_KEY, new HashMap<String, List<Injection>>());
Configuration earConfiguration = earContext.getConfiguration();
getNamingBuilders().buildNaming(webApp, jettyWebApp, earConfiguration, earConfiguration, (Module) webModule, buildingContext);
- Map compContext = (Map) buildingContext.get(NamingBuilder.JNDI_KEY);
- Map<String, List<Injection>> injections = (Map<String, List<Injection>>) buildingContext.get(NamingBuilder.INJECTION_KEY);
-
+ Map compContext = NamingBuilder.JNDI_KEY.get(buildingContext);
+ Map<String, List<Injection>> injections = NamingBuilder.INJECTION_KEY.get(buildingContext);
GBeanData webModuleData = new GBeanData(moduleName, JettyWebAppContext.GBEAN_INFO);
try {
Modified: geronimo/server/trunk/modules/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyWebAppContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyWebAppContext.java?view=diff&rev=512993&r1=512992&r2=512993
==============================================================================
--- geronimo/server/trunk/modules/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyWebAppContext.java (original)
+++ geronimo/server/trunk/modules/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyWebAppContext.java Wed Feb 28 13:40:40 2007
@@ -364,7 +364,7 @@
}
}
}
- Object filter = objectRecipe.create(clazz.getClassLoader());
+ Object filter = objectRecipe.create(webClassLoader);
Map unsetProperties = objectRecipe.getUnsetProperties();
if (unsetProperties.size() > 0) {
for (Object property : unsetProperties.keySet()) {
Modified: geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/AbstractNamingBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/AbstractNamingBuilder.java?view=diff&rev=512993&r1=512992&r2=512993
==============================================================================
--- geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/AbstractNamingBuilder.java (original)
+++ geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/AbstractNamingBuilder.java Wed Feb 28 13:40:40 2007
@@ -120,16 +120,11 @@
}
protected Map<String, Object> getJndiContextMap(Map sharedContext) {
- Map jndiContext = (Map) sharedContext.get(JNDI_KEY);
- if (jndiContext == null) {
- jndiContext = new HashMap<String, Object>();
- sharedContext.put(JNDI_KEY, jndiContext);
- }
- return jndiContext;
+ return NamingBuilder.JNDI_KEY.get(sharedContext);
}
protected AbstractName getGBeanName(Map sharedContext) {
- return (AbstractName) sharedContext.get(GBEAN_NAME_KEY);
+ return GBEAN_NAME_KEY.get(sharedContext);
}
protected static QNameSet buildQNameSet(String[] eeNamespaces, String localPart) {
@@ -296,7 +291,7 @@
protected void addInjections(String jndiName, InjectionTargetType[] injectionTargetArray, Map sharedContext) {
- Map<String, List<Injection>> injectionsMap = getInjectionsMap(sharedContext);
+ Map<String, List<Injection>> injectionsMap = NamingBuilder.INJECTION_KEY.get(sharedContext);
for (InjectionTargetType injectionTarget : injectionTargetArray) {
String targetName = injectionTarget.getInjectionTargetName().getStringValue().trim();
String targetClassName = injectionTarget.getInjectionTargetClass().getStringValue().trim();
@@ -309,12 +304,4 @@
}
}
- private Map<String, List<Injection>> getInjectionsMap(Map sharedContext) {
- Map<String, List<Injection>> injectionsMap = (Map<String, List<Injection>>) sharedContext.get(INJECTION_KEY);
- if (injectionsMap == null) {
- injectionsMap = new HashMap<String, List<Injection>>();
- sharedContext.put(INJECTION_KEY, injectionsMap);
- }
- return injectionsMap;
- }
}
Modified: geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/GBeanRefBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/GBeanRefBuilder.java?view=diff&rev=512993&r1=512992&r2=512993
==============================================================================
--- geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/GBeanRefBuilder.java (original)
+++ geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/GBeanRefBuilder.java Wed Feb 28 13:40:40 2007
@@ -98,7 +98,7 @@
String refName = gbeanRef.getRefName();
- ((Map)componentContext.get(JNDI_KEY)).put(ENV + refName, new GBeanReference(localConfiguration.getId(), queries, gBeanType));
+ NamingBuilder.JNDI_KEY.get(componentContext).put(ENV + refName, new GBeanReference(localConfiguration.getId(), queries, gBeanType));
}
}
Modified: geronimo/server/trunk/modules/geronimo-naming-builder/src/test/java/org/apache/geronimo/naming/deployment/EnvironmentEntryBuilderTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-naming-builder/src/test/java/org/apache/geronimo/naming/deployment/EnvironmentEntryBuilderTest.java?view=diff&rev=512993&r1=512992&r2=512993
==============================================================================
--- geronimo/server/trunk/modules/geronimo-naming-builder/src/test/java/org/apache/geronimo/naming/deployment/EnvironmentEntryBuilderTest.java (original)
+++ geronimo/server/trunk/modules/geronimo-naming-builder/src/test/java/org/apache/geronimo/naming/deployment/EnvironmentEntryBuilderTest.java Wed Feb 28 13:40:40 2007
@@ -98,7 +98,6 @@
"</tmp>";
public void testEnvEntries() throws Exception {
- componentContext.put(NamingBuilder.JNDI_KEY, new HashMap());
String stringVal = "Hello World";
Character charVal = new Character('H');
@@ -119,7 +118,7 @@
cursor.dispose();
}
environmentEntryBuilder.buildNaming(doc, null, null, null, null, componentContext);
- Context context = EnterpriseNamingContext.createEnterpriseNamingContext((Map) componentContext.get(NamingBuilder.JNDI_KEY));
+ Context context = EnterpriseNamingContext.createEnterpriseNamingContext(NamingBuilder.JNDI_KEY.get(componentContext));
Set actual = new HashSet();
for (NamingEnumeration e = context.listBindings("env"); e.hasMore();) {
NameClassPair pair = (NameClassPair) e.next();
Modified: geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java?view=diff&rev=512993&r1=512992&r2=512993
==============================================================================
--- geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java (original)
+++ geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java Wed Feb 28 13:40:40 2007
@@ -254,7 +254,6 @@
// Geronimo uses a map to pass data to the naming build and for the results data
Map<Object,Object> buildingContext = new HashMap<Object,Object>();
- buildingContext.put(NamingBuilder.JNDI_KEY, new HashMap());
buildingContext.put(NamingBuilder.GBEAN_NAME_KEY, gbean.getAbstractName());
namingBuilder.buildNaming(xmlbeansEjb,
@@ -263,7 +262,7 @@
earContext.getConfiguration(),
ejbModule, buildingContext);
- Map compContext = (Map) buildingContext.get(NamingBuilder.JNDI_KEY);
+ Map compContext = NamingBuilder.JNDI_KEY.get(buildingContext);
gbean.setAttribute("componentContextMap", compContext);
//
Modified: geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java?view=diff&rev=512993&r1=512992&r2=512993
==============================================================================
--- geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java (original)
+++ geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java Wed Feb 28 13:40:40 2007
@@ -57,6 +57,7 @@
import org.apache.openejb.config.DeploymentLoader;
import org.apache.openejb.config.ReadDescriptors;
import org.apache.openejb.config.UnsupportedModuleTypeException;
+import org.apache.openejb.config.UnknownModuleTypeException;
import org.apache.openejb.jee.EjbJar;
import org.apache.openejb.jee.EnterpriseBean;
import org.apache.openejb.jee.MessageDestinationRef;
@@ -153,9 +154,15 @@
AppModule appModule = null;
try {
appModule = loader.load(new File(moduleFile.getName()));
+ } catch (UnknownModuleTypeException e){
+ return null;
} catch (UnsupportedModuleTypeException e){
return null;
} catch (OpenEJBException e) {
+ Throwable t = e.getCause();
+ if (t instanceof UnknownModuleTypeException || t instanceof UnsupportedModuleTypeException) {
+ return null;
+ }
throw new DeploymentException(e);
}
Modified: geronimo/server/trunk/modules/geronimo-persistence-jpa10-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceContextRefBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-persistence-jpa10-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceContextRefBuilder.java?view=diff&rev=512993&r1=512992&r2=512993
==============================================================================
--- geronimo/server/trunk/modules/geronimo-persistence-jpa10-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceContextRefBuilder.java (original)
+++ geronimo/server/trunk/modules/geronimo-persistence-jpa10-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceContextRefBuilder.java Wed Feb 28 13:40:40 2007
@@ -30,6 +30,7 @@
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.GBeanInfoBuilder;
import org.apache.geronimo.j2ee.deployment.Module;
+import org.apache.geronimo.j2ee.deployment.NamingBuilder;
import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
import org.apache.geronimo.kernel.GBeanNotFoundException;
import org.apache.geronimo.kernel.config.Configuration;
@@ -107,7 +108,7 @@
PersistenceContextReference reference = new PersistenceContextReference(localConfiguration.getId(), persistenceUnitNameQuery, transactionScoped, properties);
- ((Map) componentContext.get(JNDI_KEY)).put(ENV + persistenceContextRefName, reference);
+ NamingBuilder.JNDI_KEY.get(componentContext).put(ENV + persistenceContextRefName, reference);
}
Modified: geronimo/server/trunk/modules/geronimo-persistence-jpa10-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitRefBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-persistence-jpa10-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitRefBuilder.java?view=diff&rev=512993&r1=512992&r2=512993
==============================================================================
--- geronimo/server/trunk/modules/geronimo-persistence-jpa10-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitRefBuilder.java (original)
+++ geronimo/server/trunk/modules/geronimo-persistence-jpa10-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitRefBuilder.java Wed Feb 28 13:40:40 2007
@@ -29,6 +29,7 @@
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.GBeanInfoBuilder;
import org.apache.geronimo.j2ee.deployment.Module;
+import org.apache.geronimo.j2ee.deployment.NamingBuilder;
import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
import org.apache.geronimo.kernel.GBeanNotFoundException;
import org.apache.geronimo.kernel.config.Configuration;
@@ -97,7 +98,7 @@
PersistenceUnitReference reference = new PersistenceUnitReference(localConfiguration.getId(), persistenceUnitNameQuery);
- ((Map)componentContext.get(JNDI_KEY)).put(ENV + persistenceUnitRefName, reference);
+ NamingBuilder.JNDI_KEY.get(componentContext).put(ENV + persistenceUnitRefName, reference);
}
@@ -115,7 +116,7 @@
PersistenceUnitReference reference = new PersistenceUnitReference(localConfiguration.getId(), persistenceUnitNameQuery);
- ((Map)componentContext.get(JNDI_KEY)).put(ENV + PersistenceUnitRefName, reference);
+ NamingBuilder.JNDI_KEY.get(componentContext).put(ENV + PersistenceUnitRefName, reference);
}
}
Modified: geronimo/server/trunk/modules/geronimo-tomcat6-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-tomcat6-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java?view=diff&rev=512993&r1=512992&r2=512993
==============================================================================
--- geronimo/server/trunk/modules/geronimo-tomcat6-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java (original)
+++ geronimo/server/trunk/modules/geronimo-tomcat6-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java Wed Feb 28 13:40:40 2007
@@ -284,11 +284,10 @@
//N.B. we use the ear context which has all the gbeans we could possibly be looking up from this ear.
Map buildingContext = new HashMap();
- buildingContext.put(NamingBuilder.JNDI_KEY, new HashMap());
buildingContext.put(NamingBuilder.GBEAN_NAME_KEY, moduleName);
Configuration earConfiguration = earContext.getConfiguration();
getNamingBuilders().buildNaming(webApp, tomcatWebApp, earConfiguration, earConfiguration, webModule, buildingContext);
- Map compContext = (Map) buildingContext.get(NamingBuilder.JNDI_KEY);
+ Map compContext = NamingBuilder.JNDI_KEY.get(buildingContext);
webModuleData.setAttribute("componentContext", compContext);
// unsharableResources, applicationManagedSecurityResources