geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r493181 - in /geronimo/server/trunk/modules: geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/jsr88/ geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ geronimo-deploy-config/src/main/...
Date Fri, 05 Jan 2007 20:32:03 GMT
Author: djencks
Date: Fri Jan  5 12:32:03 2007
New Revision: 493181

URL: http://svn.apache.org/viewvc?view=rev&rev=493181
Log:
GERONIMO-2686 Implement registration for ModuleConfigurers.  Requires openejb changes also
which will take a while to locate and commit

Added:
    geronimo/server/trunk/modules/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/jsr88/ClientConfiguration.java
  (with props)
    geronimo/server/trunk/modules/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/jsr88/ClientConfigurer.java
  (with props)
Modified:
    geronimo/server/trunk/modules/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/RARConfigurer.java
    geronimo/server/trunk/modules/geronimo-deploy-config/src/main/java/org/apache/geronimo/deployment/ModuleConfigurer.java
    geronimo/server/trunk/modules/geronimo-deploy-jsr88/pom.xml
    geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/JMXDeploymentManager.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/jsr88/EARConfigurer.java
    geronimo/server/trunk/modules/geronimo-web-builder/src/main/java/org/apache/geronimo/web/deployment/WARConfigurer.java

Added: geronimo/server/trunk/modules/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/jsr88/ClientConfiguration.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/jsr88/ClientConfiguration.java?view=auto&rev=493181
==============================================================================
--- geronimo/server/trunk/modules/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/jsr88/ClientConfiguration.java
(added)
+++ geronimo/server/trunk/modules/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/jsr88/ClientConfiguration.java
Fri Jan  5 12:32:03 2007
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+package org.apache.geronimo.client.builder.jsr88;
+
+import javax.enterprise.deploy.model.DeployableObject;
+
+import org.apache.geronimo.deployment.plugin.DeploymentConfigurationSupport;
+
+/**
+ *
+ *
+ * @version $Rev$ $Date$
+ */
+public class ClientConfiguration extends DeploymentConfigurationSupport {
+    public ClientConfiguration(DeployableObject deployable) {
+        super(deployable, null);
+    }
+}

Propchange: geronimo/server/trunk/modules/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/jsr88/ClientConfiguration.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/modules/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/jsr88/ClientConfiguration.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/modules/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/jsr88/ClientConfiguration.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/modules/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/jsr88/ClientConfigurer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/jsr88/ClientConfigurer.java?view=auto&rev=493181
==============================================================================
--- geronimo/server/trunk/modules/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/jsr88/ClientConfigurer.java
(added)
+++ geronimo/server/trunk/modules/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/jsr88/ClientConfigurer.java
Fri Jan  5 12:32:03 2007
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+package org.apache.geronimo.client.builder.jsr88;
+
+import javax.enterprise.deploy.spi.DeploymentConfiguration;
+import javax.enterprise.deploy.model.DeployableObject;
+import javax.enterprise.deploy.shared.ModuleType;
+
+import org.apache.geronimo.deployment.ModuleConfigurer;
+import org.apache.geronimo.j2ee.jsr88.EARConfiguration;
+import org.apache.geronimo.j2ee.jsr88.EARConfigurer;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+
+/**
+ *
+ *
+ * @version $Rev$ $Date$
+ */
+public class ClientConfigurer implements ModuleConfigurer {
+    public DeploymentConfiguration createConfiguration(DeployableObject deployable) {
+        if (ModuleType.EAR.equals(deployable.getType())) {
+            return new EARConfiguration(deployable);
+        } else {
+            return null;
+        }
+    }
+
+    public ModuleType getModuleType() {
+        return ModuleType.EAR;
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(ClientConfigurer.class,
NameFactory.DEPLOYMENT_CONFIGURER);
+        infoFactory.addInterface(ModuleConfigurer.class);
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return ClientConfigurer.GBEAN_INFO;
+    }
+}

Propchange: geronimo/server/trunk/modules/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/jsr88/ClientConfigurer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/modules/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/jsr88/ClientConfigurer.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/modules/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/jsr88/ClientConfigurer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/trunk/modules/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/RARConfigurer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/RARConfigurer.java?view=diff&rev=493181&r1=493180&r2=493181
==============================================================================
--- geronimo/server/trunk/modules/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/RARConfigurer.java
(original)
+++ geronimo/server/trunk/modules/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/RARConfigurer.java
Fri Jan  5 12:32:03 2007
@@ -52,6 +52,10 @@
         }
     }
 
