geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r939046 - in /geronimo/server/trunk/framework/modules: geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/ geronimo-shell-base/src/main/java/org/apache/geronimo/shell/ geronimo-shell-base/src/main/java/org/apache/geronimo...
Date Wed, 28 Apr 2010 18:38:50 GMT
Author: gawor
Date: Wed Apr 28 18:38:50 2010
New Revision: 939046

URL: http://svn.apache.org/viewvc?rev=939046&view=rev
Log:
GERONIMO-5213: Fix a bunch of Geronimo Karaf shell commands. Add support for 'embedded' mode where the commands know they are executing in a server shell and do not require a jmx connection

Added:
    geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/OfflineServerConnection.java   (with props)
    geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/OnlineServerConnection.java   (with props)
Removed:
    geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/ConfigurationManagerCommandSupport.java
    geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/KernelCommandSupport.java
Modified:
    geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/DeployTool.java
    geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/ServerConnection.java
    geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/BaseCommandSupport.java
    geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/deploy/ConnectCommand.java
    geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/geronimo/BaseJavaCommand.java
    geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/geronimo/ProcessLauncher.java
    geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/geronimo/ServerProxy.java
    geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/geronimo/StartClientCommand.java
    geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/geronimo/StopServerCommand.java
    geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/geronimo/WaitForServerCommand.java
    geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/resources/OSGI-INF/blueprint/shell-deploy.xml

