geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r405881 - in /geronimo/branches/1.1: assemblies/j2ee-jetty-server/src/var/config/ assemblies/j2ee-tomcat-server/src/var/config/ assemblies/minimal-jetty-server/src/var/config/ assemblies/minimal-tomcat-server/src/var/config/ etc/ modules/de...
Date Fri, 12 May 2006 21:29:26 GMT
Author: djencks
Date: Fri May 12 14:29:24 2006
New Revision: 405881

URL: http://svn.apache.org/viewcvs?rev=405881&view=rev
Log:
GERONIMO-1507 offline deployer.  Also GERONIMO-1861 make a backup copy of config.xml

Added:
    geronimo/branches/1.1/assemblies/j2ee-jetty-server/src/var/config/offline-deployer-list
    geronimo/branches/1.1/assemblies/j2ee-tomcat-server/src/var/config/offline-deployer-list
    geronimo/branches/1.1/assemblies/minimal-jetty-server/src/var/config/offline-deployer-list
    geronimo/branches/1.1/assemblies/minimal-tomcat-server/src/var/config/offline-deployer-list
    geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/LocalServer.java
Removed:
    geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/GBeanDataRegistry.java
Modified:
    geronimo/branches/1.1/etc/explicit_versions.properties
    geronimo/branches/1.1/etc/project.properties
    geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/ServerConnection.java
    geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentConfigurationManager.java
    geronimo/branches/1.1/modules/deployment/src/test/org/apache/geronimo/deployment/SingleFileHotDeployerTest.java
    geronimo/branches/1.1/modules/kernel/project.xml
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/MultiParentClassLoader.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
    geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/main/CommandLine.java
    geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/main/CommandLineManifest.java
    geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/plugin/PluginInstallerTest.java
    geronimo/branches/1.1/plugins/geronimo-assembly-plugin/plugin.jelly
    geronimo/branches/1.1/plugins/geronimo-assembly-plugin/project.xml

Added: geronimo/branches/1.1/assemblies/j2ee-jetty-server/src/var/config/offline-deployer-list
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/assemblies/j2ee-jetty-server/src/var/config/offline-deployer-list?rev=405881&view=auto
==============================================================================
--- geronimo/branches/1.1/assemblies/j2ee-jetty-server/src/var/config/offline-deployer-list
(added)
+++ geronimo/branches/1.1/assemblies/j2ee-jetty-server/src/var/config/offline-deployer-list
Fri May 12 14:29:24 2006
@@ -0,0 +1,7 @@
+#list of deployers to be started for offline deployment
+geronimo/geronimo-gbean-deployer/${pom.currentVersion}/car
+geronimo/j2ee-deployer/${pom.currentVersion}/car
+geronimo/openejb-deployer/${pom.currentVersion}/car
+geronimo/client-deployer/${pom.currentVersion}/car
+geronimo/axis-deployer/${pom.currentVersion}/car
+geronimo/jetty-deployer/${pom.currentVersion}/car

Added: geronimo/branches/1.1/assemblies/j2ee-tomcat-server/src/var/config/offline-deployer-list
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/assemblies/j2ee-tomcat-server/src/var/config/offline-deployer-list?rev=405881&view=auto
==============================================================================
--- geronimo/branches/1.1/assemblies/j2ee-tomcat-server/src/var/config/offline-deployer-list
(added)
+++ geronimo/branches/1.1/assemblies/j2ee-tomcat-server/src/var/config/offline-deployer-list
Fri May 12 14:29:24 2006
@@ -0,0 +1,7 @@
+#list of deployers to be started for offline deployment
+geronimo/geronimo-gbean-deployer/${pom.currentVersion}/car
+geronimo/j2ee-deployer/${pom.currentVersion}/car
+geronimo/openejb-deployer/${pom.currentVersion}/car
+geronimo/client-deployer/${pom.currentVersion}/car
+geronimo/axis-deployer/${pom.currentVersion}/car
+geronimo/tomcat-deployer/${pom.currentVersion}/car

Added: geronimo/branches/1.1/assemblies/minimal-jetty-server/src/var/config/offline-deployer-list
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/assemblies/minimal-jetty-server/src/var/config/offline-deployer-list?rev=405881&view=auto
==============================================================================
--- geronimo/branches/1.1/assemblies/minimal-jetty-server/src/var/config/offline-deployer-list
(added)
+++ geronimo/branches/1.1/assemblies/minimal-jetty-server/src/var/config/offline-deployer-list
Fri May 12 14:29:24 2006
@@ -0,0 +1,7 @@
+#list of deployers to be started for offline deployment
+geronimo/geronimo-gbean-deployer/${pom.currentVersion}/car
+geronimo/j2ee-deployer/${pom.currentVersion}/car
+geronimo/jetty-deployer/${pom.currentVersion}/car
+geronimo/unavailable-ejb-deployer/${pom.currentVersion}/car
+geronimo/unavailable-webservices-deployer/${pom.currentVersion}/car
+geronimo/unavailable-client-deployer/${pom.currentVersion}/car