+    public ModuleType getModuleType() {
+        return ModuleType.RAR;
+    }
+
     public static final GBeanInfo GBEAN_INFO;
 
     static {

Modified: geronimo/server/trunk/modules/geronimo-deploy-config/src/main/java/org/apache/geronimo/deployment/ModuleConfigurer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-deploy-config/src/main/java/org/apache/geronimo/deployment/ModuleConfigurer.java?view=diff&rev=493181&r1=493180&r2=493181
==============================================================================
--- geronimo/server/trunk/modules/geronimo-deploy-config/src/main/java/org/apache/geronimo/deployment/ModuleConfigurer.java
(original)
+++ geronimo/server/trunk/modules/geronimo-deploy-config/src/main/java/org/apache/geronimo/deployment/ModuleConfigurer.java
Fri Jan  5 12:32:03 2007
@@ -19,6 +19,7 @@
 
 import javax.enterprise.deploy.spi.DeploymentConfiguration;
 import javax.enterprise.deploy.model.DeployableObject;
+import javax.enterprise.deploy.shared.ModuleType;
 
 /**
  * Interface to be implemented by the deployment subsystem for any type
@@ -33,4 +34,10 @@
      * @return the vendor-specific deployment configuration, or null a configurer cannot
handle the DeployableObject
      */
     DeploymentConfiguration createConfiguration(DeployableObject deployable);
+
+    /**
+     * Supply the module type this configurer handles for indexing
+     * @return ModuleType handled by this Configurer.
+     */
+    ModuleType getModuleType();
 }

Modified: geronimo/server/trunk/modules/geronimo-deploy-jsr88/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-deploy-jsr88/pom.xml?view=diff&rev=493181&r1=493180&r2=493181
==============================================================================
--- geronimo/server/trunk/modules/geronimo-deploy-jsr88/pom.xml (original)
+++ geronimo/server/trunk/modules/geronimo-deploy-jsr88/pom.xml Fri Jan  5 12:32:03 2007
@@ -41,8 +41,9 @@
         </dependency>
 
         <dependency>
-            <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-j2ee-deployment_1.1_spec</artifactId>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-deploy-config</artifactId>
+            <version>${version}</version>
         </dependency>
         
         <dependency>

Modified: geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/JMXDeploymentManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/JMXDeploymentManager.java?view=diff&rev=493181&r1=493180&r2=493181
==============================================================================
--- geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/JMXDeploymentManager.java
(original)
+++ geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/JMXDeploymentManager.java
Fri Jan  5 12:32:03 2007
@@ -21,6 +21,9 @@
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+import java.util.HashMap;
 
 import javax.enterprise.deploy.model.DeployableObject;
 import javax.enterprise.deploy.shared.DConfigBeanVersionType;
@@ -36,6 +39,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.deployment.ModuleConfigurer;
 import org.apache.geronimo.deployment.plugin.TargetImpl;
 import org.apache.geronimo.deployment.plugin.TargetModuleIDImpl;
 import org.apache.geronimo.deployment.plugin.local.CommandSupport;
@@ -45,6 +49,8 @@
 import org.apache.geronimo.deployment.plugin.local.StopCommand;
 import org.apache.geronimo.deployment.plugin.local.UndeployCommand;
 import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.config.ConfigurationInfo;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
