You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by sp...@apache.org on 2006/09/12 20:15:29 UTC
svn commit: r442665 [3/4] - in /geronimo/server/branches/sachin: ./
applications/magicGball/magicGball-ear/src/main/plan/
assemblies/geronimo-boilerplate-minimal/ configs/axis-deployer/src/plan/
configs/client-deployer/src/plan/ configs/client/ configs...
Modified: geronimo/server/branches/sachin/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EJBRefContextTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EJBRefContextTest.java?view=diff&rev=442665&r1=442664&r2=442665
==============================================================================
--- geronimo/server/branches/sachin/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EJBRefContextTest.java (original)
+++ geronimo/server/branches/sachin/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EJBRefContextTest.java Tue Sep 12 11:15:24 2006
@@ -17,25 +17,20 @@
package org.apache.geronimo.j2ee.deployment;
import java.net.URI;
-import java.util.List;
-import java.util.Map;
+
import javax.management.ObjectName;
import javax.naming.Reference;
-import javax.xml.namespace.QName;
import junit.framework.TestCase;
-import org.apache.geronimo.common.UnresolvedEJBRefException;
-import org.apache.geronimo.common.UnresolvedReferenceException;
import org.apache.geronimo.common.DeploymentException;
-import org.apache.geronimo.deployment.DeploymentContext;
import org.apache.geronimo.gbean.AbstractName;
-import org.apache.geronimo.gbean.GBeanData;
import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.gbean.GBeanData;
import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
-import org.apache.geronimo.kernel.repository.Artifact;
-import org.apache.geronimo.kernel.config.Configuration;
-import org.apache.geronimo.kernel.Naming;
import org.apache.geronimo.kernel.Jsr77Naming;
+import org.apache.geronimo.kernel.Naming;
+import org.apache.geronimo.kernel.config.Configuration;
+import org.apache.geronimo.kernel.repository.Artifact;
/**
* @version $Rev:385692 $ $Date$
@@ -53,121 +48,118 @@
private AbstractName car_enzo;
- private RefContext refContext;
private Configuration configuration;
public void testNothing() throws Exception {}
- public void xtestSimpleRefs() throws Exception {
- assertReferenceEqual(coffee_peaberry, refContext.getEJBRemoteRef(null, configuration, "peaberry", null, coffee, null, null, true, null, null));
- assertReferenceEqual(coffee_peaberry, refContext.getEJBLocalRef(null, configuration, "peaberry", null, coffee, null, null, true, null, null));
- }
-
- public void xtestAmbiguousRefs() throws Exception {
- assertReferenceEqual(coffee_java, refContext.getEJBRemoteRef(null, configuration, "java", null, coffee, null, null, true, null, null));
- assertReferenceEqual(coffee_java, refContext.getEJBLocalRef(null, configuration, "java", null, coffee, null, null, true, null, null));
- assertReferenceEqual(language_java, refContext.getEJBRemoteRef(null, configuration, "java", null, language, null, null, true, null, null));
- assertReferenceEqual(language_java, refContext.getEJBLocalRef(null, configuration, "java", null, language, null, null, true, null, null));
-
- try {
- refContext.getEJBRemoteRef(null, configuration, "java", null, car, null, null, true, null, null);
- fail("should have thrown an AmbiguousEJBRefException");
- } catch (UnresolvedReferenceException e) {
- // good
- }
- try {
- refContext.getEJBLocalRef(null, configuration, "java", null, car, null, null, true, null, null);
- fail("should have thrown an AmbiguousEJBRefException");
- } catch (UnresolvedReferenceException e) {
- // good
- }
- }
-
- public void xtestRelativeRefs() throws Exception {
- assertReferenceEqual(car_enzo, refContext.getEJBRemoteRef(null, configuration, "enzo", "../../foo/bar/car.jar", coffee, null, null, true, null, null));
- assertReferenceEqual(car_enzo, refContext.getEJBLocalRef(null, configuration, "enzo", "../../foo/bar/car.jar", coffee, null, null, true, null, null));
- assertReferenceEqual(car_enzo, refContext.getEJBRemoteRef(null, configuration, "enzo", "./../funk/../../foo/bar/car.jar", coffee, null, null, true, null, null));
- assertReferenceEqual(car_enzo, refContext.getEJBLocalRef(null, configuration, "enzo", "./../funk/../../foo/bar/car.jar", coffee, null, null, true, null, null));
- assertReferenceEqual(coffee_java, refContext.getEJBRemoteRef(null, configuration, "java", "./coffee.jar", coffee, null, null, true, null, null));
- assertReferenceEqual(coffee_java, refContext.getEJBLocalRef(null, configuration, "java", "./coffee.jar", coffee, null, null, true, null, null));
- assertReferenceEqual(coffee_java, refContext.getEJBRemoteRef(null, configuration, "java", "coffee.jar", coffee, null, null, true, null, null));
- assertReferenceEqual(coffee_java, refContext.getEJBLocalRef(null, configuration, "java", "coffee.jar", coffee, null, null, true, null, null));
-
- try {
- refContext.getEJBRemoteRef(null, configuration, "blah", "not_exist.jar", coffee, null, null, true, null, null);
- fail("should have thrown an UnknownEJBRefException");
- } catch (UnresolvedReferenceException e) {
- // good
- }
-
- try {
- refContext.getEJBLocalRef(null, configuration, "blah", "not_exist.jar", coffee, null, null, true, null, null);
- fail("should have thrown an UnknownEJBRefException");
- } catch (UnresolvedReferenceException e) {
- // good
- }
-
- try {
- refContext.getEJBRemoteRef(null, configuration, "blah", "coffee.jar", coffee, null, null, true, null, null);
- fail("should have thrown an UnknownEJBRefException");
- } catch (UnresolvedReferenceException e) {
- // good
- }
-
- try {
- refContext.getEJBLocalRef(null, configuration, "blah", "coffee.jar", coffee, null, null, true, null, null);
- fail("should have thrown an UnknownEJBRefException");
- } catch (UnresolvedReferenceException e) {
- // good
- }
-
- try {
- refContext.getEJBRemoteRef(null, configuration, "enzo", "../../../../foo/bar/car.jar",coffee, null, null, true, null, null);
- fail("should have thrown an UnknownEJBRefException");
- } catch (UnresolvedReferenceException e) {
- // good
- }
- try {
- refContext.getEJBLocalRef(null, configuration, "enzo", "../../../../foo/bar/car.jar",coffee, null, null, true, null, null);
- fail("should have thrown an UnknownEJBRefException");
- } catch (UnresolvedReferenceException e) {
- // good
- }
- }
-
- public void xtestBasicImplicitRefs() throws Exception {
- assertReferenceEqual(language_lisp, refContext.getEJBRemoteRef(null, configuration, "blah", null, coffee, null, null, true, "LispHome", "LispRemote"));
- assertReferenceEqual(language_lisp, refContext.getEJBLocalRef(null, configuration, "blah", null, coffee, null, null, true, "LispLocalHome", "LispLocal"));
- }
-
- public void xtestInModuleImplicitRefs() throws Exception {
- assertReferenceEqual(coffee_java, refContext.getEJBLocalRef(null, configuration, "blah", null, coffee, null, null, true, "LocalHome", "Local"));
- assertReferenceEqual(car_enzo, refContext.getEJBLocalRef(null, configuration, "blah", null, car, null, null, true, "LocalHome", "Local"));
- }
-
- public void xtestAmbiguousModuleImplicitRefs() throws Exception {
- try {
- refContext.getEJBLocalRef(null, configuration, "blah", null, language, null, null, true, "LocalHome", "Local");
- fail("should have thrown an UnresolvedEJBRefException");
- } catch (UnresolvedEJBRefException e) {
- // good
- }
- }
-
- public void xtestNoMatchImplicitRefs() throws Exception {
- try {
- refContext.getEJBLocalRef(null, configuration, "blah", null, language, null, null, true, "foo", "bar");
- fail("should have thrown an UnresolvedEJBRefException");
- } catch (UnresolvedEJBRefException e) {
- // good
- }
- }
-
+// public void xtestSimpleRefs() throws Exception {
+// assertReferenceEqual(coffee_peaberry, refContext.getEJBRemoteRef(null, configuration, "peaberry", null, coffee, null, null, true, null, null));
+// assertReferenceEqual(coffee_peaberry, refContext.getEJBLocalRef(null, configuration, "peaberry", null, coffee, null, null, true, null, null));
+// }
+//
+// public void xtestAmbiguousRefs() throws Exception {
+// assertReferenceEqual(coffee_java, refContext.getEJBRemoteRef(null, configuration, "java", null, coffee, null, null, true, null, null));
+// assertReferenceEqual(coffee_java, refContext.getEJBLocalRef(null, configuration, "java", null, coffee, null, null, true, null, null));
+// assertReferenceEqual(language_java, refContext.getEJBRemoteRef(null, configuration, "java", null, language, null, null, true, null, null));
+// assertReferenceEqual(language_java, refContext.getEJBLocalRef(null, configuration, "java", null, language, null, null, true, null, null));
+//
+// try {
+// refContext.getEJBRemoteRef(null, configuration, "java", null, car, null, null, true, null, null);
+// fail("should have thrown an AmbiguousEJBRefException");
+// } catch (UnresolvedReferenceException e) {
+// // good
+// }
+// try {
+// refContext.getEJBLocalRef(null, configuration, "java", null, car, null, null, true, null, null);
+// fail("should have thrown an AmbiguousEJBRefException");
+// } catch (UnresolvedReferenceException e) {
+// // good
+// }
+// }
+//
+// public void xtestRelativeRefs() throws Exception {
+// assertReferenceEqual(car_enzo, refContext.getEJBRemoteRef(null, configuration, "enzo", "../../foo/bar/car.jar", coffee, null, null, true, null, null));
+// assertReferenceEqual(car_enzo, refContext.getEJBLocalRef(null, configuration, "enzo", "../../foo/bar/car.jar", coffee, null, null, true, null, null));
+// assertReferenceEqual(car_enzo, refContext.getEJBRemoteRef(null, configuration, "enzo", "./../funk/../../foo/bar/car.jar", coffee, null, null, true, null, null));
+// assertReferenceEqual(car_enzo, refContext.getEJBLocalRef(null, configuration, "enzo", "./../funk/../../foo/bar/car.jar", coffee, null, null, true, null, null));
+// assertReferenceEqual(coffee_java, refContext.getEJBRemoteRef(null, configuration, "java", "./coffee.jar", coffee, null, null, true, null, null));
+// assertReferenceEqual(coffee_java, refContext.getEJBLocalRef(null, configuration, "java", "./coffee.jar", coffee, null, null, true, null, null));
+// assertReferenceEqual(coffee_java, refContext.getEJBRemoteRef(null, configuration, "java", "coffee.jar", coffee, null, null, true, null, null));
+// assertReferenceEqual(coffee_java, refContext.getEJBLocalRef(null, configuration, "java", "coffee.jar", coffee, null, null, true, null, null));
+//
+// try {
+// refContext.getEJBRemoteRef(null, configuration, "blah", "not_exist.jar", coffee, null, null, true, null, null);
+// fail("should have thrown an UnknownEJBRefException");
+// } catch (UnresolvedReferenceException e) {
+// // good
+// }
+//
+// try {
+// refContext.getEJBLocalRef(null, configuration, "blah", "not_exist.jar", coffee, null, null, true, null, null);
+// fail("should have thrown an UnknownEJBRefException");
+// } catch (UnresolvedReferenceException e) {
+// // good
+// }
+//
+// try {
+// refContext.getEJBRemoteRef(null, configuration, "blah", "coffee.jar", coffee, null, null, true, null, null);
+// fail("should have thrown an UnknownEJBRefException");
+// } catch (UnresolvedReferenceException e) {
+// // good
+// }
+//
+// try {
+// refContext.getEJBLocalRef(null, configuration, "blah", "coffee.jar", coffee, null, null, true, null, null);
+// fail("should have thrown an UnknownEJBRefException");
+// } catch (UnresolvedReferenceException e) {
+// // good
+// }
+//
+// try {
+// refContext.getEJBRemoteRef(null, configuration, "enzo", "../../../../foo/bar/car.jar",coffee, null, null, true, null, null);
+// fail("should have thrown an UnknownEJBRefException");
+// } catch (UnresolvedReferenceException e) {
+// // good
+// }
+// try {
+// refContext.getEJBLocalRef(null, configuration, "enzo", "../../../../foo/bar/car.jar",coffee, null, null, true, null, null);
+// fail("should have thrown an UnknownEJBRefException");
+// } catch (UnresolvedReferenceException e) {
+// // good
+// }
+// }
+//
+// public void xtestBasicImplicitRefs() throws Exception {
+// assertReferenceEqual(language_lisp, refContext.getEJBRemoteRef(null, configuration, "blah", null, coffee, null, null, true, "LispHome", "LispRemote"));
+// assertReferenceEqual(language_lisp, refContext.getEJBLocalRef(null, configuration, "blah", null, coffee, null, null, true, "LispLocalHome", "LispLocal"));
+// }
+//
+// public void xtestInModuleImplicitRefs() throws Exception {
+// assertReferenceEqual(coffee_java, refContext.getEJBLocalRef(null, configuration, "blah", null, coffee, null, null, true, "LocalHome", "Local"));
+// assertReferenceEqual(car_enzo, refContext.getEJBLocalRef(null, configuration, "blah", null, car, null, null, true, "LocalHome", "Local"));
+// }
+//
+// public void xtestAmbiguousModuleImplicitRefs() throws Exception {
+// try {
+// refContext.getEJBLocalRef(null, configuration, "blah", null, language, null, null, true, "LocalHome", "Local");
+// fail("should have thrown an UnresolvedEJBRefException");
+// } catch (UnresolvedEJBRefException e) {
+// // good
+// }
+// }
+//
+// public void xtestNoMatchImplicitRefs() throws Exception {
+// try {
+// refContext.getEJBLocalRef(null, configuration, "blah", null, language, null, null, true, "foo", "bar");
+// fail("should have thrown an UnresolvedEJBRefException");
+// } catch (UnresolvedEJBRefException e) {
+// // good
+// }
+// }
+//
protected void setUp() throws Exception {
super.setUp();
- refContext = new RefContext(new MockEjbReferenceBuilder(), new MockResourceReferenceBuilder(), new MockServiceReferenceBuilder());
-
Naming naming = new Jsr77Naming();
AbstractName applicationName = naming.createRootName(new Artifact("test", "stuff", "", "ear"), "app", NameFactory.J2EE_APPLICATION) ;
@@ -232,30 +224,7 @@
}
}
- private class MockEjbReferenceBuilder implements EJBReferenceBuilder {
- public Reference createEJBLocalReference(String objectName, GBeanData gbeanData, boolean isSession, String localHome, String local) {
- return new FakeReference(objectName);
- }
-
- public Reference createEJBRemoteReference(GBeanData gbeanData, boolean isSession, String home, String remote) {
- return new FakeReference(null);
- }
-
- public Reference createCORBAReference(Configuration configuration, AbstractNameQuery containerNameQuery, URI nsCorbaloc, String objectName, String home) throws DeploymentException {
- return new FakeReference(objectName);
- }
-
- public Reference createEJBRemoteRef(String refName, Configuration configuration, String name, String requiredModule, String optionalModule, Artifact targetConfigId, AbstractNameQuery query, boolean isSession, String home, String remote) throws DeploymentException {
- return null;
- }
-
- public Reference createEJBLocalRef(String refName, Configuration configuration, String name, String requiredModule, String optionalModule, Artifact targetConfigId, AbstractNameQuery query, boolean isSession, String localHome, String local) throws DeploymentException {
- return null;
- }
-
- }
-
- private static class MockResourceReferenceBuilder implements ResourceReferenceBuilder {
+ private static class MockActivationSpecInfoLocator implements ActivationSpecInfoLocator {
public Reference createResourceRef(AbstractNameQuery containerId, Class iface, Configuration configuration) {
return null;
}
@@ -285,10 +254,4 @@
}
}
- private static class MockServiceReferenceBuilder implements ServiceReferenceBuilder {
- //it could return a Service or a Reference, we don't care
- public Object createService(Class serviceInterface, URI wsdlURI, URI jaxrpcMappingURI, QName serviceQName, Map portComponentRefMap, List handlerInfos, Object serviceRefType, DeploymentContext deploymentContext, Module module, ClassLoader classLoader) {
- return null;
- }
- }
}
Modified: geronimo/server/branches/sachin/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/MockConnectorConfigBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/MockConnectorConfigBuilder.java?view=diff&rev=442665&r1=442664&r2=442665
==============================================================================
--- geronimo/server/branches/sachin/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/MockConnectorConfigBuilder.java (original)
+++ geronimo/server/branches/sachin/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/MockConnectorConfigBuilder.java Tue Sep 12 11:15:24 2006
@@ -40,7 +40,7 @@
/**
* @version $Rev:385692 $ $Date$
*/
-public class MockConnectorConfigBuilder extends Assert implements ModuleBuilder, ResourceReferenceBuilder{
+public class MockConnectorConfigBuilder extends Assert implements ModuleBuilder, ActivationSpecInfoLocator {
private EARContext earContext;
private ClassLoader cl;
public Module connectorModule;
Modified: geronimo/server/branches/sachin/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/MockEJBConfigBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/MockEJBConfigBuilder.java?view=diff&rev=442665&r1=442664&r2=442665
==============================================================================
--- geronimo/server/branches/sachin/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/MockEJBConfigBuilder.java (original)
+++ geronimo/server/branches/sachin/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/MockEJBConfigBuilder.java Tue Sep 12 11:15:24 2006
@@ -40,7 +40,7 @@
/**
* @version $Rev:385692 $ $Date$
*/
-public class MockEJBConfigBuilder extends Assert implements ModuleBuilder, EJBReferenceBuilder {
+public class MockEJBConfigBuilder extends Assert implements ModuleBuilder {
private EARContext earContext;
private ClassLoader cl;
public EJBModule ejbModule;
@@ -83,18 +83,6 @@
}
public String getSchemaNamespace() {
- return null;
- }
-
- public Reference createCORBAReference(Configuration configuration, AbstractNameQuery containerNameQuery, URI nsCorbaloc, String objectName, String home) throws DeploymentException {
- return null;
- }
-
- public Reference createEJBRemoteRef(String refName, Configuration configuration, String name, String requiredModule, String optionalModule, Artifact targetConfigId, AbstractNameQuery query, boolean isSession, String home, String remote) throws DeploymentException {
- return null;
- }
-
- public Reference createEJBLocalRef(String refName, Configuration configuration, String name, String requiredModule, String optionalModule, Artifact targetConfigId, AbstractNameQuery query, boolean isSession, String localHome, String local) throws DeploymentException {
return null;
}
Modified: geronimo/server/branches/sachin/modules/geronimo-jetty-builder/src/main/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/geronimo-jetty-builder/src/main/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java?view=diff&rev=442665&r1=442664&r2=442665
==============================================================================
--- geronimo/server/branches/sachin/modules/geronimo-jetty-builder/src/main/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java (original)
+++ geronimo/server/branches/sachin/modules/geronimo-jetty-builder/src/main/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java Tue Sep 12 11:15:24 2006
@@ -63,6 +63,7 @@
import org.apache.geronimo.j2ee.deployment.ModuleBuilder;
import org.apache.geronimo.j2ee.deployment.WebModule;
import org.apache.geronimo.j2ee.deployment.WebServiceBuilder;
+import org.apache.geronimo.j2ee.deployment.NamingBuilder;
import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
import org.apache.geronimo.jetty.Host;
import org.apache.geronimo.jetty.JettyDefaultServletHolder;
@@ -76,6 +77,7 @@
import org.apache.geronimo.kernel.Kernel;
import org.apache.geronimo.kernel.Naming;
import org.apache.geronimo.kernel.config.ConfigurationData;
+import org.apache.geronimo.kernel.config.Configuration;
import org.apache.geronimo.kernel.repository.Environment;
import org.apache.geronimo.naming.deployment.ENCConfigBuilder;
import org.apache.geronimo.naming.deployment.GBeanResourceEnvironmentBuilder;
@@ -85,7 +87,6 @@
import org.apache.geronimo.security.jacc.ComponentPermissions;
import org.apache.geronimo.web.deployment.AbstractWebModuleBuilder;
import org.apache.geronimo.web.deployment.GenericToSpecificPlanConverter;
-import org.apache.geronimo.xbeans.geronimo.naming.GerMessageDestinationType;
import org.apache.geronimo.xbeans.geronimo.web.jetty.JettyWebAppDocument;
import org.apache.geronimo.xbeans.geronimo.web.jetty.JettyWebAppType;
import org.apache.geronimo.xbeans.geronimo.web.jetty.config.GerJettyDocument;
@@ -99,7 +100,6 @@
import org.apache.geronimo.xbeans.j2ee.LocaleEncodingMappingListType;
import org.apache.geronimo.xbeans.j2ee.LocaleEncodingMappingType;
import org.apache.geronimo.xbeans.j2ee.LoginConfigType;
-import org.apache.geronimo.xbeans.j2ee.MessageDestinationType;
import org.apache.geronimo.xbeans.j2ee.MimeMappingType;
import org.apache.geronimo.xbeans.j2ee.ParamValueType;
import org.apache.geronimo.xbeans.j2ee.ServletMappingType;
@@ -146,8 +146,9 @@
Collection webServiceBuilder,
Collection securityBuilders,
Collection serviceBuilders,
+ NamingBuilder namingBuilders,
Kernel kernel) throws GBeanNotFoundException {
- super(kernel, securityBuilders, serviceBuilders);
+ super(kernel, securityBuilders, serviceBuilders, namingBuilders);
this.defaultEnvironment = defaultEnvironment;
this.defaultSessionTimeoutSeconds = (defaultSessionTimeoutSeconds == null) ? new Integer(30 * 60) : defaultSessionTimeoutSeconds;
this.jettyContainerObjectName = jettyContainerName;
@@ -222,6 +223,9 @@
EnvironmentType environmentType = jettyWebApp.getEnvironment();
Environment environment = EnvironmentBuilder.buildEnvironment(environmentType, defaultEnvironment);
+
+ getNamingBuilders().buildEnvironment(webApp, jettyWebApp, environment);
+
// Note: logic elsewhere depends on the default artifact ID being the file name less extension (ConfigIDExtractor)
String warName = deployableModule.getRoot().getName();
if (warName.lastIndexOf('.') > -1) {
@@ -302,11 +306,12 @@
public void initContext(EARContext earContext, Module module, ClassLoader cl) throws DeploymentException {
WebAppType webApp = (WebAppType) module.getSpecDD();
- MessageDestinationType[] messageDestinations = webApp.getMessageDestinationArray();
+// MessageDestinationType[] messageDestinations = webApp.getMessageDestinationArray();
JettyWebAppType gerWebApp = (JettyWebAppType) module.getVendorDD();
- GerMessageDestinationType[] gerMessageDestinations = gerWebApp.getMessageDestinationArray();
+// GerMessageDestinationType[] gerMessageDestinations = gerWebApp.getMessageDestinationArray();
- ENCConfigBuilder.registerMessageDestinations(earContext.getRefContext(), module.getName(), messageDestinations, gerMessageDestinations);
+// ENCConfigBuilder.registerMessageDestinations(earContext, module.getName(), messageDestinations, gerMessageDestinations);
+ getNamingBuilders().initContext(webApp, gerWebApp, module.getEarContext().getConfiguration(), earContext.getConfiguration(), module);
if ((webApp.getSecurityConstraintArray().length > 0 || webApp.getSecurityRoleArray().length > 0) &&
!gerWebApp.isSetSecurityRealmName()) {
throw new DeploymentException("web.xml for web app " + module.getName() + " includes security elements but Geronimo deployment plan is not provided or does not contain <security-realm-name> element necessary to configure security accordingly.");
@@ -381,8 +386,8 @@
webModuleData.setAttribute("contextPath", webModule.getContextRoot());
- webModuleData.setReferencePattern("TransactionManager", moduleContext.getTransactionManagerObjectName());
- webModuleData.setReferencePattern("TrackedConnectionAssociator", moduleContext.getConnectionTrackerObjectName());
+ webModuleData.setReferencePattern("TransactionManager", moduleContext.getTransactionManagerName());
+ webModuleData.setReferencePattern("TrackedConnectionAssociator", moduleContext.getConnectionTrackerName());
if (jettyWebApp.isSetWebContainer()) {
AbstractNameQuery webContainerName = ENCConfigBuilder.getGBeanQuery(NameFactory.GERONIMO_SERVICE, jettyWebApp.getWebContainer());
webModuleData.setReferencePattern("JettyContainer", webContainerName);
@@ -895,19 +900,10 @@
}
private Map buildComponentContext(EARContext earContext, Module webModule, WebAppType webApp, JettyWebAppType jettyWebApp, ClassLoader cl) throws DeploymentException {
- return ENCConfigBuilder.buildComponentContext(earContext,
- earContext.getConfiguration(),
- webModule,
- null,
- webApp.getEnvEntryArray(),
- webApp.getEjbRefArray(), jettyWebApp.getEjbRefArray(),
- webApp.getEjbLocalRefArray(), jettyWebApp.getEjbLocalRefArray(),
- webApp.getResourceRefArray(), jettyWebApp.getResourceRefArray(),
- webApp.getResourceEnvRefArray(), jettyWebApp.getResourceEnvRefArray(),
- webApp.getMessageDestinationRefArray(),
- webApp.getServiceRefArray(), jettyWebApp.getServiceRefArray(),
- jettyWebApp.getGbeanRefArray(),
- cl);
+ Map componentContext = new HashMap();
+ Configuration earConfiguration = earContext.getConfiguration();
+ getNamingBuilders().buildNaming(webApp, jettyWebApp, earConfiguration, earConfiguration, webModule, componentContext);
+ return componentContext;
}
public static final GBeanInfo GBEAN_INFO;
@@ -925,6 +921,7 @@
infoBuilder.addReference("WebServiceBuilder", WebServiceBuilder.class, NameFactory.MODULE_BUILDER);
infoBuilder.addReference("SecurityBuilders", NamespaceDrivenBuilder.class, NameFactory.MODULE_BUILDER);
infoBuilder.addReference("ServiceBuilders", NamespaceDrivenBuilder.class, NameFactory.MODULE_BUILDER);
+ infoBuilder.addReference("NamingBuilders", NamingBuilder.class, NameFactory.MODULE_BUILDER);
infoBuilder.addAttribute("kernel", Kernel.class, false);
infoBuilder.addInterface(ModuleBuilder.class);
@@ -940,6 +937,7 @@
"WebServiceBuilder",
"SecurityBuilders",
"ServiceBuilders",
+ "NamingBuilders",
"kernel"});
GBEAN_INFO = infoBuilder.getBeanInfo();
}
Modified: geronimo/server/branches/sachin/modules/geronimo-jetty-builder/src/test/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/geronimo-jetty-builder/src/test/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java?view=diff&rev=442665&r1=442664&r2=442665
==============================================================================
--- geronimo/server/branches/sachin/modules/geronimo-jetty-builder/src/test/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java (original)
+++ geronimo/server/branches/sachin/modules/geronimo-jetty-builder/src/test/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java Tue Sep 12 11:15:24 2006
@@ -19,26 +19,19 @@
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
-import java.net.URI;
import java.net.URL;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.List;
import java.util.Map;
import java.util.Set;
-import javax.management.ObjectName;
-import javax.naming.Reference;
-import javax.xml.namespace.QName;
-
import org.apache.geronimo.testsupport.TestSupport;
import org.apache.geronimo.common.DeploymentException;
import org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinatorGBean;
-import org.apache.geronimo.deployment.DeploymentContext;
import org.apache.geronimo.deployment.ModuleIDBuilder;
import org.apache.geronimo.deployment.DeployableModule;
import org.apache.geronimo.deployment.DeployableModuleFactory;
@@ -51,13 +44,10 @@
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.GBeanInfoBuilder;
import org.apache.geronimo.j2ee.deployment.EARContext;
-import org.apache.geronimo.j2ee.deployment.EJBReferenceBuilder;
import org.apache.geronimo.j2ee.deployment.Module;
-import org.apache.geronimo.j2ee.deployment.RefContext;
-import org.apache.geronimo.j2ee.deployment.ResourceReferenceBuilder;
-import org.apache.geronimo.j2ee.deployment.ServiceReferenceBuilder;
import org.apache.geronimo.j2ee.deployment.UnavailableWebServiceBuilder;
import org.apache.geronimo.j2ee.deployment.WebServiceBuilder;
+import org.apache.geronimo.j2ee.deployment.NamingBuilderCollection;
import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
import org.apache.geronimo.j2ee.management.impl.J2EEServerImpl;
import org.apache.geronimo.jetty.JettyContainerImpl;
@@ -124,6 +114,7 @@
AbstractName moduleName = module.getModuleName();
EARContext earContext = createEARContext(outputPath, defaultEnvironment, repository, configStore, moduleName);
module.setEarContext(earContext);
+ module.setRootEarContext(earContext);
builder.initContext(earContext, module, cl);
builder.addGBeans(earContext, module, cl, Collections.EMPTY_SET);
ConfigurationData configurationData = earContext.getConfigurationData();
@@ -162,6 +153,7 @@
AbstractName moduleName = module.getModuleName();
EARContext earContext = createEARContext(outputPath, defaultEnvironment, repository, configStore, moduleName);
module.setEarContext(earContext);
+ module.setRootEarContext(earContext);
builder.initContext(earContext, module, cl);
builder.addGBeans(earContext, module, cl, Collections.EMPTY_SET);
ConfigurationData configurationData = earContext.getConfigurationData();
@@ -199,59 +191,8 @@
new AbstractNameQuery(ctcName),
null,
null,
- null,
- new RefContext(new EJBReferenceBuilder() {
-
-
- public Reference createCORBAReference(Configuration configuration, AbstractNameQuery containerNameQuery, URI nsCorbaloc, String objectName, String home) {
- return null;
- }
-
- public Reference createEJBRemoteRef(String refName, Configuration configuration, String name, String requiredModule, String optionalModule, Artifact targetConfigId, AbstractNameQuery query, boolean isSession, String home, String remote) {
- return null;
- }
-
- public Reference createEJBLocalRef(String refName, Configuration configuration, String name, String requiredModule, String optionalModule, Artifact targetConfigId, AbstractNameQuery query, boolean isSession, String localHome, String local) {
- return null;
- }
-
- },
- new ResourceReferenceBuilder() {
-
- public Reference createResourceRef(AbstractNameQuery containerId, Class iface, Configuration configuration) {
- return null;
- }
-
- public Reference createAdminObjectRef(AbstractNameQuery containerId, Class iface, Configuration configuration) {
- return null;
- }
-
- public ObjectName locateResourceName(ObjectName query) {
- return null;
- }
-
- public GBeanData locateActivationSpecInfo(AbstractNameQuery nameQuery, String messageListenerInterface, Configuration configuration) {
- return null;
- }
-
- public GBeanData locateResourceAdapterGBeanData(GBeanData resourceAdapterModuleData) {
- return null;
- }
-
- public GBeanData locateAdminObjectInfo(GBeanData resourceAdapterModuleData, String adminObjectInterfaceName) {
- return null;
- }
-
- public GBeanData locateConnectionFactoryInfo(GBeanData resourceAdapterModuleData, String connectionFactoryInterfaceName) {
- return null;
- }
- },
- new ServiceReferenceBuilder() {
- //it could return a Service or a Reference, we don't care
- public Object createService(Class serviceInterface, URI wsdlURI, URI jaxrpcMappingURI, QName serviceQName, Map portComponentRefMap, List handlerInfos, Object serviceRefType, DeploymentContext deploymentContext, Module module, ClassLoader classLoader) {
- return null;
- }
- }));
+ null
+ );
}
private void recursiveDelete(File path) {
@@ -328,7 +269,7 @@
defaultEnvironment.addDependency(baseId, ImportType.ALL);
defaultEnvironment.setConfigId(webModuleArtifact);
- builder = new JettyModuleBuilder(defaultEnvironment, new Integer(1800), Collections.EMPTY_LIST, new AbstractNameQuery(containerName), defaultServlets, defaultFilters, defaultFilterMappings, pojoWebServiceTemplate, Collections.singleton(webServiceBuilder), Collections.singleton(new GeronimoSecurityBuilderImpl()), Collections.singleton(new GBeanBuilder(null, null)), kernel);
+ builder = new JettyModuleBuilder(defaultEnvironment, new Integer(1800), Collections.EMPTY_LIST, new AbstractNameQuery(containerName), defaultServlets, defaultFilters, defaultFilterMappings, pojoWebServiceTemplate, Collections.singleton(webServiceBuilder), Collections.singleton(new GeronimoSecurityBuilderImpl()), Collections.singleton(new GBeanBuilder(null, null)), new NamingBuilderCollection(null, null), kernel);
}
protected void tearDown() throws Exception {
Modified: geronimo/server/branches/sachin/modules/geronimo-jetty-builder/src/test/java/org/apache/geronimo/jetty/deployment/PlanParsingTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/geronimo-jetty-builder/src/test/java/org/apache/geronimo/jetty/deployment/PlanParsingTest.java?view=diff&rev=442665&r1=442664&r2=442665
==============================================================================
--- geronimo/server/branches/sachin/modules/geronimo-jetty-builder/src/test/java/org/apache/geronimo/jetty/deployment/PlanParsingTest.java (original)
+++ geronimo/server/branches/sachin/modules/geronimo-jetty-builder/src/test/java/org/apache/geronimo/jetty/deployment/PlanParsingTest.java Tue Sep 12 11:15:24 2006
@@ -6,13 +6,13 @@
import org.apache.geronimo.deployment.xbeans.ArtifactType;
import org.apache.geronimo.deployment.xbeans.EnvironmentType;
import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
-import org.apache.geronimo.deployment.service.ServiceConfigBuilder;
import org.apache.geronimo.deployment.service.GBeanBuilder;
import org.apache.geronimo.deployment.DeployableModule;
import org.apache.geronimo.deployment.DeployableModuleFactory;
import org.apache.geronimo.gbean.AbstractName;
import org.apache.geronimo.gbean.AbstractNameQuery;
import org.apache.geronimo.j2ee.deployment.WebServiceBuilder;
+import org.apache.geronimo.j2ee.deployment.NamingBuilderCollection;
import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
import org.apache.geronimo.kernel.Jsr77Naming;
import org.apache.geronimo.kernel.Naming;
@@ -55,7 +55,7 @@
private JettyModuleBuilder builder;
public PlanParsingTest() throws Exception {
- builder = new JettyModuleBuilder(defaultEnvironment, new Integer(1800), null, jettyContainerObjectName, new HashSet(), new HashSet(), new HashSet(), pojoWebServiceTemplate, Collections.singleton(webServiceBuilder), Collections.singleton(new GeronimoSecurityBuilderImpl()), Collections.singleton(new GBeanBuilder(null, null)), null);
+ builder = new JettyModuleBuilder(defaultEnvironment, new Integer(1800), null, jettyContainerObjectName, new HashSet(), new HashSet(), new HashSet(), pojoWebServiceTemplate, Collections.singleton(webServiceBuilder), Collections.singleton(new GeronimoSecurityBuilderImpl()), Collections.singleton(new GBeanBuilder(null, null)), new NamingBuilderCollection(null, null), null);
}
public void testContents() throws Exception {
Modified: geronimo/server/branches/sachin/modules/geronimo-jetty/src/main/java/org/apache/geronimo/jetty/JettyWebAppContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/geronimo-jetty/src/main/java/org/apache/geronimo/jetty/JettyWebAppContext.java?view=diff&rev=442665&r1=442664&r2=442665
==============================================================================
--- geronimo/server/branches/sachin/modules/geronimo-jetty/src/main/java/org/apache/geronimo/jetty/JettyWebAppContext.java (original)
+++ geronimo/server/branches/sachin/modules/geronimo-jetty/src/main/java/org/apache/geronimo/jetty/JettyWebAppContext.java Tue Sep 12 11:15:24 2006
@@ -248,7 +248,10 @@
setAuthenticator(authenticator);
setRealmName(realmName);
setTagLibMap(tagLibMap);
- setSessionTimeoutSeconds(sessionTimeoutSeconds);
+
+ if (false == distributable) {
+ setSessionTimeoutSeconds(sessionTimeoutSeconds);
+ }
GeronimoUserTransaction userTransaction = new GeronimoUserTransaction(transactionManager);
Context enc = EnterpriseNamingContext.createEnterpriseNamingContext(componentContext, userTransaction, kernel, webClassLoader);
Modified: geronimo/server/branches/sachin/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/ENCConfigBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/ENCConfigBuilder.java?view=diff&rev=442665&r1=442664&r2=442665
==============================================================================
--- geronimo/server/branches/sachin/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/ENCConfigBuilder.java (original)
+++ geronimo/server/branches/sachin/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/ENCConfigBuilder.java Tue Sep 12 11:15:24 2006
@@ -17,60 +17,22 @@
package org.apache.geronimo.naming.deployment;
-import java.net.MalformedURLException;
import java.net.URI;
-import java.net.URISyntaxException;
import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.List;
import java.util.Map;
import java.util.Set;
-import javax.naming.NamingException;
-import javax.naming.Reference;
-import javax.transaction.UserTransaction;
-import javax.xml.namespace.QName;
+
import org.apache.geronimo.common.DeploymentException;
-import org.apache.geronimo.common.UnresolvedReferenceException;
import org.apache.geronimo.gbean.AbstractNameQuery;
-import org.apache.geronimo.gbean.GBeanData;
-import org.apache.geronimo.j2ee.deployment.EARContext;
-import org.apache.geronimo.j2ee.deployment.Module;
-import org.apache.geronimo.j2ee.deployment.RefContext;
-import org.apache.geronimo.j2ee.deployment.ServiceReferenceBuilder;
import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
-import org.apache.geronimo.kernel.ClassLoading;
-import org.apache.geronimo.kernel.GBeanNotFoundException;
-import org.apache.geronimo.kernel.config.Configuration;
import org.apache.geronimo.kernel.repository.Artifact;
-import org.apache.geronimo.naming.java.ComponentContextBuilder;
-import org.apache.geronimo.naming.reference.GBeanReference;
-import org.apache.geronimo.xbeans.geronimo.naming.GerEjbLocalRefType;
-import org.apache.geronimo.xbeans.geronimo.naming.GerEjbRefType;
import org.apache.geronimo.xbeans.geronimo.naming.GerGbeanLocatorType;
-import org.apache.geronimo.xbeans.geronimo.naming.GerGbeanRefType;
-import org.apache.geronimo.xbeans.geronimo.naming.GerMessageDestinationType;
import org.apache.geronimo.xbeans.geronimo.naming.GerPatternType;
-import org.apache.geronimo.xbeans.geronimo.naming.GerResourceEnvRefType;
import org.apache.geronimo.xbeans.geronimo.naming.GerResourceRefType;
-import org.apache.geronimo.xbeans.geronimo.naming.GerServiceRefType;
-import org.apache.geronimo.xbeans.j2ee.EjbLocalRefType;
-import org.apache.geronimo.xbeans.j2ee.EjbRefType;
-import org.apache.geronimo.xbeans.j2ee.EnvEntryType;
-import org.apache.geronimo.xbeans.j2ee.MessageDestinationRefType;
-import org.apache.geronimo.xbeans.j2ee.MessageDestinationType;
-import org.apache.geronimo.xbeans.j2ee.ParamValueType;
-import org.apache.geronimo.xbeans.j2ee.PortComponentRefType;
-import org.apache.geronimo.xbeans.j2ee.ResourceEnvRefType;
import org.apache.geronimo.xbeans.j2ee.ResourceRefType;
-import org.apache.geronimo.xbeans.j2ee.ServiceRefHandlerType;
-import org.apache.geronimo.xbeans.j2ee.ServiceRefType;
-import org.apache.geronimo.xbeans.j2ee.XsdQNameType;
-import org.apache.geronimo.xbeans.j2ee.XsdStringType;
/**
* @version $Rev:385232 $ $Date$
@@ -79,27 +41,6 @@
private static final String JAXR_CONNECTION_FACTORY_CLASS = "javax.xml.registry.ConnectionFactory";
- public static void registerMessageDestinations(RefContext refContext, String moduleName, MessageDestinationType[] specDestinations, GerMessageDestinationType[] destinations) throws DeploymentException {
- Map nameMap = new HashMap();
- for (int i = 0; i < destinations.length; i++) {
- GerMessageDestinationType destination = destinations[i];
- String name = destination.getMessageDestinationName().trim();
- nameMap.put(name, destination);
- boolean found = false;
- for (int j = 0; j < specDestinations.length; j++) {
- MessageDestinationType specDestination = specDestinations[j];
- if (specDestination.getMessageDestinationName().getStringValue().trim().equals(name)) {
- found = true;
- break;
- }
- }
- if (!found) {
- throw new DeploymentException("No spec DD message-destination for " + name);
- }
- }
- refContext.registerMessageDestionations(moduleName, nameMap);
- }
-
public static AbstractNameQuery getGBeanQuery(String j2eeType, GerGbeanLocatorType gerGbeanLocator) {
AbstractNameQuery abstractNameQuery;
@@ -117,100 +58,6 @@
return abstractNameQuery;
}
-
- static void addEnvEntries(EnvEntryType[] envEntries, ComponentContextBuilder builder, ClassLoader classLoader) throws DeploymentException {
- for (int i = 0; i < envEntries.length; i++) {
- EnvEntryType envEntry = envEntries[i];
- String name = getStringValue(envEntry.getEnvEntryName());
- String type = getStringValue(envEntry.getEnvEntryType());
- String text = getStringValue(envEntry.getEnvEntryValue());
- try {
- builder.addEnvEntry(name, type, text, classLoader);
- } catch (NumberFormatException e) {
- throw new DeploymentException("Invalid env-entry value for name: " + name, e);
- } catch (NamingException e) {
- throw new DeploymentException("Invalid env-entry definition for name: " + name, e);
- }
- }
-
- }
-
- static void addResourceRefs(Configuration earContext, RefContext refContext, ResourceRefType[] resourceRefs, Map refMap, ClassLoader cl, ComponentContextBuilder builder) throws DeploymentException {
- if (refMap == null) {
- refMap = Collections.EMPTY_MAP;
- }
- Map newMap = new HashMap();
- for (Iterator it = refMap.keySet().iterator(); it.hasNext();) {
- String name = (String) it.next();
- newMap.put(name.trim(), refMap.get(name));
- }
- refMap = newMap;
-
- for (int i = 0; i < resourceRefs.length; i++) {
- ResourceRefType resourceRef = resourceRefs[i];
- String name = getStringValue(resourceRef.getResRefName());
- String type = getStringValue(resourceRef.getResType());
- GerResourceRefType gerResourceRef = (GerResourceRefType) refMap.get(name);
- Class iface;
- try {
- iface = cl.loadClass(type);
- } catch (ClassNotFoundException e) {
- throw new DeploymentException("could not load class " + type, e);
- }
- Reference ref;
- if (iface == URL.class) {
- if (gerResourceRef == null || !gerResourceRef.isSetUrl()) {
- throw new DeploymentException("No url supplied to resolve: " + name);
- }
- try {
- //TODO expose jsr-77 objects for these guys
- builder.bind(name, new URL(gerResourceRef.getUrl()));
- } catch (MalformedURLException e) {
- throw new DeploymentException("Could not convert " + gerResourceRef.getUrl() + " to URL", e);
- }
- } else {
- //determine jsr-77 type from interface
- String j2eeType;
-
-
- if ("javax.mail.Session".equals(type)) {
- j2eeType = NameFactory.JAVA_MAIL_RESOURCE;
- } else if (JAXR_CONNECTION_FACTORY_CLASS.equals(type)) {
- j2eeType = NameFactory.JAXR_CONNECTION_FACTORY;
- } else {
- j2eeType = NameFactory.JCA_MANAGED_CONNECTION_FACTORY;
- }
- try {
- AbstractNameQuery containerId = getResourceContainerId(name, j2eeType, null, gerResourceRef);
-
- ref = refContext.getConnectionFactoryRef(containerId, iface, earContext);
- builder.bind(name, ref);
- } catch (UnresolvedReferenceException e) {
-
- StringBuffer errorMessage = new StringBuffer("Unable to resolve resource reference '");
- errorMessage.append(name);
- errorMessage.append("' (");
- if (e.isMultiple()) {
- errorMessage.append("Found multiple matching resources. Try being more specific in a resource-ref mapping in your Geronimo deployment plan.");
- } else if (gerResourceRef == null){
- errorMessage.append("Could not auto-map to resource. Try adding a resource-ref mapping to your Geronimo deployment plan.");
- } else if (gerResourceRef.isSetResourceLink()){
- errorMessage.append("Could not find resource '");
- errorMessage.append(gerResourceRef.getResourceLink());
- errorMessage.append("'. Perhaps it has not yet been configured, or your application does not have a dependency declared for that resource module?");
- } else {
- errorMessage.append("Could not find the resource specified in your Geronimo deployment plan:");
- errorMessage.append(gerResourceRef.getPattern());
- }
- errorMessage.append(")");
-
- throw new DeploymentException(errorMessage.toString());
- }
- }
- }
-
- }
-
private static AbstractNameQuery getResourceContainerId(String name, String type, URI moduleURI, GerResourceRefType gerResourceRef) {
AbstractNameQuery containerId;
String module = moduleURI == null ? null : moduleURI.toString();
@@ -226,415 +73,6 @@
return containerId;
}
- static void addResourceEnvRefs(Configuration earContext, RefContext refContext, ResourceEnvRefType[] resourceEnvRefArray, Map refMap, ClassLoader cl, ComponentContextBuilder builder) throws DeploymentException {
- if (refMap == null) {
- refMap = Collections.EMPTY_MAP;
- }
- Map newMap = new HashMap();
- for (Iterator it = refMap.keySet().iterator(); it.hasNext();) {
- String name = (String) it.next();
- newMap.put(name.trim(), refMap.get(name));
- }
- refMap = newMap;
-
- for (int i = 0; i < resourceEnvRefArray.length; i++) {
- ResourceEnvRefType resourceEnvRef = resourceEnvRefArray[i];
- String name = getStringValue(resourceEnvRef.getResourceEnvRefName());
- String type = getStringValue(resourceEnvRef.getResourceEnvRefType());
- Class iface;
- try {
- iface = cl.loadClass(type);
- } catch (ClassNotFoundException e) {
- throw new DeploymentException("could not load class " + type, e);
- }
- GerResourceEnvRefType gerResourceEnvRef = (GerResourceEnvRefType) refMap.get(name);
- try {
- AbstractNameQuery containerId = getAdminObjectContainerId(name, gerResourceEnvRef);
- Reference ref = refContext.getAdminObjectRef(containerId, iface, earContext);
-
- builder.bind(name, ref);
- } catch (UnresolvedReferenceException e) {
- throw new DeploymentException("Unable to resolve resource env reference '" + name + "' (" + (e.isMultiple() ? "found multiple matching resources" : "no matching resources found") + ")");
- }
- }
- }
-
- private static AbstractNameQuery getAdminObjectContainerId(String name, GerResourceEnvRefType gerResourceEnvRef) {
- AbstractNameQuery containerId;
- if (gerResourceEnvRef == null) {
- containerId = buildAbstractNameQuery(null, null, name, NameFactory.JCA_ADMIN_OBJECT, NameFactory.RESOURCE_ADAPTER_MODULE);
- } else if (gerResourceEnvRef.isSetMessageDestinationLink()) {
- containerId = buildAbstractNameQuery(null, null, gerResourceEnvRef.getMessageDestinationLink().trim(), NameFactory.JCA_ADMIN_OBJECT, NameFactory.RESOURCE_ADAPTER_MODULE);
- } else if (gerResourceEnvRef.isSetAdminObjectLink()) {
- String moduleURI = null;
- if (gerResourceEnvRef.isSetAdminObjectModule()) {
- moduleURI = gerResourceEnvRef.getAdminObjectModule().trim();
- }
- containerId = buildAbstractNameQuery(null, moduleURI, gerResourceEnvRef.getAdminObjectLink().trim(), NameFactory.JCA_ADMIN_OBJECT, NameFactory.RESOURCE_ADAPTER_MODULE);
- } else {
- //construct name from components
- GerPatternType patternType = gerResourceEnvRef.getPattern();
- containerId = buildAbstractNameQuery(patternType, NameFactory.JCA_ADMIN_OBJECT, NameFactory.RESOURCE_ADAPTER_MODULE, null);
- }
- return containerId;
- }
-
- static void addMessageDestinationRefs(Configuration earContext, RefContext refContext, MessageDestinationRefType[] messageDestinationRefs, ClassLoader cl, ComponentContextBuilder builder) throws DeploymentException {
- for (int i = 0; i < messageDestinationRefs.length; i++) {
- MessageDestinationRefType messageDestinationRef = messageDestinationRefs[i];
- String name = getStringValue(messageDestinationRef.getMessageDestinationRefName());
- String linkName = getStringValue(messageDestinationRef.getMessageDestinationLink());
- String type = getStringValue(messageDestinationRef.getMessageDestinationType());
- Class iface;
- try {
- iface = cl.loadClass(type);
- } catch (ClassNotFoundException e) {
- throw new DeploymentException("could not load class " + type, e);
- }
- String moduleURI = null;
- GerMessageDestinationType destination = (GerMessageDestinationType) refContext.getMessageDestination(linkName);
- if (destination != null) {
- if (destination.isSetAdminObjectLink()) {
- if (destination.isSetAdminObjectModule()) {
- moduleURI = destination.getAdminObjectModule().trim();
- }
- linkName = destination.getAdminObjectLink().trim();
- }
- } else {
- //well, we know for sure an admin object is not going to be defined in a modules that can have a message-destination
- int pos = linkName.indexOf('#');
- if (pos > -1) {
- //AMM -- the following line causes blowups; e.g. to look in DayTrader EJB module for a RA -- why is that?!?
- //moduleURI = linkName.substring(0, pos);
- linkName = linkName.substring(pos + 1);
- }
- }
-
- //try to resolve ref based only matching resource-ref-name
- //throws exception if it can't locate ref.
- AbstractNameQuery containerId = buildAbstractNameQuery(null, moduleURI, linkName, NameFactory.JCA_ADMIN_OBJECT, NameFactory.RESOURCE_ADAPTER_MODULE);
- Reference ref = refContext.getAdminObjectRef(containerId, iface, earContext);
- builder.bind(name, ref);
-
- }
-
- }
-
- static void addEJBRefs(Configuration earContext, Configuration ejbContext, RefContext refContext, URI moduleURI, EjbRefType[] ejbRefs, Map ejbRefMap, ClassLoader cl, ComponentContextBuilder builder) throws DeploymentException {
- Map newMap = new HashMap();
- for (Iterator it = ejbRefMap.keySet().iterator(); it.hasNext();) {
- String name = (String) it.next();
- newMap.put(name.trim(), ejbRefMap.get(name));
- }
- ejbRefMap = newMap;
- for (int i = 0; i < ejbRefs.length; i++) {
- EjbRefType ejbRef = ejbRefs[i];
-
- String ejbRefName = getStringValue(ejbRef.getEjbRefName());
- GerEjbRefType remoteRef = (GerEjbRefType) ejbRefMap.get(ejbRefName);
-
- Reference ejbReference = addEJBRef(earContext, ejbContext, refContext, moduleURI, ejbRef, remoteRef, cl);
- builder.bind(ejbRefName, ejbReference);
- }
- }
-
- static Reference addEJBRef(Configuration earContext, Configuration ejbContext, RefContext refContext, URI moduleURI, EjbRefType ejbRef, GerEjbRefType remoteRef, ClassLoader cl) throws DeploymentException {
- String remote = getStringValue(ejbRef.getRemote());
- String refName = getStringValue(ejbRef.getEjbRefName());
- try {
- assureEJBObjectInterface(remote, cl);
- } catch (DeploymentException e) {
- throw new DeploymentException("Error processing 'remote' element for EJB Reference '" + refName + "' for module '" + moduleURI + "': " + e.getMessage());
- }
-
- String home = getStringValue(ejbRef.getHome());
- try {
- assureEJBHomeInterface(home, cl);
- } catch (DeploymentException e) {
- throw new DeploymentException("Error processing 'home' element for EJB Reference '" + refName + "' for module '" + moduleURI + "': " + e.getMessage());
- }
-
- Reference ejbReference;
- boolean isSession = "Session".equals(getStringValue(ejbRef.getEjbRefType()));
-
- if (isSession && remote.equals("javax.management.j2ee.Management") && home.equals("javax.management.j2ee.ManagementHome")) {
- AbstractNameQuery query = new AbstractNameQuery(null, Collections.singletonMap("name", "ejb/mgmt/MEJB"));
- ejbReference = refContext.getEJBRemoteRef(null, ejbContext, null, null, null, null, query, isSession, home, remote);
- } else {
-
- String ejbLink = null;
- if (remoteRef != null && remoteRef.isSetNsCorbaloc()) {
- try {
- AbstractNameQuery cssBean;
- if (remoteRef.isSetCssLink()) {
- String cssLink = remoteRef.getCssLink().trim();
- cssBean = buildAbstractNameQuery(null, null, cssLink, NameFactory.CORBA_CSS, NameFactory.EJB_MODULE);
- } else {
- GerPatternType css = remoteRef.getCss();
- cssBean = buildAbstractNameQuery(css, NameFactory.CORBA_CSS, NameFactory.EJB_MODULE, null);
- }
- ejbReference = refContext.getCORBARemoteRef(earContext,
- cssBean,
- new URI(getStringValue(remoteRef.getNsCorbaloc())),
- getStringValue(remoteRef.getName()),
- home);
- } catch (URISyntaxException e) {
- throw new DeploymentException("Could not construct CORBA NameServer URI: " + remoteRef.getNsCorbaloc(), e);
- }
- } else {
- Artifact targetConfigId = null;
- String optionalModule = moduleURI == null ? null : moduleURI.toString();
- String requiredModule = null;
- AbstractNameQuery containerQuery = null;
- if (remoteRef != null && remoteRef.isSetEjbLink()) {
- ejbLink = remoteRef.getEjbLink();
- } else if (ejbRef.isSetEjbLink()) {
- ejbLink = getStringValue(ejbRef.getEjbLink());
- targetConfigId = ejbContext.getId();
- }
- if (ejbLink != null) {
- String[] bits = ejbLink.split("#");
- if (bits.length == 2) {
- //look only in specified module.
- requiredModule = bits[0];
- if (moduleURI != null) {
- requiredModule = moduleURI.resolve(requiredModule).getPath();
- }
- ejbLink = bits[1];
- }
- } else if (remoteRef != null) {
- GerPatternType patternType = remoteRef.getPattern();
- containerQuery = buildAbstractNameQuery(patternType, null, NameFactory.EJB_MODULE, null);
- }
- ejbReference = refContext.getEJBRemoteRef(refName, ejbContext, ejbLink, requiredModule, optionalModule, targetConfigId, containerQuery, isSession, home, remote);
- }
- }
- return ejbReference;
- }
-
- static void addEJBLocalRefs(Configuration ejbContext, RefContext refContext, URI moduleURI, EjbLocalRefType[] ejbLocalRefs, Map ejbLocalRefMap, ClassLoader cl, ComponentContextBuilder builder) throws DeploymentException {
- Map newMap = new HashMap();
- for (Iterator it = ejbLocalRefMap.keySet().iterator(); it.hasNext();) {
- String name = (String) it.next();
- newMap.put(name.trim(), ejbLocalRefMap.get(name));
- }
- ejbLocalRefMap = newMap;
- for (int i = 0; i < ejbLocalRefs.length; i++) {
- EjbLocalRefType ejbLocalRef = ejbLocalRefs[i];
-
- String ejbRefName = getStringValue(ejbLocalRef.getEjbRefName());
- GerEjbLocalRefType localRef = (GerEjbLocalRefType) ejbLocalRefMap.get(ejbRefName);
-
- Reference ejbReference = addEJBLocalRef(ejbContext, refContext, moduleURI, ejbLocalRef, localRef, cl);
- builder.bind(ejbRefName, ejbReference);
- }
- }
-
- static Reference addEJBLocalRef(Configuration ejbContext, RefContext refContext, URI moduleURI, EjbLocalRefType ejbLocalRef, GerEjbLocalRefType localRef, ClassLoader cl) throws DeploymentException {
- String local = getStringValue(ejbLocalRef.getLocal());
- String refName = getStringValue(ejbLocalRef.getEjbRefName());
- try {
- assureEJBLocalObjectInterface(local, cl);
- } catch (DeploymentException e) {
- throw new DeploymentException("Error processing 'local' element for EJB Local Reference '" + refName + "' for module '" + moduleURI + "': " + e.getMessage());
- }
-
- String localHome = getStringValue(ejbLocalRef.getLocalHome());
- try {
- assureEJBLocalHomeInterface(localHome, cl);
- } catch (DeploymentException e) {
- throw new DeploymentException("Error processing 'local-home' element for EJB Local Reference '" + refName + "' for module '" + moduleURI + "': " + e.getMessage());
- }
-
- boolean isSession = "Session".equals(getStringValue(ejbLocalRef.getEjbRefType()));
-
- String ejbLink = null;
- if (localRef != null && localRef.isSetEjbLink()) {
- ejbLink = localRef.getEjbLink();
- } else if (ejbLocalRef.isSetEjbLink()) {
- ejbLink = getStringValue(ejbLocalRef.getEjbLink());
- }
-
- Artifact targetConfigId = null;
- String optionalModule = moduleURI == null ? null : moduleURI.toString();
- String requiredModule = null;
- AbstractNameQuery containerQuery = null;
- if (localRef != null && localRef.isSetEjbLink()) {
- ejbLink = localRef.getEjbLink();
- } else if (ejbLocalRef.isSetEjbLink()) {
- ejbLink = getStringValue(ejbLocalRef.getEjbLink());
- targetConfigId = ejbContext.getId();
- }
- if (ejbLink != null) {
- String[] bits = ejbLink.split("#");
- if (bits.length == 2) {
- //look only in specified module.
- requiredModule = bits[0];
- ejbLink = bits[1];
- }
- } else if (localRef != null) {
- GerPatternType patternType = localRef.getPattern();
- containerQuery = buildAbstractNameQuery(patternType, null, NameFactory.EJB_MODULE, null);
- }
- return refContext.getEJBLocalRef(refName, ejbContext, ejbLink, requiredModule, optionalModule, targetConfigId, containerQuery, isSession, localHome, local);
- }
-
-//TODO current implementation does not deal with portComponentRef links.
-
- static void addServiceRefs(EARContext earContext, Module module, ServiceRefType[] serviceRefs, Map serviceRefMap, ClassLoader cl, ComponentContextBuilder builder) throws DeploymentException {
- Map newMap = new HashMap();
- for (Iterator it = serviceRefMap.keySet().iterator(); it.hasNext();) {
- String name = (String) it.next();
- newMap.put(name.trim(), serviceRefMap.get(name));
- }
- serviceRefMap = newMap;
-
- RefContext refContext = earContext.getRefContext();
-
- for (int i = 0; i < serviceRefs.length; i++) {
- ServiceRefType serviceRef = serviceRefs[i];
- String name = getStringValue(serviceRef.getServiceRefName());
- GerServiceRefType serviceRefType = (GerServiceRefType) serviceRefMap.get(name);
-// Map credentialsNameMap = (Map) serviceRefCredentialsNameMap.get(name);
- String serviceInterfaceName = getStringValue(serviceRef.getServiceInterface());
- assureInterface(serviceInterfaceName, "javax.xml.rpc.Service", "[Web]Service", cl);
- Class serviceInterface;
- try {
- serviceInterface = cl.loadClass(serviceInterfaceName);
- } catch (ClassNotFoundException e) {
- throw new DeploymentException("Could not load service interface class: " + serviceInterfaceName, e);
- }
- URI wsdlURI = null;
- if (serviceRef.isSetWsdlFile()) {
- try {
- wsdlURI = new URI(getStringValue(serviceRef.getWsdlFile().getStringValue()));
- } catch (URISyntaxException e) {
- throw new DeploymentException("could not construct wsdl uri from " + serviceRef.getWsdlFile().getStringValue(), e);
- }
- }
- URI jaxrpcMappingURI = null;
- if (serviceRef.isSetJaxrpcMappingFile()) {
- try {
- jaxrpcMappingURI = new URI(getStringValue(serviceRef.getJaxrpcMappingFile()));
- } catch (URISyntaxException e) {
- throw new DeploymentException("Could not construct jaxrpc mapping uri from " + serviceRef.getJaxrpcMappingFile(), e);
- }
- }
- QName serviceQName = null;
- if (serviceRef.isSetServiceQname()) {
- serviceQName = serviceRef.getServiceQname().getQNameValue();
- }
- Map portComponentRefMap = new HashMap();
- PortComponentRefType[] portComponentRefs = serviceRef.getPortComponentRefArray();
- if (portComponentRefs != null) {
- for (int j = 0; j < portComponentRefs.length; j++) {
- PortComponentRefType portComponentRef = portComponentRefs[j];
- String portComponentLink = getStringValue(portComponentRef.getPortComponentLink());
- String serviceEndpointInterfaceType = getStringValue(portComponentRef.getServiceEndpointInterface());
- assureInterface(serviceEndpointInterfaceType, "java.rmi.Remote", "ServiceEndpoint", cl);
- Class serviceEndpointClass;
- try {
- serviceEndpointClass = cl.loadClass(serviceEndpointInterfaceType);
- } catch (ClassNotFoundException e) {
- throw new DeploymentException("could not load service endpoint class " + serviceEndpointInterfaceType, e);
- }
- portComponentRefMap.put(serviceEndpointClass, portComponentLink);
- }
- }
- ServiceRefHandlerType[] handlers = serviceRef.getHandlerArray();
- List handlerInfos = buildHandlerInfoList(handlers, cl);
-
-//we could get a Reference or the actual serializable Service back.
- Object ref = refContext.getServiceReference(serviceInterface, wsdlURI, jaxrpcMappingURI, serviceQName, portComponentRefMap, handlerInfos, serviceRefType, earContext, module, cl);
- builder.bind(name, ref);
- }
-
- }
-
- private static List buildHandlerInfoList(ServiceRefHandlerType[] handlers, ClassLoader classLoader) throws DeploymentException {
- List handlerInfos = new ArrayList();
- for (int i = 0; i < handlers.length; i++) {
- ServiceRefHandlerType handler = handlers[i];
- org.apache.geronimo.xbeans.j2ee.String[] portNameArray = handler.getPortNameArray();
- List portNames = new ArrayList();
- for (int j = 0; j < portNameArray.length; j++) {
- portNames.add(portNameArray[j].getStringValue().trim());
-
- }
-// Set portNames = new HashSet(Arrays.asList(portNameArray));
- String handlerClassName = handler.getHandlerClass().getStringValue().trim();
- Class handlerClass;
- try {
- handlerClass = ClassLoading.loadClass(handlerClassName, classLoader);
- } catch (ClassNotFoundException e) {
- throw new DeploymentException("Could not load handler class", e);
- }
- Map config = new HashMap();
- ParamValueType[] paramValues = handler.getInitParamArray();
- for (int j = 0; j < paramValues.length; j++) {
- ParamValueType paramValue = paramValues[j];
- String paramName = paramValue.getParamName().getStringValue().trim();
- String paramStringValue = paramValue.getParamValue().getStringValue().trim();
- config.put(paramName, paramStringValue);
- }
- XsdQNameType[] soapHeaderQNames = handler.getSoapHeaderArray();
- QName[] headerQNames = new QName[soapHeaderQNames.length];
- for (int j = 0; j < soapHeaderQNames.length; j++) {
- XsdQNameType soapHeaderQName = soapHeaderQNames[j];
- headerQNames[j] = soapHeaderQName.getQNameValue();
- }
- Set soapRoles = new HashSet();
- for (int j = 0; j < handler.getSoapRoleArray().length; j++) {
- String soapRole = handler.getSoapRoleArray(j).getStringValue().trim();
- soapRoles.add(soapRole);
- }
- ServiceReferenceBuilder.HandlerInfoInfo handlerInfoInfo = new ServiceReferenceBuilder.HandlerInfoInfo(new HashSet(portNames), handlerClass, config, headerQNames, soapRoles);
- handlerInfos.add(handlerInfoInfo);
- }
- return handlerInfos;
- }
-
- public static Class assureEJBObjectInterface(String remote, ClassLoader cl) throws DeploymentException {
- return assureInterface(remote, "javax.ejb.EJBObject", "Remote", cl);
- }
-
- public static Class assureEJBHomeInterface(String home, ClassLoader cl) throws DeploymentException {
- return assureInterface(home, "javax.ejb.EJBHome", "Home", cl);
- }
-
- public static Class assureEJBLocalObjectInterface(String local, ClassLoader cl) throws DeploymentException {
- return assureInterface(local, "javax.ejb.EJBLocalObject", "Local", cl);
- }
-
- public static Class assureEJBLocalHomeInterface(String localHome, ClassLoader cl) throws DeploymentException {
- return assureInterface(localHome, "javax.ejb.EJBLocalHome", "LocalHome", cl);
- }
-
- public static Class assureInterface(String interfaceName, String superInterfaceName, String interfaceType, ClassLoader cl) throws DeploymentException {
- if (interfaceName == null || interfaceName.equals("")) {
- throw new DeploymentException("interface name cannot be blank");
- }
- Class clazz;
- try {
- clazz = cl.loadClass(interfaceName);
- } catch (ClassNotFoundException e) {
- throw new DeploymentException(interfaceType + " interface class not found: " + interfaceName);
- }
- if (!clazz.isInterface()) {
- throw new DeploymentException(interfaceType + " interface is not an interface: " + interfaceName);
- }
- Class superInterface;
- try {
- superInterface = cl.loadClass(superInterfaceName);
- } catch (ClassNotFoundException e) {
- throw new DeploymentException("Class " + superInterfaceName + " could not be loaded");
- }
- if (!superInterface.isAssignableFrom(clazz)) {
- throw new DeploymentException(interfaceType + " interface does not extend " + superInterfaceName + ": " + interfaceName);
- }
- return clazz;
- }
-
private static String getStringValue(org.apache.geronimo.xbeans.j2ee.String string) {
if (string == null) {
return null;
@@ -643,19 +81,6 @@
return s == null ? null : s.trim();
}
- private static String getStringValue(XsdStringType string) {
- if (string == null) {
- return null;
- }
- String s = string.getStringValue();
- return s == null ? null : s.trim();
- }
-
- private static String getStringValue(String string) {
- return string == null ? null : string.trim();
- }
-
-
public static void setResourceEnvironment(ResourceEnvironmentBuilder builder, ResourceRefType[] resourceRefs, GerResourceRefType[] gerResourceRefs) {
Map refMap = mapResourceRefs(gerResourceRefs);
Set unshareableResources = new HashSet();
@@ -684,139 +109,7 @@
builder.setApplicationManagedSecurityResources(applicationManagedSecurityResources);
}
- public static Map buildComponentContext(EARContext earContext,
- Configuration ejbContext,
- Module module,
- UserTransaction userTransaction,
- EnvEntryType[] envEntries,
- EjbRefType[] ejbRefs,
- GerEjbRefType[] gerEjbRefs,
- EjbLocalRefType[] ejbLocalRefs,
- GerEjbLocalRefType[] gerEjbLocalRef,
- ResourceRefType[] resourceRefs,
- GerResourceRefType[] gerResourceRef,
- ResourceEnvRefType[] resourceEnvRefs,
- GerResourceEnvRefType[] gerResourceEnvRef,
- MessageDestinationRefType[] messageDestinationRefs,
- ServiceRefType[] serviceRefs,
- GerServiceRefType[] gerServiceRefs,
- GerGbeanRefType[] gerGbeanRefs,
- ClassLoader cl) throws DeploymentException {
- ComponentContextBuilder builder = new ComponentContextBuilder();
- RefContext refContext = earContext.getRefContext();
- Configuration earConfiguration = earContext.getConfiguration();
-
- if (userTransaction != null) {
- builder.addUserTransaction(userTransaction);
- }
-
- AbstractNameQuery corbaGBean = earContext.getCORBAGBeanObjectName();
- if (corbaGBean != null) {
- builder.addORB(earConfiguration.getId(), corbaGBean);
- builder.addHandleDelegateReference(earConfiguration.getId(), corbaGBean);
- }
-
- URI moduleURI = module.getModuleURI();
-
- addEnvEntries(envEntries, builder, cl);
-
- if (ejbContext == null) {
- ejbContext = earConfiguration;
- }
-
-// ejb-ref
- addEJBRefs(earConfiguration, ejbContext, refContext, moduleURI, ejbRefs, mapEjbRefs(gerEjbRefs), cl, builder);
-
-// ejb-local-ref
- addEJBLocalRefs(ejbContext, refContext, moduleURI, ejbLocalRefs, mapEjbLocalRefs(gerEjbLocalRef), cl, builder);
-
-// resource-ref
- addResourceRefs(earConfiguration, refContext, resourceRefs, mapResourceRefs(gerResourceRef), cl, builder);
-
-// resource-env-ref
- addResourceEnvRefs(earConfiguration, refContext, resourceEnvRefs, mapResourceEnvRefs(gerResourceEnvRef), cl, builder);
-
- addMessageDestinationRefs(earConfiguration, refContext, messageDestinationRefs, cl, builder);
-
-// Map serviceRefMap = new HashMap();
-// Map serviceRefCredentialsNameMap = new HashMap();
-// mapServiceRefs(gerServiceRefs, serviceRefMap, serviceRefCredentialsNameMap);
- Map serviceRefMap = mapServiceRefs(gerServiceRefs);
- addServiceRefs(earContext, module, serviceRefs, serviceRefMap, cl, builder);
-
- addGBeanRefs(earContext, builder, refContext, gerGbeanRefs, cl);
-
- return builder.getContext();
- }
-
- private static void addGBeanRefs(EARContext earContext, ComponentContextBuilder builder, RefContext refContext, GerGbeanRefType[] gerGbeanRefs, ClassLoader cl) throws DeploymentException {
- if (null == gerGbeanRefs) {
- return;
- }
-
-
- for (int i = 0; i < gerGbeanRefs.length; i++) {
- GerGbeanRefType gerGbeanRef = gerGbeanRefs[i];
- addGBeanRef(earContext, builder, refContext, gerGbeanRef, cl);
- }
- }
-
- private static void addGBeanRef(EARContext earContext, ComponentContextBuilder builder, RefContext refContext, GerGbeanRefType gerGbeanRef, ClassLoader cl) throws DeploymentException{
- GerPatternType[] gbeanLocatorArray = gerGbeanRef.getPatternArray();
-
- String[] interfaceTypesArray = gerGbeanRef.getRefTypeArray();
- Set interfaceTypes = new HashSet(Arrays.asList(interfaceTypesArray));
- Set queries = new HashSet();
- for (int i = 0; i < gbeanLocatorArray.length; i++) {
- GerPatternType patternType = gbeanLocatorArray[i];
- AbstractNameQuery abstractNameQuery = buildAbstractNameQuery(patternType, null, null, interfaceTypes);
- queries.add(abstractNameQuery);
- }
-
- GBeanData gBeanData;
- Configuration configuration = earContext.getConfiguration();
- try {
- gBeanData = configuration.findGBeanData(queries);
- } catch (GBeanNotFoundException e) {
- throw new DeploymentException("Could not resolve reference at deploy time for queries " + queries, e);
- }
-
- if (interfaceTypes.isEmpty()) {
- interfaceTypes.add(gBeanData.getGBeanInfo().getClassName());
- }
- Class gBeanType;
- try {
- gBeanType = ClassLoading.loadClass(gBeanData.getGBeanInfo().getClassName(), cl);
- } catch (ClassNotFoundException e) {
- throw new DeploymentException("Cannot load GBean class", e);
- }
-
- String refName = gerGbeanRef.getRefName();
-
- builder.bind(refName, new GBeanReference(configuration.getId(), queries, gBeanType));
- }
-
- private static Map mapEjbRefs(GerEjbRefType[] refs) {
- Map refMap = new HashMap();
- if (refs != null) {
- for (int i = 0; i < refs.length; i++) {
- GerEjbRefType ref = refs[i];
- refMap.put(ref.getRefName().trim(), ref);
- }
- }
- return refMap;
- }
- private static Map mapEjbLocalRefs(GerEjbLocalRefType[] refs) {
- Map refMap = new HashMap();
- if (refs != null) {
- for (int i = 0; i < refs.length; i++) {
- GerEjbLocalRefType ref = refs[i];
- refMap.put(ref.getRefName().trim(), ref);
- }
- }
- return refMap;
- }
private static Map mapResourceRefs(GerResourceRefType[] refs) {
Map refMap = new HashMap();
@@ -829,29 +122,6 @@
return refMap;
}
- private static Map mapResourceEnvRefs(GerResourceEnvRefType[] refs) {
- Map refMap = new HashMap();
- if (refs != null) {
- for (int i = 0; i < refs.length; i++) {
- GerResourceEnvRefType ref = refs[i];
- refMap.put(ref.getRefName().trim(), ref);
- }
- }
- return refMap;
- }
-
- private static Map mapServiceRefs(GerServiceRefType[] refs) {
- Map refMap = new HashMap();
- if (refs != null) {
- for (int i = 0; i < refs.length; i++) {
- GerServiceRefType ref = refs[i];
- String serviceRefName = ref.getServiceRefName().trim();
- refMap.put(serviceRefName, ref);
- }
- }
- return refMap;
- }
-
public static AbstractNameQuery buildAbstractNameQuery(GerPatternType pattern, String type, String moduleType, Set interfaceTypes) {
String groupId = pattern.isSetGroupId() ? pattern.getGroupId().trim() : null;
String artifactid = pattern.isSetArtifactId() ? pattern.getArtifactId().trim() : null;
@@ -890,6 +160,5 @@
}
return new AbstractNameQuery(configId, nameMap);
}
-
}
Modified: geronimo/server/branches/sachin/modules/geronimo-naming-builder/src/main/schema/geronimo-naming-1.2.xsd
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/geronimo-naming-builder/src/main/schema/geronimo-naming-1.2.xsd?view=diff&rev=442665&r1=442664&r2=442665
==============================================================================
--- geronimo/server/branches/sachin/modules/geronimo-naming-builder/src/main/schema/geronimo-naming-1.2.xsd (original)
+++ geronimo/server/branches/sachin/modules/geronimo-naming-builder/src/main/schema/geronimo-naming-1.2.xsd Tue Sep 12 11:15:24 2006
@@ -36,9 +36,8 @@
</xsd:annotation>
- <xsd:element name="gbean-ref" type="gernaming:gbean-refType"/>
<xsd:element name="ejb-ref" type="gernaming:ejb-refType"/>
- <!-- <xsd:element name="ejb-local-ref" type="gernaming:ejb-local-refType"/>-->
+ <xsd:element name="ejb-local-ref" type="gernaming:ejb-local-refType"/>
<xsd:element name="service-ref" type="gernaming:service-refType"/>
<xsd:element name="resource-ref" type="gernaming:resource-refType"/>
<xsd:element name="resource-env-ref" type="gernaming:resource-env-refType"/>
@@ -55,7 +54,7 @@
</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
- <xsd:element name="gbean-ref" type="gernaming:gbean-refType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element ref="gernaming:abstract-naming-entry" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="ejb-ref" type="gernaming:ejb-refType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="ejb-local-ref" type="gernaming:ejb-local-refType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="service-ref" type="gernaming:service-refType" minOccurs="0" maxOccurs="unbounded"/>
@@ -65,6 +64,13 @@
</xsd:sequence>
</xsd:group>
+ <xsd:element name="abstract-naming-entry" abstract="true" type="gernaming:abstract-naming-entryType"/>
+
+ <xsd:complexType name="abstract-naming-entryType" abstract="true">
+ <xsd:sequence>
+ </xsd:sequence>
+ </xsd:complexType>
+
<!--ejb-link acts like ejb-link in spec descriptors-->
<!--resource-link contains the name of the outbound-connectionfactory-instance -->
<!--message-destination-link acts like message-destination-link in spec descriptors-->
@@ -106,13 +112,53 @@
</xsd:sequence>
</xsd:complexType>
+ <xsd:element name="gbean-ref" type="gernaming:gbean-refType" substitutionGroup="gernaming:abstract-naming-entry"/>
+
<xsd:complexType name="gbean-refType">
+ <xsd:complexContent>
+ <xsd:extension base="gernaming:abstract-naming-entryType">
+ <xsd:sequence>
+ <xsd:element name="ref-name" type="xsd:string"/>
+ <xsd:element name="ref-type" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="pattern" type="gernaming:patternType"/>
+ </xsd:choice>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:element name="persistence-context-ref" type="gernaming:persistence-context-refType"
+ substitutionGroup="gernaming:abstract-naming-entry"/>
+
+ <xsd:complexType name="persistence-context-refType">
+ <xsd:complexContent>
+ <xsd:extension base="gernaming:abstract-naming-entryType">
+ <xsd:sequence>
+ <xsd:element name="persistence-context-ref-name" type="xsd:string"/>
+ <xsd:choice>
+ <xsd:element name="persistence-unit-name" type="xsd:string"/>
+ <xsd:element name="pattern" type="gernaming:patternType"/>
+ </xsd:choice>
+ <xsd:element name="persistence-context-type" type="gernaming:persistence-context-typeType"
+ minOccurs="0"/>
+ <xsd:element name="property" type="gernaming:propertyType" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:simpleType name="persistence-context-typeType">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="transaction-scoped"/>
+ <xsd:enumeration value="extended"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:complexType name="propertyType">
<xsd:sequence>
- <xsd:element name="ref-name" type="xsd:string"/>
- <xsd:element name="ref-type" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
- <xsd:choice minOccurs="0" maxOccurs="unbounded">
- <xsd:element name="pattern" type="gernaming:patternType"/>
- </xsd:choice>
+ <xsd:element name="key" type="xsd:string"/>
+ <xsd:element name="value" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
Modified: geronimo/server/branches/sachin/modules/geronimo-security/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/geronimo-security/pom.xml?view=diff&rev=442665&r1=442664&r2=442665
==============================================================================
--- geronimo/server/branches/sachin/modules/geronimo-security/pom.xml (original)
+++ geronimo/server/branches/sachin/modules/geronimo-security/pom.xml Tue Sep 12 11:15:24 2006
@@ -73,6 +73,15 @@
<artifactId>activeio</artifactId>
</dependency>
+ <!--
+ Required by activeio:activeio
+ -->
+ <dependency>
+ <groupId>concurrent</groupId>
+ <artifactId>concurrent</artifactId>
+ <scope>test</scope>
+ </dependency>
+
<dependency>
<groupId>regexp</groupId>
<artifactId>regexp</artifactId>