Author: dain Date: Mon Sep 27 12:34:21 2004 New Revision: 47327 Modified: geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java geronimo/trunk/modules/j2ee-schema/src/java/org/apache/geronimo/schema/SchemaConversionUtils.java geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java Log: Application client schema code was attempting to convert application-client.xml into an applcation.xml Added better error messages when a module does not contain a specDD (or the alt-dd is invalid)
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 Mon Sep 27 12:34:21 2004 @@ -106,8 +106,11 @@ specDD = IOUtil.readAll(appClientXmlUrl); // check if we have an alt spec dd - ApplicationClientDocument appClientDoc = SchemaConversionUtils.convertToApplicationClientSchema(SchemaConversionUtils.parse(specDD)); + XmlObject xmlObject = SchemaConversionUtils.parse(specDD); + ApplicationClientDocument appClientDoc = SchemaConversionUtils.convertToApplicationClientSchema(xmlObject); appClient = appClientDoc.getApplicationClient(); + } catch (XmlException e) { + throw new DeploymentException("Unable to parse application-client.xml", e); } catch (Exception e) { return null; } 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 Mon Sep 27 12:34:21 2004 @@ -123,7 +123,7 @@ } finally { cursor.dispose(); } - XmlObject result = xmlObject.changeType(ApplicationDocument.type); + XmlObject result = xmlObject.changeType(ApplicationClientDocument.type); if (result != null) { validateDD(result); return (ApplicationClientDocument) result; 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 Mon Sep 27 12:34:21 2004 @@ -131,7 +131,7 @@ module = appClientConfigBuilder.createModule(name, planFile, jarFile, null, null); } if (module == null) { - throw new DeploymentException("Could not build module list; Unknown plan type"); + return null; } // in the case of a stand alone module we actually want the name to be the @@ -384,30 +384,35 @@ String modulePath; ModuleBuilder builder; + String moduleTypeName; if (moduleXml.isSetEjb()) { modulePath = moduleXml.getEjb().getStringValue(); if (ejbConfigBuilder == null) { throw new DeploymentException("Can not deploy ejb application; No ejb deployer defined: " + modulePath); } builder = ejbConfigBuilder; + moduleTypeName = "an EJB"; } else if (moduleXml.isSetWeb()) { modulePath = moduleXml.getWeb().getWebUri().getStringValue(); if (webConfigBuilder == null) { throw new DeploymentException("Can not deploy web application; No war deployer defined: " + modulePath); } builder = webConfigBuilder; + moduleTypeName = "a war"; } else if (moduleXml.isSetConnector()) { modulePath = moduleXml.getConnector().getStringValue(); if (connectorConfigBuilder == null) { throw new DeploymentException("Can not deploy resource adapter; No rar deployer defined: " + modulePath); } builder = connectorConfigBuilder; + moduleTypeName = "a connector"; } else if (moduleXml.isSetJava()) { modulePath = moduleXml.getJava().getStringValue(); if (appClientConfigBuilder == null) { throw new DeploymentException("Can not deploy app client; No app client deployer defined: " + modulePath); } builder = appClientConfigBuilder; + moduleTypeName = "an application client"; } else { throw new DeploymentException("Could not find a module builder for module: " + moduleXml); } @@ -424,6 +429,10 @@ new NestedJarFile(earFile, modulePath), altSpecDD, modulePath); + + if (module == null) { + throw new DeploymentException("Module was not " + moduleTypeName + ": " + modulePath); + } if (module instanceof WebModule) { ((WebModule) module).setContextRoot(moduleXml.getWeb().getContextRoot().getStringValue());