jboynes 2004/02/08 16:01:20
Modified:
modules/connector/src/java/org/apache/geronimo/connector/deployment
AbstractRARConfigurationFactory.java
RARConfigurationFactory.java
modules/deployment/src/java/org/apache/geronimo/deployment/plugin
DeploymentManagerImpl.java
modules/deployment/src/java/org/apache/geronimo/deployment/plugin/application
EARConfigurationFactory.java
modules/deployment/src/java/org/apache/geronimo/deployment/plugin/client
ClientConfigurationFactory.java
modules/deployment/src/java/org/apache/geronimo/deployment/plugin/factories
DeploymentConfigurationFactory.java
DeploymentFactoryImpl.java
modules/jetty/src/java/org/apache/geronimo/jetty/deployment
WARConfigurationFactory.java
modules/jetty/src/test/org/apache/geronimo/jetty/deployment
DeployerTestCase.java
WARConfigurationFactoryTest.java
Added:
modules/connector/src/java/org/apache/geronimo/connector/deployment
RARConfigurer.java
modules/deployment/src/java/org/apache/geronimo/deployment
ModuleConfigurer.java
modules/deployment/src/java/org/apache/geronimo/deployment/plugin/application
EARConfigurer.java
modules/jetty/src/java/org/apache/geronimo/jetty/deployment
WARConfigurer.java
Log:
Split createConfiguration out from DeploymentConfigurationFactory into its
own interface
This is because the configure and distribute sides of JSR88 don't overlap much
Revision Changes Path
1.3 +1 -8
incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/deployment/AbstractRARConfigurationFactory.java
Index: AbstractRARConfigurationFactory.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/deployment/AbstractRARConfigurationFactory.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AbstractRARConfigurationFactory.java 6 Feb 2004 08:56:42 -0000
1.2
+++ AbstractRARConfigurationFactory.java 9 Feb 2004 00:01:19 -0000
1.3
@@ -95,13 +95,6 @@
return connectionTrackerNamePattern;
}
- public DeploymentConfiguration createConfiguration(DeployableObject
deployable) throws InvalidModuleException {
- if (!ModuleType.RAR.equals(deployable.getType())) {
- throw new InvalidModuleException("DeployableObject must be a
RAR");
- }
- return new RARConfiguration(deployable);
- }
-
public abstract DeploymentModule createModule(InputStream moduleArchive,
XmlObject geronimoDD, URI configID, boolean isLocal) throws DeploymentException;
public SchemaTypeLoader getSchemaTypeLoader() {
1.4 +1 -8
incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/deployment/RARConfigurationFactory.java
Index: RARConfigurationFactory.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/deployment/RARConfigurationFactory.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- RARConfigurationFactory.java 8 Feb 2004 20:21:57 -0000 1.3
+++ RARConfigurationFactory.java 9 Feb 2004 00:01:19 -0000 1.4
@@ -98,13 +98,6 @@
return connectionTrackerNamePattern;
}
- public DeploymentConfiguration createConfiguration(DeployableObject
deployable) throws InvalidModuleException {
- if (!ModuleType.RAR.equals(deployable.getType())) {
- throw new InvalidModuleException("DeployableObject must be a
RAR");
- }
- return new RARConfiguration(deployable);
- }
-
public DeploymentModule createModule(InputStream moduleArchive,
XmlObject geronimoDD, URI configID, boolean isLocal) throws DeploymentException
{
GerConnectorDocument geronimoConnectorDocument =
(GerConnectorDocument) geronimoDD;
GerVersionType.Enum version =
geronimoConnectorDocument.getConnector().getVersion();
1.1
incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/deployment/RARConfigurer.java
Index: RARConfigurer.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Geronimo" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Geronimo", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* ====================================================================
*/
package org.apache.geronimo.connector.deployment;
import javax.enterprise.deploy.model.DeployableObject;
import javax.enterprise.deploy.shared.ModuleType;
import javax.enterprise.deploy.spi.DeploymentConfiguration;
import org.apache.geronimo.deployment.ModuleConfigurer;
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.GBeanInfoFactory;
/**
*
*
* @version $Revision: 1.1 $ $Date: 2004/02/09 00:01:19 $
*/
public class RARConfigurer implements ModuleConfigurer {
public DeploymentConfiguration createConfiguration(DeployableObject
deployable) {
if (ModuleType.RAR.equals(deployable.getType())) {
return new RARConfiguration(deployable);
} else {
return null;
}
}
public static final GBeanInfo GBEAN_INFO;
static {
GBeanInfoFactory infoFactory = new
GBeanInfoFactory(RARConfigurer.class);
infoFactory.addInterface(ModuleConfigurer.class);
GBEAN_INFO = infoFactory.getBeanInfo();
}
public static GBeanInfo getGBeanInfo() {
return GBEAN_INFO;
}
}
1.1
incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/ModuleConfigurer.java
Index: ModuleConfigurer.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Geronimo" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Geronimo", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* ====================================================================
*/
package org.apache.geronimo.deployment;
import javax.enterprise.deploy.spi.DeploymentConfiguration;
import javax.enterprise.deploy.model.DeployableObject;
/**
* Interface to be implemented by the deployment subsystem for any type
* of component (e.g. EAR, WAR, ...) that needs configuration.
*
* @version $Revision: 1.1 $ $Date: 2004/02/09 00:01:19 $
*/
public interface ModuleConfigurer {
/**
* JSR88 method for getting the vendor part of the deployment
configuration
* @param deployable the object the tool is trying to deploy
* @return the vendor-specific deployment configuration, or null a
configurer cannot handle the DeployableObject
*/
DeploymentConfiguration createConfiguration(DeployableObject deployable);
}
1.9 +16 -8
incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/DeploymentManagerImpl.java
Index: DeploymentManagerImpl.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/DeploymentManagerImpl.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- DeploymentManagerImpl.java 6 Feb 2004 08:55:04 -0000 1.8
+++ DeploymentManagerImpl.java 9 Feb 2004 00:01:19 -0000 1.9
@@ -67,6 +67,7 @@
import java.util.LinkedHashMap;
import java.util.Locale;
import java.util.Map;
+import java.util.Collection;
import javax.enterprise.deploy.model.DeployableObject;
import javax.enterprise.deploy.shared.CommandType;
@@ -83,6 +84,7 @@
import org.apache.geronimo.deployment.DeploymentException;
import org.apache.geronimo.deployment.DeploymentModule;
+import org.apache.geronimo.deployment.ModuleConfigurer;
import
org.apache.geronimo.deployment.plugin.factories.DeploymentConfigurationFactory;
import org.apache.geronimo.gbean.GBean;
import org.apache.geronimo.gbean.GBeanContext;
@@ -110,9 +112,11 @@
private final SchemaTypeLoader thisTypeLoader =
XmlBeans.getContextTypeLoader();
private SchemaTypeLoader schemaTypeLoader = thisTypeLoader;
private final Map configurationFactories;
+ private final Collection configurers;
public DeploymentManagerImpl(
DeploymentServer server,
+ Collection configurers,
DeploymentConfigurationFactory earFactory,
DeploymentConfigurationFactory warFactory,
DeploymentConfigurationFactory ejbFactory,
@@ -120,6 +124,7 @@
DeploymentConfigurationFactory carFactory
) {
this.server = server;
+ this.configurers = configurers;
//make sure context loader is always present
//todo think if null is a plausible key here.
schemaTypeToLoaderMap.put(null, thisTypeLoader);
@@ -155,12 +160,14 @@
}
public DeploymentConfiguration createConfiguration(DeployableObject
deployable) throws InvalidModuleException {
- ModuleType type = deployable.getType();
- DeploymentConfigurationFactory factory =
(DeploymentConfigurationFactory) configurationFactories.get(type);
- if (factory == null) {
- throw new InvalidModuleException("Unable to load
DeploymentConfigurationFactory");
+ for (Iterator i = configurers.iterator(); i.hasNext();) {
+ ModuleConfigurer configurer = (ModuleConfigurer) i.next();
+ DeploymentConfiguration config =
configurer.createConfiguration(deployable);
+ if (config != null) {
+ return config;
+ }
}
- return factory.createConfiguration(deployable);
+ throw new InvalidModuleException("Unable to load
DeploymentConfigurationFactory");
}
public DConfigBeanVersionType getDConfigBeanVersion() {
@@ -355,14 +362,15 @@
infoFactory.addOperation(new
GOperationInfo("addDeploymentConfigurationFactory", new
String[]{SchemaType.class.getName(), SchemaTypeLoader.class.getName(),
DeploymentConfigurationFactory.class.getName()}));
infoFactory.addOperation(new
GOperationInfo("removeDeploymentConfigurationFactory", new
String[]{SchemaType.class.getName()}));
infoFactory.addReference(new GReferenceInfo("Server",
DeploymentServer.class.getName()));
+ infoFactory.addReference(new GReferenceInfo("Configurers",
ModuleConfigurer.class));
infoFactory.addReference(new GReferenceInfo("EARFactory",
DeploymentConfigurationFactory.class.getName()));
infoFactory.addReference(new GReferenceInfo("WARFactory",
DeploymentConfigurationFactory.class.getName()));
infoFactory.addReference(new GReferenceInfo("EJBFactory",
DeploymentConfigurationFactory.class.getName()));
infoFactory.addReference(new GReferenceInfo("RARFactory",
DeploymentConfigurationFactory.class.getName()));
infoFactory.addReference(new GReferenceInfo("CARFactory",
DeploymentConfigurationFactory.class.getName()));
infoFactory.setConstructor(new GConstructorInfo(
- Arrays.asList(new Object[]{"Server", "EARFactory",
"WARFactory", "EJBFactory", "RARFactory", "CARFactory"}),
- Arrays.asList(new Object[]{DeploymentServer.class,
DeploymentConfigurationFactory.class, DeploymentConfigurationFactory.class,
DeploymentConfigurationFactory.class, DeploymentConfigurationFactory.class,
DeploymentConfigurationFactory.class})
+ Arrays.asList(new Object[]{"Server", "Configurers",
"EARFactory", "WARFactory", "EJBFactory", "RARFactory", "CARFactory"}),
+ Arrays.asList(new Object[]{DeploymentServer.class,
Collection.class, DeploymentConfigurationFactory.class,
DeploymentConfigurationFactory.class, DeploymentConfigurationFactory.class,
DeploymentConfigurationFactory.class, DeploymentConfigurationFactory.class})
));
GBEAN_INFO = infoFactory.getBeanInfo();
}
1.6 +1 -7
incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/application/EARConfigurationFactory.java
Index: EARConfigurationFactory.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/application/EARConfigurationFactory.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- EARConfigurationFactory.java 6 Feb 2004 08:55:04 -0000 1.5
+++ EARConfigurationFactory.java 9 Feb 2004 00:01:19 -0000 1.6
@@ -83,12 +83,6 @@
public class EARConfigurationFactory implements
DeploymentConfigurationFactory {
private static final SchemaTypeLoader SCHEMA_TYPE_LOADER =
XmlBeans.getContextTypeLoader();
- public DeploymentConfiguration createConfiguration(DeployableObject
deployable) throws InvalidModuleException {
- if (!ModuleType.EAR.equals(deployable.getType())) {
- throw new InvalidModuleException("DeployableObject must be an
EAR");
- }
- return new EARConfiguration(deployable);
- }
public DeploymentModule createModule(InputStream moduleArchive,
XmlObject deploymentPlan, URI configID, boolean isLocal) throws
DeploymentException {
return null;
1.1
incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/application/EARConfigurer.java
Index: EARConfigurer.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Geronimo" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Geronimo", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* ====================================================================
*/
package org.apache.geronimo.deployment.plugin.application;
import javax.enterprise.deploy.model.DeployableObject;
import javax.enterprise.deploy.shared.ModuleType;
import javax.enterprise.deploy.spi.DeploymentConfiguration;
import org.apache.geronimo.deployment.ModuleConfigurer;
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.GBeanInfoFactory;
/**
*
*
* @version $Revision: 1.1 $ $Date: 2004/02/09 00:01:19 $
*/
public class EARConfigurer implements ModuleConfigurer {
public DeploymentConfiguration createConfiguration(DeployableObject
deployable) {
if (ModuleType.EAR.equals(deployable.getType())) {
return new EARConfiguration(deployable);
} else {
return null;
}
}
public static final GBeanInfo GBEAN_INFO;
static {
GBeanInfoFactory infoFactory = new
GBeanInfoFactory(EARConfigurer.class);
infoFactory.addInterface(ModuleConfigurer.class);
GBEAN_INFO = infoFactory.getBeanInfo();
}
public static GBeanInfo getGBeanInfo() {
return GBEAN_INFO;
}
}
1.6 +1 -4
incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/client/ClientConfigurationFactory.java
Index: ClientConfigurationFactory.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/client/ClientConfigurationFactory.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ClientConfigurationFactory.java 6 Feb 2004 08:55:04 -0000 1.5
+++ ClientConfigurationFactory.java 9 Feb 2004 00:01:19 -0000 1.6
@@ -78,9 +78,6 @@
*/
public class ClientConfigurationFactory implements
DeploymentConfigurationFactory {
private static final SchemaTypeLoader SCHEMA_TYPE_LOADER =
XmlBeans.getContextTypeLoader();
- public DeploymentConfiguration createConfiguration(DeployableObject
deployable) throws InvalidModuleException {
- return null;
- }
public DeploymentModule createModule(InputStream moduleArchive,
XmlObject deploymentPlan, URI configID, boolean isLocal) throws
DeploymentException {
return null;
1.6 +1 -2
incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/factories/DeploymentConfigurationFactory.java
Index: DeploymentConfigurationFactory.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/factories/DeploymentConfigurationFactory.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- DeploymentConfigurationFactory.java 6 Feb 2004 08:55:04 -0000
1.5
+++ DeploymentConfigurationFactory.java 9 Feb 2004 00:01:19 -0000
1.6
@@ -74,7 +74,6 @@
* @version $Revision$ $Date$
*/
public interface DeploymentConfigurationFactory {
- public DeploymentConfiguration createConfiguration(DeployableObject
deployable) throws InvalidModuleException;
public DeploymentModule createModule(InputStream moduleArchive,
XmlObject deploymentPlan, URI configID, boolean isLocal) throws
DeploymentException;
1.6 +12 -5
incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/factories/DeploymentFactoryImpl.java
Index: DeploymentFactoryImpl.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/factories/DeploymentFactoryImpl.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- DeploymentFactoryImpl.java 4 Feb 2004 05:43:31 -0000 1.5
+++ DeploymentFactoryImpl.java 9 Feb 2004 00:01:19 -0000 1.6
@@ -65,6 +65,7 @@
import org.apache.geronimo.deployment.plugin.DisconnectedServer;
import org.apache.geronimo.deployment.plugin.local.LocalServer;
import
org.apache.geronimo.deployment.plugin.application.EARConfigurationFactory;
+import org.apache.geronimo.deployment.plugin.application.EARConfigurer;
import org.apache.geronimo.gbean.InvalidConfigurationException;
import org.apache.geronimo.gbean.jmx.GBeanMBean;
import org.apache.geronimo.kernel.Kernel;
@@ -136,9 +137,10 @@
ObjectName managerName = new
ObjectName("geronimo.deployment:role=DeploymentManager");
manager = new GBeanMBean(DeploymentManagerImpl.GBEAN_INFO);
manager.setReferencePatterns("Server",
Collections.singleton(serverName));
+ manager.setReferencePatterns("Configurers",
Collections.singleton(new ObjectName("geronimo.deployment:role=Configurer,*")));
// @todo for now lets hard code the deployers to use -
ultimately this should use a predefined Configuration
- loadFactory(kernel, manager, "EARFactory",
EARConfigurationFactory.class.getName());
+ loadFactory(kernel, manager, "EAR",
EARConfigurationFactory.class.getName(), EARConfigurer.class.getName());
kernel.loadGBean(managerName, manager);
kernel.startGBean(managerName);
@@ -150,11 +152,16 @@
return (DeploymentManager) manager.getTarget();
}
- private void loadFactory(Kernel kernel, GBeanMBean manager, String
factory, String className) throws Exception {
- ObjectName earFactoryName = new
ObjectName("geronimo.deployment:role="+factory);
+ private void loadFactory(Kernel kernel, GBeanMBean manager, String
factory, String className, String configurerClassName) throws Exception {
+ ObjectName earFactoryName = new
ObjectName("geronimo.deployment:role=Factory,type="+factory);
GBeanMBean earFactory = new GBeanMBean(className);
kernel.loadGBean(earFactoryName, earFactory);
kernel.startGBean(earFactoryName);
- manager.setReferencePatterns(factory,
Collections.singleton(earFactoryName));
+ manager.setReferencePatterns(factory+"Factory",
Collections.singleton(earFactoryName));
+
+ ObjectName configurerName = new
ObjectName("geronimo.deployment:role=Configurer,type="+factory);
+ GBeanMBean configurer = new GBeanMBean(configurerClassName);
+ kernel.loadGBean(configurerName, configurer);
+ kernel.startGBean(configurerName);
}
}
1.7 +1 -8
incubator-geronimo/modules/jetty/src/java/org/apache/geronimo/jetty/deployment/WARConfigurationFactory.java
Index: WARConfigurationFactory.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/jetty/src/java/org/apache/geronimo/jetty/deployment/WARConfigurationFactory.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- WARConfigurationFactory.java 8 Feb 2004 20:19:21 -0000 1.6
+++ WARConfigurationFactory.java 9 Feb 2004 00:01:20 -0000 1.7
@@ -82,13 +82,6 @@
public class WARConfigurationFactory implements
DeploymentConfigurationFactory {
private static final SchemaTypeLoader SCHEMA_TYPE_LOADER =
XmlBeans.getContextTypeLoader();
- public DeploymentConfiguration createConfiguration(DeployableObject
deployable) throws InvalidModuleException {
- if (!ModuleType.WAR.equals(deployable.getType())) {
- throw new InvalidModuleException("DeployableObject must be a
WAR");
- }
- return new WARConfiguration(deployable);
- }
-
//TODO a createModule method taking a file/directory for unpacked jsp
handling.
//Should create a UnpackedModule if supplied file is a directory.
public DeploymentModule createModule(InputStream moduleArchive,
XmlObject deploymentPlan, URI configID, boolean isLocal) throws
DeploymentException {
1.1
incubator-geronimo/modules/jetty/src/java/org/apache/geronimo/jetty/deployment/WARConfigurer.java
Index: WARConfigurer.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Geronimo" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Geronimo", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* ====================================================================
*/
package org.apache.geronimo.jetty.deployment;
import javax.enterprise.deploy.model.DeployableObject;
import javax.enterprise.deploy.shared.ModuleType;
import javax.enterprise.deploy.spi.DeploymentConfiguration;
import org.apache.geronimo.deployment.ModuleConfigurer;
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.GBeanInfoFactory;
/**
*
*
* @version $Revision: 1.1 $ $Date: 2004/02/09 00:01:20 $
*/
public class WARConfigurer implements ModuleConfigurer {
public DeploymentConfiguration createConfiguration(DeployableObject
deployable) {
if (ModuleType.WAR.equals(deployable.getType())) {
return new WARConfiguration(deployable);
} else {
return null;
}
}
public static final GBeanInfo GBEAN_INFO;
static {
GBeanInfoFactory infoFactory = new
GBeanInfoFactory(WARConfigurer.class);
infoFactory.addInterface(ModuleConfigurer.class);
GBEAN_INFO = infoFactory.getBeanInfo();
}
public static GBeanInfo getGBeanInfo() {
return GBEAN_INFO;
}
}
1.5 +8 -2
incubator-geronimo/modules/jetty/src/test/org/apache/geronimo/jetty/deployment/DeployerTestCase.java
Index: DeployerTestCase.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/jetty/src/test/org/apache/geronimo/jetty/deployment/DeployerTestCase.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DeployerTestCase.java 4 Feb 2004 05:45:11 -0000 1.4
+++ DeployerTestCase.java 9 Feb 2004 00:01:20 -0000 1.5
@@ -99,13 +99,19 @@
serverName = new ObjectName("geronimo.deployment:role=Server");
- warName = new ObjectName("geronimo.deployment:role=WARFactory");
+ warName = new
ObjectName("geronimo.deployment:role=Factory,type=WAR");
GBeanMBean warFactoryGBean = new
GBeanMBean(WARConfigurationFactory.GBEAN_INFO);
+ ObjectName warConfigurerName = new
ObjectName("geronimo.deployment:role=Configurer,type=WAR");
+ GBeanMBean warConfigurer = new GBeanMBean(WARConfigurer.GBEAN_INFO);
+ kernel.loadGBean(warConfigurerName, warConfigurer);
+ kernel.startGBean(warConfigurerName);
+
managerName = new
ObjectName("geronimo.deployment:role=DeploymentManager");
managerGBean = new GBeanMBean(DeploymentManagerImpl.GBEAN_INFO);
managerGBean.setReferencePatterns("WARFactory",
Collections.singleton(warName));
managerGBean.setReferencePatterns("Server",
Collections.singleton(serverName));
+ managerGBean.setReferencePatterns("Configurers",
Collections.singleton(new ObjectName("geronimo.deployment:role=Configurer,*")));
kernel.loadGBean(warName, warFactoryGBean);
kernel.startGBean(warName);
1.8 +5 -11
incubator-geronimo/modules/jetty/src/test/org/apache/geronimo/jetty/deployment/WARConfigurationFactoryTest.java
Index: WARConfigurationFactoryTest.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/jetty/src/test/org/apache/geronimo/jetty/deployment/WARConfigurationFactoryTest.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- WARConfigurationFactoryTest.java 6 Feb 2004 08:55:49 -0000 1.7
+++ WARConfigurationFactoryTest.java 9 Feb 2004 00:01:20 -0000 1.8
@@ -75,15 +75,9 @@
*/
public class WARConfigurationFactoryTest extends DeployerTestCase {
- public void testFactory() throws Exception {
- WebDeployable deployable = new
WebDeployable(classLoader.getResource("deployables/war1/"));
- DeploymentConfiguration config =
manager.createConfiguration(deployable);
- assertEquals(deployable, config.getDeployableObject());
- }
-
public void testConfig() throws Exception {
WebDeployable deployable = new
WebDeployable(classLoader.getResource("deployables/war1/"));
- WARConfiguration config = (WARConfiguration)
warFactory.createConfiguration(deployable);
+ WARConfiguration config = new WARConfiguration(deployable);
assertNotNull(config);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
config.save(baos);
@@ -98,7 +92,7 @@
public void testConfigSet() throws Exception {
WebDeployable deployable = new
WebDeployable(classLoader.getResource("deployables/war1/"));
- WARConfiguration config = (WARConfiguration)
warFactory.createConfiguration(deployable);
+ WARConfiguration config = new WARConfiguration(deployable);
DConfigBeanRoot configRoot =
config.getDConfigBeanRoot(deployable.getDDBeanRoot());
WebAppDConfigBean contextBean = (WebAppDConfigBean)
configRoot.getDConfigBean(deployable.getChildBean("/web-app")[0]);
contextBean.setContextRoot("/test");
@@ -118,7 +112,7 @@
public void testConfigSaveRestore() throws Exception {
WebDeployable deployable = new
WebDeployable(classLoader.getResource("deployables/war1/"));
- WARConfiguration config = (WARConfiguration)
warFactory.createConfiguration(deployable);
+ WARConfiguration config = new WARConfiguration(deployable);
DConfigBeanRoot configRoot =
config.getDConfigBeanRoot(deployable.getDDBeanRoot());
WebAppDConfigBean contextBean = (WebAppDConfigBean)
configRoot.getDConfigBean(deployable.getChildBean("/web-app")[0]);
contextBean.setContextRoot("/test");
@@ -131,7 +125,7 @@
String output = new String(bytes);
System.out.println(output);
- config = (WARConfiguration)
warFactory.createConfiguration(deployable);
+ config = new WARConfiguration(deployable);
configRoot = config.getDConfigBeanRoot(deployable.getDDBeanRoot());
contextBean = (WebAppDConfigBean)
configRoot.getDConfigBean(deployable.getChildBean("/web-app")[0]);