Added: geronimo/branches/1.1/assemblies/minimal-tomcat-server/src/var/config/offline-deployer-list
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/assemblies/minimal-tomcat-server/src/var/config/offline-deployer-list?rev=405881&view=auto
==============================================================================
--- geronimo/branches/1.1/assemblies/minimal-tomcat-server/src/var/config/offline-deployer-list
(added)
+++ geronimo/branches/1.1/assemblies/minimal-tomcat-server/src/var/config/offline-deployer-list
Fri May 12 14:29:24 2006
@@ -0,0 +1,7 @@
+#list of deployers to be started for offline deployment
+geronimo/geronimo-gbean-deployer/${pom.currentVersion}/car
+geronimo/j2ee-deployer/${pom.currentVersion}/car
+geronimo/tomcat-deployer/${pom.currentVersion}/car
+geronimo/unavailable-ejb-deployer/${pom.currentVersion}/car
+geronimo/unavailable-webservices-deployer/${pom.currentVersion}/car
+geronimo/unavailable-client-deployer/${pom.currentVersion}/car

Modified: geronimo/branches/1.1/etc/explicit_versions.properties
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/etc/explicit_versions.properties?rev=405881&r1=405880&r2=405881&view=diff
==============================================================================
--- geronimo/branches/1.1/etc/explicit_versions.properties (original)
+++ geronimo/branches/1.1/etc/explicit_versions.properties Fri May 12 14:29:24 2006
@@ -42,7 +42,7 @@
 dom4j///=1.4
 dwr///=1.0
 eclipse_compiler///=3.0.1
-howl///=0.1.11
+howl///=1.0.1
 #security:
 hsqldb///=1.7.2.2
 jasper///=5.5.15

Modified: geronimo/branches/1.1/etc/project.properties
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/etc/project.properties?rev=405881&r1=405880&r2=405881&view=diff
==============================================================================
--- geronimo/branches/1.1/etc/project.properties (original)
+++ geronimo/branches/1.1/etc/project.properties Fri May 12 14:29:24 2006
@@ -97,7 +97,7 @@
 release_notes_version=1.0
 
 geronimo_packaging_plugin_version=1.1.0-8
-geronimo_assembly_plugin_version=1.1.0-11
+geronimo_assembly_plugin_version=1.1.0-12
 geronimo_deployment_plugin_version=1.1.0-3
 geronimo_dependency_plugin_version=1.1.0-3
 
@@ -153,7 +153,7 @@
 dom4j_version=1.4
 dwr_version=1.1.1
 eclipse_compiler_version=3.0.1
-howl_version=0.1.11
+howl_version=1.0.1
 #security:
 hsqldb_version=1.7.2.2
 jasper_version=5.5.15

Added: geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/LocalServer.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/LocalServer.java?rev=405881&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/LocalServer.java
(added)
+++ geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/LocalServer.java
Fri May 12 14:29:24 2006
@@ -0,0 +1,80 @@
+/**
+ *
+ * Copyright 2006 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.
+ */
+
+package org.apache.geronimo.deployment.cli;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+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.PersistentConfigurationList;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.system.main.CommandLine;
+import org.apache.geronimo.system.serverinfo.ServerInfo;
+
+/**
+ * @version $Rev:$ $Date:$
+ */
+public class LocalServer extends CommandLine {
+
+    public LocalServer(String configListLocation) throws Exception {
+        startKernel(Artifact.create("geronimo/j2ee-system//car"));
+        Runtime.getRuntime().addShutdownHook(new Thread("Geronimo shutdown thread") {
+            public void run() {
+                getKernel().shutdown();
+            }
+        });
+        List configs = getConfigurationList(configListLocation);
+        loadConfigurations(configs);
+    }
+
+    public Kernel getKernel() {
+        return super.getKernel();
+    }
+
+    protected List getConfigurationList(String path) throws GBeanNotFoundException, IOException
{
+        ServerInfo serverInfo = (ServerInfo) getKernel().getGBean(ServerInfo.class);
+        File configFile = serverInfo.resolve(path);
+        List modules = new ArrayList();
+        BufferedReader in = new BufferedReader(new FileReader(configFile));
+        try {
+            String artifactString;
+            while ((artifactString = in.readLine()) != null) {
+                artifactString = artifactString.trim();
+                if (!artifactString.startsWith("#") && artifactString.length() >
0) {
+                    Artifact artifact = Artifact.create(artifactString);
+                    modules.add(artifact);
+                }
+            }
+        } finally {
+            in.close();
+        }
+        return modules;
+    }
+
+}

Modified: geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/ServerConnection.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/ServerConnection.java?rev=405881&r1=405880&r2=405881&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/ServerConnection.java
(original)
+++ geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/ServerConnection.java
Fri May 12 14:29:24 2006
@@ -31,6 +31,7 @@
 import java.util.Map;
 import java.util.Properties;
 import java.util.jar.JarFile;
