Author: djencks Date: Tue Sep 28 00:03:28 2004 New Revision: 47393 Added: geronimo/trunk/modules/client-builder/src/test/ geronimo/trunk/modules/client-builder/src/test-resources/ geronimo/trunk/modules/client-builder/src/test-resources/plans/ geronimo/trunk/modules/client-builder/src/test-resources/plans/plan1.xml geronimo/trunk/modules/client-builder/src/test/org/ geronimo/trunk/modules/client-builder/src/test/org/apache/ geronimo/trunk/modules/client-builder/src/test/org/apache/geronimo/ geronimo/trunk/modules/client-builder/src/test/org/apache/geronimo/client/ geronimo/trunk/modules/client-builder/src/test/org/apache/geronimo/client/builder/ geronimo/trunk/modules/client-builder/src/test/org/apache/geronimo/client/builder/PlanParsingTest.java geronimo/trunk/modules/jetty/src/test-resources/plans/ geronimo/trunk/modules/jetty/src/test-resources/plans/plan1.xml geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/deployment/PlanParsingTest.java Modified: 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/client-builder/src/schema/xmlconfig.xml geronimo/trunk/modules/connector/src/schema/geronimo-connector_1_5.xsd geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java geronimo/trunk/modules/jetty/src/schema/geronimo-jetty.xsd geronimo/trunk/modules/jetty/src/schema/xmlconfig.xml geronimo/trunk/modules/jetty/src/test-resources/deployables/war1/WEB-INF/geronimo-web.xml geronimo/trunk/modules/naming/src/schema/geronimo-naming.xsd Log: don't make duplicate xmlbeans-generated classes. Work around problem with xmlbeans imported group refs
Modified: geronimo/trunk/modules/client-builder/project.xml ============================================================================== --- geronimo/trunk/modules/client-builder/project.xml (original) +++ geronimo/trunk/modules/client-builder/project.xml Tue Sep 28 00:03:28 2004 @@ -72,6 +72,9 @@ <groupId>geronimo</groupId> <artifactId>geronimo-connector</artifactId> <version>${pom.currentVersion}</version> + <properties> + <xmlbeans>true</xmlbeans> + </properties> </dependency> <dependency> @@ -108,6 +111,9 @@ <groupId>geronimo</groupId> <artifactId>geronimo-naming</artifactId> <version>${pom.currentVersion}</version> + <properties> + <xmlbeans>true</xmlbeans> + </properties> </dependency> <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 Tue Sep 28 00:03:28 2004 @@ -116,6 +116,41 @@ } GerApplicationClientType gerAppClient = null; + gerAppClient = getApplicationClientType(plan, moduleFile, name, appClient); + + // get the ids from either the application plan or for a stand alone module from the specific deployer + URI configId = null; + try { + configId = new URI(gerAppClient.getConfigId()); + } catch (URISyntaxException e) { + throw new DeploymentException("Invalid configId " + gerAppClient.getConfigId(), e); + } + + URI parentId = null; + if (gerAppClient.isSetParentId()) { + try { + parentId = new URI(gerAppClient.getParentId()); + } catch (URISyntaxException e) { + throw new DeploymentException("Invalid parentId " + gerAppClient.getParentId(), e); + } + } + + URI moduleURI; + if (targetPath != null) { + moduleURI = URI.create(targetPath); + if (targetPath.endsWith("/")) { + throw new DeploymentException("targetPath must not end with a '/'"); + } + } else { + targetPath = "app-client"; + moduleURI = URI.create(""); + } + + return new AppClientModule(name, configId, parentId, moduleURI, moduleFile, targetPath, appClient, gerAppClient, specDD); + } + + GerApplicationClientType getApplicationClientType(Object plan, JarFile moduleFile, String name, ApplicationClientType appClient) throws DeploymentException { + GerApplicationClientType gerAppClient = null; try { // load the geronimo-application-client.xml from either the supplied plan or from the earFile try { @@ -149,36 +184,7 @@ } catch (XmlException e) { throw new DeploymentException(e); } - - // get the ids from either the application plan or for a stand alone module from the specific deployer - URI configId = null; - try { - configId = new URI(gerAppClient.getConfigId()); - } catch (URISyntaxException e) { - throw new DeploymentException("Invalid configId " + gerAppClient.getConfigId(), e); - } - - URI parentId = null; - if (gerAppClient.isSetParentId()) { - try { - parentId = new URI(gerAppClient.getParentId()); - } catch (URISyntaxException e) { - throw new DeploymentException("Invalid parentId " + gerAppClient.getParentId(), e); - } - } - - URI moduleURI; - if (targetPath != null) { - moduleURI = URI.create(targetPath); - if (targetPath.endsWith("/")) { - throw new DeploymentException("targetPath must not end with a '/'"); - } - } else { - targetPath = "app-client"; - moduleURI = URI.create(""); - } - - return new AppClientModule(name, configId, parentId, moduleURI, moduleFile, targetPath, appClient, gerAppClient, specDD); + return gerAppClient; } private GerApplicationClientType createDefaultPlan(String name, ApplicationClientType appClient) { 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 Tue Sep 28 00:03:28 2004 @@ -43,7 +43,14 @@ <!-- type="geronimo:fully-qualified-classType"--> <!-- minOccurs="0"/>--> - <xs:group ref="naming:jndiEnvironmentRefsGroup"/> + <!--xs:group ref="naming:jndiEnvironmentRefsGroup"/--> + + <xs:element ref="naming:ejb-ref" minOccurs="0" maxOccurs="unbounded"/> + <xs:element ref="naming:ejb-local-ref" minOccurs="0" maxOccurs="unbounded"/> + <!-- leave web services out until I know what they do --> + <!--xs:group ref="service-refGroup"/--> + <xs:element ref="naming:resource-ref" minOccurs="0" maxOccurs="unbounded"/> + <xs:element ref="naming:resource-env-ref" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="resource" type="geronimo:resourceType" minOccurs="0" maxOccurs="unbounded"/> Modified: geronimo/trunk/modules/client-builder/src/schema/xmlconfig.xml ============================================================================== --- geronimo/trunk/modules/client-builder/src/schema/xmlconfig.xml (original) +++ geronimo/trunk/modules/client-builder/src/schema/xmlconfig.xml Tue Sep 28 00:03:28 2004 @@ -24,12 +24,13 @@ </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:namespace uri="http://geronimo.apache.org/xml/ns/naming"> <xb:package>org.apache.geronimo.xbeans.geronimo.naming</xb:package> + <xb:prefix>Ger</xb:prefix> + </xb:namespace> + + <xb:namespace uri="http://geronimo.apache.org/xml/ns/j2ee/connector"> + <xb:package>org.apache.geronimo.xbeans.geronimo</xb:package> <xb:prefix>Ger</xb:prefix> </xb:namespace> Added: geronimo/trunk/modules/client-builder/src/test-resources/plans/plan1.xml ============================================================================== --- (empty file) +++ geronimo/trunk/modules/client-builder/src/test-resources/plans/plan1.xml Tue Sep 28 00:03:28 2004 @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<application-client xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-client" + configId="client" + parentId="org/apache/geronimo/DefaultDatabase"> + <resource-ref> + <ref-name>jdbc/DB1</ref-name> + <target-name>DefaultDatabase</target-name> + </resource-ref> +</application-client> Added: geronimo/trunk/modules/client-builder/src/test/org/apache/geronimo/client/builder/PlanParsingTest.java ============================================================================== --- (empty file) +++ geronimo/trunk/modules/client-builder/src/test/org/apache/geronimo/client/builder/PlanParsingTest.java Tue Sep 28 00:03:28 2004 @@ -0,0 +1,37 @@ +package org.apache.geronimo.client.builder; + +import java.io.File; + +import junit.framework.TestCase; +import org.apache.geronimo.xbeans.geronimo.naming.GerLocalRefType; +import org.apache.geronimo.xbeans.geronimo.client.GerApplicationClientType; +import org.apache.geronimo.xbeans.geronimo.client.GerApplicationClientDocument; +import org.apache.geronimo.schema.SchemaConversionUtils; + +/** + */ +public class PlanParsingTest extends TestCase { + + private AppClientModuleBuilder builder = new AppClientModuleBuilder(null, null,null, null, null, null); + File basedir = new File(System.getProperty("basedir", ".")); + + public void testResourceRef() throws Exception { + File resourcePlan = new File(basedir, "src/test-resources/plans/plan1.xml"); + assertTrue(resourcePlan.exists()); + GerApplicationClientType appClient = builder.getApplicationClientType(resourcePlan, null, null, null); + assertEquals(1, appClient.getResourceRefArray().length); + } + + public void testConstructPlan() throws Exception { + GerApplicationClientDocument appClientDoc = GerApplicationClientDocument.Factory.newInstance(); + GerApplicationClientType appClient = appClientDoc.addNewApplicationClient(); + appClient.setConfigId("configId"); + appClient.setParentId("parentId"); + GerLocalRefType ref = appClient.addNewResourceRef(); + ref.setRefName("ref"); + ref.setTargetName("target"); + + SchemaConversionUtils.validateDD(appClient); + System.out.println(appClient.toString()); + } +} Modified: geronimo/trunk/modules/connector/src/schema/geronimo-connector_1_5.xsd ============================================================================== --- geronimo/trunk/modules/connector/src/schema/geronimo-connector_1_5.xsd (original) +++ geronimo/trunk/modules/connector/src/schema/geronimo-connector_1_5.xsd Tue Sep 28 00:03:28 2004 @@ -24,6 +24,7 @@ elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.5"> + <xsd:import namespace="http://java.sun.com/xml/ns/j2ee" schemaLocation="j2ee_1_4.xsd"/> <xsd:include schemaLocation="../../../deployment/src/schema/geronimo-common.xsd"/> Modified: geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java ============================================================================== --- geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java (original) +++ geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java Tue Sep 28 00:03:28 2004 @@ -103,6 +103,43 @@ } + JettyWebAppType jettyWebApp = getJettyWebApp(plan, moduleFile, name, webApp); + + // get the ids from either the application plan or for a stand alone module from the specific deployer + URI configId = null; + try { + configId = new URI(jettyWebApp.getConfigId()); + } catch (URISyntaxException e) { + throw new DeploymentException("Invalid configId " + jettyWebApp.getConfigId(), e); + } + + URI parentId = null; + if (jettyWebApp.isSetParentId()) { + try { + parentId = new URI(jettyWebApp.getParentId()); + } catch (URISyntaxException e) { + throw new DeploymentException("Invalid parentId " + jettyWebApp.getParentId(), e); + } + } + + URI moduleURI; + if (targetPath != null) { + moduleURI = URI.create(targetPath); + if (targetPath.endsWith("/")) { + throw new DeploymentException("targetPath must not end with a '/'"); + } + targetPath += "/"; + } else { + targetPath = "war/"; + moduleURI = URI.create(""); + } + + WebModule module = new WebModule(name, configId, parentId, moduleURI, moduleFile, targetPath, webApp, jettyWebApp, specDD); + module.setContextRoot(jettyWebApp.getContextRoot()); + return module; + } + + JettyWebAppType getJettyWebApp(Object plan, JarFile moduleFile, String name, WebAppType webApp) throws DeploymentException { JettyWebAppType jettyWebApp = null; try { // load the geronimo-jetty.xml from either the supplied plan or from the earFile @@ -137,39 +174,7 @@ } catch (XmlException e) { throw new DeploymentException(e); } - - // get the ids from either the application plan or for a stand alone module from the specific deployer - URI configId = null; - try { - configId = new URI(jettyWebApp.getConfigId()); - } catch (URISyntaxException e) { - throw new DeploymentException("Invalid configId " + jettyWebApp.getConfigId(), e); - } - - URI parentId = null; - if (jettyWebApp.isSetParentId()) { - try { - parentId = new URI(jettyWebApp.getParentId()); - } catch (URISyntaxException e) { - throw new DeploymentException("Invalid parentId " + jettyWebApp.getParentId(), e); - } - } - - URI moduleURI; - if (targetPath != null) { - moduleURI = URI.create(targetPath); - if (targetPath.endsWith("/")) { - throw new DeploymentException("targetPath must not end with a '/'"); - } - targetPath += "/"; - } else { - targetPath = "war/"; - moduleURI = URI.create(""); - } - - WebModule module = new WebModule(name, configId, parentId, moduleURI, moduleFile, targetPath, webApp, jettyWebApp, specDD); - module.setContextRoot(jettyWebApp.getContextRoot()); - return module; + return jettyWebApp; } private JettyWebAppType createDefaultPlan(String name, WebAppType webApp) { Modified: geronimo/trunk/modules/jetty/src/schema/geronimo-jetty.xsd ============================================================================== --- geronimo/trunk/modules/jetty/src/schema/geronimo-jetty.xsd (original) +++ geronimo/trunk/modules/jetty/src/schema/geronimo-jetty.xsd Tue Sep 28 00:03:28 2004 @@ -18,9 +18,9 @@ <xs:schema xmlns:jetty="http://geronimo.apache.org/xml/ns/web/jetty" - xmlns:sec="http://geronimo.apache.org/xml/ns/security" - xmlns:naming="http://geronimo.apache.org/xml/ns/naming" targetNamespace="http://geronimo.apache.org/xml/ns/web/jetty" + xmlns:naming="http://geronimo.apache.org/xml/ns/naming" + xmlns:sec="http://geronimo.apache.org/xml/ns/security" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" @@ -28,9 +28,6 @@ <xs:import namespace="http://geronimo.apache.org/xml/ns/naming" schemaLocation="../../../naming/src/schema/geronimo-naming.xsd"/> - <!-- - <xs:include schemaLocation="../../../naming/src/schema/geronimo-naming.xsd"/> - --> <xs:include schemaLocation="../../../deployment/src/schema/geronimo-common.xsd"/> <xs:include schemaLocation="../../../security/src/schema/geronimo-security.xsd"/> @@ -43,27 +40,20 @@ <xs:element name="context-root" type="xs:string" minOccurs="0" maxOccurs="1"/> <xs:element name="context-priority-classloader" type="xs:boolean"/> - <xs:group ref="naming:jndiEnvironmentRefsGroup"/> - <!--xs:element name="ejb-ref" - type="jetty:remote-refType" - minOccurs="0" maxOccurs="unbounded"/> - <xs:element name="ejb-local-ref" - type="jetty:local-refType" - minOccurs="0" maxOccurs="unbounded"/--> - <!-- leave web services out until I know what they do --> - <!--xsd:group ref="service-refGroup"/--> - <!--xs:element name="resource-ref" - type="jetty:local-refType" - minOccurs="0" maxOccurs="unbounded"/> - <xs:element name="resource-env-ref" - type="jetty:local-refType" - minOccurs="0" maxOccurs="unbounded"/> - <xs:element name="message-destination-ref" - type="jetty:remote-refType" - minOccurs="0" maxOccurs="unbounded"/--> + <xs:element name="security" type="jetty:securityType" minOccurs="0"/> <xs:element name="gbean" type="jetty:gbeanType" minOccurs="0" maxOccurs="unbounded"/> + + <!--xs:group ref="naming:jndiEnvironmentRefsGroup"/--> + + <xs:element ref="naming:ejb-ref" minOccurs="0" maxOccurs="unbounded"/> + <xs:element ref="naming:ejb-local-ref" minOccurs="0" maxOccurs="unbounded"/> + <!-- leave web services out until I know what they do --> + <!--xs:group ref="service-refGroup"/--> + <xs:element ref="naming:resource-ref" minOccurs="0" maxOccurs="unbounded"/> + <xs:element ref="naming:resource-env-ref" minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> <xs:attribute name="configId" type="xs:string" use="required"/> <xs:attribute name="parentId" type="xs:string" use="optional"/> Modified: geronimo/trunk/modules/jetty/src/schema/xmlconfig.xml ============================================================================== --- geronimo/trunk/modules/jetty/src/schema/xmlconfig.xml (original) +++ geronimo/trunk/modules/jetty/src/schema/xmlconfig.xml Tue Sep 28 00:03:28 2004 @@ -24,8 +24,8 @@ </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:namespace uri="http://geronimo.apache.org/xml/ns/naming"> + <xb:package>org.apache.geronimo.xbeans.geronimo.naming</xb:package> <xb:prefix>Ger</xb:prefix> </xb:namespace> Modified: geronimo/trunk/modules/jetty/src/test-resources/deployables/war1/WEB-INF/geronimo-web.xml ============================================================================== --- geronimo/trunk/modules/jetty/src/test-resources/deployables/war1/WEB-INF/geronimo-web.xml (original) +++ geronimo/trunk/modules/jetty/src/test-resources/deployables/war1/WEB-INF/geronimo-web.xml Tue Sep 28 00:03:28 2004 @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. --> - + <jetty:web-app xmlns:jetty="http://geronimo.apache.org/xml/ns/web/jetty" configId="org/apache/geronimo/jetty/Test" Added: geronimo/trunk/modules/jetty/src/test-resources/plans/plan1.xml ============================================================================== --- (empty file) +++ geronimo/trunk/modules/jetty/src/test-resources/plans/plan1.xml Tue Sep 28 00:03:28 2004 @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<web-app xmlns="http://geronimo.apache.org/xml/ns/web/jetty" + configId="goodservlet" + parentId="org/apache/geronimo/DefaultDatabase"> + <context-priority-classloader>false</context-priority-classloader> + <resource-ref> + <ref-name>jdbc/DB1</ref-name> + <target-name>DefaultDatabase</target-name> + </resource-ref> +</web-app> Added: geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/deployment/PlanParsingTest.java ============================================================================== --- (empty file) +++ geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/deployment/PlanParsingTest.java Tue Sep 28 00:03:28 2004 @@ -0,0 +1,38 @@ +package org.apache.geronimo.jetty.deployment; + +import java.io.File; + +import junit.framework.TestCase; +import org.apache.geronimo.xbeans.geronimo.jetty.JettyWebAppType; +import org.apache.geronimo.xbeans.geronimo.jetty.JettyWebAppDocument; +import org.apache.geronimo.xbeans.geronimo.naming.GerLocalRefType; +import org.apache.geronimo.schema.SchemaConversionUtils; + +/** + */ +public class PlanParsingTest extends TestCase { + + private JettyModuleBuilder builder = new JettyModuleBuilder(); + File basedir = new File(System.getProperty("basedir", ".")); + + public void testResourceRef() throws Exception { + File resourcePlan = new File(basedir, "src/test-resources/plans/plan1.xml"); + assertTrue(resourcePlan.exists()); + JettyWebAppType jettyWebApp = builder.getJettyWebApp(resourcePlan, null, null, null); + assertEquals(1, jettyWebApp.getResourceRefArray().length); + } + + public void testConstructPlan() throws Exception { + JettyWebAppDocument jettyWebAppDoc = JettyWebAppDocument.Factory.newInstance(); + JettyWebAppType jettyWebAppType = jettyWebAppDoc.addNewWebApp(); + jettyWebAppType.setConfigId("configId"); + jettyWebAppType.setParentId("parentId"); + jettyWebAppType.setContextPriorityClassloader(false); + GerLocalRefType ref = jettyWebAppType.addNewResourceRef(); + ref.setRefName("ref"); + ref.setTargetName("target"); + + SchemaConversionUtils.validateDD(jettyWebAppType); + System.out.println(jettyWebAppType.toString()); + } +} Modified: geronimo/trunk/modules/naming/src/schema/geronimo-naming.xsd ============================================================================== --- geronimo/trunk/modules/naming/src/schema/geronimo-naming.xsd (original) +++ geronimo/trunk/modules/naming/src/schema/geronimo-naming.xsd Tue Sep 28 00:03:28 2004 @@ -34,8 +34,21 @@ </xsd:documentation> </xsd:annotation> - <!--xsd:import namespace="http://java.sun.com/xml/ns/j2ee" schemaLocation="j2ee_1_4.xsd"/--> + <!-- + temporary (I hope) individual elements while xmlbeans group handling is straightened out + --> + <xsd:element name="ejb-ref" + type="gernaming:remote-refType"/> + <xsd:element name="ejb-local-ref" + type="gernaming:local-refType"/> + <!-- leave web services out until I know what they do --> + <!--xsd:group ref="service-refGroup"/--> + <xsd:element name="resource-ref" + type="gernaming:local-refType"/> + <xsd:element name="resource-env-ref" + type="gernaming:local-refType"/> + <xsd:group name="jndiEnvironmentRefsGroup"> <xsd:annotation> <xsd:documentation> @@ -46,9 +59,6 @@ </xsd:documentation> </xsd:annotation> <xsd:sequence> - <!--xsd:element name="env-entry" - type="env-entryType" - minOccurs="0" maxOccurs="unbounded"/--> <xsd:element name="ejb-ref" type="gernaming:remote-refType" minOccurs="0" maxOccurs="unbounded"/>