Author: djencks
Date: Fri Sep 24 13:21:47 2004
New Revision: 47172
Added:
geronimo/trunk/modules/connector/src/test-data/data/external-application-plan.xml
Modified:
geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
geronimo/trunk/modules/connector/maven.xml
geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
geronimo/trunk/modules/connector/src/test-data/ear/application.xml
geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/deployment/RAR_1_0ConfigBuilderTest.java
geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/Deployer.java
geronimo/trunk/modules/j2ee-schema/src/java/org/apache/geronimo/schema/SchemaConversionUtils.java
geronimo/trunk/modules/j2ee-schema/src/test/org/apache/geronimo/schema/SchemaConversionUtilsTest.java
geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/deployment/ModuleBuilder.java
geronimo/trunk/modules/j2ee/src/schema/geronimo-application.xsd
geronimo/trunk/modules/j2ee/src/test-unpacked-ear/alt-ger-ejb-jar.xml
geronimo/trunk/modules/j2ee/src/test-unpacked-ear/alt-ger-ra.xml
geronimo/trunk/modules/j2ee/src/test-unpacked-ear/alt-ger-war.xml
geronimo/trunk/modules/j2ee/src/test/org/apache/geronimo/j2ee/deployment/MockConnectorConfigBuilder.java
geronimo/trunk/modules/j2ee/src/test/org/apache/geronimo/j2ee/deployment/MockEJBConfigBuilder.java
geronimo/trunk/modules/j2ee/src/test/org/apache/geronimo/j2ee/deployment/MockWARConfigBuilder.java
geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
Log:
Changes to allow embedded vendor dds in geronimo-application.xml, and changes from xxxDocument to xxxType in vendor dd handling. WARNING: THIS BREAKS THE BUILD. Committed to allow easier collaboration
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 Fri Sep 24 13:21:47 2004
@@ -70,6 +70,7 @@
import org.apache.xmlbeans.SchemaTypeLoader;
import org.apache.xmlbeans.XmlBeans;
import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlException;
/**
@@ -132,19 +133,25 @@
} else {
moduleBase = new URL("jar:" + module.toString() + "!/");
}
- GerApplicationClientDocument plan = (GerApplicationClientDocument) parseVendorDD(new URL(moduleBase, "META-INF/geronimo-application-client.xml"));
+ URL path = new URL(moduleBase, "META-INF/geronimo-application-client.xml");
+ XmlObject dd = SchemaConversionUtils.parse(path.openStream());
+
+ GerApplicationClientDocument plan = (GerApplicationClientDocument) validateVendorDD(dd);
if (plan == null) {
return createDefaultPlan(moduleBase);
}
return plan;
} catch (MalformedURLException e) {
return null;
+ } catch (IOException e) {
+ return null;
+ } catch (XmlException e) {
+ throw new DeploymentException(e);
}
}
- public XmlObject parseVendorDD(URL path) throws DeploymentException {
+ public XmlObject validateVendorDD(XmlObject dd) throws DeploymentException {
try {
- XmlObject dd = SchemaConversionUtils.parse(path.openStream());
dd = SchemaConversionUtils.convertToGeronimoNamingSchema(dd);
return dd.changeType(GerApplicationClientDocument.type);
} catch (Exception e) {
Modified: geronimo/trunk/modules/connector/maven.xml
==============================================================================
--- geronimo/trunk/modules/connector/maven.xml (original)
+++ geronimo/trunk/modules/connector/maven.xml Fri Sep 24 13:21:47 2004
@@ -54,12 +54,45 @@
basedir="${basedir}/target/test-rar-15"/>
<!-- Build test-ear -->
- <ant:jar destfile="${basedir}/target/test-ear.ear" >
+ <ant:jar destfile="${basedir}/target/test-ear.ear">
<fileset dir="${basedir}/target">
<include name="test-rar-10.rar"/>
<include name="test-rar-15.rar"/>
</fileset>
<zipfileset dir="${basedir}/src/test-data/ear" prefix="META-INF"/>
+ </ant:jar>
+ <!--do it again without geronimo dds-->
+ <!-- Build test-rar-10 -->
+ <ant:mkdir dir="${basedir}/target/test-rar-10-noger/META-INF"/>
+ <copy todir="${basedir}/target/test-rar-10-noger/META-INF">
+ <fileset dir="${basedir}/src/test-data/connector_1_0">
+ <exclude name="geronimo-ra.xml"/>
+ </fileset>
+ </copy>
+
+ <ant:jar destfile="${basedir}/target/test-rar-10-noger.rar"
+ basedir="${basedir}/target/test-rar-10"/>
+
+ <!-- Build test-rar-15 -->
+ <ant:mkdir dir="${basedir}/target/test-rar-15-noger/META-INF"/>
+ <copy todir="${basedir}/target/test-rar-15-noger/META-INF">
+ <fileset dir="${basedir}/src/test-data/connector_1_5">
+ <exclude name="geronimo-ra.xml"/>
+ </fileset>
+ </copy>
+
+ <ant:jar destfile="${basedir}/target/test-rar-15-noger.rar"
+ basedir="${basedir}/target/test-rar-15"/>
+
+ <!-- Build test-ear -->
+ <ant:jar destfile="${basedir}/target/test-ear-noger.ear">
+ <fileset dir="${basedir}/target">
+ <include name="test-rar-10-noger.rar"/>
+ <include name="test-rar-15-noger.rar"/>
+ </fileset>
+ <zipfileset dir="${basedir}/src/test-data/ear" prefix="META-INF">
+ <exclude name="geronimo-application.xml"/>
+ </zipfileset>
</ant:jar>
</preGoal>
Modified: geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
==============================================================================
--- geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java (original)
+++ geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java Fri Sep 24 13:21:47 2004
@@ -24,11 +24,10 @@
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Collections;
+import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
-import java.util.Enumeration;
-import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.zip.ZipEntry;
import javax.management.AttributeNotFoundException;
@@ -37,7 +36,6 @@
import javax.management.ReflectionException;
import org.apache.geronimo.common.propertyeditor.PropertyEditors;
-import org.apache.geronimo.common.xml.XmlBeansUtil;
import org.apache.geronimo.connector.ActivationSpecInfo;
import org.apache.geronimo.connector.outbound.connectionmanagerconfig.LocalTransactions;
import org.apache.geronimo.connector.outbound.connectionmanagerconfig.NoPool;
@@ -51,8 +49,8 @@
import org.apache.geronimo.connector.outbound.security.PasswordCredentialRealm;
import org.apache.geronimo.deployment.DeploymentException;
import org.apache.geronimo.deployment.service.GBeanHelper;
-import org.apache.geronimo.deployment.util.JarUtil;
import org.apache.geronimo.deployment.util.IOUtil;
+import org.apache.geronimo.deployment.util.JarUtil;
import org.apache.geronimo.gbean.DynamicGAttributeInfo;
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.GBeanInfoFactory;
@@ -137,13 +135,15 @@
throw new DeploymentException("Unable to parse specDD");
}
- public XmlObject parseVendorDD(URL path) throws DeploymentException {
+ public XmlObject validateVendorDD(XmlObject dd) throws DeploymentException {
try {
- XmlObject dd = SchemaConversionUtils.parse(path.openStream());
- return dd.changeType(GerConnectorDocument.type);
- } catch (Exception e) {
- throw new DeploymentException(e);
- }
+ dd = SchemaConversionUtils.getNestedObjectAsType(dd, "connector", GerConnectorType.type);
+ SchemaConversionUtils.validateDD(dd);
+ System.out.println("Successfully validated: " + dd);
+ return dd;
+ } catch (Exception e) {
+ throw new DeploymentException(e);
+ }
}
public XmlObject getDeploymentPlan(URL module) throws DeploymentException {
@@ -154,18 +154,33 @@
} else {
moduleBase = new URL("jar:" + module.toString() + "!/");
}
- return (GerConnectorDocument) parseVendorDD(new URL(moduleBase, "META-INF/geronimo-ra.xml"));
+ URL path = new URL(moduleBase, "META-INF/geronimo-ra.xml");
+ return getGerConnector(path);
} catch (MalformedURLException e) {
return null;
+ } catch (IOException e) {
+ return null;
+ }
+ }
+
+ GerConnectorType getGerConnector(URL path) throws DeploymentException {
+ try {
+ XmlObject dd = SchemaConversionUtils.parse(path.openStream());
+ return (GerConnectorType) validateVendorDD(dd);
+ } catch (IOException e) {
+ //todo should this throw an exception? we have already opened the stream!
+ return null;
+ } catch (XmlException e) {
+ throw new DeploymentException(e);
}
}
public boolean canHandlePlan(XmlObject plan) {
- return plan instanceof GerConnectorDocument;
+ return plan instanceof GerConnectorType;
}
public URI getParentId(XmlObject plan) throws DeploymentException {
- GerConnectorType geronimoConnector = ((GerConnectorDocument) plan).getConnector();
+ GerConnectorType geronimoConnector = (GerConnectorType) plan;
if (geronimoConnector.isSetParentId()) {
try {
return new URI(geronimoConnector.getParentId());
@@ -178,7 +193,7 @@
}
public URI getConfigId(XmlObject plan) throws DeploymentException {
- GerConnectorType geronimoConnector = ((GerConnectorDocument) plan).getConnector();
+ GerConnectorType geronimoConnector = (GerConnectorType) plan;
try {
return new URI(geronimoConnector.getConfigId());
} catch (URISyntaxException e) {
@@ -217,13 +232,8 @@
if (vendorDD == null) {
try {
- JarEntry entry = moduleFile.getJarEntry("META-INF/geronimo-ra.xml");
- if (entry != null) {
- InputStream in = moduleFile.getInputStream(entry);
- if (in != null) {
- vendorDD = XmlBeansUtil.parse(in, GerConnectorDocument.type);
- }
- }
+ URL vendorURL = JarUtil.createJarURL(moduleFile, "META-INF/geronimo-ra.xml");
+ vendorDD = getGerConnector(vendorURL);
} catch (Exception e) {
throw new DeploymentException("Unable to parse META-INF/geronimo-ra.xml", e);
}
@@ -232,8 +242,7 @@
throw new DeploymentException("No geronimo-ra.xml.");
}
- GerConnectorDocument geronimoConnectorDoc = (GerConnectorDocument) vendorDD;
- GerConnectorType geronimoConnector = geronimoConnectorDoc.getConnector();
+ GerConnectorType geronimoConnector = (GerConnectorType) vendorDD;
return new ConnectorModule(name, moduleURI, moduleFile, targetPath, connector, geronimoConnector, specDD);
}
Added: geronimo/trunk/modules/connector/src/test-data/data/external-application-plan.xml
==============================================================================
--- (empty file)
+++ geronimo/trunk/modules/connector/src/test-data/data/external-application-plan.xml Fri Sep 24 13:21:47 2004
@@ -0,0 +1,183 @@
+<?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.
+-->
+
+<application xmlns="http://geronimo.apache.org/xml/ns/j2ee/application"
+ configId="org/apache/geronimo/j2ee/deployment/test"
+ >
+ <!--parentId="org/apache/geronimo/Server"-->
+
+ <module>
+ <connector>test-rar-10-noger.rar</connector>
+ <module-dd>
+ <connector xmlns="http://geronimo.apache.org/xml/ns/j2ee" version="1.0"
+ configId="org/apache/geronimo/j2ee/deployment/test"
+ parentId="org/apache/geronimo/Server">
+
+ <resourceadapter>
+ <outbound-resourceadapter>
+ <connection-definition>
+ <connectionfactory-interface>javax.resource.cci.ConnectionFactory</connectionfactory-interface>
+ <connectiondefinition-instance>
+ <name>FirstTestOutboundConnectionFactory</name>
+ <config-property-setting name="OutboundStringProperty1">newvalue1</config-property-setting>
+ <config-property-setting name="OutboundStringProperty3">newvalue2</config-property-setting>
+ <connectionmanager>
+ <realm-bridge>TargetRealm</realm-bridge>
+ <xa-transaction>
+ <transaction-caching/>
+ </xa-transaction>
+ <partitioned-pool>
+ <max-size>10</max-size>
+ <blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
+ <match-one/>
+ <partition-by-subject/>
+ </partitioned-pool>
+ </connectionmanager>
+ <global-jndi-name>connectionfactories/testcf</global-jndi-name>
+ <credential-interface>javax.resource.spi.security.PasswordCredential</credential-interface>
+ </connectiondefinition-instance>
+ <connectiondefinition-instance>
+ <name>SecondTestOutboundConnectionFactory</name>
+ <config-property-setting name="OutboundStringProperty4">newvalue3</config-property-setting>
+ <config-property-setting name="OutboundStringProperty1">newvalue4</config-property-setting>
+ <connectionmanager>
+ <xa-transaction>
+ <transaction-caching/>
+ </xa-transaction>
+ <single-pool>
+ <max-size>10</max-size>
+ <blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
+ <match-one/>
+ </single-pool>
+ </connectionmanager>
+ </connectiondefinition-instance>
+ <connectiondefinition-instance>
+ <name>ThirdTestOutboundConnectionFactory</name>
+ <config-property-setting name="OutboundStringProperty">StringValue3</config-property-setting>
+ <connectionmanager>
+ <realm-bridge>TargetRealm</realm-bridge>
+ <xa-transaction>
+ <transaction-caching/>
+ </xa-transaction>
+ <partitioned-pool>
+ <max-size>10</max-size>
+ <blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
+ <match-one/>
+ <partition-by-subject/>
+ </partitioned-pool>
+ </connectionmanager>
+ </connectiondefinition-instance>
+ </connection-definition>
+ </outbound-resourceadapter>
+ </resourceadapter>
+
+ </connector>
+ </module-dd>
+ </module>
+ <module>
+ <connector>test-rar-15-noger.rar</connector>
+ <module-dd>
+ <connector xmlns="http://geronimo.apache.org/xml/ns/j2ee" version="1.5"
+ configId="org/apache/geronimo/j2ee/deployment/test"
+ parentId="org/apache/geronimo/Server">
+
+ <resourceadapter>
+ <resourceadapter-instance>
+ <resourceadapter-name>testRA</resourceadapter-name>
+ <config-property-setting name="RAStringProperty">NewStringValue</config-property-setting>
+ <workmanager-name>DefaultWorkManager</workmanager-name>
+ </resourceadapter-instance>
+ <outbound-resourceadapter>
+ <connection-definition>
+ <connectionfactory-interface>javax.resource.cci.ConnectionFactory</connectionfactory-interface>
+ <connectiondefinition-instance>
+ <name>FirstTestOutboundConnectionFactory</name>
+ <config-property-setting name="OutboundStringProperty1">newvalue1</config-property-setting>
+ <config-property-setting name="OutboundStringProperty3">newvalue2</config-property-setting>
+ <connectionmanager>
+ <realm-bridge>TargetRealm</realm-bridge>
+ <xa-transaction>
+ <transaction-caching/>
+ </xa-transaction>
+ <partitioned-pool>
+ <max-size>10</max-size>
+ <blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
+ <match-one/>
+ <partition-by-subject/>
+ </partitioned-pool>
+ </connectionmanager>
+ <global-jndi-name>connectionfactories/testcf</global-jndi-name>
+ <credential-interface>javax.resource.spi.security.PasswordCredential</credential-interface>
+ </connectiondefinition-instance>
+ <connectiondefinition-instance>
+ <name>SecondTestOutboundConnectionFactory</name>
+ <config-property-setting name="OutboundStringProperty4">newvalue3</config-property-setting>
+ <config-property-setting name="OutboundStringProperty1">newvalue4</config-property-setting>
+ <connectionmanager>
+ <realm-bridge>TargetRealm</realm-bridge>
+ <xa-transaction>
+ <transaction-caching/>
+ </xa-transaction>
+ <partitioned-pool>
+ <max-size>10</max-size>
+ <blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
+ <match-one/>
+ <partition-by-subject/>
+ </partitioned-pool>
+ </connectionmanager>
+ </connectiondefinition-instance>
+ </connection-definition>
+ <connection-definition>
+ <connectionfactory-interface>org.apache.geronimo.connector.mock.ConnectionFactoryExtension</connectionfactory-interface>
+ <connectiondefinition-instance>
+ <name>ThirdTestOutboundConnectionFactory</name>
+ <config-property-setting name="OutboundStringProperty1">StringValue3</config-property-setting>
+ <connectionmanager>
+ <realm-bridge>TargetRealm</realm-bridge>
+ <xa-transaction>
+ <transaction-caching/>
+ </xa-transaction>
+ <partitioned-pool>
+ <max-size>10</max-size>
+ <blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
+ <match-one/>
+ <partition-by-subject/>
+ </partitioned-pool>
+ </connectionmanager>
+ </connectiondefinition-instance>
+ </connection-definition>
+ </outbound-resourceadapter>
+ <adminobject>
+ <adminobject-interface>org.apache.geronimo.connector.mock.MockAdminObject</adminobject-interface>
+ <adminobject-class>org.apache.geronimo.connector.mock.MockAdminObjectImpl</adminobject-class>
+ <adminobject-instance>
+ <message-destination-name>tweedledee</message-destination-name>
+ <config-property-setting name="Tweedle">Dee-value</config-property-setting>
+ </adminobject-instance>
+ <adminobject-instance>
+ <message-destination-name>tweedledum</message-destination-name>
+ <config-property-setting name="Tweedle">Dum-value</config-property-setting>
+ </adminobject-instance>
+ </adminobject>
+ </resourceadapter>
+
+ </connector>
+
+ </module-dd>
+ </module>
+</application>
\ No newline at end of file
Modified: geronimo/trunk/modules/connector/src/test-data/ear/application.xml
==============================================================================
--- geronimo/trunk/modules/connector/src/test-data/ear/application.xml (original)
+++ geronimo/trunk/modules/connector/src/test-data/ear/application.xml Fri Sep 24 13:21:47 2004
@@ -3,15 +3,9 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd"
version="1.4">
<module>
- <web>
- <context-root>test</context-root>
- <web-uri>test-war.war</web-uri>
- </web>
+ <connector>test-rar-10-noger.rar</connector>
</module>
<module>
- <ejb>test-ejb-jar.jar</ejb>
- </module>
- <module>
- <connector>test-rar.rar</connector>
+ <connector>test-rar-15-noger.rar</connector>
</module>
</application>
Modified: geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/deployment/RAR_1_0ConfigBuilderTest.java
==============================================================================
--- geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/deployment/RAR_1_0ConfigBuilderTest.java (original)
+++ geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/deployment/RAR_1_0ConfigBuilderTest.java Fri Sep 24 13:21:47 2004
@@ -47,6 +47,7 @@
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.j2ee.deployment.EARConfigBuilder;
import org.apache.geronimo.j2ee.management.impl.J2EEServerImpl;
import org.apache.geronimo.kernel.Kernel;
import org.apache.geronimo.kernel.config.Configuration;
@@ -56,8 +57,10 @@
import org.apache.geronimo.system.serverinfo.ServerInfo;
import org.apache.geronimo.xbeans.geronimo.GerConnectorDocument;
import org.apache.geronimo.xbeans.j2ee.connector_1_0.ConnectorDocument10;
+import org.apache.geronimo.schema.SchemaConversionUtils;
import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.XmlCursor;
import org.tranql.sql.jdbc.JDBCUtil;
/**
@@ -100,9 +103,11 @@
}
private File rarFile = new File(basedir, "target/test-rar-10");
+
public File getRARFile() {
return rarFile;
}
+
public void install(ModuleBuilder moduleBuilder, EARContext earContext, Module module) throws Exception {
moduleBuilder.installModule(new UnpackedJarFile(rarFile), earContext, module);
}
@@ -121,9 +126,11 @@
}
private File rarFile = new File(basedir, "target/test-rar-10");
+
public File getRARFile() {
return rarFile;
}
+
public void install(ModuleBuilder moduleBuilder, EARContext earContext, Module module) throws Exception {
moduleBuilder.installModule(new UnpackedJarFile(rarFile), earContext, module);
}
@@ -147,9 +154,11 @@
}
private File rarFile = new File(basedir, "target/test-rar-10");
+
public File getRARFile() {
return rarFile;
}
+
public void install(ModuleBuilder moduleBuilder, EARContext earContext, Module module) throws Exception {
moduleBuilder.installModule(new UnpackedJarFile(rarFile), earContext, module);
}
@@ -160,7 +169,7 @@
} catch (DeploymentException e) {
}
}
-
+
public void testBuildUnpackedAltSpecVendorDDModule() throws Exception {
InstallAction action = new InstallAction() {
public URL getVendorDD() throws MalformedURLException {
@@ -173,16 +182,18 @@
}
private File rarFile = new File(basedir, "target/test-rar-10");
+
public File getRARFile() {
return rarFile;
}
+
public void install(ModuleBuilder moduleBuilder, EARContext earContext, Module module) throws Exception {
moduleBuilder.installModule(new UnpackedJarFile(rarFile), earContext, module);
}
};
executeTestBuildModule(action);
}
-
+
public void testBuildPackedModule() throws Exception {
InstallAction action = new InstallAction() {
public URL getVendorDD() {
@@ -194,9 +205,11 @@
}
private File rarFile = new File(basedir, "target/test-rar-10.rar");
+
public File getRARFile() {
return rarFile;
}
+
public void install(ModuleBuilder moduleBuilder, EARContext earContext, Module module) throws Exception {
moduleBuilder.installModule(JarUtil.createJarFile(rarFile), earContext, module);
}
@@ -211,7 +224,7 @@
String j2eeModuleName = "org/apache/geronimo/j2ee/deployment/test";
ObjectName connectionTrackerName = new ObjectName("geronimo.connector:service=ConnectionTracker");
- ModuleBuilder moduleBuilder = new ConnectorModuleBuilder();
+ ConnectorModuleBuilder moduleBuilder = new ConnectorModuleBuilder();
File rarFile = action.getRARFile();
ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
@@ -224,7 +237,7 @@
if (vendorURL == null) {
vendorURL = JarUtil.createJarURL(rarJarFile, "META-INF/geronimo-ra.xml");
}
- XmlObject plan = moduleBuilder.parseVendorDD(vendorURL);
+ XmlObject plan = moduleBuilder.getGerConnector(vendorURL);
if (plan == null) {
throw new DeploymentException();
}
@@ -267,6 +280,34 @@
}
}
+ public void testBuildEar() throws Exception {
+ String j2eeDomainName = "geronimo.server";
+ String j2eeServerName = "TestGeronimoServer";
+ String j2eeApplicationName = "TestEar";
+ String j2eeModuleName = "org/apache/geronimo/j2ee/deployment/test";
+ ObjectName connectionTrackerName = new ObjectName("geronimo.connector:service=ConnectionTracker");
+ ObjectName j2eeServer = new ObjectName(j2eeDomainName + ":name=" + j2eeServerName);
+ Kernel kernel = new Kernel("blah");
+ kernel.boot();
+
+ EARConfigBuilder configBuilder = new EARConfigBuilder(j2eeServer, null, connectionTrackerName, null, null, null, null, null, null, new ConnectorModuleBuilder(), null, kernel);
+ File rarFile = new File(basedir, "target/test-ear-noger.ear");
+ File outFile = File.createTempFile("EARTest", ".car");
+ try {
+ File planFile = new File(basedir, "src/test-data/data/external-application-plan.xml");
+ XmlObject planDoc = SchemaConversionUtils.parse(planFile.toURL().openStream());
+ XmlCursor cursor = planDoc.newCursor();
+ cursor.toFirstChild();
+ XmlObject plan = cursor.getObject();
+ cursor.dispose();
+ configBuilder.buildConfiguration(outFile, null, rarFile, plan);
+
+ } finally {
+ outFile.delete();
+ }
+ }
+
+
private void verifyDeployment(File unpackedDir, ClassLoader cl, String j2eeDomainName, String j2eeServerName, String j2eeApplicationName, String j2eeModuleName) throws Exception {
DataSource ds = null;
Kernel kernel = null;
@@ -428,8 +469,11 @@
private interface InstallAction {
File getRARFile();
+
void install(ModuleBuilder moduleBuilder, EARContext earContext, Module module) throws Exception;
+
URL getVendorDD() throws MalformedURLException;
+
URL getSpecDD() throws MalformedURLException;
}
Modified: geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/Deployer.java
==============================================================================
--- geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/Deployer.java (original)
+++ geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/Deployer.java Fri Sep 24 13:21:47 2004
@@ -47,6 +47,7 @@
import org.apache.xmlbeans.XmlBeans;
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlCursor;
/**
* Command line based deployment utility which combines multiple deployable modules
@@ -69,10 +70,8 @@
XmlObject plan = null;
if (deploymentPlan != null) {
try {
- plan = getLoader().parse(deploymentPlan, null, null);
- } catch (XmlException e) {
- throw new DeploymentException(e);
- } catch (IOException e) {
+ plan = getPlan(deploymentPlan.toURL());
+ } catch (MalformedURLException e) {
throw new DeploymentException(e);
}
for (Iterator i = builders.iterator(); i.hasNext();) {
@@ -123,6 +122,19 @@
}
}
+ private XmlObject getPlan(URL deploymentPlan) throws DeploymentException {
+ try {
+ XmlObject plan = getLoader().parse(deploymentPlan, null, null);
+ XmlCursor cursor = plan.newCursor();
+ cursor.toFirstChild();
+ return cursor.getObject();
+ } catch (XmlException e) {
+ throw new DeploymentException(e);
+ } catch (IOException e) {
+ throw new DeploymentException(e);
+ }
+ }
+
/**
* GBean entry point invoked from an executable CAR.
*
@@ -139,7 +151,7 @@
// parse the plan
XmlObject plan = null;
if (cmd.plan != null) {
- plan = getLoader().parse(cmd.plan, null, null);
+ plan = getPlan(cmd.plan);
for (Iterator i = builders.iterator(); i.hasNext();) {
ConfigurationBuilder candidate = (ConfigurationBuilder) i.next();
if (candidate.canConfigure(plan)) {
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 Fri Sep 24 13:21:47 2004
@@ -31,6 +31,7 @@
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.SchemaType;
/**
* @version $Rev$ $Date$
@@ -203,26 +204,46 @@
public static XmlObject convertToGeronimoNamingSchema(XmlObject xmlObject) {
XmlCursor cursor = xmlObject.newCursor();
- XmlCursor end = xmlObject.newCursor();
+ XmlCursor end = xmlObject.newCursor();
String version = "1.0";
try {
while (cursor.hasNextToken()) {
if (cursor.isStart()) {
String localName = cursor.getName().getLocalPart();
if (localName.equals("ejb-ref")
- || localName.equals("ejb-local-ref")
- || localName.equals("resource-ref")
- || localName.equals("resource-env-ref")) {
+ || localName.equals("ejb-local-ref")
+ || localName.equals("resource-ref")
+ || localName.equals("resource-env-ref")) {
convertElementToSchema(cursor, end, GERONIMO_NAMING_NAMESPACE, GERONIMO_NAMING_NAMESPACE_L0CATION, version);
}
- }
- cursor.toNextToken();
+ }
+ cursor.toNextToken();
}
} finally {
cursor.dispose();
+ end.dispose();
}
return xmlObject;
+ }
+ public static XmlObject getNestedObjectAsType(XmlObject xmlObject, String desiredElement, SchemaType type) {
+ XmlCursor cursor = xmlObject.newCursor();
+ try {
+ while (cursor.hasNextToken()) {
+ if (cursor.isStart()) {
+ String localName = cursor.getName().getLocalPart();
+ if (localName.equals(desiredElement)) {
+ XmlObject child = cursor.getObject();
+ XmlObject result = child.changeType(type);
+ return result;
+ }
+ }
+ cursor.toNextToken();
+ }
+ } finally {
+ cursor.dispose();
+ }
+ throw new IllegalArgumentException("xmlobject did not have desired element: " + desiredElement + "/n" + xmlObject);
}
@@ -252,9 +273,9 @@
public static boolean convertElementToSchema(XmlCursor cursor, XmlCursor end, String namespace, String schemaLocationURL, String version) {
//convert namespace
- // boolean isFirstStart = true;
- end.toCursor(cursor);
- end.toEndToken();
+ // boolean isFirstStart = true;
+ end.toCursor(cursor);
+ end.toEndToken();
while (cursor.hasNextToken() && cursor.isLeftOf(end)) {
if (cursor.isStart()) {
if (namespace.equals(cursor.getName().getNamespaceURI())) {
@@ -263,9 +284,9 @@
}
cursor.setName(new QName(namespace, cursor.getName().getLocalPart()));
cursor.toNextToken();
- // if (isFirstStart) {
- // cursor.insertAttributeWithValue(new QName("http://www.w3.org/2001/XMLSchema-instance", "schemaLocation", "xsi"), namespace + " " + schemaLocationURL);
- // isFirstStart = false;
+ // if (isFirstStart) {
+ // cursor.insertAttributeWithValue(new QName("http://www.w3.org/2001/XMLSchema-instance", "schemaLocation", "xsi"), namespace + " " + schemaLocationURL);
+ // isFirstStart = false;
//}
} else {
cursor.toNextToken();
Modified: geronimo/trunk/modules/j2ee-schema/src/test/org/apache/geronimo/schema/SchemaConversionUtilsTest.java
==============================================================================
--- geronimo/trunk/modules/j2ee-schema/src/test/org/apache/geronimo/schema/SchemaConversionUtilsTest.java (original)
+++ geronimo/trunk/modules/j2ee-schema/src/test/org/apache/geronimo/schema/SchemaConversionUtilsTest.java Fri Sep 24 13:21:47 2004
@@ -24,6 +24,7 @@
import junit.framework.TestCase;
import org.apache.xmlbeans.XmlCursor;
import org.apache.xmlbeans.XmlObject;
+import org.apache.geronimo.xbeans.j2ee.EjbJarType;
/**
* ejb 1.1 dtd appears to be a subset of ejb 2.0 dtd so the same xsl should
@@ -250,6 +251,15 @@
xmlObject = SchemaConversionUtils.convertToGeronimoNamingSchema(xmlObject);
boolean ok2 = compareXmlObjects(xmlObject, expected, problems);
assertTrue("Differences: " + problems, ok2);
+ }
+//
+ public void testGetNestedObjectAsType() throws Exception {
+ File srcXml = new File(basedir, "src/test-data/geronimo/ejb-naming-pre.xml");
+// File expectedOutputXml = new File(basedir, "src/test-data/geronimo/ejb-naming-post.xml");
+ XmlObject xmlObject = XmlObject.Factory.parse(srcXml);
+ //this is not a usable type, we'll see what happens though
+ xmlObject = SchemaConversionUtils.getNestedObjectAsType(xmlObject, "openejb-jar", EjbJarType.type);
+// System.out.println(xmlObject.toString());
}
private boolean compareXmlObjects(XmlObject xmlObject, XmlObject expectedObject, List problems) {
Modified: geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
==============================================================================
--- geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java (original)
+++ geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java Fri Sep 24 13:21:47 2004
@@ -165,29 +165,18 @@
URL path = new URL(moduleBase, "META-INF/geronimo-application.xml");
XmlObject plan = null;
- try {
- plan = SchemaConversionUtils.parse(path.openStream());
- } catch (XmlException e) {
- throw new DeploymentException(e);
- } catch (IOException e) {
- //plan not found, construct default plan
- }
+ plan = getGerConnector(path);
if (plan != null) {
- plan.changeType(GerApplicationDocument.type);
- SchemaConversionUtils.validateDD(plan);
return plan;
}
// try to create a default plan (will return null if this is not an ear file)
- GerApplicationDocument defaultPlan = createDefaultPlan(moduleBase);
+ GerApplicationType defaultPlan = createDefaultPlan(moduleBase);
if (defaultPlan != null) {
return defaultPlan;
}
} catch (MalformedURLException e) {
- } catch (XmlException e) {
- throw new DeploymentException("Invalid geronimo-application.xml", e);
}
-
// support a naked modules
if (webConfigBuilder != null) {
XmlObject plan = webConfigBuilder.getDeploymentPlan(deploymentURL);
@@ -220,7 +209,29 @@
return null;
}
- private GerApplicationDocument createDefaultPlan(URL deploymentURL) {
+ private GerApplicationType getGerConnector(URL path) throws DeploymentException {
+ try {
+ XmlObject dd = SchemaConversionUtils.parse(path.openStream());
+ return (GerApplicationType) validateVendorDD(dd);
+ } catch (IOException e) {
+ //todo should this throw an exception? we have already opened the stream!
+ return null;
+ } catch (XmlException e) {
+ throw new DeploymentException(e);
+ }
+ }
+
+ private XmlObject validateVendorDD(XmlObject dd) throws DeploymentException {
+ try {
+ dd = SchemaConversionUtils.getNestedObjectAsType(dd, "application", GerApplicationType.type);
+ SchemaConversionUtils.validateDD(dd);
+ return dd;
+ } catch (Exception e) {
+ throw new DeploymentException(e);
+ }
+ }
+
+ private GerApplicationType createDefaultPlan(URL deploymentURL) {
// load the web.xml
URL applicationXmlUrl = null;
try {
@@ -242,8 +253,7 @@
}
// construct the empty geronimo-application.xml
- GerApplicationDocument gerApplicationDocument = GerApplicationDocument.Factory.newInstance();
- GerApplicationType gerApplication = gerApplicationDocument.addNewApplication();
+ GerApplicationType gerApplication = GerApplicationType.Factory.newInstance();
// set the parentId and configId
gerApplication.setParentId(PARENT_ID);
@@ -263,7 +273,7 @@
}
gerApplication.setConfigId(id);
- return gerApplicationDocument;
+ return gerApplication;
}
public void buildConfiguration(File outfile, Manifest manifest, final File earFolder, final XmlObject plan) throws IOException, DeploymentException {
@@ -388,7 +398,7 @@
}
private ApplicationType addModules(final JarFile earFile, XmlObject plan, URI configId, Set moduleLocations, Set modules) throws IOException, DeploymentException {
- if (plan instanceof GerApplicationDocument) {
+ if (plan instanceof GerApplicationType) {
ApplicationType application;
JarEntry appXMLEntry = earFile.getJarEntry("META-INF/application.xml");
if (appXMLEntry == null) {
@@ -399,12 +409,12 @@
// build map from module path to alt vendor dd
Map altVendorDDs = new HashMap();
- GerApplicationDocument gerApplication = (GerApplicationDocument) plan;
- GerModuleType gerModuleTypes[] = gerApplication.getApplication().getModuleArray();
+ GerApplicationType gerApplication = (GerApplicationType) plan;
+ GerModuleType gerModuleTypes[] = gerApplication.getModuleArray();
for (int i = 0; i < gerModuleTypes.length; i++) {
GerModuleType gerModuleType = gerModuleTypes[i];
+ String path = null;
if (gerModuleType.isSetAltDd()) {
- String path = null;
if (gerModuleType.isSetEjb()) {
path = gerModuleType.getEjb().getStringValue();
} else if (gerModuleType.isSetWeb()) {
@@ -412,7 +422,18 @@
} else if (gerModuleType.isSetConnector()) {
path = gerModuleType.getConnector().getStringValue();
}
- altVendorDDs.put(path, JarUtil.createJarURL(earFile, gerModuleType.getAltDd().getStringValue()));
+ URL ddURL = JarUtil.createJarURL(earFile, gerModuleType.getAltDd().getStringValue());
+ XmlObject dd = null;
+ try {
+ dd = SchemaConversionUtils.parse(ddURL.openStream());
+ } catch (XmlException e) {
+ throw new DeploymentException(e);
+ }
+
+ altVendorDDs.put(path, dd);
+ } else {
+ //dd is included explicitly
+ altVendorDDs.put(path, gerModuleType.getModuleDd());
}
}
@@ -463,9 +484,9 @@
}
XmlObject vendorDD = null;
- URL altVendorDD = (URL) altVendorDDs.get(modulePath);
+ XmlObject altVendorDD = (XmlObject) altVendorDDs.get(modulePath);
if (altVendorDD != null) {
- vendorDD = builder.parseVendorDD(altVendorDD);
+ vendorDD = builder.validateVendorDD(altVendorDD);
if (vendorDD == null) {
throw new DeploymentException("Invalid alt vendor dd: modulePath=" + modulePath + ", url=" + altVendorDD);
}
@@ -532,9 +553,8 @@
}
private URI getParentId(XmlObject plan) throws DeploymentException {
- if (plan instanceof GerApplicationDocument) {
- GerApplicationDocument applicationDoc = (GerApplicationDocument) plan;
- GerApplicationType application = applicationDoc.getApplication();
+ if (plan instanceof GerApplicationType) {
+ GerApplicationType application = (GerApplicationType) plan;
if (application.isSetParentId()) {
try {
return new URI(application.getParentId());
@@ -574,9 +594,8 @@
}
private URI getConfigId(XmlObject plan) throws DeploymentException {
- if (plan instanceof GerApplicationDocument) {
- GerApplicationDocument applicationDoc = (GerApplicationDocument) plan;
- GerApplicationType application = applicationDoc.getApplication();
+ if (plan instanceof GerApplicationType) {
+ GerApplicationType application = (GerApplicationType) plan;
try {
return new URI(application.getConfigId());
} catch (URISyntaxException e) {
@@ -612,7 +631,7 @@
}
private ConfigurationModuleType getType(XmlObject plan) throws DeploymentException {
- if (plan instanceof GerApplicationDocument) {
+ if (plan instanceof GerApplicationType) {
return ConfigurationModuleType.EAR;
}
Modified: geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/deployment/ModuleBuilder.java
==============================================================================
--- geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/deployment/ModuleBuilder.java (original)
+++ geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/deployment/ModuleBuilder.java Fri Sep 24 13:21:47 2004
@@ -22,7 +22,6 @@
import org.apache.geronimo.deployment.DeploymentException;
import org.apache.xmlbeans.SchemaTypeLoader;
-import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlObject;
/**
@@ -31,7 +30,7 @@
public interface ModuleBuilder {
XmlObject parseSpecDD(URL path) throws DeploymentException;
- XmlObject parseVendorDD(URL vendorURL) throws DeploymentException;
+ XmlObject validateVendorDD(XmlObject vendorDD) throws DeploymentException;
XmlObject getDeploymentPlan(URL module) throws DeploymentException;
Modified: geronimo/trunk/modules/j2ee/src/schema/geronimo-application.xsd
==============================================================================
--- geronimo/trunk/modules/j2ee/src/schema/geronimo-application.xsd (original)
+++ geronimo/trunk/modules/j2ee/src/schema/geronimo-application.xsd Fri Sep 24 13:21:47 2004
@@ -15,7 +15,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
+
<xs:schema
xmlns:geronimo="http://geronimo.apache.org/xml/ns/j2ee/application"
targetNamespace="http://geronimo.apache.org/xml/ns/j2ee/application"
@@ -38,7 +38,7 @@
<xs:attribute name="configId" type="xs:string" use="required"/>
<xs:attribute name="parentId" type="xs:string" use="optional"/>
</xs:complexType>
-
+
<xs:complexType name="moduleType">
<xs:annotation>
<xs:documentation>
@@ -48,22 +48,31 @@
</xs:annotation>
<xs:sequence>
<xs:choice>
- <xs:element name="connector" type="geronimo:pathType"/>
+ <xs:element name="connector" type="geronimo:pathType"/>
<xs:element name="ejb" type="geronimo:pathType"/>
<xs:element name="java" type="geronimo:pathType"/>
<xs:element name="web" type="geronimo:pathType"/>
</xs:choice>
- <xs:element name="alt-dd" type="geronimo:pathType" minOccurs="0">
- <xs:annotation>
- <xs:documentation>
+ <xs:choice>
+ <xs:element name="alt-dd" type="geronimo:pathType">
+ <xs:annotation>
+ <xs:documentation>
Specifies an optional URI to the post-assembly version of the Geronimo
specific deployment descriptor file for a particular J2EE module.
- </xs:documentation>
- </xs:annotation>
- </xs:element>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="module-dd" type="geronimo:module-ddType">
+ <xs:annotation>
+ <xs:documentation>
+ Include the literal vendor dd in the appropriate namespace.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:choice>
</xs:sequence>
</xs:complexType>
-
+
<xs:complexType name="pathType">
<xs:annotation>
<xs:documentation>
@@ -74,7 +83,7 @@
<xs:restriction base="geronimo:string"/>
</xs:simpleContent>
</xs:complexType>
-
+
<xs:complexType name="string">
<xs:annotation>
<xs:documentation>
@@ -83,9 +92,20 @@
</xs:annotation>
<xs:simpleContent>
<xs:extension base="xs:token">
- <xs:attribute name="id" type="xs:ID"/>
+ <xs:attribute name="id" type="xs:ID"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
-
+
+ <xs:complexType name="module-ddType">
+ <xs:annotation>
+ <xs:documentation>
+ contains a literal vendor dd
+ </xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:any/>
+ </xs:sequence>
+ </xs:complexType>
+
</xs:schema>
Modified: geronimo/trunk/modules/j2ee/src/test-unpacked-ear/alt-ger-ejb-jar.xml
==============================================================================
--- geronimo/trunk/modules/j2ee/src/test-unpacked-ear/alt-ger-ejb-jar.xml (original)
+++ geronimo/trunk/modules/j2ee/src/test-unpacked-ear/alt-ger-ejb-jar.xml Fri Sep 24 13:21:47 2004
@@ -0,0 +1,31 @@
+<?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.
+-->
+<openejb-jar
+ xmlns="http://www.openejb.org/xml/ns/openejb-jar"
+ configId="org/openejb/itests"
+ parentId="org/apache/geronimo/Server">
+
+ <cmp-connection-factory>DefaultDatasource</cmp-connection-factory>
+
+ <enterprise-beans>
+ <session>
+ <ejb-name>SimpleStatelessSession</ejb-name>
+ <jndi-name>client/test/simple/SimpleStatelessSessionHome</jndi-name>
+ </session>
+ </enterprise-beans>
+</openejb-jar>
Modified: geronimo/trunk/modules/j2ee/src/test-unpacked-ear/alt-ger-ra.xml
==============================================================================
--- geronimo/trunk/modules/j2ee/src/test-unpacked-ear/alt-ger-ra.xml (original)
+++ geronimo/trunk/modules/j2ee/src/test-unpacked-ear/alt-ger-ra.xml Fri Sep 24 13:21:47 2004
@@ -0,0 +1,23 @@
+<?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.
+-->
+
+<connector xmlns="http://geronimo.apache.org/xml/ns/j2ee" version="1.5"
+ configId="org/apache/geronimo/j2ee/deployment/test"
+ parentId="org/apache/geronimo/Server">
+
+</connector>
Modified: geronimo/trunk/modules/j2ee/src/test-unpacked-ear/alt-ger-war.xml
==============================================================================
--- geronimo/trunk/modules/j2ee/src/test-unpacked-ear/alt-ger-war.xml (original)
+++ geronimo/trunk/modules/j2ee/src/test-unpacked-ear/alt-ger-war.xml Fri Sep 24 13:21:47 2004
@@ -0,0 +1,29 @@
+<?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.
+-->
+
+<jetty:web-app xmlns:jetty="http://geronimo.apache.org/xml/ns/web/jetty">
+ <jetty:context-priority-classloader>false</jetty:context-priority-classloader>
+ <!--
+ <jetty:security>
+ <sec:default-principal realm-name="foo">
+ <sec:principal class="org.apache.geronimo.security.DefaultPrincipal"
+ name="bar"/>
+ </sec:default-principal>
+ </jetty:security>
+ -->
+</jetty:web-app>
Modified: geronimo/trunk/modules/j2ee/src/test/org/apache/geronimo/j2ee/deployment/MockConnectorConfigBuilder.java
==============================================================================
--- geronimo/trunk/modules/j2ee/src/test/org/apache/geronimo/j2ee/deployment/MockConnectorConfigBuilder.java (original)
+++ geronimo/trunk/modules/j2ee/src/test/org/apache/geronimo/j2ee/deployment/MockConnectorConfigBuilder.java Fri Sep 24 13:21:47 2004
@@ -16,17 +16,16 @@
*/
package org.apache.geronimo.j2ee.deployment;
+import java.io.IOException;
+import java.io.InputStream;
import java.net.URI;
import java.net.URL;
import java.util.jar.JarFile;
-import java.io.InputStream;
-import java.io.IOException;
import junit.framework.Assert;
import org.apache.geronimo.deployment.DeploymentException;
import org.apache.xmlbeans.SchemaTypeLoader;
import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlException;
/**
* @version $Rev$ $Date$
@@ -90,21 +89,8 @@
}
}
- public XmlObject parseVendorDD(URL vendorURL) throws DeploymentException {
- InputStream in = null;
- try {
- in = vendorURL.openStream();
- return XmlObject.Factory.newInstance();
- } catch (IOException e) {
- throw new DeploymentException(e);
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (IOException e) {
- }
- }
- }
+ public XmlObject validateVendorDD(XmlObject vendorDD) throws DeploymentException {
+ return XmlObject.Factory.newInstance();
}
public void initContext(EARContext earContext, Module connectorModule, ClassLoader cl) {
Modified: geronimo/trunk/modules/j2ee/src/test/org/apache/geronimo/j2ee/deployment/MockEJBConfigBuilder.java
==============================================================================
--- geronimo/trunk/modules/j2ee/src/test/org/apache/geronimo/j2ee/deployment/MockEJBConfigBuilder.java (original)
+++ geronimo/trunk/modules/j2ee/src/test/org/apache/geronimo/j2ee/deployment/MockEJBConfigBuilder.java Fri Sep 24 13:21:47 2004
@@ -16,17 +16,16 @@
*/
package org.apache.geronimo.j2ee.deployment;
+import java.io.IOException;
+import java.io.InputStream;
import java.net.URI;
import java.net.URL;
import java.util.jar.JarFile;
-import java.io.InputStream;
-import java.io.IOException;
import junit.framework.Assert;
import org.apache.geronimo.deployment.DeploymentException;
import org.apache.xmlbeans.SchemaTypeLoader;
import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlException;
/**
* @version $Rev$ $Date$
@@ -90,21 +89,8 @@
}
}
- public XmlObject parseVendorDD(URL vendorURL) throws DeploymentException {
- InputStream in = null;
- try {
- in = vendorURL.openStream();
- return XmlObject.Factory.newInstance();
- } catch (IOException e) {
- throw new DeploymentException(e);
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (IOException e) {
- }
- }
- }
+ public XmlObject validateVendorDD(XmlObject vendorDD) throws DeploymentException {
+ return XmlObject.Factory.newInstance();
}
public void initContext(EARContext earContext, Module ejbModule, ClassLoader cl) {
Modified: geronimo/trunk/modules/j2ee/src/test/org/apache/geronimo/j2ee/deployment/MockWARConfigBuilder.java
==============================================================================
--- geronimo/trunk/modules/j2ee/src/test/org/apache/geronimo/j2ee/deployment/MockWARConfigBuilder.java (original)
+++ geronimo/trunk/modules/j2ee/src/test/org/apache/geronimo/j2ee/deployment/MockWARConfigBuilder.java Fri Sep 24 13:21:47 2004
@@ -16,17 +16,16 @@
*/
package org.apache.geronimo.j2ee.deployment;
+import java.io.IOException;
+import java.io.InputStream;
import java.net.URI;
import java.net.URL;
import java.util.jar.JarFile;
-import java.io.InputStream;
-import java.io.IOException;
import junit.framework.Assert;
import org.apache.geronimo.deployment.DeploymentException;
import org.apache.xmlbeans.SchemaTypeLoader;
import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlException;
/**
* @version $Rev$ $Date$
@@ -91,21 +90,8 @@
}
}
- public XmlObject parseVendorDD(URL vendorURL) throws DeploymentException {
- InputStream in = null;
- try {
- in = vendorURL.openStream();
- return XmlObject.Factory.newInstance();
- } catch (IOException e) {
- throw new DeploymentException(e);
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (IOException e) {
- }
- }
- }
+ public XmlObject validateVendorDD(XmlObject vendorDD) throws DeploymentException {
+ return XmlObject.Factory.newInstance();
}
public void initContext(EARContext earContext, Module webModule, ClassLoader cl) {
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 Fri Sep 24 13:21:47 2004
@@ -117,9 +117,8 @@
return webAppDoc.getWebApp();
}
- public XmlObject parseVendorDD(URL path) throws DeploymentException {
+ public XmlObject validateVendorDD(XmlObject dd) throws DeploymentException {
try {
- XmlObject dd = SchemaConversionUtils.parse(path.openStream());
dd = SchemaConversionUtils.convertToGeronimoNamingSchema(dd);
dd = dd.changeType(JettyWebAppDocument.type);
SchemaConversionUtils.validateDD(dd);
@@ -137,13 +136,19 @@
} else {
moduleBase = new URL("jar:" + module.toString() + "!/");
}
- JettyWebAppDocument plan = (JettyWebAppDocument) parseVendorDD(new URL(moduleBase, "WEB-INF/geronimo-jetty.xml"));
+ URL path = new URL(moduleBase, "WEB-INF/geronimo-jetty.xml");
+ XmlObject dd = SchemaConversionUtils.parse(path.openStream());
+ JettyWebAppDocument plan = (JettyWebAppDocument) validateVendorDD(dd);
if (plan == null) {
return createDefaultPlan(moduleBase);
}
return plan;
} catch (MalformedURLException e) {
return null;
+ } catch (IOException e) {
+ return null;
+ } catch (XmlException e) {
+ throw new DeploymentException(e);
}
}
|