geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: rev 55656 - in geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/plugin: factories jmx local
Date Wed, 27 Oct 2004 01:21:28 GMT
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;
+	}
 }

Mime
View raw message