@@ -58,15 +64,27 @@
  */
 public abstract class JMXDeploymentManager implements DeploymentManager {
     private static final Log log = LogFactory.getLog(JMXDeploymentManager.class);
+    private static final AbstractNameQuery CONFIGURER_QUERY = new AbstractNameQuery(ModuleConfigurer.class.getName());
 
     protected Kernel kernel;
     private ConfigurationManager configurationManager;
     private CommandContext commandContext;
+    private Map<ModuleType, ModuleConfigurer> moduleConfigurers = new HashMap<ModuleType,
ModuleConfigurer>();
 
     protected void initialize(Kernel kernel) {
         this.kernel = kernel;
         configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
         commandContext = new CommandContext(true, true, null, null, false);
+        Set configurerNames = kernel.listGBeans(CONFIGURER_QUERY);
+        for (Object configurerName : configurerNames) {
+            AbstractName name = (AbstractName) configurerName;
+            try {
+                ModuleConfigurer configurer = (ModuleConfigurer) kernel.getGBean(name);
+                moduleConfigurers.put(configurer.getModuleType(), configurer);
+            } catch (GBeanNotFoundException e) {
+                log.warn("No gbean found for name returned in query : " + name);
+            }
+        }
     }
 
     public void setAuthentication(String username, String password) {
@@ -138,22 +156,22 @@
             throw new IllegalStateException("Disconnected");
         }
         try {
-            ArrayList result = new ArrayList();
-            for (int i = 0; i < targetList.length; i++) {
-                TargetImpl target = (TargetImpl) targetList[i];
+            ArrayList<TargetModuleIDImpl> result = new ArrayList<TargetModuleIDImpl>();
+            for (Target aTargetList : targetList) {
+                TargetImpl target = (TargetImpl) aTargetList;
                 AbstractName storeName = target.getAbstractName();
                 List infos = configurationManager.listConfigurations(storeName);
-                for (int j = 0; j < infos.size(); j++) {
-                    ConfigurationInfo info = (ConfigurationInfo) infos.get(j);
+                for (Object info1 : infos) {
+                    ConfigurationInfo info = (ConfigurationInfo) info1;
                     if (filter.accept(info)) {
                         String name = info.getConfigID().toString();
                         List list = CommandSupport.loadChildren(kernel, name);
                         TargetModuleIDImpl moduleID = new TargetModuleIDImpl(target, name,
(String[]) list.toArray(new String[list.size()]));
                         moduleID.setType(CommandSupport.convertModuleType(info.getType()));
-                        if(moduleID.getChildTargetModuleID() != null) {
+                        if (moduleID.getChildTargetModuleID() != null) {
                             for (int k = 0; k < moduleID.getChildTargetModuleID().length;
k++) {
                                 TargetModuleIDImpl child = (TargetModuleIDImpl) moduleID.getChildTargetModuleID()[k];
-                                if(CommandSupport.isWebApp(kernel, child.getModuleID()))
{
+                                if (CommandSupport.isWebApp(kernel, child.getModuleID()))
{
                                     child.setType(ModuleType.WAR);
                                 }
                             }
@@ -278,23 +296,14 @@
     }
 
     public DeploymentConfiguration createConfiguration(DeployableObject dObj) throws InvalidModuleException
{
-        if(dObj.getType().equals(ModuleType.CAR)) {
-            //todo: need a client configurer
-        } else if(dObj.getType().equals(ModuleType.EAR)) {
-            //todo: need an EAR configurer
-        } else if(dObj.getType().equals(ModuleType.EJB)) {
-            try {
-                Class cls = Class.forName("org.apache.openejb.deployment.EJBConfigurer");
-                return (DeploymentConfiguration)cls.getMethod("createConfiguration", new
Class[]{DeployableObject.class}).invoke(cls.newInstance(), new Object[]{dObj});
-            } catch (Exception e) {
-                log.error("Unable to invoke EJB deployer", e);
-            }
-        } else if(dObj.getType().equals(ModuleType.RAR)) {
-//            return new RARConfigurer().createConfiguration(dObj);
-        } else if(dObj.getType().equals(ModuleType.WAR)) {
-//            return new WARConfigurer().createConfiguration(dObj);
+        if (dObj == null) {
+            throw new NullPointerException("No deployable object supplied to configure");
+        }
+        ModuleConfigurer configurer = moduleConfigurers.get(dObj.getType());
+        if (configurer == null) {
+            throw new InvalidModuleException("No configurer for module type: " + dObj.getType()
+ " registered");
         }
-        throw new InvalidModuleException("Not supported");
+        return configurer.createConfiguration(dObj);
     }
 
     protected DistributeCommand createDistributeCommand(Target[] targetList, File moduleArchive,
File deploymentPlan) {

Modified: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/jsr88/EARConfigurer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/jsr88/EARConfigurer.java?view=diff&rev=493181&r1=493180&r2=493181
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/jsr88/EARConfigurer.java
(original)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/jsr88/EARConfigurer.java
Fri Jan  5 12:32:03 2007
@@ -41,6 +41,10 @@
         }
     }
 
+    public ModuleType getModuleType() {
+        return ModuleType.EAR;
+    }
+
     public static final GBeanInfo GBEAN_INFO;
 
     static {

Modified: geronimo/server/trunk/modules/geronimo-web-builder/src/main/java/org/apache/geronimo/web/deployment/WARConfigurer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-web-builder/src/main/java/org/apache/geronimo/web/deployment/WARConfigurer.java?view=diff&rev=493181&r1=493180&r2=493181
==============================================================================
--- geronimo/server/trunk/modules/geronimo-web-builder/src/main/java/org/apache/geronimo/web/deployment/WARConfigurer.java
(original)
+++ geronimo/server/trunk/modules/geronimo-web-builder/src/main/java/org/apache/geronimo/web/deployment/WARConfigurer.java
Fri Jan  5 12:32:03 2007
@@ -22,6 +22,9 @@
 import javax.enterprise.deploy.spi.DeploymentConfiguration;
 
 import org.apache.geronimo.deployment.ModuleConfigurer;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 
 /**
  * @version $Rev$ $Date$
@@ -33,5 +36,21 @@
         } else {
             return null;
         }
+    }
+
+    public ModuleType getModuleType() {
+        return ModuleType.WAR;
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(WARConfigurer.class,
NameFactory.DEPLOYMENT_CONFIGURER);
+        infoFactory.addInterface(ModuleConfigurer.class);
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
     }
 }



Mime
View raw message