Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 10741 invoked from network); 27 Oct 2004 01:21:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 27 Oct 2004 01:21:34 -0000 Received: (qmail 84300 invoked by uid 500); 27 Oct 2004 01:21:33 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 84160 invoked by uid 500); 27 Oct 2004 01:21:30 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: dev@geronimo.apache.org Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 84132 invoked by uid 99); 27 Oct 2004 01:21:30 -0000 X-ASF-Spam-Status: No, hits=-10.0 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Tue, 26 Oct 2004 18:21:29 -0700 Received: (qmail 10705 invoked by uid 65534); 27 Oct 2004 01:21:28 -0000 Date: 27 Oct 2004 01:21:28 -0000 Message-ID: <20041027012128.10702.qmail@minotaur.apache.org> From: chirino@apache.org To: scm@geronimo.apache.org Subject: svn commit: rev 55656 - in geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin: factories jmx local X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Author: chirino Date: Tue Oct 26 18:21:27 2004 New Revision: 55656 Modified: geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/factories/DeploymentFactoryImpl.java geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/jmx/JMXDeploymentManager.java geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/CommandSupport.java Log: If the deployer uri ends with "/debug" we now turn on a flag on the deployer client side that logs deployer exceptions to System.err Modified: geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/factories/DeploymentFactoryImpl.java ============================================================================== --- geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/factories/DeploymentFactoryImpl.java (original) +++ geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/factories/DeploymentFactoryImpl.java Tue Oct 26 18:21:27 2004 @@ -18,6 +18,8 @@ package org.apache.geronimo.deployment.plugin.factories; import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; import java.util.HashMap; import java.util.Map; import javax.enterprise.deploy.shared.factories.DeploymentFactoryManager; @@ -75,11 +77,19 @@ Map environment = new HashMap(); String[] credentials = new String[]{username, password}; environment.put(JMXConnector.CREDENTIALS, credentials); + + boolean logErrors=false; + if( uri.endsWith("/debug") ) { + logErrors=true; + uri = uri.substring(0, uri.length() - "/debug".length()); + } try { JMXServiceURL address = new JMXServiceURL("service:" + uri); JMXConnector jmxConnector = JMXConnectorFactory.connect(address, environment); - return new JMXDeploymentManager(jmxConnector); + JMXDeploymentManager manager = new JMXDeploymentManager(jmxConnector); + manager.setLogErrors(logErrors); + return manager; } catch (IOException e) { throw (DeploymentManagerCreationException)new DeploymentManagerCreationException(e.getMessage()).initCause(e); } @@ -97,7 +107,7 @@ } } - static { + static { DeploymentFactoryManager manager = DeploymentFactoryManager.getInstance(); manager.registerDeploymentFactory(new DeploymentFactoryImpl()); } Modified: geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/jmx/JMXDeploymentManager.java ============================================================================== --- geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/jmx/JMXDeploymentManager.java (original) +++ geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/jmx/JMXDeploymentManager.java Tue Oct 26 18:21:27 2004 @@ -61,6 +61,7 @@ private JMXConnector jmxConnector; private MBeanServerConnection mbServerConnection; private KernelMBean kernel; + private boolean logErrors; public JMXDeploymentManager(JMXConnector jmxConnector) throws IOException { this.jmxConnector = jmxConnector; @@ -157,6 +158,7 @@ throw new IllegalStateException("Disconnected"); } DistributeCommand command = new DistributeCommand(kernel, targetList, moduleArchive, deploymentPlan); + command.setLogErrors(logErrors); new Thread(command).start(); return command; } @@ -166,6 +168,7 @@ throw new IllegalStateException("Disconnected"); } DistributeCommand command = new DistributeCommand(kernel, targetList, moduleArchive, deploymentPlan); + command.setLogErrors(logErrors); new Thread(command).start(); return command; } @@ -175,6 +178,7 @@ throw new IllegalStateException("Disconnected"); } StartCommand command = new StartCommand(kernel, moduleIDList); + command.setLogErrors(logErrors); new Thread(command).start(); return command; } @@ -184,6 +188,7 @@ throw new IllegalStateException("Disconnected"); } StopCommand command = new StopCommand(kernel, moduleIDList); + command.setLogErrors(logErrors); new Thread(command).start(); return command; } @@ -193,6 +198,7 @@ throw new IllegalStateException("Disconnected"); } UndeployCommand command = new UndeployCommand(kernel, moduleIDList); + command.setLogErrors(logErrors); new Thread(command).start(); return command; } @@ -206,6 +212,7 @@ throw new IllegalStateException("Disconnected"); } RedeployCommand command = new RedeployCommand(kernel, moduleIDList, moduleArchive, deploymentPlan); + command.setLogErrors(logErrors); new Thread(command).start(); return command; } @@ -251,4 +258,8 @@ public DeploymentConfiguration createConfiguration(DeployableObject dObj) throws InvalidModuleException { throw new InvalidModuleException("Not supported"); } + + public void setLogErrors(boolean logErrors) { + this.logErrors = logErrors; + } } Modified: geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/CommandSupport.java ============================================================================== --- geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/CommandSupport.java (original) +++ geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/CommandSupport.java Tue Oct 26 18:21:27 2004 @@ -47,6 +47,7 @@ private String message; private final Set listeners = new HashSet(); private final List moduleIDs = new ArrayList(); + private boolean logErrors; protected CommandSupport(CommandType command) { this.command = command; @@ -107,6 +108,12 @@ if (e instanceof MBeanException) { e = ((MBeanException)e).getTargetException(); } + + if( logErrors ) { + System.err.println("Deployer operation failed: "+e.getMessage()); + e.printStackTrace(System.err); + } + StringWriter writer = new StringWriter(); PrintWriter printWriter = new PrintWriter(writer); printWriter.println(e.getMessage()); @@ -185,4 +192,12 @@ return buf.toString(); } } + + public boolean isLogErrors() { + return logErrors; + } + + public void setLogErrors(boolean logErrors) { + this.logErrors = logErrors; + } }