Modified: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/DeployTool.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/DeployTool.java?rev=939046&r1=939045&r2=939046&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/DeployTool.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/DeployTool.java Wed Apr 28 18:38:50 2010
@@ -163,7 +163,11 @@ public class DeployTool implements Main 
             } else {
                 try {
                     if (con == null) {
-                        con = new ServerConnection(parser, consoleReader, kernel, deploymentFactory);
+                        if (parser.isOffline()) {
+                            con = new OfflineServerConnection(kernel, true);
+                        } else {
+                            con = new OnlineServerConnection(parser, consoleReader, deploymentFactory);
+                        }
                     }
                     try {
                         dc.execute(consoleReader, con, commandArgs);

Added: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/OfflineServerConnection.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/OfflineServerConnection.java?rev=939046&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/OfflineServerConnection.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/OfflineServerConnection.java Wed Apr 28 18:38:50 2010
@@ -0,0 +1,57 @@
+/**
+ *  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.deployment.cli;
+
+import java.io.IOException;
+
+import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.deployment.plugin.jmx.LocalDeploymentManager;
+import org.apache.geronimo.kernel.GBeanNotFoundException;
+import org.apache.geronimo.kernel.Kernel;
+
+/**
+ * Supports offline connections to the server, via JSR-88.
+ *
+ * @version $Rev$ $Date$
+ */
+public class OfflineServerConnection extends ServerConnection {
+
+    public OfflineServerConnection(Kernel kernel, boolean startDeployer) throws DeploymentException {
+        if (null == kernel) {
+            throw new IllegalArgumentException("kernel is required");
+        }
+        if (startDeployer) {
+            startOfflineDeployer(kernel);
+        }
+        try {
+            manager = new LocalDeploymentManager(kernel);
+        } catch (IOException e) {
+            throw new DeploymentException(e);
+        }
+    }
+
+    protected void startOfflineDeployer(Kernel kernel) throws DeploymentException {
+        try {
+            OfflineDeployerStarter offlineDeployerStarter = new OfflineDeployerStarter(kernel);
+            offlineDeployerStarter.start();
+        } catch (GBeanNotFoundException e) {
+            throw new DeploymentException(e);
+        }
+    }
+
+}

Propchange: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/OfflineServerConnection.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/OfflineServerConnection.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/OfflineServerConnection.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/OnlineServerConnection.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/OnlineServerConnection.java?rev=939046&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/OnlineServerConnection.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/OnlineServerConnection.java Wed Apr 28 18:38:50 2010
@@ -0,0 +1,209 @@
+/**
+ *  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.deployment.cli;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.Properties;
+import java.util.jar.JarFile;
+
+import javax.enterprise.deploy.shared.factories.DeploymentFactoryManager;
+import javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException;
+import javax.enterprise.deploy.spi.factories.DeploymentFactory;
+
+import org.apache.geronimo.cli.deployer.ConnectionParams;
+import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.crypto.EncryptionManager;
+import org.apache.geronimo.deployment.cli.DeployUtils.SavedAuthentication;
+import org.apache.geronimo.deployment.plugin.factories.AuthenticationFailedException;
+import org.apache.geronimo.deployment.plugin.jmx.JMXDeploymentManager;
+import org.apache.geronimo.kernel.util.JarUtils;
+
+/**
+ * Supports online connections to the server, via JSR-88, valid only when the
+ * server is online.
+ *
+ * @version $Rev$ $Date$
+ */
+public class OnlineServerConnection extends ServerConnection {
+
+    private final DeploymentFactory geronimoDeploymentFactory;
+
+    private final ServerConnection.UsernamePasswordHandler handler;
+    
+    private boolean logToSysErr;
+
+    private boolean verboseMessages;
+
+    String KEYSTORE_TRUSTSTORE_PASSWORD_FILE = "org.apache.geronimo.keyStoreTrustStorePasswordFile";
+
+    String DEFAULT_TRUSTSTORE_KEYSTORE_LOCATION = "/var/security/keystores/geronimo-default";
+
+    String GERONIMO_HOME = "org.apache.geronimo.home.dir";
+
+    String DEFAULT_KEYSTORE_TRUSTSTORE_PASSWORD_FILE = System.getProperty(GERONIMO_HOME) + "/var/config/config-substitutions.properties";
+
+    public OnlineServerConnection(ConnectionParams params, ConsoleReader consoleReader, DeploymentFactory geronimoDeploymentFactory) throws DeploymentException {
+        this(params, new DefaultUserPasswordHandler(consoleReader), geronimoDeploymentFactory);
+    }
+
+    public OnlineServerConnection(ConnectionParams params, ServerConnection.UsernamePasswordHandler handler, DeploymentFactory geronimoDeploymentFactory) throws DeploymentException {
+        this.geronimoDeploymentFactory = geronimoDeploymentFactory;
+        this.handler = handler;
+        String uri = params.getURI();
+        String driver = params.getDriver();
+        String user = params.getUser();
+        String password = params.getPassword();
+        String host = params.getHost();
+        Integer port = params.getPort();
+        verboseMessages = params.isVerbose();
+        logToSysErr = params.isSyserr();
+        boolean secure = params.isSecure();
+        
+        if ((driver != null) && uri == null) {
+            throw new DeploymentSyntaxException("A custom driver requires a custom URI");
+        }
+        if (params.isOffline()) {
+            throw new DeploymentException("Offline connection is not supported");
+        }
+        if (host != null || port != null) {
+            uri = DeployUtils.getConnectionURI(host, port, secure);
+        }
+        
+        ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
+        Thread.currentThread().setContextClassLoader(DeployUtils.class.getClassLoader());
+        try {
+            tryToConnect(uri, driver, user, password, secure);
+        } finally  {
+            Thread.currentThread().setContextClassLoader(oldCL);
+        }
+        if (manager == null) {
+            throw new DeploymentException("Unexpected error; connection failed.");
+        }
+    }
+
+    private void tryToConnect(String argURI, String driver, String user, String password, boolean secure) throws DeploymentException {
+        DeploymentFactoryManager mgr = DeploymentFactoryManager.getInstance();
+        if (driver != null) {
+            loadDriver(driver, mgr);
+        } else {
+            mgr.registerDeploymentFactory(geronimoDeploymentFactory);
+        }
+        String useURI = argURI == null ? DeployUtils.getConnectionURI(null, null, secure) : argURI;
+        if (user == null && password == null) {
+            try {
+                SavedAuthentication savedAuthentication = DeployUtils.readSavedCredentials(useURI);
+                if (savedAuthentication != null) {
+                    user = savedAuthentication.getUser();
+                    password = new String(savedAuthentication.getPassword());
+                }
+            } catch (IOException e) {
+                System.out.println("Warning: " + e.getMessage());
+            }
+        }
+        if (secure) {
+            try {
+                Properties props = new Properties();
+                String keyStorePassword = null;
+                String trustStorePassword = null;
+                FileInputStream fstream = new FileInputStream(System.getProperty(KEYSTORE_TRUSTSTORE_PASSWORD_FILE, DEFAULT_KEYSTORE_TRUSTSTORE_PASSWORD_FILE));
+                props.load(fstream);
+                keyStorePassword = (String) EncryptionManager.decrypt(props.getProperty("keyStorePassword"));
+                trustStorePassword = (String) EncryptionManager.decrypt(props.getProperty("trustStorePassword"));
+                fstream.close();
+                String value = System.getProperty("javax.net.ssl.keyStore", System.getProperty(GERONIMO_HOME) + DEFAULT_TRUSTSTORE_KEYSTORE_LOCATION);
+                String value1 = System.getProperty("javax.net.ssl.trustStore", System.getProperty(GERONIMO_HOME) + DEFAULT_TRUSTSTORE_KEYSTORE_LOCATION);
+                System.setProperty("javax.net.ssl.keyStore", value);
+                System.setProperty("javax.net.ssl.trustStore", value1);
+                System.setProperty("javax.net.ssl.keyStorePassword", keyStorePassword);
+                System.setProperty("javax.net.ssl.trustStorePassword", trustStorePassword);
+            } catch (IOException e) {
+                throw new DeploymentException("Unable to set KeyStorePassword and TrustStorePassword.", e);
+            }
+        }
+        if (user == null || password == null) {
+            try {
+                if (user == null) {
+                    user = handler.getUsername();
+                }
+                if (password == null) {
+                    password = handler.getPassword();
+                }
+            } catch (IOException e) {
+                throw new DeploymentException("Unable to prompt for login", e);
+            }
+        }
+        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
+            throw new DeploymentException("Login Failed");
+        } catch (DeploymentManagerCreationException e) {
+            throw new DeploymentException("Unable to connect to server at " + useURI + " -- " + e.getMessage(), e);
+        }
+        if (manager instanceof JMXDeploymentManager) {
+            JMXDeploymentManager deploymentManager = (JMXDeploymentManager) manager;
+            deploymentManager.setLogConfiguration(logToSysErr, verboseMessages);
+        }
+    }
+
+    private void loadDriver(String driver, DeploymentFactoryManager mgr) throws DeploymentException {
+        File file = new File(driver);
+        try {
+            if (!file.exists() || !file.canRead() || !JarUtils.isJarFile(file)) {
+                throw new DeploymentSyntaxException("Driver '" + file.getAbsolutePath() + "' is not a readable JAR file");
+            }
+        } catch (IOException e) {
+            throw new DeploymentException("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.");
+            }
+            jar.close();
+            DeploymentFactory factory = (DeploymentFactory) Class.forName(className).newInstance();
+            mgr.registerDeploymentFactory(factory);
+        } catch (DeploymentException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new DeploymentSyntaxException("Unable to load driver class " + className + " from JAR " + file.getAbsolutePath(), e);
+        }
+    }
+
+    private static class DefaultUserPasswordHandler implements ServerConnection.UsernamePasswordHandler {
+
+        private ConsoleReader consoleReader;
+
+        public DefaultUserPasswordHandler(ConsoleReader consoleReader) {
+            this.consoleReader = consoleReader;
+        }
+
+        public String getPassword() throws IOException {
+            return new String(consoleReader.readPassword("Password: "));
+        }
+
+        public String getUsername() throws IOException {
+            return consoleReader.readLine("Username: ");
+        }
+    }
+}

Propchange: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/OnlineServerConnection.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/OnlineServerConnection.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/OnlineServerConnection.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/ServerConnection.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/ServerConnection.java?rev=939046&r1=939045&r2=939046&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/ServerConnection.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/ServerConnection.java Wed Apr 28 18:38:50 2010
@@ -17,108 +17,24 @@
 
 package org.apache.geronimo.deployment.cli;
 
-import java.io.File;
-import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.Serializable;
-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;
-import javax.enterprise.deploy.spi.factories.DeploymentFactory;
 
-import org.apache.geronimo.cli.deployer.ConnectionParams;
 import org.apache.geronimo.common.DeploymentException;
-import org.apache.geronimo.crypto.EncryptionManager;
 import org.apache.geronimo.deployment.cli.DeployUtils.SavedAuthentication;
-import org.apache.geronimo.deployment.plugin.factories.AuthenticationFailedException;
-import org.apache.geronimo.deployment.plugin.jmx.JMXDeploymentManager;
-import org.apache.geronimo.deployment.plugin.jmx.LocalDeploymentManager;
-import org.apache.geronimo.kernel.GBeanNotFoundException;
-import org.apache.geronimo.kernel.Kernel;
-import org.apache.geronimo.kernel.util.JarUtils;
 
 /**
- * Supports online connections to the server, via JSR-88, valid only when the
- * server is online.
  *
  * @version $Rev$ $Date$
  */
-public class ServerConnection {
+public abstract class ServerConnection {
 
-    private final DeploymentFactory geronimoDeploymentFactory;
+    protected DeploymentManager manager;
+    protected SavedAuthentication auth;
 
-    private DeploymentManager manager;
-
-    private UsernamePasswordHandler handler;
-
-    private SavedAuthentication auth;
-
-    private boolean logToSysErr;
-
-    private boolean verboseMessages;
-
-    String KEYSTORE_TRUSTSTORE_PASSWORD_FILE = "org.apache.geronimo.keyStoreTrustStorePasswordFile";
-
-    String DEFAULT_TRUSTSTORE_KEYSTORE_LOCATION = "/var/security/keystores/geronimo-default";
-
-    String GERONIMO_HOME = "org.apache.geronimo.home.dir";
-
-    String DEFAULT_KEYSTORE_TRUSTSTORE_PASSWORD_FILE = System.getProperty(GERONIMO_HOME) + "/var/config/config-substitutions.properties";
-
-    public ServerConnection(ConnectionParams params, ConsoleReader consoleReader, Kernel kernel, DeploymentFactory geronimoDeploymentFactory) throws DeploymentException {
-        this(params, new DefaultUserPasswordHandler(consoleReader), kernel, geronimoDeploymentFactory);
-    }
-
-    public ServerConnection(ConnectionParams params, UsernamePasswordHandler handler, Kernel kernel, DeploymentFactory geronimoDeploymentFactory) throws DeploymentException {
-        if (null == kernel) {
-            throw new IllegalArgumentException("kernel is required");
-        }
-        this.geronimoDeploymentFactory = geronimoDeploymentFactory;
-        this.handler = handler;
-        String uri = params.getURI();
-        String driver = params.getDriver();
-        String user = params.getUser();
-        String password = params.getPassword();
-        String host = params.getHost();
-        Integer port = params.getPort();
-        verboseMessages = params.isVerbose();
-        logToSysErr = params.isSyserr();
-        boolean offline = params.isOffline();
-        boolean secure = params.isSecure();
-        if ((driver != null) && uri == null) {
-            throw new DeploymentSyntaxException("A custom driver requires a custom URI");
-        }
-        if (host != null || port != null) {
-            uri = DeployUtils.getConnectionURI(host, port, secure);
-        }
-        if (offline) {
-            startOfflineDeployer(kernel);
-            try {
-                manager = new LocalDeploymentManager(kernel);
-            } catch (IOException e) {
-                throw new DeploymentException(e);
-            }
-        } else {
-            ClassLoader OldCL = Thread.currentThread().getContextClassLoader();
-            Thread.currentThread().setContextClassLoader(DeployUtils.class.getClassLoader());
-            tryToConnect(uri, driver, user, password, secure);
-            Thread.currentThread().setContextClassLoader(OldCL);
-        }
-        if (manager == null) {
-            throw new DeploymentException("Unexpected error; connection failed.");
-        }
-    }
-
-    protected void startOfflineDeployer(Kernel kernel) throws DeploymentException {
-        try {
-            OfflineDeployerStarter offlineDeployerStarter = new OfflineDeployerStarter(kernel);
-            offlineDeployerStarter.start();
-        } catch (GBeanNotFoundException e) {
-            throw new DeploymentException(e);
-        }
+    protected ServerConnection() {        
     }
 
     public void close() throws DeploymentException {
@@ -135,98 +51,6 @@ public class ServerConnection {
         return (auth == null) ? null : auth.getURI();
     }
 
-    private void tryToConnect(String argURI, String driver, String user, String password, boolean secure) throws DeploymentException {
-        DeploymentFactoryManager mgr = DeploymentFactoryManager.getInstance();
-        if (driver != null) {
-            loadDriver(driver, mgr);
-        } else {
-            mgr.registerDeploymentFactory(geronimoDeploymentFactory);
-        }
-        String useURI = argURI == null ? DeployUtils.getConnectionURI(null, null, secure) : argURI;
-        if (user == null && password == null) {
-            try {
-                SavedAuthentication savedAuthentication = DeployUtils.readSavedCredentials(useURI);
-                if (savedAuthentication != null) {
-                    user = savedAuthentication.getUser();
-                    password = new String(savedAuthentication.getPassword());
-                }
-            } catch (IOException e) {
-                System.out.println("Warning: " + e.getMessage());
-            }
-        }
-        if (secure) {
-            try {
-                Properties props = new Properties();
-                String keyStorePassword = null;
-                String trustStorePassword = null;
-                FileInputStream fstream = new FileInputStream(System.getProperty(KEYSTORE_TRUSTSTORE_PASSWORD_FILE, DEFAULT_KEYSTORE_TRUSTSTORE_PASSWORD_FILE));
-                props.load(fstream);
-                keyStorePassword = (String) EncryptionManager.decrypt(props.getProperty("keyStorePassword"));
-                trustStorePassword = (String) EncryptionManager.decrypt(props.getProperty("trustStorePassword"));
-                fstream.close();
-                String value = System.getProperty("javax.net.ssl.keyStore", System.getProperty(GERONIMO_HOME) + DEFAULT_TRUSTSTORE_KEYSTORE_LOCATION);
-                String value1 = System.getProperty("javax.net.ssl.trustStore", System.getProperty(GERONIMO_HOME) + DEFAULT_TRUSTSTORE_KEYSTORE_LOCATION);
-                System.setProperty("javax.net.ssl.keyStore", value);
-                System.setProperty("javax.net.ssl.trustStore", value1);
-                System.setProperty("javax.net.ssl.keyStorePassword", keyStorePassword);
-                System.setProperty("javax.net.ssl.trustStorePassword", trustStorePassword);
-            } catch (IOException e) {
-                throw new DeploymentException("Unable to set KeyStorePassword and TrustStorePassword.", e);
-            }
-        }
-        if (user == null || password == null) {
-            try {
-                if (user == null) {
-                    user = handler.getUsername();
-                }
-                if (password == null) {
-                    password = handler.getPassword();
-                }
-            } catch (IOException e) {
-                throw new DeploymentException("Unable to prompt for login", e);
-            }
-        }
-        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
-            throw new DeploymentException("Login Failed");
-        } catch (DeploymentManagerCreationException e) {
-            throw new DeploymentException("Unable to connect to server at " + useURI + " -- " + e.getMessage(), e);
-        }
-        if (manager instanceof JMXDeploymentManager) {
-            JMXDeploymentManager deploymentManager = (JMXDeploymentManager) manager;
-            deploymentManager.setLogConfiguration(logToSysErr, verboseMessages);
-        }
-    }
-
-    private void loadDriver(String driver, DeploymentFactoryManager mgr) throws DeploymentException {
-        File file = new File(driver);
-        try {
-            if (!file.exists() || !file.canRead() || !JarUtils.isJarFile(file)) {
-                throw new DeploymentSyntaxException("Driver '" + file.getAbsolutePath() + "' is not a readable JAR file");
-            }
-        } catch (IOException e) {
-            throw new DeploymentException("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.");
-            }
-            jar.close();
-            DeploymentFactory factory = (DeploymentFactory) Class.forName(className).newInstance();
-            mgr.registerDeploymentFactory(factory);
-        } catch (DeploymentException e) {
-            throw e;
-        } catch (Exception e) {
-            throw new DeploymentSyntaxException("Unable to load driver class " + className + " from JAR " + file.getAbsolutePath(), e);
-        }
-    }
-
     public DeploymentManager getDeploymentManager() {
         return manager;
     }
@@ -234,28 +58,11 @@ public class ServerConnection {
     public boolean isGeronimo() {
         return manager.getClass().getName().startsWith("org.apache.geronimo.");
     }
-
+    
     public static interface UsernamePasswordHandler {
 
         String getUsername() throws IOException;
 
         String getPassword() throws IOException;
     }
-
-    private static class DefaultUserPasswordHandler implements UsernamePasswordHandler {
-
-        private ConsoleReader consoleReader;
-
-        public DefaultUserPasswordHandler(ConsoleReader consoleReader) {
-            this.consoleReader = consoleReader;
-        }
-
-        public String getPassword() throws IOException {
-            return new String(consoleReader.readPassword("Password: "));
-        }
-
-        public String getUsername() throws IOException {
-            return consoleReader.readLine("Username: ");
-        }
-    }
 }

Modified: geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/BaseCommandSupport.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/BaseCommandSupport.java?rev=939046&r1=939045&r2=939046&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/BaseCommandSupport.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/BaseCommandSupport.java Wed Apr 28 18:38:50 2010
@@ -24,9 +24,13 @@ import java.io.BufferedReader;
 import java.io.InputStreamReader;
 import java.io.IOException;
 import java.io.PrintWriter;
+import java.util.Set;
 
 import org.apache.felix.karaf.shell.console.OsgiCommandSupport;
 import org.apache.geronimo.deployment.cli.ConsoleReader;
+import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.kernel.Kernel;
+import org.osgi.framework.ServiceReference;
 
 /**
  * @version $Rev$ $Date$
@@ -130,4 +134,15 @@ public abstract class BaseCommandSupport
     public String readPassword(String prompt) throws IOException {
         return readLine(prompt);
     }
+    
+    public Kernel getKernel() {
+        ServiceReference reference = bundleContext.getServiceReference(Kernel.class.getName());
+        Kernel kernel = getService(Kernel.class, reference);
+        return kernel;
+    }
+    
+    public boolean isEmbedded(Kernel kernel) {
+        Set deamon = kernel.listGBeans(new AbstractNameQuery("org.apache.geronimo.system.main.EmbeddedDaemon"));
+        return !deamon.isEmpty();
+    }
 }

Modified: geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/deploy/ConnectCommand.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/deploy/ConnectCommand.java?rev=939046&r1=939045&r2=939046&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/deploy/ConnectCommand.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/deploy/ConnectCommand.java Wed Apr 28 18:38:50 2010
@@ -17,21 +17,24 @@
  * under the License.
  */
 
-
-
 package org.apache.geronimo.shell.deploy;
 
 import java.io.IOException;
+import java.util.Set;
 
 import org.apache.felix.gogo.commands.Command;
 import org.apache.felix.gogo.commands.Option;
+import org.apache.geronimo.deployment.cli.OfflineServerConnection;
+import org.apache.geronimo.deployment.cli.OnlineServerConnection;
 import org.apache.geronimo.deployment.cli.ServerConnection;
 import org.apache.geronimo.deployment.cli.ServerConnection.UsernamePasswordHandler;
 import org.apache.geronimo.deployment.plugin.factories.BaseDeploymentFactory;
+import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.cli.deployer.ConnectionParamsImpl;
-import org.apache.geronimo.kernel.basic.BasicKernel;
+import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.shell.BaseCommandSupport;
 
+import org.osgi.framework.ServiceReference;
 import org.osgi.service.command.CommandSession;
 
 /**
@@ -134,15 +137,22 @@ public class ConnectCommand extends Base
      * @exception Exception
      */
     protected ServerConnection openConnection(boolean quiet) throws Exception {
-        if (!quiet) {
-            println("Connecting to Geronimo server: " + hostname + ":" + port);
+        Kernel kernel = getKernel();
+        
+        ServerConnection connection;
+        
+        if (isEmbedded(kernel)) {
+            connection = new OfflineServerConnection(kernel, false);
+        } else {
+            if (!quiet) {
+                println("Connecting to Geronimo server: " + hostname + ":" + port);
+            }
+        
+            BaseDeploymentFactory deploymentFactory = new BaseDeploymentFactory();
+            ConnectionParamsImpl connectionParams = new ConnectionParamsImpl(null, hostname, port, null, username, password, false, false, false, secure);
+            connection = new OnlineServerConnection(connectionParams, new ShellUserPasswordHandler(session), deploymentFactory);
         }
 
-        BasicKernel kernel = new BasicKernel("Geronimo deployer", getBundleContext());
-        BaseDeploymentFactory deploymentFactory = new BaseDeploymentFactory();
-        ConnectionParamsImpl connectionParams = new ConnectionParamsImpl(null, hostname, port, null, username, password, false, false, false, secure);
-        ServerConnection connection = new ServerConnection(connectionParams, new ShellUserPasswordHandler(session), kernel, deploymentFactory);
-
         // Disconnect previous connection if any
         disconnect();
         // store this in the permanent session
@@ -155,7 +165,6 @@ public class ConnectCommand extends Base
         return connection;
     }
 
-
     /**
      * Simple password handler for the gogo shell.
      */

Modified: geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/geronimo/BaseJavaCommand.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/geronimo/BaseJavaCommand.java?rev=939046&r1=939045&r2=939046&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/geronimo/BaseJavaCommand.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/geronimo/BaseJavaCommand.java Wed Apr 28 18:38:50 2010
@@ -20,23 +20,21 @@
 package org.apache.geronimo.shell.geronimo;
 
 import java.io.File;
-import java.net.InetAddress;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
 import org.apache.felix.gogo.commands.Option;
 import org.apache.geronimo.shell.BaseCommandSupport;
+
 /**
  * @version $Rev$ $Date$
  */
-public class BaseJavaCommand extends BaseCommandSupport {
+public abstract class BaseJavaCommand extends BaseCommandSupport {
 
     AntBuilder ant;
 
-    // @Option(required=true, name = "shellInfo")
-    // ShellInfo shellInfo;
-
     @Option(name = "-H", aliases = { "--home" }, description = "Use a specific Geronimo home directory")
     String geronimoHome;
 
@@ -89,10 +87,10 @@ public class BaseJavaCommand extends Bas
     List<String> gPropertyFrom;
 
     @Option(name = "-J", aliases = { "--javaopt" }, description = "Set a JVM flag")
-    List<String> javaFlags;
+    List<String> javaFlags = new ArrayList<String>();
 
     protected File getJavaAgentJar() {
-        File file = new File(geronimoHome, "bin/jpa.jar");
+        File file = new File(geronimoHome, "lib/agent/transformer.jar");
 
         if (javaAgent != null) {
             if (javaAgent.toLowerCase() == "none") {
@@ -109,44 +107,6 @@ public class BaseJavaCommand extends Bas
 
         return file;
     }
-/*
- * No need of rc.d
- * definely need java6 and totally change the way server started
- */
-    /**
-     * Process custom rc.d scripts.
-     
-    protected void processScripts() {
-        //
-        // FIXME: Make the base directory configurable
-        //
-        
-        File basedir = new File(geronimoHome, "etc/rc.d");
-        if (!basedir.exists()) {
-            log.debug("Skipping script processing; missing base directory: "+basedir);
-            return;
-        }
-        
-        // Use the target commands name (not the alias name)
-        String name = context.info.name;
-        
-        def scanner = ant.fileScanner {
-            fileset(dir: basedir) {
-                include(name: "${name},*.groovy");
-            }
-        }
-        
-        Binding binding = new Binding([command: this, log: log, io: io]);
-        GroovyShell shell = new GroovyShell(binding);
-        
-        for (file in scanner) {
-            log.debug("Evaluating script: "+file);
-            
-            // Use InputStream method to avoid classname problems from the file's name
-            shell.evaluate(file.newInputStream());
-        }
-    }
-    */
     
     protected String prefixSystemPath(final String name, final File file) {
         assert name != null;
@@ -161,17 +121,4 @@ public class BaseJavaCommand extends Bas
         return path;
     }
 
-    @Override
-    protected Object doExecute() throws Exception {
-        // TODO Auto-generated method stub
-        return null;
-    }
-}
-
-interface ShellInfo {
-    File getHomeDir();
-
-    InetAddress getLocalHost();
-
-    String getUserName();
 }

Modified: geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/geronimo/ProcessLauncher.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/geronimo/ProcessLauncher.java?rev=939046&r1=939045&r2=939046&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/geronimo/ProcessLauncher.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/geronimo/ProcessLauncher.java Wed Apr 28 18:38:50 2010
@@ -54,18 +54,14 @@ public class ProcessLauncher {
     
     PrintStream out;
 
-    public ProcessLauncher(Logger log, String name, boolean background,PrintStream out) {
+    public ProcessLauncher(Logger log, String name, boolean background, PrintStream out) {
         this.background = background;
         this.log = log;
         this.name = name;
-        this.out=out;
+        this.out = out;
     }
 
-    private class Inner extends Thread {
-        Inner() {
-            super();
-        }
-
+    private class Inner implements Runnable {
         public void run() {
             try {
                 process();
@@ -76,15 +72,10 @@ public class ProcessLauncher {
     }
 
     private class TimingTimerTask extends TimerTask {
-        protected TimingTimerTask() {
-            super();
-        }
-
         @Override
         public void run() {
             timedOut = true;
         }
-
     }
 
     public void launch() throws Exception {
@@ -139,7 +130,7 @@ public class ProcessLauncher {
         //System.console().flush();
 
         if (!background) {
-            log.debug("Waiting for "+name+" to shutdown...");
+            log.debug("Waiting for " + name + " to shutdown...");
 
             t.join();
 

Modified: geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/geronimo/ServerProxy.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/geronimo/ServerProxy.java?rev=939046&r1=939045&r2=939046&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/geronimo/ServerProxy.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/geronimo/ServerProxy.java Wed Apr 28 18:38:50 2010
@@ -242,7 +242,17 @@ public class ServerProxy
     }
 
     public void shutdown() throws Exception {
-        invoke("shutdown");
+        MBeanServerConnection connection = getConnection();
+        Set<ObjectName> objectNameSet =
+            connection.queryNames(new ObjectName("osgi.core:type=framework,*"), null);
+        if (objectNameSet.isEmpty()) {
+            throw new Exception("Framework mbean not found");
+        } else if (objectNameSet.size() == 1) {
+            connection.invoke(objectNameSet.iterator().next(), "stopBundle",
+                              new Object[] { 0 }, new String[] { long.class.getName() });
+        } else {
+            throw new Exception("Found multiple framework mbeans");
+        }
     }
 
     //

Modified: geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/geronimo/StartClientCommand.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/geronimo/StartClientCommand.java?rev=939046&r1=939045&r2=939046&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/geronimo/StartClientCommand.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/geronimo/StartClientCommand.java Wed Apr 28 18:38:50 2010
@@ -27,7 +27,10 @@ import org.apache.felix.gogo.commands.Co
 import org.apache.felix.gogo.commands.Option;
 import org.apache.tools.ant.ExitStatusException;
 import org.apache.tools.ant.taskdefs.Java;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
 import org.apache.tools.ant.types.Environment.Variable;
+
 /**
  * @version $Rev$ $Date$
  */
@@ -52,29 +55,23 @@ public class StartClientCommand extends 
 
         log.debug("Geronimo home: " + geronimoHome);
 
-        // Setup the default properties required to boot the server
+        // Set the properties which we pass to the JVM from the startup script
         properties.put("org.apache.geronimo.home.dir", geronimoHome);
+        properties.put("karaf.home", geronimoHome);
+        properties.put("karaf.base", geronimoHome);
+        // Use relative path
         properties.put("java.io.tmpdir", "var/temp");// Use relative path
-        properties.put("java.endorsed.dirs", prefixSystemPath("java.endorsed.dirs", new File(geronimoHome,
-                "lib/endorsed")));
+        properties.put("java.endorsed.dirs", prefixSystemPath("java.endorsed.dirs", new File(geronimoHome, "lib/endorsed")));
         properties.put("java.ext.dirs", prefixSystemPath("java.ext.dirs", new File(geronimoHome, "lib/ext")));
-
-        // processScripts();
-        
+        // set console properties
+        properties.put("karaf.startLocalConsole", "false");
+        properties.put("karaf.startRemoteShell", "false");
+                
           // Setup default java flags
         if (getJavaAgentJar() != null && getJavaAgentJar().exists()) {
             javaFlags.add("-javaagent:" + getJavaAgentJar().getCanonicalPath());
         }
-         
-        
-        // If we are not backgrounding, then add a nice message for the user when ctrl-c gets hit
-        if (!background) {
-            Runtime.getRuntime().addShutdownHook(new Thread(){
-                public void run(){
-                    println("Shutting down Server...");
-                  }
-            });
-        }
+                 
         //init properties
         if(propertyFrom!=null){
             for(String nameValue:propertyFrom){
@@ -92,11 +89,16 @@ public class StartClientCommand extends 
             protected void process() throws Exception {
                 try {
                     Java javaTask = (Java) ant.createTask("java");
-                    //TODO: build client.jar and put it in the right place
-                    javaTask.setJar(new File(geronimoHome + "/bin/client.jar"));
+                    javaTask.setClassname("org.apache.geronimo.cli.client.ClientCLI");
+                    Path path = javaTask.createClasspath();
+                    File libDir = new File(geronimoHome, "lib");
+                    FileSet fileSet = new FileSet();
+                    fileSet.setDir(libDir);
+                    path.addFileset(fileSet);
                     javaTask.setDir(new File(geronimoHome));
-                    javaTask.setFork(true);
                     javaTask.setFailonerror(true);
+                    javaTask.setFork(true);
+                    
                     if (timeout > 0) {
                         log.info("Timeout after: " + timeout + " seconds");
                         javaTask.setTimeout((long) timeout);
@@ -119,16 +121,11 @@ public class StartClientCommand extends 
                     }
 
                     if (javaFlags != null) {
-                        String javaFlag = "";
-                        for (String s : javaFlags) {
-                            javaFlag.concat(s);
+                        for (String javaFlag : javaFlags) {
+                            javaTask.createJvmarg().setValue(javaFlag);
                         }
-                        javaTask.setJvmargs(javaFlag);
-                    }
-
-                    if (verbose) {
-                        javaTask.setArgs("--verbose");
                     }
+                    
                     for (String i : properties.keySet()) {
                         Variable sysp = new Variable();
                         sysp.setKey(i);
@@ -136,18 +133,20 @@ public class StartClientCommand extends 
                         javaTask.addSysproperty(sysp);
                     }
 
-                    javaTask.setArgs(moduleName);
+                    if (verbose) {
+                        javaTask.createArg().setValue("--verbose");
+                    }
+                    
+                    javaTask.createArg().setValue(moduleName);
 
                     if (moduleArguments != null) {
                         for (String m : moduleArguments) {
-                            javaTask.setArgs(m);
+                            javaTask.createArg().setValue(m);
                         }
                     }
+                    
                     javaTask.execute();
-
-                }
-
-                catch (ExitStatusException e) {
+                } catch (ExitStatusException e) {
                     String tmp = "";
                     log.info(tmp);
 
@@ -155,7 +154,7 @@ public class StartClientCommand extends 
                         log.warn(tmp);
                     }
 
-                    tmp = "Process exited with status: "+e.getStatus();
+                    tmp = "Process exited with status: " + e.getStatus();
 
                     throw e;
                 }

Modified: geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/geronimo/StopServerCommand.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/geronimo/StopServerCommand.java?rev=939046&r1=939045&r2=939046&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/geronimo/StopServerCommand.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/geronimo/StopServerCommand.java Wed Apr 28 18:38:50 2010
@@ -19,11 +19,12 @@
 
 package org.apache.geronimo.shell.geronimo;
 
-
-
 import org.apache.felix.gogo.commands.Command;
+import org.apache.geronimo.deployment.cli.ServerConnection;
+import org.apache.geronimo.deployment.plugin.jmx.RemoteDeploymentManager;
+import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.shell.deploy.ConnectCommand;
-import org.osgi.framework.Bundle;
+
 /**
  * @version $Rev$ $Date$
  */
@@ -32,26 +33,24 @@ public class StopServerCommand extends C
 
     @Override
     protected Object doExecute() throws Exception {
-        //TODO: to stop remote server 
         println("Stopping Geronimo server...");
-        Bundle[] bundles = bundleContext.getBundles();
-        for(Bundle bundle:bundles){
-            if(bundle.getLocation().equals("mvn:org.apache.geronimo.framework/j2ee-system/3.0-SNAPSHOT/car")){
-                try {
-                    bundle.stop();
-                    println("Shutdown request has been issued");
-                    super.disconnect();
-                }
-                catch (Exception e) {
-                    log.debug("Failed to request shutdown:", e);
-                    println("Unable to shutdown the server: "+e.getMessage());
-                }
-                
-                break;
+        Kernel kernel = getKernel();
+        try {
+            if (isEmbedded(kernel)) {
+                bundleContext.getBundle(0).stop();
+            } else {
+                ServerConnection connection = connect();
+                ServerProxy server = 
+                    new ServerProxy(((RemoteDeploymentManager)connection.getDeploymentManager()).getJMXConnector());
+                server.shutdown();
             }
+            println("Shutdown request has been issued");
+        } catch (Exception e) {
+            println("Unable to shutdown the server: " + e.getMessage());
+        } finally {
+            disconnect();
         }
         
-        
         return null;
     }
 

Modified: geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/geronimo/WaitForServerCommand.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/geronimo/WaitForServerCommand.java?rev=939046&r1=939045&r2=939046&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/geronimo/WaitForServerCommand.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/geronimo/WaitForServerCommand.java Wed Apr 28 18:38:50 2010
@@ -27,6 +27,7 @@ import org.apache.felix.gogo.commands.Op
 import org.apache.geronimo.deployment.cli.ServerConnection;
 import org.apache.geronimo.deployment.plugin.jmx.RemoteDeploymentManager;
 import org.apache.geronimo.shell.deploy.ConnectCommand;
+
 /**
  * @version $Rev$ $Date$
  */

Modified: geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/resources/OSGI-INF/blueprint/shell-deploy.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/resources/OSGI-INF/blueprint/shell-deploy.xml?rev=939046&r1=939045&r2=939046&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/resources/OSGI-INF/blueprint/shell-deploy.xml (original)
+++ geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/resources/OSGI-INF/blueprint/shell-deploy.xml Wed Apr 28 18:38:50 2010
@@ -89,7 +89,7 @@
             <action class="org.apache.geronimo.shell.deploy.UndeployModuleCommand">
             </action>
         </command>
-        <command name="deploy/ecrypt">
+        <command name="deploy/encrypt">
             <action class="org.apache.geronimo.shell.deploy.EncryptCommand">
             </action>
         </command>



Mime
View raw message