Author: dain Date: Thu Sep 16 17:02:47 2004 New Revision: 46221 Added: geronimo/trunk/modules/client/ geronimo/trunk/modules/client-builder/ geronimo/trunk/modules/client-builder/LICENSE.txt geronimo/trunk/modules/client-builder/NOTICE.txt geronimo/trunk/modules/client-builder/locator.ent geronimo/trunk/modules/client-builder/maven.xml geronimo/trunk/modules/client-builder/project.properties geronimo/trunk/modules/client-builder/project.xml geronimo/trunk/modules/client-builder/src/ geronimo/trunk/modules/client-builder/src/java/ geronimo/trunk/modules/client-builder/src/java/org/ geronimo/trunk/modules/client-builder/src/java/org/apache/ geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/ geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/ geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/ geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientGBeanAdapter.java 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/AppClientRefAdapter.java geronimo/trunk/modules/client-builder/src/schema/ geronimo/trunk/modules/client-builder/src/schema/geronimo-application-client.xsd geronimo/trunk/modules/client-builder/src/schema/xmlconfig.xml geronimo/trunk/modules/client/LICENSE.txt geronimo/trunk/modules/client/NOTICE.txt geronimo/trunk/modules/client/locator.ent geronimo/trunk/modules/client/project.properties geronimo/trunk/modules/client/project.xml geronimo/trunk/modules/client/src/ geronimo/trunk/modules/client/src/java/ geronimo/trunk/modules/client/src/java/org/ geronimo/trunk/modules/client/src/java/org/apache/ geronimo/trunk/modules/client/src/java/org/apache/geronimo/ geronimo/trunk/modules/client/src/java/org/apache/geronimo/client/ geronimo/trunk/modules/client/src/java/org/apache/geronimo/client/AppClientContainer.java geronimo/trunk/modules/client/src/java/org/apache/geronimo/client/AppClientInitializationException.java geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/deployment/AppClientModule.java Modified: geronimo/trunk/modules/j2ee-schema/src/java/org/apache/geronimo/schema/SchemaConversionUtils.java Log: http://nagoya.apache.org/jira/browse/GERONIMO-213
Added stubbed out deployer and AppClientContainerGBean Added: geronimo/trunk/modules/client-builder/LICENSE.txt ============================================================================== --- (empty file) +++ geronimo/trunk/modules/client-builder/LICENSE.txt Thu Sep 16 17:02:47 2004 @@ -0,0 +1,203 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + Added: geronimo/trunk/modules/client-builder/NOTICE.txt ============================================================================== --- (empty file) +++ geronimo/trunk/modules/client-builder/NOTICE.txt Thu Sep 16 17:02:47 2004 @@ -0,0 +1,3 @@ +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). + Added: geronimo/trunk/modules/client-builder/locator.ent ============================================================================== --- (empty file) +++ geronimo/trunk/modules/client-builder/locator.ent Thu Sep 16 17:02:47 2004 @@ -0,0 +1,3 @@ +<!ENTITY % versions SYSTEM "file:../../etc/version-info.ent"> + + Added: geronimo/trunk/modules/client-builder/maven.xml ============================================================================== --- (empty file) +++ geronimo/trunk/modules/client-builder/maven.xml Thu Sep 16 17:02:47 2004 @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!-- + + Copyright 2004 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + + +<!-- $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $ --> + +<project default="default" + xmlns:j="jelly:core" + xmlns:ant="jelly:ant" + xmlns:maven="jelly:maven" + xmlns:xmlbeans="geronimo:xmlbeans"> + + <preGoal name="java:compile"> + <xmlbeans:schema2java + sourcedir="${basedir}/src" + sourceschema="schema/geronimo-application-client.xsd" + xmlconfigs="${basedir}/src/schema/xmlconfig.xml" + targetdir="${basedir}/target/xmlbeans" + cataloglocation="${basedir}/../j2ee-schema/src/catalog/resolver-catalog.xml"/> + </preGoal> +</project> Added: geronimo/trunk/modules/client-builder/project.properties ============================================================================== --- (empty file) +++ geronimo/trunk/modules/client-builder/project.properties Thu Sep 16 17:02:47 2004 @@ -0,0 +1,5 @@ +## +## $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $ +## + +maven.repo.remote=http://www.openejb.org/maven, http://www.ibiblio.org/maven Added: geronimo/trunk/modules/client-builder/project.xml ============================================================================== --- (empty file) +++ geronimo/trunk/modules/client-builder/project.xml Thu Sep 16 17:02:47 2004 @@ -0,0 +1,168 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!-- + + Copyright 2003-2004 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<!DOCTYPE project [ +<!ENTITY % locator SYSTEM "file:locator.ent"> +%locator; +%versions; +]> + +<!-- $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $ --> + +<project> + <pomVersion>3</pomVersion> + <extend>${basedir}/../../etc/project.xml</extend> + + <!-- ===================== --> + <!-- Module Identification --> + <!-- ===================== --> + + <name>Geronimo :: Client Builder</name> + <id>geronimo-client-builder</id> + <shortDescription>Geronimo Client Builder</shortDescription> + <description>Geronimo Client Builder</description> + <url>http://incubator.apache.org/projects/geronimo/client-builder/</url> + <siteDirectory>/www/incubator.apache.org/projects/geronimo/client-builder</siteDirectory> + <distributionDirectory>/www/incubator.apache.org/projects/geronimo/builds/client-builder</distributionDirectory> + + <package>org.apache.geronimo.client.builder</package> + + <!-- ============ --> + <!-- Dependencies --> + <!-- ============ --> + + <dependencies> + <dependency> + <groupId>geronimo</groupId> + <artifactId>geronimo-xmlbeans-plugin</artifactId> + <version>${pom.currentVersion}</version> + <type>plugin</type> + </dependency> + + <!-- needed for xmlbeans runtime--> + <dependency> + <groupId>xmlbeans</groupId> + <artifactId>xbean-apache</artifactId> + <version>&xmlbeans-version;</version> + </dependency> + + <!-- Module Dependencies --> + <dependency> + <groupId>geronimo</groupId> + <artifactId>geronimo-common</artifactId> + <version>${pom.currentVersion}</version> + </dependency> + + <dependency> + <groupId>geronimo</groupId> + <artifactId>geronimo-core</artifactId> + <version>${pom.currentVersion}</version> + </dependency> + + <dependency> + <groupId>geronimo</groupId> + <artifactId>geronimo-deployment</artifactId> + <version>${pom.currentVersion}</version> + </dependency> + + <dependency> + <groupId>geronimo</groupId> + <artifactId>geronimo-j2ee</artifactId> + <version>${pom.currentVersion}</version> + </dependency> + + <dependency> + <groupId>geronimo</groupId> + <artifactId>geronimo-j2ee-schema</artifactId> + <version>${pom.currentVersion}</version> + </dependency> + + <dependency> + <groupId>geronimo</groupId> + <artifactId>geronimo-kernel</artifactId> + <version>${pom.currentVersion}</version> + </dependency> + + <dependency> + <groupId>geronimo</groupId> + <artifactId>geronimo-naming</artifactId> + <version>${pom.currentVersion}</version> + </dependency> + + <dependency> + <groupId>geronimo</groupId> + <artifactId>geronimo-transaction</artifactId> + <version>${pom.currentVersion}</version> + </dependency> + + <dependency> + <groupId>geronimo-spec</groupId> + <artifactId>geronimo-spec-j2ee</artifactId> + <version>&geronimo-spec-j2ee-version;</version> + </dependency> + + <!-- Thirdparty --> + + <dependency> + <groupId>cglib</groupId> + <artifactId>cglib-full</artifactId> + <version>&cglib-version;</version> + <url>http://cglib.sf.net/</url> + </dependency> + + <dependency> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + <version>&commons-logging-version;</version> + <url>http://jakarta.apache.org/commons/logging/</url> + </dependency> + + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <version>&log4j-version;</version> + <url>http://jakarta.apache.org/log4j</url> + </dependency> + + <dependency> + <groupId>mx4j</groupId> + <artifactId>mx4j</artifactId> + <version>&mx4j-version;</version> + </dependency> + </dependencies> + + <build> + <resources> + <resource> + <directory>${basedir}/src/java</directory> + <includes> + <include>**/*.xml</include> + <include>**/*.properties</include> + </includes> + </resource> + </resources> + <unitTest> + <includes> + <include>**/*Test.java</include> + </includes> + <excludes> + <exclude>**/Abstract*.java</exclude> + </excludes> + </unitTest> + </build> +</project> Added: geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientGBeanAdapter.java ============================================================================== --- (empty file) +++ geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientGBeanAdapter.java Thu Sep 16 17:02:47 2004 @@ -0,0 +1,80 @@ +/** + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.geronimo.client.builder; + +import org.apache.geronimo.deployment.service.GBeanAdapter; +import org.apache.geronimo.xbeans.geronimo.client.GerGbeanType; + +/** + * @version $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $ + */ +public class AppClientGBeanAdapter implements GBeanAdapter { + + private final GerGbeanType gbean; + + public AppClientGBeanAdapter(GerGbeanType gbean) { + this.gbean = gbean; + } + + public String getName() { + return gbean.getName(); + } + + public String getClass1() { + return gbean.getClass1(); + } + + public int getAttributeCount() { + return gbean.getAttributeArray().length; + } + + public String getAttributeName(int i) { + return gbean.getAttributeArray(i).getName(); + } + + public String getAttributeType(int i) { + return gbean.getAttributeArray(i).getType(); + } + + public String getAttributeStringValue(int i) { + return gbean.getAttributeArray(i).getStringValue(); + } + + public int getReferenceCount() { + return gbean.getReferenceArray().length; + } + + public String getReferenceName(int i) { + return gbean.getReferenceArray(i).getName(); + } + + public String getReferenceStringValue(int i) { + return gbean.getReferenceArray(i).getStringValue(); + } + + public int getReferencesCount() { + return gbean.getReferencesArray().length; + } + + public String getReferencesName(int i) { + return gbean.getReferencesArray(i).getName(); + } + + public String[] getReferencesPatternArray(int i) { + return gbean.getReferencesArray(i).getPatternArray(); + } +} Added: geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java ============================================================================== --- (empty file) +++ geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java Thu Sep 16 17:02:47 2004 @@ -0,0 +1,539 @@ +/** + * + * Copyright 2003-2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.geronimo.client.builder; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; +import java.util.ArrayList; +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.JarEntry; +import java.util.jar.JarFile; +import java.util.jar.JarInputStream; +import java.util.zip.ZipEntry; +import javax.management.MalformedObjectNameException; +import javax.management.ObjectName; +import javax.transaction.UserTransaction; + +import org.apache.geronimo.common.xml.XmlBeansUtil; +import org.apache.geronimo.deployment.DeploymentException; +import org.apache.geronimo.deployment.service.GBeanHelper; +import org.apache.geronimo.deployment.util.FileUtil; +import org.apache.geronimo.gbean.GBeanInfo; +import org.apache.geronimo.gbean.GBeanInfoFactory; +import org.apache.geronimo.j2ee.deployment.AppClientModule; +import org.apache.geronimo.j2ee.deployment.EARContext; +import org.apache.geronimo.j2ee.deployment.Module; +import org.apache.geronimo.j2ee.deployment.ModuleBuilder; +import org.apache.geronimo.naming.deployment.ENCConfigBuilder; +import org.apache.geronimo.naming.java.ReadOnlyContext; +import org.apache.geronimo.schema.SchemaConversionUtils; +import org.apache.geronimo.transaction.UserTransactionImpl; +import org.apache.geronimo.xbeans.geronimo.client.GerApplicationClientDocument; +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.GerRemoteRefType; +import org.apache.geronimo.xbeans.j2ee.ApplicationClientDocument; +import org.apache.geronimo.xbeans.j2ee.ApplicationClientType; +import org.apache.geronimo.xbeans.j2ee.EjbLocalRefType; +import org.apache.xmlbeans.SchemaTypeLoader; +import org.apache.xmlbeans.XmlBeans; +import org.apache.xmlbeans.XmlException; +import org.apache.xmlbeans.XmlObject; + + +/** + * @version $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $ + */ +public class AppClientModuleBuilder implements ModuleBuilder { + static final SchemaTypeLoader SCHEMA_TYPE_LOADER = XmlBeans.typeLoaderUnion(new SchemaTypeLoader[]{ + XmlBeans.typeLoaderForClassLoader(org.apache.geronimo.xbeans.j2ee.String.class.getClassLoader()), + XmlBeans.typeLoaderForClassLoader(GerApplicationClientDocument.class.getClassLoader()) + }); + + private static final String PARENT_ID = "org/apache/geronimo/Server"; + + public XmlObject getDeploymentPlan(URL module) throws XmlException { + try { + URL moduleBase; + if (module.toString().endsWith("/")) { + moduleBase = module; + } else { + moduleBase = new URL("jar:" + module.toString() + "!/"); + } + GerApplicationClientDocument plan = (GerApplicationClientDocument) XmlBeansUtil.getXmlObject(new URL(moduleBase, "META-INF/geronimo-application-client.xml"), GerApplicationClientDocument.type); + if (plan == null) { + return createDefaultPlan(moduleBase); + } + return plan; + } catch (MalformedURLException e) { + return null; + } + } + + private GerApplicationClientDocument createDefaultPlan(URL moduleBase) throws XmlException { + // load the application-client.xml + URL appClientXmlUrl = null; + try { + appClientXmlUrl = new URL(moduleBase, "META-INF/application-client.xml"); + } catch (MalformedURLException e) { + return null; + } + ApplicationClientDocument appClientDoc = null; + try { + InputStream ddInputStream = appClientXmlUrl.openStream(); + appClientDoc = getAppClientDocument(ddInputStream); + } catch (IOException e) { + return null; + } catch (DeploymentException e) { + return null; + } + if (appClientDoc == null) { + return null; + } + + ApplicationClientType appClient = appClientDoc.getApplicationClient(); + String id = appClient.getId(); + if (id == null) { + id = moduleBase.getFile(); + if (id.endsWith("!/")) { + id = id.substring(0, id.length() - 2); + } + if (id.endsWith(".jar")) { + id = id.substring(0, id.length() - 4); + } + if (id.endsWith("/")) { + id = id.substring(0, id.length() - 1); + } + id = id.substring(id.lastIndexOf('/') + 1); + } + return newGerApplicationClientDocument(appClient, id); + } + + private GerApplicationClientDocument newGerApplicationClientDocument(ApplicationClientType appClient, String id) { + // construct the empty geronimo-jetty.xml + GerApplicationClientDocument geronimoAppClientDoc = GerApplicationClientDocument.Factory.newInstance(); + GerApplicationClientType geronimoAppClient = geronimoAppClientDoc.addNewApplicationClient(); + + // set the parentId, configId and context root + geronimoAppClient.setParentId(PARENT_ID); + if (null != appClient.getId()) { + id = appClient.getId(); + } + geronimoAppClient.setConfigId(id); + return geronimoAppClientDoc; + } + + public boolean canHandlePlan(XmlObject plan) { + return plan instanceof GerApplicationClientDocument; + } + + public URI getParentId(XmlObject plan) throws DeploymentException { + GerApplicationClientType geronimoAppClient = ((GerApplicationClientDocument) plan).getApplicationClient(); + try { + return new URI(geronimoAppClient.getParentId()); + } catch (URISyntaxException e) { + throw new DeploymentException("Invalid parentId " + geronimoAppClient.getParentId(), e); + } + } + + public URI getConfigId(XmlObject plan) throws DeploymentException { + GerApplicationClientType geronimoAppClient = ((GerApplicationClientDocument) plan).getApplicationClient(); + try { + return new URI(geronimoAppClient.getConfigId()); + } catch (URISyntaxException e) { + throw new DeploymentException("Invalid configId " + geronimoAppClient.getConfigId(), e); + } + } + + public Module createModule(String name, XmlObject plan) throws DeploymentException { + GerApplicationClientType geronimoAppClient = ((GerApplicationClientDocument) plan).getApplicationClient(); + AppClientModule module = new AppClientModule(name, URI.create("/")); + module.setVendorDD(geronimoAppClient); + return module; + } + + public void installModule(File earFolder, EARContext earContext, Module appClientModule) throws DeploymentException { + File appClientFolder = new File(earFolder, appClientModule.getURI().toString()); + + InstallCallback callback; + if (appClientFolder.isDirectory()) { + callback = new UnPackedInstallCallback(appClientModule, appClientFolder); + } else { + JarFile appClientFile; + try { + appClientFile = new JarFile(appClientFolder); + } catch (IOException e) { + throw new DeploymentException("Can not create application File file " + appClientFolder, e); + } + callback = new PackedInstallCallback(appClientModule, appClientFile); + } + installModule(callback, earContext, appClientModule); + } + + public void installModule(JarFile earFile, EARContext earContext, Module appClientModule) throws DeploymentException { + JarFile appClientFile; + try { + if (!appClientModule.getURI().equals(URI.create("/"))) { + ZipEntry appClientEntry = earFile.getEntry(appClientModule.getURI().toString()); + if (null == appClientEntry) { + throw new DeploymentException("Can not find application client file " + appClientModule.getURI()); + } + // Unpack the nested JAR + File tempFile = FileUtil.toTempFile(earFile.getInputStream(appClientEntry)); + appClientFile = new JarFile(tempFile); + } else { + appClientFile = earFile; + } + } catch (IOException e) { + throw new DeploymentException("Problem deploying applicaiton client", e); + } + InstallCallback callback = new PackedInstallCallback(appClientModule, appClientFile); + installModule(callback, earContext, appClientModule); + } + + private void installModule(InstallCallback callback, EARContext earContext, Module appClientModule) throws DeploymentException { + URI moduleBase; + if (!appClientModule.getURI().equals(URI.create("/"))) { + moduleBase = URI.create(appClientModule.getURI() + "/"); + } else { + moduleBase = URI.create("war/"); + } + try { + // load the application-client.xml file + ApplicationClientType appClient; + try { + // todo what is this install callback stuff + InputStream ddInputStream = callback.getWebDD(); + appClient = getAppClientDocument(ddInputStream).getApplicationClient(); + appClientModule.setSpecDD(appClient); + } catch (XmlException e) { + throw new DeploymentException("Unable to parse " + + (null == appClientModule.getAltSpecDD() ? + "WEB-INF/web.xml" : + appClientModule.getAltSpecDD().toString()), e); + } + + // load the geronimo-application-client.xml file + GerApplicationClientType geronimoAppClient = (GerApplicationClientType) appClientModule.getVendorDD(); + if (geronimoAppClient == null) { + try { + // todo what is this install callback stuff + InputStream geronimoAppClientDDInputStream = callback.getGeronimoJettyDD(); + GerApplicationClientDocument geronimoAppClientDoc; + if (geronimoAppClientDDInputStream != null) { + geronimoAppClientDoc = (GerApplicationClientDocument) XmlBeansUtil.parse(geronimoAppClientDDInputStream, GerApplicationClientDocument.type); + } else { + geronimoAppClientDoc = newGerApplicationClientDocument(appClient, moduleBase.toString()); + } + geronimoAppClient = geronimoAppClientDoc.getApplicationClient(); + appClientModule.setVendorDD(geronimoAppClient); + } catch (XmlException e) { + throw new DeploymentException("Unable to parse " + + (null == appClientModule.getAltVendorDD() ? + "WEB-INF/geronimo-jetty.xml" : + appClientModule.getAltVendorDD().toString()), e); + } + } + + // add the applicationClient's content to the configuration + callback.installInEARContext(earContext, moduleBase); + + // add the dependencies declared in the geronimo-jetty.xml file + GerDependencyType[] dependencies = geronimoAppClient.getDependencyArray(); + for (int i = 0; i < dependencies.length; i++) { + earContext.addDependency(getDependencyURI(dependencies[i])); + } + } catch (IOException e) { + throw new DeploymentException("Problem deploying war", e); + } + } + + public void initContext(EARContext earContext, Module webModule, ClassLoader cl) { + // application clients do not add anything to the shared context + } + + public void addGBeans(EARContext earContext, Module module, ClassLoader cl) throws DeploymentException { + AppClientModule appClientModule = (AppClientModule) module; + + ApplicationClientType appClient = (ApplicationClientType) appClientModule.getSpecDD(); + GerApplicationClientType geronimoAppClient = (GerApplicationClientType) appClientModule.getVendorDD(); + + if (geronimoAppClient != null) { + GerGbeanType[] gbeans = geronimoAppClient.getGbeanArray(); + for (int i = 0; i < gbeans.length; i++) { + GBeanHelper.addGbean(new AppClientGBeanAdapter(gbeans[i]), cl, earContext); + } + } + + URI configID = earContext.getConfigID(); + + Properties nameProps = new Properties(); + nameProps.put("J2EEServer", earContext.getJ2EEServerName()); + nameProps.put("J2EEApplication", earContext.getJ2EEApplicationName()); + nameProps.put("j2eeType", "AppClientModule"); + nameProps.put("name", appClientModule.getName()); + ObjectName name; + try { + name = new ObjectName(earContext.getJ2EEDomainName(), nameProps); + } catch (MalformedObjectNameException e) { + throw new DeploymentException("Unable to construct ObjectName", e); + } + + UserTransaction userTransaction = new UserTransactionImpl(); + ReadOnlyContext compContext = buildComponentContext(earContext, appClientModule, appClient, geronimoAppClient, userTransaction, cl); + + // todo install the appclient gbean here + } + + public SchemaTypeLoader getSchemaTypeLoader() { + return SCHEMA_TYPE_LOADER; + } + + private ApplicationClientDocument getAppClientDocument(InputStream ddInputStream) throws XmlException, DeploymentException { + XmlObject dd; + try { + dd = SchemaConversionUtils.parse(ddInputStream); + } catch (IOException e) { + throw new DeploymentException(e); + } + ApplicationClientDocument applicationClientDoc = SchemaConversionUtils.convertToApplicationClientSchema(dd); + return applicationClientDoc; + } + + private ReadOnlyContext buildComponentContext(EARContext earContext, AppClientModule appClientModuel, ApplicationClientType appClient, GerApplicationClientType geronimoAppClient, UserTransaction userTransaction, ClassLoader cl) throws DeploymentException { + Map ejbRefMap = mapRefs(geronimoAppClient.getEjbRefArray()); + Map resourceRefMap = mapRefs(geronimoAppClient.getResourceRefArray()); + Map resourceEnvRefMap = mapRefs(geronimoAppClient.getResourceEnvRefArray()); + + URI uri = appClientModuel.getURI(); + + return ENCConfigBuilder.buildComponentContext(earContext, + uri, + userTransaction, + appClient.getEnvEntryArray(), + appClient.getEjbRefArray(), ejbRefMap, + new EjbLocalRefType[0], Collections.EMPTY_MAP, + appClient.getResourceRefArray(), resourceRefMap, + appClient.getResourceEnvRefArray(), resourceEnvRefMap, + appClient.getMessageDestinationRefArray(), + cl); + + } + + private static Map mapRefs(GerRemoteRefType[] refs) { + Map refMap = new HashMap(); + if (refs != null) { + for (int i = 0; i < refs.length; i++) { + GerRemoteRefType ref = refs[i]; + refMap.put(ref.getRefName(), new AppClientRefAdapter(ref)); + } + } + return refMap; + } + + + private static String getJ2eeStringValue(org.apache.geronimo.xbeans.j2ee.String string) { + if (string == null) { + return null; + } + return string.getStringValue(); + } + + private URI getDependencyURI(GerDependencyType dep) throws DeploymentException { + URI uri; + if (dep.isSetUri()) { + try { + uri = new URI(dep.getUri()); + } catch (URISyntaxException e) { + throw new DeploymentException("Invalid dependency URI " + dep.getUri(), e); + } + } else { + // @todo support more than just jars + String id = dep.getGroupId() + "/jars/" + dep.getArtifactId() + '-' + dep.getVersion() + ".jar"; + try { + uri = new URI(id); + } catch (URISyntaxException e) { + throw new DeploymentException("Unable to construct URI for groupId=" + dep.getGroupId() + ", artifactId=" + dep.getArtifactId() + ", version=" + dep.getVersion(), e); + } + } + return uri; + } + + + private byte[] getBytes(InputStream is) throws IOException { + byte[] buffer = new byte[4096]; + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + int count; + while ((count = is.read(buffer)) > 0) { + baos.write(buffer, 0, count); + } + return baos.toByteArray(); + } + + private static abstract class InstallCallback { + + protected final Module webModule; + + private InstallCallback(Module webModule) { + this.webModule = webModule; + } + + public abstract void installInEARContext(EARContext earContext, URI moduleBase) throws DeploymentException, IOException; + + public InputStream getWebDD() throws DeploymentException, IOException { + if (null == webModule.getAltSpecDD()) { + return null; + } + return webModule.getAltSpecDD().openStream(); + } + + public InputStream getGeronimoJettyDD() throws DeploymentException, IOException { + if (null == webModule.getAltVendorDD()) { + return null; + } + return webModule.getAltVendorDD().openStream(); + } + + } + + private static final class UnPackedInstallCallback extends InstallCallback { + + private final File webFolder; + + private UnPackedInstallCallback(Module webModule, File webFolder) { + super(webModule); + this.webFolder = webFolder; + } + + public void installInEARContext(EARContext earContext, URI moduleBase) throws IOException { + URI warRoot = webFolder.toURI(); + // add the warfile's content to the configuration + Collection files = new ArrayList(); + FileUtil.listRecursiveFiles(webFolder, files); + for (Iterator iter = files.iterator(); iter.hasNext();) { + File file = (File) iter.next(); + URI fileURI = warRoot.relativize(file.toURI()); + URI target = moduleBase.resolve(fileURI); + // TODO gets rid of these tests when Jetty will use the + // serialized Geronimo DD. + if (fileURI.equals("WEB-INF/web.xml") && + null != webModule.getAltSpecDD()) { + } else { + earContext.addFile(target, file); + } + } + } + + public InputStream getWebDD() throws DeploymentException, IOException { + InputStream in = super.getWebDD(); + if (null != in) { + return in; + } + File webAppFile = new File(webFolder, "WEB-INF/web.xml"); + if (!webAppFile.exists()) { + throw new DeploymentException("No WEB-INF/web.xml in module [" + webModule.getName() + "]"); + } + return new FileInputStream(webAppFile); + } + + public InputStream getGeronimoJettyDD() throws DeploymentException, IOException { + InputStream in = super.getGeronimoJettyDD(); + if (null != in) { + return in; + } + File jettyWebAppFile = new File(webFolder, "WEB-INF/geronimo-jetty.xml"); + if (jettyWebAppFile.exists()) { + return new FileInputStream(jettyWebAppFile); + } + return null; + } + + } + + private static final class PackedInstallCallback extends InstallCallback { + + private final JarFile webAppFile; + + private PackedInstallCallback(Module webModule, JarFile webAppFile) { + super(webModule); + this.webAppFile = webAppFile; + } + + public void installInEARContext(EARContext earContext, URI moduleBase) throws IOException { + JarInputStream jarIS = new JarInputStream(new FileInputStream(webAppFile.getName())); + for (JarEntry entry; (entry = jarIS.getNextJarEntry()) != null; jarIS.closeEntry()) { + URI target = moduleBase.resolve(entry.getName()); + // TODO gets rid of these tests when Jetty will use the + // serialized Geronimo DD. + if (entry.getName().equals("WEB-INF/web.xml") && + null != webModule.getAltSpecDD()) { + } else { + earContext.addFile(target, jarIS); + } + } + } + + public InputStream getWebDD() throws DeploymentException, IOException { + InputStream in = super.getWebDD(); + if (null != in) { + return in; + } + JarEntry entry = webAppFile.getJarEntry("WEB-INF/web.xml"); + if (entry == null) { + throw new DeploymentException("No WEB-INF/web.xml in module [" + webModule.getName() + "]"); + } + return webAppFile.getInputStream(entry); + } + + public InputStream getGeronimoJettyDD() throws DeploymentException, IOException { + InputStream in = super.getGeronimoJettyDD(); + if (null != in) { + return in; + } + JarEntry entry = webAppFile.getJarEntry("WEB-INF/geronimo-jetty.xml"); + if (entry != null) { + return webAppFile.getInputStream(entry); + } + return null; + } + } + + public static final GBeanInfo GBEAN_INFO; + + static { + GBeanInfoFactory infoFactory = new GBeanInfoFactory(AppClientModuleBuilder.class); + infoFactory.addInterface(ModuleBuilder.class); + GBEAN_INFO = infoFactory.getBeanInfo(); + } + + public static GBeanInfo getGBeanInfo() { + return GBEAN_INFO; + } +} Added: geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientRefAdapter.java ============================================================================== --- (empty file) +++ geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientRefAdapter.java Thu Sep 16 17:02:47 2004 @@ -0,0 +1,81 @@ +/** + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.geronimo.client.builder; + +import org.apache.geronimo.naming.deployment.RefAdapter; +import org.apache.geronimo.xbeans.geronimo.client.GerRemoteRefType; +import org.apache.xmlbeans.XmlObject; + +/** + * @version $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $ + */ +public class AppClientRefAdapter implements RefAdapter { + + private GerRemoteRefType ref; + + public AppClientRefAdapter(GerRemoteRefType ref) { + this.ref = ref; + } + + public XmlObject getXmlObject() { + return ref; + } + + public void setXmlObject(XmlObject xmlObject) { + ref = (GerRemoteRefType) xmlObject; + } + + public String getRefName() { + return ref.getRefName(); + } + + public void setRefName(String name) { + ref.setRefName(name); + } + + public String getServerName() { + return ref.getServer(); + } + + public void setServerName(String serverName) { + ref.setServer(serverName); + } + + public String getKernelName() { + return ref.getKernelName(); + } + + public void setKernelName(String kernelName) { + ref.setKernelName(kernelName); + } + + public String getTargetName() { + return ref.getTargetName(); + } + + public void setTargetName(String targetName) { + ref.setTargetName(targetName); + } + + public String getExternalUri() { + return ref.getExternalUri(); + } + + public void setExternalUri(String externalURI) { + ref.setExternalUri(externalURI); + } +} Added: geronimo/trunk/modules/client-builder/src/schema/geronimo-application-client.xsd ============================================================================== --- (empty file) +++ geronimo/trunk/modules/client-builder/src/schema/geronimo-application-client.xsd Thu Sep 16 17:02:47 2004 @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Copyright 2004 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<!-- @version $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $ --> +<xs:schema + xmlns:geronimo="http://geronimo.apache.org/xml/ns/j2ee/application-client" + targetNamespace="http://geronimo.apache.org/xml/ns/j2ee/application-client" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + elementFormDefault="qualified" + attributeFormDefault="unqualified" + version="1.0"> + + <xs:include schemaLocation="../../../naming/src/schema/geronimo-naming.xsd"/> + <xs:include schemaLocation="../../../deployment/src/schema/geronimo-common.xsd"/> + + <xs:element name="application-client" type="geronimo:application-clientType"/> + + <xs:complexType name="application-clientType"> + <xs:sequence> + <xs:element name="dependency" type="geronimo:dependencyType" minOccurs="0" maxOccurs="unbounded"/> + + <!----> + <!-- <xs:element name="callback-handler"--> + <!-- type="geronimo:fully-qualified-classType"--> + <!-- minOccurs="0"/>--> + + <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="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:schema> Added: geronimo/trunk/modules/client-builder/src/schema/xmlconfig.xml ============================================================================== --- (empty file) +++ geronimo/trunk/modules/client-builder/src/schema/xmlconfig.xml Thu Sep 16 17:02:47 2004 @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Copyright 2004 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<!-- @version $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $ --> +<xb:config xmlns:xb="http://www.bea.com/2002/09/xbean/config"> + + <xb:namespace uri="http://geronimo.apache.org/xml/ns/j2ee/application-client"> + <xb:package>org.apache.geronimo.xbeans.geronimo.client</xb:package> + <xb:prefix>Ger</xb:prefix> + </xb:namespace> + + <!--this should be unnecessary. Probably needs xmlbeans plugin to reuse the naming classes rather than generating duplicates--> + <xb:namespace uri="http://geronimo.apache.org/xml/ns/j2ee"> + <xb:package>org.apache.geronimo.xbeans.geronimo</xb:package> + <xb:prefix>Ger</xb:prefix> + </xb:namespace> + +</xb:config> \ No newline at end of file Added: geronimo/trunk/modules/client/LICENSE.txt ============================================================================== --- (empty file) +++ geronimo/trunk/modules/client/LICENSE.txt Thu Sep 16 17:02:47 2004 @@ -0,0 +1,203 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + Added: geronimo/trunk/modules/client/NOTICE.txt ============================================================================== --- (empty file) +++ geronimo/trunk/modules/client/NOTICE.txt Thu Sep 16 17:02:47 2004 @@ -0,0 +1,3 @@ +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). + Added: geronimo/trunk/modules/client/locator.ent ============================================================================== --- (empty file) +++ geronimo/trunk/modules/client/locator.ent Thu Sep 16 17:02:47 2004 @@ -0,0 +1,3 @@ +<!ENTITY % versions SYSTEM "file:../../etc/version-info.ent"> + + Added: geronimo/trunk/modules/client/project.properties ============================================================================== --- (empty file) +++ geronimo/trunk/modules/client/project.properties Thu Sep 16 17:02:47 2004 @@ -0,0 +1,5 @@ +## +## $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $ +## + +maven.repo.remote=http://www.openejb.org/maven, http://www.ibiblio.org/maven Added: geronimo/trunk/modules/client/project.xml ============================================================================== --- (empty file) +++ geronimo/trunk/modules/client/project.xml Thu Sep 16 17:02:47 2004 @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!-- + + Copyright 2003-2004 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<!DOCTYPE project [ +<!ENTITY % locator SYSTEM "file:locator.ent"> +%locator; +%versions; +]> + +<!-- $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $ --> + +<project> + <pomVersion>3</pomVersion> + <extend>${basedir}/../../etc/project.xml</extend> + + <!-- ===================== --> + <!-- Module Identification --> + <!-- ===================== --> + + <name>Geronimo :: Client</name> + <id>geronimo-client</id> + <shortDescription>Geronimo Client</shortDescription> + <description>Geronimo Client</description> + <url>http://incubator.apache.org/projects/geronimo/client/</url> + <siteDirectory>/www/incubator.apache.org/projects/geronimo/client</siteDirectory> + <distributionDirectory>/www/incubator.apache.org/projects/geronimo/builds/client</distributionDirectory> + + <package>org.apache.geronimo.client</package> + + <!-- ============ --> + <!-- Dependencies --> + <!-- ============ --> + + <dependencies> + <dependency> + <groupId>geronimo</groupId> + <artifactId>geronimo-kernel</artifactId> + <version>${pom.currentVersion}</version> + </dependency> + + <dependency> + <groupId>geronimo</groupId> + <artifactId>geronimo-naming</artifactId> + <version>${pom.currentVersion}</version> + </dependency> + + <dependency> + <groupId>geronimo</groupId> + <artifactId>geronimo-transaction</artifactId> + <version>${pom.currentVersion}</version> + </dependency> + + <!-- Thirdparty --> + + <dependency> + <groupId>cglib</groupId> + <artifactId>cglib-full</artifactId> + <version>&cglib-version;</version> + <url>http://cglib.sf.net/</url> + </dependency> + + <dependency> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + <version>&commons-logging-version;</version> + <url>http://jakarta.apache.org/commons/logging/</url> + </dependency> + + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <version>&log4j-version;</version> + <url>http://jakarta.apache.org/log4j</url> + </dependency> + + <dependency> + <groupId>mx4j</groupId> + <artifactId>mx4j</artifactId> + <version>&mx4j-version;</version> + </dependency> + </dependencies> + + <build> + <resources> + <resource> + <directory>${basedir}/src/java</directory> + <includes> + <include>**/*.xml</include> + <include>**/*.properties</include> + </includes> + </resource> + </resources> + <unitTest> + <includes> + <include>**/*Test.java</include> + </includes> + <excludes> + <exclude>**/Abstract*.java</exclude> + </excludes> + </unitTest> + </build> +</project> Added: geronimo/trunk/modules/client/src/java/org/apache/geronimo/client/AppClientContainer.java ============================================================================== --- (empty file) +++ geronimo/trunk/modules/client/src/java/org/apache/geronimo/client/AppClientContainer.java Thu Sep 16 17:02:47 2004 @@ -0,0 +1,98 @@ +/** + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.geronimo.client; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import org.apache.geronimo.naming.java.ReadOnlyContext; +import org.apache.geronimo.naming.java.RootContext; +import org.apache.geronimo.gbean.GBeanInfo; +import org.apache.geronimo.gbean.GBeanInfoFactory; + +/** + * @version $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $ + */ +public final class AppClientContainer { + private static final Class[] MAIN_ARGS = {String[].class}; + + private final String mainClassName; + private final ReadOnlyContext compContext; + private final Method mainMethod; + + public AppClientContainer(String mainClassName, ReadOnlyContext compContext, ClassLoader classLoader) throws Exception { + this.mainClassName = mainClassName; + this.compContext = compContext; + + try { + Class mainClass = classLoader.loadClass(mainClassName); + mainMethod = mainClass.getMethod("main", MAIN_ARGS); + } catch (ClassNotFoundException e) { + throw new AppClientInitializationException("Unable to load Main-Class " + mainClassName, e); + } catch (NoSuchMethodException e) { + throw new AppClientInitializationException("Main-Class " + mainClassName + " does not have a main method", e); + } + } + + public String getMainClassName() { + return mainClassName; + } + + public ReadOnlyContext getComponentContext() { + return compContext; + } + + public void main(String[] args) throws Exception { + ReadOnlyContext oldContext = RootContext.getComponentContext(); + try { + RootContext.setComponentContext(compContext); + + try { + mainMethod.invoke(null, args); + } catch (InvocationTargetException e) { + Throwable cause = e.getCause(); + if (cause instanceof Exception) { + throw (Exception) cause; + } else if (cause instanceof Error) { + throw (Error) cause; + } + throw e; + } + } finally { + RootContext.setComponentContext(oldContext); + } + } + + public static final GBeanInfo GBEAN_INFO; + + static { + GBeanInfoFactory infoFactory = new GBeanInfoFactory(AppClientContainer.class); + + infoFactory.addOperation("main", new Class[]{String[].class}); + infoFactory.addAttribute("mainClassName", String.class, true); + infoFactory.addAttribute("componentContext", ReadOnlyContext.class, true); + infoFactory.addAttribute("classLoader", ClassLoader.class, false); + + infoFactory.setConstructor(new String[]{"mainClassname", "componentContext", "classLoader"}); + + GBEAN_INFO = infoFactory.getBeanInfo(); + } + + public static GBeanInfo getGBeanInfo() { + return GBEAN_INFO; + } +} Added: geronimo/trunk/modules/client/src/java/org/apache/geronimo/client/AppClientInitializationException.java ============================================================================== --- (empty file) +++ geronimo/trunk/modules/client/src/java/org/apache/geronimo/client/AppClientInitializationException.java Thu Sep 16 17:02:47 2004 @@ -0,0 +1,37 @@ +/** + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.geronimo.client; + +/** + * @version $Rev$ $Date$ + */ +public class AppClientInitializationException extends Exception { + public AppClientInitializationException() { + } + + public AppClientInitializationException(String message) { + super(message); + } + + public AppClientInitializationException(String message, Throwable cause) { + super(message, cause); + } + + public AppClientInitializationException(Throwable cause) { + super(cause); + } +} Modified: geronimo/trunk/modules/j2ee-schema/src/java/org/apache/geronimo/schema/SchemaConversionUtils.java ============================================================================== --- geronimo/trunk/modules/j2ee-schema/src/java/org/apache/geronimo/schema/SchemaConversionUtils.java (original) +++ geronimo/trunk/modules/j2ee-schema/src/java/org/apache/geronimo/schema/SchemaConversionUtils.java Thu Sep 16 17:02:47 2004 @@ -26,6 +26,7 @@ import org.apache.geronimo.xbeans.j2ee.ApplicationDocument; import org.apache.geronimo.xbeans.j2ee.EjbJarDocument; import org.apache.geronimo.xbeans.j2ee.WebAppDocument; +import org.apache.geronimo.xbeans.j2ee.ApplicationClientDocument; import org.apache.xmlbeans.XmlCursor; import org.apache.xmlbeans.XmlException; import org.apache.xmlbeans.XmlObject; @@ -160,6 +161,14 @@ } validateDD(xmlObject); return (WebAppDocument) xmlObject; + } + + public static ApplicationClientDocument convertToApplicationClientSchema(XmlObject xmlObject) throws XmlException { + if (ApplicationClientDocument.type.equals(xmlObject.schemaType())) { + validateDD(xmlObject); + return (ApplicationClientDocument) xmlObject; + } + throw new UnsupportedOperationException("Deployment of previous version of application not supported"); } public static boolean convertToSchema(XmlCursor cursor, String schemaLocationURL, String version) { Added: geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/deployment/AppClientModule.java ============================================================================== --- (empty file) +++ geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/deployment/AppClientModule.java Thu Sep 16 17:02:47 2004 @@ -0,0 +1,29 @@ +/** + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.geronimo.j2ee.deployment; + +import java.net.URI; + +/** + * @version $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $ + */ +public class AppClientModule extends Module { + public AppClientModule(String name, URI uri) { + super(name, uri); + } +} +