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 2004/09/27 02:00:04 UTC
svn commit: rev 47265 - in geronimo/trunk/modules: assembly/src/plan client-builder client-builder/src/java/org/apache/geronimo/client/builder client-builder/src/schema j2ee/src/java/org/apache/geronimo/j2ee/deployment
Author: djencks
Date: Sun Sep 26 17:00:02 2004
New Revision: 47265
Modified:
geronimo/trunk/modules/assembly/src/plan/j2ee-client-plan.xml
geronimo/trunk/modules/assembly/src/plan/j2ee-deployer-plan.xml
geronimo/trunk/modules/client-builder/project.xml
geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
geronimo/trunk/modules/client-builder/src/schema/geronimo-application-client.xsd
geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/deployment/AppClientModule.java
Log:
first, untested, cut at client deployment of resource adapters.
Modified: geronimo/trunk/modules/assembly/src/plan/j2ee-client-plan.xml
==============================================================================
--- geronimo/trunk/modules/assembly/src/plan/j2ee-client-plan.xml (original)
+++ geronimo/trunk/modules/assembly/src/plan/j2ee-client-plan.xml Sun Sep 26 17:00:02 2004
@@ -46,8 +46,54 @@
<uri>openejb/jars/openejb-core-${openejb_version}.jar</uri>
</dependency>
+ <!-- client side connector support -->
+ <dependency>
+ <uri>geronimo/jars/geronimo-core-${geronimo_version}.jar</uri>
+ </dependency>
+ <dependency>
+ <uri>geronimo/jars/geronimo-connector-${geronimo_version}.jar</uri>
+ </dependency>
+ <dependency>
+ <uri>concurrent/jars/concurrent-${concurrent_version}.jar</uri>
+ </dependency>
+ <dependency>
+ <uri>geronimo/jars/geronimo-transaction-${geronimo_version}.jar</uri>
+ </dependency>
+ <dependency>
+ <uri>tranql/jars/tranql-${tranql_version}.jar</uri>
+ </dependency>
+
<gbean name="geronimo.client:type=JNDIContext" class="org.openejb.client.AppClientJNDIContext">
<attribute name="host" type="java.lang.String">localhost</attribute>
<attribute name="port" type="int">4201</attribute>
</gbean>
+
+ <!--client connector support-->
+ <gbean name="geronimo.client:type=ThreadPool,name=DefaultThreadPool" class="org.apache.geronimo.pool.ThreadPool">
+ <attribute name="keepAliveTime" type="long">5000</attribute>
+ <attribute name="poolSize" type="int">10</attribute>
+ <attribute name="poolName" type="java.lang.String">DefaultThreadPool</attribute>
+ </gbean>
+
+ <gbean name="geronimo.client:type=ConnectionTracker" class="org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinator">
+ </gbean>
+
+ <gbean name="geronimo.client:type=WorkManager,name=DefaultWorkManager" class="org.apache.geronimo.connector.work.GeronimoWorkManager">
+ <attribute name="syncMaximumPoolSize" type="int">10</attribute>
+ <attribute name="startMaximumPoolSize" type="int">10</attribute>
+ <attribute name="scheduledMaximumPoolSize" type="int">10</attribute>
+ <reference name="XAServices">geronimo.client:type=TransactionManager</reference>
+ </gbean>
+
+ <gbean name="geronimo.client:type=TransactionManager" class="org.apache.geronimo.transaction.GeronimoTransactionManager">
+ <references name="ResourceManagers">
+ <pattern>geronimo.client:j2eeType=JCAManagedConnectionFactory,*</pattern>
+ <pattern>geronimo.client:j2eeType=ActivationSpec,*</pattern>
+ </references>
+ </gbean>
+
+ <gbean name="geronimo.client:type=TransactionContextManager" class="org.apache.geronimo.transaction.context.TransactionContextManager">
+ <reference name="TransactionManager">geronimo.client:type=TransactionManager</reference>
+ </gbean>
+
</configuration>
Modified: geronimo/trunk/modules/assembly/src/plan/j2ee-deployer-plan.xml
==============================================================================
--- geronimo/trunk/modules/assembly/src/plan/j2ee-deployer-plan.xml (original)
+++ geronimo/trunk/modules/assembly/src/plan/j2ee-deployer-plan.xml Sun Sep 26 17:00:02 2004
@@ -109,8 +109,11 @@
<gbean name="geronimo.deployer:role=ModuleBuilder,type=Connector,config=org/apache/geronimo/J2EEDeployer" class="org.apache.geronimo.connector.deployment.ConnectorModuleBuilder"/>
<gbean name="geronimo.deployer:role=ModuleBuilder,type=AppClient,config=org/apache/geronimo/J2EEDeployer" class="org.apache.geronimo.client.builder.AppClientModuleBuilder">
- <reference name="Repository">*:role=Repository,*</reference>
+ <attribute name="transactionContextManagerObjectName" type="javax.management.ObjectName">geronimo.client:type=TransactionContextManager</attribute>
+ <attribute name="connectionTrackerObjectName" type="javax.management.ObjectName">geronimo.client:type=ConnectionTracker</attribute>
+ <reference name="ConnectorModuleBuilder">geronimo.deployer:role=ModuleBuilder,type=Connector,config=org/apache/geronimo/J2EEDeployer</reference>
<reference name="Store">geronimo.deployment:role=ConfigurationStore,type=Local</reference>
+ <reference name="Repository">*:role=Repository,*</reference>
</gbean>
</configuration>
Modified: geronimo/trunk/modules/client-builder/project.xml
==============================================================================
--- geronimo/trunk/modules/client-builder/project.xml (original)
+++ geronimo/trunk/modules/client-builder/project.xml Sun Sep 26 17:00:02 2004
@@ -70,6 +70,12 @@
<dependency>
<groupId>geronimo</groupId>
+ <artifactId>geronimo-connector</artifactId>
+ <version>${pom.currentVersion}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>geronimo</groupId>
<artifactId>geronimo-core</artifactId>
<version>${pom.currentVersion}</version>
</dependency>
Modified: geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
==============================================================================
--- geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java (original)
+++ geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java Sun Sep 26 17:00:02 2004
@@ -23,8 +23,10 @@
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import java.util.jar.Attributes;
@@ -34,12 +36,12 @@
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
-import org.apache.geronimo.deployment.DeploymentContext;
import org.apache.geronimo.deployment.DeploymentException;
import org.apache.geronimo.deployment.service.GBeanHelper;
import org.apache.geronimo.deployment.util.FileUtil;
import org.apache.geronimo.deployment.util.IOUtil;
import org.apache.geronimo.deployment.util.JarUtil;
+import org.apache.geronimo.deployment.util.NestedJarFile;
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.GBeanInfoFactory;
import org.apache.geronimo.gbean.jmx.GBeanMBean;
@@ -59,6 +61,7 @@
import org.apache.geronimo.xbeans.geronimo.client.GerApplicationClientType;
import org.apache.geronimo.xbeans.geronimo.client.GerDependencyType;
import org.apache.geronimo.xbeans.geronimo.client.GerGbeanType;
+import org.apache.geronimo.xbeans.geronimo.client.GerResourceType;
import org.apache.geronimo.xbeans.geronimo.naming.GerRemoteRefType;
import org.apache.geronimo.xbeans.j2ee.ApplicationClientDocument;
import org.apache.geronimo.xbeans.j2ee.ApplicationClientType;
@@ -76,11 +79,20 @@
private final ConfigurationStore store;
private static final URI PARENT_ID = URI.create("org/apache/geronimo/Client");
+ private final String clientDomainName = "geronimo.client";
+ private final String clientServerName = "client";
+ private final String clientApplicationName = "client-application";
+ private final ObjectName transactionContextManagerObjectName;
+ private final ObjectName connectionTrackerObjectName;
+ private final ModuleBuilder connectorModuleBuilder;
- public AppClientModuleBuilder(Kernel kernel, Repository repository, ConfigurationStore store) {
+ public AppClientModuleBuilder(ObjectName transactionContextManagerObjectName, ObjectName connectionTrackerObjectName, ModuleBuilder connectorModuleBuilder, ConfigurationStore store, Repository repository, Kernel kernel) {
this.kernel = kernel;
this.repository = repository;
this.store = store;
+ this.transactionContextManagerObjectName = transactionContextManagerObjectName;
+ this.connectionTrackerObjectName = connectionTrackerObjectName;
+ this.connectorModuleBuilder = connectorModuleBuilder;
}
public Module createModule(String name, Object plan, JarFile moduleFile, URL appClientXmlUrl, String targetPath) throws DeploymentException {
@@ -197,9 +209,10 @@
} catch (IOException e) {
throw new DeploymentException("Unable to copy app client module jar into configuration: " + moduleFile.getName());
}
+ ((AppClientModule)module).setEarFile(earFile);
}
- public void initContext(EARContext earContext, Module webModule, ClassLoader cl) {
+ public void initContext(EARContext earContext, Module clientModule, ClassLoader cl) {
// application clients do not add anything to the shared context
}
@@ -255,7 +268,7 @@
earContext.addGBean(appClientModuleName, appClientModuleGBean);
// create another child configuration within the config store for the client application
- DeploymentContext appClientDeploymentContext = null;
+ EARContext appClientDeploymentContext = null;
File appClientConfiguration = null;
try {
appClientConfiguration = FileUtil.createTempFile();
@@ -264,12 +277,23 @@
// construct the app client deployment context... this is the same class used by the ear context
try {
URI configId = URI.create(geronimoAppClient.getConfigId());
- appClientDeploymentContext = new DeploymentContext(jos, configId, ConfigurationModuleType.APP_CLIENT, PARENT_ID, kernel);
+ appClientDeploymentContext = new EARContext(jos,
+ configId,
+ ConfigurationModuleType.APP_CLIENT, PARENT_ID,
+ kernel,
+ clientDomainName,
+ clientServerName,
+ clientApplicationName,
+ transactionContextManagerObjectName,
+ connectionTrackerObjectName,
+ null,
+ null,
+ null);//not sure if EJBReferenceBuilder should be used for this.
} catch (Exception e) {
throw new DeploymentException("Could not create a deployment context for the app client", e);
}
- // extract the ejbJar file into a standalone packed jar file and add the contents to the output
+ // extract the client Jar file into a standalone packed jar file and add the contents to the output
File appClientJarFile = JarUtil.extractToPackedJar(moduleFile);
appClientDeploymentContext.addInclude(URI.create(module.getTargetPath()), appClientJarFile.toURL());
@@ -312,6 +336,41 @@
for (int i = 0; i < gbeans.length; i++) {
GBeanHelper.addGbean(new AppClientGBeanAdapter(gbeans[i]), appClientClassLoader, appClientDeploymentContext);
}
+ //deploy the resource adapters specified in the geronimo-application.xml
+ Collection resourceModules = appClientModule.getResourceModules();
+ GerResourceType[] resources = geronimoAppClient.getResourceArray();
+ for (int i = 0; i < resources.length; i++) {
+ GerResourceType resource = resources[i];
+ String path;
+ JarFile connectorFile;
+ if (resource.isSetExternalRar()) {
+ path = resource.getExternalRar();
+ URI pathURI = new URI(path);
+ if (!repository.hasURI(pathURI)) {
+ throw new DeploymentException("Missing rar in repository: " + path);
+ }
+ URL pathURL = repository.getURL(pathURI);
+ connectorFile = new JarFile(pathURL.getFile());
+ } else {
+ path = resource.getInternalRar();
+ connectorFile = new NestedJarFile(appClientModule.getEarFile(), path);
+ }
+ XmlObject connectorPlan = resource.getConnector();
+ Module connectorModule = connectorModuleBuilder.createModule(path, connectorPlan, connectorFile, null, path);
+ resourceModules.add(connectorModule);
+ connectorModuleBuilder.installModule(connectorFile, appClientDeploymentContext, connectorModule);
+ }
+ ClassLoader cl = appClientDeploymentContext.getClassLoader(repository);
+ for (Iterator iterator = resourceModules.iterator(); iterator.hasNext();) {
+ Module connectorModule = (Module) iterator.next();
+ connectorModuleBuilder.initContext(appClientDeploymentContext, connectorModule, cl);
+ }
+
+ for (Iterator iterator = resourceModules.iterator(); iterator.hasNext();) {
+ Module connectorModule = (Module) iterator.next();
+ connectorModuleBuilder.addGBeans(appClientDeploymentContext, connectorModule, cl);
+ }
+
}
// finally add the app client container
@@ -396,11 +455,17 @@
static {
GBeanInfoFactory infoFactory = new GBeanInfoFactory(AppClientModuleBuilder.class);
- infoFactory.addAttribute("kernel", Kernel.class, false);
- infoFactory.addReference("Repository", Repository.class);
+ infoFactory.addAttribute("transactionContextManagerObjectName", ObjectName.class, true);
+ infoFactory.addAttribute("connectionTrackerObjectName", ObjectName.class, true);
+ infoFactory.addReference("ConnectorModuleBuilder", ModuleBuilder.class);
infoFactory.addReference("Store", ConfigurationStore.class);
- infoFactory.setConstructor(new String[] {"kernel", "Repository", "Store"});
+ infoFactory.addReference("Repository", Repository.class);
+
+ infoFactory.addAttribute("kernel", Kernel.class, false);
+
infoFactory.addInterface(ModuleBuilder.class);
+
+ infoFactory.setConstructor(new String[] {"transactionContextManagerObjectName", "connectionTrackerObjectName", "ConnectorModuleBuilder", "Store", "Repository", "kernel"});
GBEAN_INFO = infoFactory.getBeanInfo();
}
Modified: geronimo/trunk/modules/client-builder/src/schema/geronimo-application-client.xsd
==============================================================================
--- geronimo/trunk/modules/client-builder/src/schema/geronimo-application-client.xsd (original)
+++ geronimo/trunk/modules/client-builder/src/schema/geronimo-application-client.xsd Sun Sep 26 17:00:02 2004
@@ -20,12 +20,14 @@
xmlns:geronimo="http://geronimo.apache.org/xml/ns/j2ee/application-client"
targetNamespace="http://geronimo.apache.org/xml/ns/j2ee/application-client"
xmlns:naming="http://geronimo.apache.org/xml/ns/naming"
+ xmlns:connector="http://geronimo.apache.org/xml/ns/j2ee/connector"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
version="1.0">
<xs:import namespace="http://geronimo.apache.org/xml/ns/naming" schemaLocation="../../../naming/src/schema/geronimo-naming.xsd"/>
+ <xs:import namespace="http://geronimo.apache.org/xml/ns/j2ee/connector" schemaLocation="../../../connector/src/schema/geronimo-connector_1_5.xsd"/>
<!--xs:include schemaLocation="../../../naming/src/schema/geronimo-naming.xsd"/-->
<xs:include schemaLocation="../../../deployment/src/schema/geronimo-common.xsd"/>
@@ -42,24 +44,24 @@
<!-- minOccurs="0"/>-->
<xs:group ref="naming:jndiEnvironmentRefsGroup"/>
- <!--xs:element name="ejb-ref"
- type="geronimo:remote-refType"
- minOccurs="0" maxOccurs="unbounded"/>
- <xs:element name="resource-ref"
- type="geronimo:local-refType"
- minOccurs="0" maxOccurs="unbounded"/>
- <xs:element name="resource-env-ref"
- type="geronimo:local-refType"
- minOccurs="0" maxOccurs="unbounded"/>
- <xs:element name="message-destination-ref"
- type="geronimo:remote-refType"
- minOccurs="0" maxOccurs="unbounded"/-->
+
+ <xs:element name="resource" type="geronimo:resourceType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="gbean" type="geronimo:gbeanType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="configId" type="xs:string" use="required"/>
<xs:attribute name="parentId" type="xs:string" use="optional"/>
+ </xs:complexType>
+
+ <xs:complexType name="resourceType">
+ <xs:sequence>
+ <xs:choice>
+ <xs:element name="external-rar" type="xs:string"/>
+ <xs:element name="internal-rar" type="xs:string"/>
+ </xs:choice>
+ <xs:element name="connector" type="connector:connectorType"/>
+ </xs:sequence>
</xs:complexType>
Modified: geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/deployment/AppClientModule.java
==============================================================================
--- geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/deployment/AppClientModule.java (original)
+++ geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/deployment/AppClientModule.java Sun Sep 26 17:00:02 2004
@@ -17,6 +17,9 @@
package org.apache.geronimo.j2ee.deployment;
import java.util.jar.JarFile;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Collection;
import java.net.URI;
import org.apache.xmlbeans.XmlObject;
@@ -26,12 +29,29 @@
* @version $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $
*/
public class AppClientModule extends Module {
+
+ private final Collection resourceModules = new HashSet();
+
+ private JarFile earFile;
+
public AppClientModule(String name, URI configId, URI parentId, URI moduleURI, JarFile moduleFile, String targetPath, XmlObject specDD, XmlObject vendorDD, String originalSpecDD) {
super(name, configId, parentId, moduleURI, moduleFile, targetPath, specDD, vendorDD, originalSpecDD);
}
public ConfigurationModuleType getType() {
return ConfigurationModuleType.APP_CLIENT;
+ }
+
+ public JarFile getEarFile() {
+ return earFile;
+ }
+
+ public void setEarFile(JarFile earFile) {
+ this.earFile = earFile;
+ }
+
+ public Collection getResourceModules() {
+ return resourceModules;
}
}