+
 import javax.enterprise.deploy.shared.factories.DeploymentFactoryManager;
 import javax.enterprise.deploy.spi.DeploymentManager;
 import javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException;
@@ -40,7 +41,12 @@
 import org.apache.geronimo.deployment.plugin.factories.AuthenticationFailedException;
 import org.apache.geronimo.deployment.plugin.factories.DeploymentFactoryImpl;
 import org.apache.geronimo.deployment.plugin.jmx.JMXDeploymentManager;
+import org.apache.geronimo.deployment.plugin.jmx.LocalDeploymentManager;
 import org.apache.geronimo.util.SimpleEncryption;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.config.ConfigurationManager;
+import org.apache.geronimo.kernel.config.ConfigurationUtil;
+import org.apache.geronimo.kernel.config.KernelConfigurationManager;
 
 /**
  * Supports online connections to the server, via JSR-88, valid only
@@ -50,6 +56,7 @@
  */
 public class ServerConnection {
     private final static Map OPTION_HELP = new LinkedHashMap(9);
+
     static {
         OPTION_HELP.put("--uri", "A URI to contact the server.  If not specified, the deployer
defaults to " +
                 "operating on a Geronimo server running on the standard port on localhost.\n"
+
@@ -69,7 +76,9 @@
         OPTION_HELP.put("--password", "Specifies a password to use to authenticate to the
server.");
         OPTION_HELP.put("--syserr", "Enables error logging to syserr.  Disabled by default.");
         OPTION_HELP.put("--verbose", "Enables verbose execution mode.  Disabled by default.");
+        OPTION_HELP.put("--offline", "Deploy offline to a local server, using whatever deployers
are available in the local server");
     }
+
     public static Map getOptionHelp() {
         return OPTION_HELP;
     }
@@ -80,19 +89,18 @@
      * argument).  For example, if the arguments were "--user bob foo" then
      * this should return true for "--user" and "bob" and false for "foo".
      *
-     * @param args The previous arguments on the command line
+     * @param args   The previous arguments on the command line
      * @param option The argument we're checking at the moment
-     *
      * @return True if the argument we're checking is part of a general argument
      */
     public static boolean isGeneralOption(List args, String option) {
-        if(OPTION_HELP.containsKey(option) || option.equals("--url")) {
+        if (OPTION_HELP.containsKey(option) || option.equals("--url")) {
             return true;
         }
-        if(args.size() == 0) {
+        if (args.size() == 0) {
             return false;
         }
-        String last = (String) args.get(args.size()-1);
+        String last = (String) args.get(args.size() - 1);
         return last.equals("--uri") || last.equals("--url") || last.equals("--driver") ||
last.equals("--user") ||
                 last.equals("--password") || last.equals("--host") || last.equals("--port");
     }
@@ -111,62 +119,64 @@
         Integer port = null;
         this.out = out;
         this.in = in;
-        for(int i = 0; i < args.length; i++) {
+        boolean offline = false;
+        for (int i = 0; i < args.length; i++) {
             String arg = args[i];
-            if(arg.equals("--uri") || arg.equals("--url")) {
-                if(uri != null) {
+            if (arg.equals("--uri") || arg.equals("--url")) {
+                if (uri != null) {
                     throw new DeploymentSyntaxException("Cannot specify more than one URI");
-                } else if(i >= args.length-1) {
+                } else if (i >= args.length - 1) {
                     throw new DeploymentSyntaxException("Must specify a URI (e.g. --uri deployer:...)");
                 }
-                if(host != null || port != null) {
+                if (host != null || port != null) {
                     throw new DeploymentSyntaxException("Cannot specify a URI as well as
a host/port");
                 }
                 uri = args[++i];
-            } else if(arg.equals("--host")) {
-                if(host != null) {
+            } else if (arg.equals("--host")) {
+                if (host != null) {
                     throw new DeploymentSyntaxException("Cannot specify more than one host");
-                } else if(i >= args.length-1) {
+                } else if (i >= args.length - 1) {
                     throw new DeploymentSyntaxException("Must specify a hostname (e.g. --host
localhost)");
                 }
-                if(uri != null) {
+                if (uri != null) {
                     throw new DeploymentSyntaxException("Cannot specify a URI as well as
a host/port");
                 }
                 host = args[++i];
-            } else if(arg.equals("--port")) {
-                if(port != null) {
+            } else if (arg.equals("--port")) {
+                if (port != null) {
                     throw new DeploymentSyntaxException("Cannot specify more than one port");
-                } else if(i >= args.length-1) {
+                } else if (i >= args.length - 1) {
                     throw new DeploymentSyntaxException("Must specify a port (e.g. --port
1099)");
                 }
-                if(uri != null) {
+                if (uri != null) {
                     throw new DeploymentSyntaxException("Cannot specify a URI as well as
a host/port");
                 }
                 try {
                     port = new Integer(args[++i]);
                 } catch (NumberFormatException e) {
-                    throw new DeploymentSyntaxException("Port must be a number ("+e.getMessage()+")");
+                    throw new DeploymentSyntaxException("Port must be a number (" + e.getMessage()
+ ")");
                 }
-            } else if(arg.equals("--driver")) {
-                if(driver != null) {
+            } else if (arg.equals("--driver")) {
+                if (driver != null) {
                     throw new DeploymentSyntaxException("Cannot specify more than one driver");
-                } else if(i >= args.length-1) {
+                } else if (i >= args.length - 1) {
                     throw new DeploymentSyntaxException("Must specify a driver JAR (--driver
jarfile)");
                 }
                 driver = args[++i];
-            } else if(arg.equals("--offline")) {
-                throw new DeploymentSyntaxException("This tool no longer handles offline
deployment");
-            } else if(arg.equals("--user")) {
-                if(user != null) {
+            } else if (arg.equals("--offline")) {
+                //throw new DeploymentSyntaxException("This tool no longer handles offline
deployment");
+                offline = true;
+            } else if (arg.equals("--user")) {
+                if (user != null) {
                     throw new DeploymentSyntaxException("Cannot specify more than one user
name");
-                } else if(i >= args.length-1) {
+                } else if (i >= args.length - 1) {
                     throw new DeploymentSyntaxException("Must specify a username (--user
username)");
                 }
                 user = args[++i];
-            } else if(arg.equals("--password")) {
-                if(password != null) {
+            } else if (arg.equals("--password")) {
+                if (password != null) {
                     throw new DeploymentSyntaxException("Cannot specify more than one password");
-                } else if(i >= args.length-1) {
+                } else if (i >= args.length - 1) {
                     throw new DeploymentSyntaxException("Must specify a password (--password
password)");
                 }
                 password = args[++i];
@@ -175,23 +185,37 @@
             } else if (arg.equals("--syserr")) {
                 logToSysErr = true;
             } else {
-                throw new DeploymentException("Invalid option "+arg);
+                throw new DeploymentException("Invalid option " + arg);
             }
         }
-        if((driver != null) && uri == null) {
+        if ((driver != null) && uri == null) {
             throw new DeploymentSyntaxException("A custom driver requires a custom URI");
         }
-        if(host != null || port != null) {
-            uri = DEFAULT_URI+"://"+(host == null ? "" : host)+(port == null ? "" : ":"+port);
+        if (host != null || port != null) {
+            uri = DEFAULT_URI + "://" + (host == null ? "" : host) + (port == null ? "" :
":" + port);
+        }
+        if (offline) {
+            LocalServer localServer;
+            try {
+                localServer = new LocalServer("var/config/offline-deployer-list");
+            } catch (Exception e) {
+                throw new DeploymentException("Could not start local server", e);
+            }
+            Kernel kernel = localServer.getKernel();
+            ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
+            configurationManager.setOnline(false);
+
+            manager = new LocalDeploymentManager(localServer.getKernel());
+        } else {
+            tryToConnect(uri, driver, user, password, true);
         }
-        tryToConnect(uri, driver, user, password, true);
-        if(manager == null) {
+        if (manager == null) {
             throw new DeploymentException("Unexpected error; connection failed.");
         }
     }
 
     public void close() throws DeploymentException {
-        if(manager != null) {
+        if (manager != null) {
             manager.release();
         }
     }
@@ -206,55 +230,59 @@
 
     private void tryToConnect(String argURI, String driver, String user, String password,
boolean authPrompt) throws DeploymentException {
         DeploymentFactoryManager mgr = DeploymentFactoryManager.getInstance();
-        if(driver != null) {
+        if (driver != null) {
             loadDriver(driver, mgr);
         } else {
             mgr.registerDeploymentFactory(new DeploymentFactoryImpl());
         }
         String useURI = argURI == null ? DEFAULT_URI : argURI;
 
-        if(authPrompt && user == null && password == null) {
+        if (authPrompt && user == null && password == null) {
             InputStream in;
             // First check for .geronimo-deployer on class path (e.g. packaged in deployer.jar)
             in = ServerConnection.class.getResourceAsStream("/.geronimo-deployer");
             // If not there, check in home directory
-            if(in == null) {
+            if (in == null) {
                 File authFile = new File(System.getProperty("user.home"), ".geronimo-deployer");
-                if(authFile.exists() && authFile.canRead()) {
+                if (authFile.exists() && authFile.canRead()) {
                     try {
                         in = new BufferedInputStream(new FileInputStream(authFile));
-                    } catch (FileNotFoundException e) {}
+                    } catch (FileNotFoundException e) {
+                    }
                 }
             }
-            if(in != null) {
+            if (in != null) {
                 try {
                     Properties props = new Properties();
                     props.load(in);
-                    String encryped = props.getProperty("login."+useURI);
-                    if(encryped != null) {
-                        if(encryped.startsWith("{Standard}")) {
+                    String encryped = props.getProperty("login." + useURI);
+                    if (encryped != null) {
+                        if (encryped.startsWith("{Standard}")) {
                             SavedAuthentication auth = (SavedAuthentication) SimpleEncryption.decrypt(encryped.substring(10));
-                            if(auth.uri.equals(useURI)) {
+                            if (auth.uri.equals(useURI)) {
                                 user = auth.user;
                                 password = new String(auth.password);
                             }
-                        } else if(encryped.startsWith("{Plain}")) {
+                        } else if (encryped.startsWith("{Plain}")) {
                             int pos = encryped.indexOf("/");
                             user = encryped.substring(7, pos);
-                            password = encryped.substring(pos+1);
+                            password = encryped.substring(pos + 1);
                         } else {
                             System.out.print(DeployUtils.reformat("Unknown encryption used
in saved login file", 4, 72));
                         }
                     }
                 } catch (IOException e) {
-                    System.out.print(DeployUtils.reformat("Unable to read authentication
from saved login file: "+e.getMessage(), 4, 72));
+                    System.out.print(DeployUtils.reformat("Unable to read authentication
from saved login file: " + e.getMessage(), 4, 72));
                 } finally {
-                    try {in.close();}catch(IOException e) {}
+                    try {
+                        in.close();
+                    } catch (IOException e) {
+                    }
                 }
             }
         }
 
-        if(authPrompt && !useURI.equals(DEFAULT_URI) && user == null &&
password == null) {
+        if (authPrompt && !useURI.equals(DEFAULT_URI) && user == null &&
password == null) {
             // Non-standard URI, but no authentication information
             doAuthPromptAndRetry(useURI, user, password);
             return;
@@ -262,15 +290,15 @@
             try {
                 manager = mgr.getDeploymentManager(useURI, user, password);
                 auth = new SavedAuthentication(useURI, user, password == null ? null : password.toCharArray());
-            } catch(AuthenticationFailedException e) { // server's there, you just can't
talk to it
-                if(authPrompt) {
+            } catch (AuthenticationFailedException e) { // server's there, you just can't
talk to it
+                if (authPrompt) {
                     doAuthPromptAndRetry(useURI, user, password);
                     return;
                 } else {
                     throw new DeploymentException("Login Failed");
                 }
-            } catch(DeploymentManagerCreationException e) {
-                throw new DeploymentException("Unable to connect to server at "+useURI+"
-- "+e.getMessage());
+            } catch (DeploymentManagerCreationException e) {
+                throw new DeploymentException("Unable to connect to server at " + useURI
+ " -- " + e.getMessage());
             }
         }
 
@@ -282,37 +310,37 @@
 
     private void loadDriver(String driver, DeploymentFactoryManager mgr) throws DeploymentException
{
         File file = new File(driver);
-        if(!file.exists() || !file.canRead() || !DeployUtils.isJarFile(file)) {
-            throw new DeploymentSyntaxException("Driver '"+file.getAbsolutePath()+"' is not
a readable JAR file");
+        if (!file.exists() || !file.canRead() || !DeployUtils.isJarFile(file)) {
+            throw new DeploymentSyntaxException("Driver '" + file.getAbsolutePath() + "'
is not a readable JAR file");
         }
         String className = null;
         try {
             JarFile jar = new JarFile(file);
             className = jar.getManifest().getMainAttributes().getValue("J2EE-DeploymentFactory-Implementation-Class");
-            if(className == null) {
-                throw new DeploymentException("The driver JAR "+file.getAbsolutePath()+"
does not specify a J2EE-DeploymentFactory-Implementation-Class; cannot load driver.");
+            if (className == null) {
+                throw new DeploymentException("The driver JAR " + file.getAbsolutePath()
+ " does not specify a J2EE-DeploymentFactory-Implementation-Class; cannot load driver.");
             }
             jar.close();
             DeploymentFactory factory = (DeploymentFactory) Class.forName(className).newInstance();
             mgr.registerDeploymentFactory(factory);
-        } catch(DeploymentException e) {
+        } catch (DeploymentException e) {
             throw e;
-        } catch(Exception e) {
-            throw new DeploymentSyntaxException("Unable to load driver class "+className+"
from JAR "+file.getAbsolutePath(), e);
+        } catch (Exception e) {
+            throw new DeploymentSyntaxException("Unable to load driver class " + className
+ " from JAR " + file.getAbsolutePath(), e);
         }
     }
 
     private void doAuthPromptAndRetry(String uri, String user, String password) throws DeploymentException
{
         try {
-            if(user == null) {
+            if (user == null) {
                 out.print("Username: ");
                 out.flush();
                 user = in.readLine();
             }
-            if(password == null) {
+            if (password == null) {
                 password = new PasswordPrompt("Password: ", out).getPassword(in);
             }
-        } catch(IOException e) {
+        } catch (IOException e) {
             throw new DeploymentException("Unable to prompt for login", e);
         }
         tryToConnect(uri, null, user, password, false);
@@ -349,13 +377,13 @@
             int priority = Thread.currentThread().getPriority();
             try {
                 Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
-                String fullPrompt = "\r"+prompt+"          "+"\r"+prompt;
+                String fullPrompt = "\r" + prompt + "          " + "\r" + prompt;
                 StringBuffer clearline = new StringBuffer();
                 clearline.append('\r');
-                for(int i=prompt.length()+10; i>=0; i--) {
+                for (int i = prompt.length() + 10; i >= 0; i--) {
                     clearline.append(' ');
                 }
-                while(!done) {
+                while (!done) {
                     out.print(fullPrompt);
                     out.flush();
                     Thread.sleep(1);
@@ -377,7 +405,7 @@
          * the entered password.  For this to make sense, the input reader
          * here must be part of the same console as the output writer passed
          * to the constructor.
-         *
+         * <p/>
          * For higher security, should return a char[], but that will just
          * be defeated by the JSR-88 call that takes a String anyway, so
          * why bother?

Modified: geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentConfigurationManager.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentConfigurationManager.java?rev=405881&r1=405880&r2=405881&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentConfigurationManager.java
(original)
+++ geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentConfigurationManager.java
Fri May 12 14:29:24 2006
@@ -84,6 +84,16 @@
         return super.getArtifactResolver();
     }
 
+    /**
+     * This configuration manager never starts any configurations
+     * @return false
+     */
+    public boolean isOnline() {
+        return false;
+    }
+
+    public void setOnline(boolean online) {
+    }
 
     //
     // LOAD

Modified: geronimo/branches/1.1/modules/deployment/src/test/org/apache/geronimo/deployment/SingleFileHotDeployerTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deployment/src/test/org/apache/geronimo/deployment/SingleFileHotDeployerTest.java?rev=405881&r1=405880&r2=405881&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/deployment/src/test/org/apache/geronimo/deployment/SingleFileHotDeployerTest.java
(original)
+++ geronimo/branches/1.1/modules/deployment/src/test/org/apache/geronimo/deployment/SingleFileHotDeployerTest.java
Fri May 12 14:29:24 2006
@@ -453,5 +453,12 @@
         public ArtifactResolver getArtifactResolver() {
             return artifactResolver;
         }
+
+        public boolean isOnline() {
+            return true;
+        }
+
+        public void setOnline(boolean online) {
+        }
     }
 }

Modified: geronimo/branches/1.1/modules/kernel/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/project.xml?rev=405881&r1=405880&r2=405881&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/project.xml (original)
+++ geronimo/branches/1.1/modules/kernel/project.xml Fri May 12 14:29:24 2006
@@ -103,33 +103,4 @@
         </dependency>
     </dependencies>
 
-    <build>
-        <resources>
-            <resource>
-                <directory>${basedir}/src/java</directory>
-                <includes>
-                    <include>**/*.xml</include>
-                    <include>**/*.properties</include>
-                </includes>
-            </resource>
-        </resources>
-        <unitTest>
-            <includes>
-                <include>**/*Test.java</include>
-            </includes>
-            <excludes>
-                <exclude>**/Abstract*.java</exclude>
-            </excludes>
-            <resources>
-                <resource>
-                    <directory>${basedir}/target/test-xdoclet/jmx/org/apache/geronimo/tools/xdoclet</directory>
-                    <targetPath>org/apache/geronimo/tools/xdoclet</targetPath>
-                    <includes>
-                        <include>*.xml</include>
-                    </includes>
-                </resource>
-            </resources>
-        </unitTest>
-    </build>
-
 </project>

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java?rev=405881&r1=405880&r2=405881&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java
(original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java
Fri May 12 14:29:24 2006
@@ -463,4 +463,13 @@
      * configuration manager, etc.
      */
     ArtifactResolver getArtifactResolver();
+
+    /**
+     * Online means full functionality.  Offline typically means that configurations will
never be started,
+     * although they may be marked in the persistent configuration list.
+     *
+     * @return online status of ConfigurationManager
+     */
+    boolean isOnline();
+    void setOnline(boolean online);
 }

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java?rev=405881&r1=405880&r2=405881&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java
(original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java
Fri May 12 14:29:24 2006
@@ -57,6 +57,7 @@
     private final ArtifactManager artifactManager;
     protected final ClassLoader classLoader;
     private final ShutdownHook shutdownHook;
+    private boolean online = true;
 
     public KernelConfigurationManager(Kernel kernel,
             Collection stores,
@@ -178,11 +179,21 @@
     }
 
     public void start(Configuration configuration) throws InvalidConfigException {
-        ConfigurationUtil.startConfigurationGBeans(configuration.getAbstractName(), configuration,
kernel);
+        if (online) {
+            ConfigurationUtil.startConfigurationGBeans(configuration.getAbstractName(), configuration,
kernel);
+        }
 
         if (configurationList != null && configuration.getConfigurationData().isAutoStart())
{
             configurationList.startConfiguration(configuration.getId());
         }
+    }
+
+    public boolean isOnline() {
+        return online;
+    }
+
+    public void setOnline(boolean online) {
+        this.online = online;
     }
 
     protected void stop(Configuration configuration) {

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/MultiParentClassLoader.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/MultiParentClassLoader.java?rev=405881&r1=405880&r2=405881&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/MultiParentClassLoader.java
(original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/MultiParentClassLoader.java
Fri May 12 14:29:24 2006
@@ -246,7 +246,7 @@
             }
         }
 
-        throw new ClassNotFoundException(name);
+        throw new ClassNotFoundException(name + " in classloader " + id);
     }
 
     private boolean isNonOverridableClass(String name) {

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java?rev=405881&r1=405880&r2=405881&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
(original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
Fri May 12 14:29:24 2006
@@ -1226,6 +1226,17 @@
         return artifactResolver;
     }
 
+    /**
+     * this configuration manager never starts configurations.
+     * @return false
+     */
+    public boolean isOnline() {
+        return false;
+    }
+
+    public void setOnline(boolean online) {
+    }
+
     private List getStoreList() {
         return new ArrayList(stores);
     }

Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/main/CommandLine.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/main/CommandLine.java?rev=405881&r1=405880&r2=405881&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/main/CommandLine.java
(original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/main/CommandLine.java
Fri May 12 14:29:24 2006
@@ -20,6 +20,9 @@
 import java.io.InputStream;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Enumeration;
+import java.net.URL;
+
 import javax.management.ObjectName;
 
 import org.apache.commons.logging.Log;
@@ -31,6 +34,9 @@
 import org.apache.geronimo.kernel.KernelFactory;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
 import org.apache.geronimo.kernel.config.ConfigurationUtil;
+import org.apache.geronimo.kernel.config.NoSuchConfigException;
+import org.apache.geronimo.kernel.config.LifecycleException;
+import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.kernel.log.GeronimoLogging;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.gbean.AbstractName;
@@ -61,7 +67,7 @@
             // the interesting entries from the manifest
             CommandLineManifest manifest = CommandLineManifest.getManifestEntries();
             List configurations = manifest.getConfigurations();
-            ObjectName mainGBean = manifest.getMainGBean();
+            AbstractName mainGBean = manifest.getMainGBean();
             String mainMethod = manifest.getMainMethod();
 
             new CommandLine().invokeMainGBean(configurations, mainGBean, mainMethod, args);
@@ -78,34 +84,9 @@
     private Kernel kernel;
     private AbstractName configurationName;
 
-    /**
-     * @deprecated use the next one with AbstractName
-     *
-     * @param configurations
-     * @param mainGBean
-     * @param mainMethod
-     * @param args
-     * @throws Exception
-     */
-    public void invokeMainGBean(List configurations, ObjectName mainGBean, String mainMethod,
String[] args) throws Exception {
-        startKernel(configurations);
-
-        log.info("Server startup completed");
-
-        // invoke the main method
-        kernel.invoke(
-                mainGBean,
-                mainMethod,
-                new Object[]{args},
-                new String[]{String[].class.getName()});
-
-        log.info("Server shutdown begun");
-
-        stopKernel();
-    }
-
     public void invokeMainGBean(List configurations, AbstractName mainGBean, String mainMethod,
String[] args) throws Exception {
-        startKernel(configurations);
+        startKernel();
+        loadConfigurations(configurations);
 
         log.info("Server startup completed");
 
@@ -121,7 +102,7 @@
         stopKernel();
     }
 
-    protected void startKernel(List configurations) throws Exception {
+    protected void startKernel() throws Exception {
         ClassLoader classLoader = CommandLine.class.getClassLoader();
         InputStream in = classLoader.getResourceAsStream("META-INF/config.ser");
 
@@ -132,6 +113,31 @@
         // load the configuration
         configurationName = ConfigurationUtil.loadBootstrapConfiguration(kernel, in, classLoader);
 
+    }
+
+    protected void startKernel(Artifact moduleId) throws Exception {
+        // boot the kernel
+        kernel = KernelFactory.newInstance().createKernel("geronimo");
+        kernel.boot();
+        ClassLoader classLoader = CommandLine.class.getClassLoader();
+        for (Enumeration modules = classLoader.getResources("META-INF/config.ser"); modules.hasMoreElements();
) {
+            URL moduleDataURL = (URL) modules.nextElement();
+            InputStream in = moduleDataURL.openStream();
+            try {
+                ConfigurationData moduleData = ConfigurationUtil.readConfigurationData(in);
+                if (moduleId.matches(moduleData.getId())) {
+                    // load the configuration
+                    configurationName = ConfigurationUtil.loadBootstrapConfiguration(kernel,
moduleData, classLoader);
+                    return;
+                }
+            } finally {
+                in.close();
+            }
+        }
+        throw new NoSuchConfigException(moduleId);
+    }
+
+    protected void loadConfigurations(List configurations) throws NoSuchConfigException,
LifecycleException {
         // load and start the configurations
         ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
         try {

Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/main/CommandLineManifest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/main/CommandLineManifest.java?rev=405881&r1=405880&r2=405881&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/main/CommandLineManifest.java
(original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/main/CommandLineManifest.java
Fri May 12 14:29:24 2006
@@ -30,6 +30,8 @@
 import javax.management.ObjectName;
 import javax.management.MalformedObjectNameException;
 
+import org.apache.geronimo.gbean.AbstractName;
+
 /**
  *
  *
@@ -65,11 +67,11 @@
         // get the main gbean class
         String mainGBeanString = mainAttributes.getValue(MAIN_GBEAN);
 
-        ObjectName mainGBean = null;
+        AbstractName mainGBean = null;
         if(mainGBeanString != null) {
             try {
-                mainGBean = new ObjectName(mainGBeanString);
-            } catch (MalformedObjectNameException e) {
+                mainGBean = new AbstractName(new URI(mainGBeanString));
+            } catch (URISyntaxException e) {
                 System.err.println("Invalid Main-GBean name: " + mainGBeanString);
                 System.exit(1);
                 throw new AssertionError();
@@ -119,13 +121,13 @@
         return commandLineManifest;
     }
 
-    private final ObjectName mainGBean;
+    private final AbstractName mainGBean;
     private final String mainMethod;
     private final List configurations;
     private final List endorsedDirs;
     private final List extensionDirs;
 
-    public CommandLineManifest(ObjectName mainGBean, String mainMethod, List configurations,
List endorsedDirs, List extensionDirs) {
+    public CommandLineManifest(AbstractName mainGBean, String mainMethod, List configurations,
List endorsedDirs, List extensionDirs) {
         this.mainGBean = mainGBean;
         this.mainMethod = mainMethod;
         this.configurations = Collections.unmodifiableList(configurations);
@@ -133,7 +135,7 @@
         this.extensionDirs = extensionDirs;
     }
 
-    public ObjectName getMainGBean() {
+    public AbstractName getMainGBean() {
         return mainGBean;
     }
 

Modified: geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/plugin/PluginInstallerTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/plugin/PluginInstallerTest.java?rev=405881&r1=405880&r2=405881&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/plugin/PluginInstallerTest.java
(original)
+++ geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/plugin/PluginInstallerTest.java
Fri May 12 14:29:24 2006
@@ -123,6 +123,7 @@
     }
 
     private static class MockConfigManager implements ConfigurationManager {
+
         public boolean isInstalled(Artifact configurationId) {
             return false;
         }
@@ -253,6 +254,13 @@
 
         public ArtifactResolver getArtifactResolver() {
             return null;
+        }
+
+        public boolean isOnline() {
+            return true;
+        }
+
+        public void setOnline(boolean online) {
         }
     }
 }

Modified: geronimo/branches/1.1/plugins/geronimo-assembly-plugin/plugin.jelly
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/plugins/geronimo-assembly-plugin/plugin.jelly?rev=405881&r1=405880&r2=405881&view=diff
==============================================================================
--- geronimo/branches/1.1/plugins/geronimo-assembly-plugin/plugin.jelly (original)
+++ geronimo/branches/1.1/plugins/geronimo-assembly-plugin/plugin.jelly Fri May 12 14:29:24
2006
@@ -43,6 +43,10 @@
         <ant:mkdir dir="${geronimo.assembly.dest}/var/config"/>
         <velocity:merge basedir="${geronimo.assembly.src}/var/config" template="config.xml"
                         name="${geronimo.assembly.dest}/var/config/config.xml"/>
+        <velocity:merge basedir="${geronimo.assembly.src}/var/config" template="config.xml"
+                        name="${geronimo.assembly.dest}/var/config/config.xml.original"/>
+        <velocity:merge basedir="${geronimo.assembly.src}/var/config" template="offline-deployer-list"
+                        name="${geronimo.assembly.dest}/var/config/offline-deployer-list"/>
     </goal>
 
     <goal name="assemble:assemble-lib">

Modified: geronimo/branches/1.1/plugins/geronimo-assembly-plugin/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/plugins/geronimo-assembly-plugin/project.xml?rev=405881&r1=405880&r2=405881&view=diff
==============================================================================
--- geronimo/branches/1.1/plugins/geronimo-assembly-plugin/project.xml (original)
+++ geronimo/branches/1.1/plugins/geronimo-assembly-plugin/project.xml Fri May 12 14:29:24
2006
@@ -23,7 +23,7 @@
     <id>geronimo-assembly-plugin</id>
     <name>Geronimo :: Maven Assembly Plugin</name>
     <description>A plugin used to assemble a distribution of Geronimo</description>
-    <currentVersion>1.1.0-11</currentVersion>
+    <currentVersion>1.1.0-12</currentVersion>
 
     <dependencies>
         <dependency>



Mime
View raw message