geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sppa...@apache.org
Subject svn commit: r359865 - in /geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core: ./ commands/ internal/
Date Thu, 29 Dec 2005 18:18:09 GMT
Author: sppatel
Date: Thu Dec 29 10:18:05 2005
New Revision: 359865

URL: http://svn.apache.org/viewcvs?rev=359865&view=rev
Log:
set dm log configuration

Added:
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/internal/DeploymentStatusMessage.java
      - copied, changed from r358629, geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/internal/DeploymentStatusMessageTranslator.java
Removed:
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/internal/DeploymentStatusMessageTranslator.java
Modified:
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/GeronimoConnectionFactory.java
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/SynchronizedDeploymentOp.java
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/internal/GeronimoServerBehaviour.java

Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/GeronimoConnectionFactory.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/GeronimoConnectionFactory.java?rev=359865&r1=359864&r2=359865&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/GeronimoConnectionFactory.java
(original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/GeronimoConnectionFactory.java
Thu Dec 29 10:18:05 2005
@@ -13,6 +13,7 @@
 import org.apache.geronimo.core.internal.GeronimoServer;
 import org.apache.geronimo.core.internal.Trace;
 import org.apache.geronimo.deployment.plugin.factories.DeploymentFactoryImpl;
+import org.apache.geronimo.deployment.plugin.jmx.JMXDeploymentManager;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.wst.server.core.IServer;
@@ -53,6 +54,9 @@
 			Trace.trace(Trace.INFO, "DeployerURL: " + deployerURL);
 			dm = mgr.getDeploymentManager(deployerURL, getUserName(server),
 					getPassword(server));
+			if(dm instanceof JMXDeploymentManager) {
+				((JMXDeploymentManager) dm).setLogConfiguration(true, true);
+			}
 			connections.put(server.getId(), dm);
 		}
 

Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/SynchronizedDeploymentOp.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/SynchronizedDeploymentOp.java?rev=359865&r1=359864&r2=359865&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/SynchronizedDeploymentOp.java
(original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/SynchronizedDeploymentOp.java
Thu Dec 29 10:18:05 2005
@@ -21,7 +21,7 @@
 import javax.enterprise.deploy.spi.status.ProgressListener;
 import javax.enterprise.deploy.spi.status.ProgressObject;
 
-import org.apache.geronimo.core.internal.DeploymentStatusMessageTranslator;
+import org.apache.geronimo.core.internal.DeploymentStatusMessage;
 import org.apache.geronimo.core.internal.GeronimoPlugin;
 import org.apache.geronimo.core.internal.Trace;
 import org.eclipse.core.runtime.IProgressMonitor;
@@ -30,6 +30,11 @@
 import org.eclipse.core.runtime.Status;
 import org.eclipse.wst.server.core.IModule;
 
+/**
+ * This class is a wrapper IDeploymentCommand that when executed blocks the
+ * callee's thread until completed, either when its waiting thread times out, or
+ * a failed or completed notification is recieved from the DeploymentManager.
+ */
 public class SynchronizedDeploymentOp implements ProgressListener,
 		IDeploymentCommand {
 
@@ -48,7 +53,9 @@
 		this.command = command;
 	}
 
-	/* (non-Javadoc)
+	/*
+	 * (non-Javadoc)
+	 * 
 	 * @see org.apache.geronimo.core.commands.IDeploymentCommand#execute(org.eclipse.core.runtime.IProgressMonitor)
 	 */
 	public IStatus execute(IProgressMonitor monitor) {
@@ -63,11 +70,11 @@
 		waitThread.start();
 
 		IStatus ds = command.execute(_monitor);
-		
+
 		ProgressObject po = null;
 
 		if (ds instanceof DeploymentCmdStatus) {
-			
+
 			po = ((DeploymentCmdStatus) ds).getProgressObject();
 
 			po.addProgressListener(this);
@@ -96,39 +103,44 @@
 		}
 	}
 
-	/* (non-Javadoc)
+	/*
+	 * (non-Javadoc)
+	 * 
 	 * @see javax.enterprise.deploy.spi.status.ProgressListener#handleProgressEvent(javax.enterprise.deploy.spi.status.ProgressEvent)
 	 */
 	public void handleProgressEvent(ProgressEvent event) {
 		DeploymentStatus deploymentStatus = event.getDeploymentStatus();
 		if (deploymentStatus != null) {
-			String msg = DeploymentStatusMessageTranslator
-					.getTranslatedMessage(event, command.getModule()
-							.getProject());
-			Trace.trace(Trace.INFO, msg);
-			_monitor.subTask(msg);
+			DeploymentStatusMessage dsm = new DeploymentStatusMessage(
+					deploymentStatus);
+			Trace.trace(Trace.INFO, dsm.toString());
+			_monitor.subTask(dsm.toString());
 			if (command.getCommandType() == deploymentStatus.getCommand()) {
 				if (deploymentStatus.isCompleted()) {
 					status = new Status(IStatus.OK, GeronimoPlugin.PLUGIN_ID,
-							0, msg, null);
+							0, dsm.getMessage(), null);
 					waitThread.interrupt();
 				} else if (deploymentStatus.isFailed()) {
 					status = new Status(IStatus.ERROR,
-							GeronimoPlugin.PLUGIN_ID, 0, msg, null);
+							GeronimoPlugin.PLUGIN_ID, 0, dsm.getMessage(), null);
 					waitThread.interrupt();
 				}
 			}
 		}
 	}
 
-	/* (non-Javadoc)
+	/*
+	 * (non-Javadoc)
+	 * 
 	 * @see org.apache.geronimo.core.commands.IDeploymentCommand#getCommandType()
 	 */
 	public CommandType getCommandType() {
 		return command.getCommandType();
 	}
 
-	/* (non-Javadoc)
+	/*
+	 * (non-Javadoc)
+	 * 
 	 * @see org.apache.geronimo.core.commands.IDeploymentCommand#getModule()
 	 */
 	public IModule getModule() {

Copied: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/internal/DeploymentStatusMessage.java
(from r358629, geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/internal/DeploymentStatusMessageTranslator.java)
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/internal/DeploymentStatusMessage.java?p2=geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/internal/DeploymentStatusMessage.java&p1=geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/internal/DeploymentStatusMessageTranslator.java&r1=358629&r2=359865&rev=359865&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/internal/DeploymentStatusMessageTranslator.java
(original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/internal/DeploymentStatusMessage.java
Thu Dec 29 10:18:05 2005
@@ -15,54 +15,48 @@
  */
 package org.apache.geronimo.core.internal;
 
+import javax.enterprise.deploy.shared.ActionType;
 import javax.enterprise.deploy.shared.CommandType;
-import javax.enterprise.deploy.shared.StateType;
 import javax.enterprise.deploy.spi.status.DeploymentStatus;
-import javax.enterprise.deploy.spi.status.ProgressEvent;
 
-import org.eclipse.core.resources.IProject;
-
-public class DeploymentStatusMessageTranslator {
+public class DeploymentStatusMessage {
+	
+	private DeploymentStatus status;
+	
+	private ActionType action;
+	private CommandType command;
+	private String message;
+	
+	public DeploymentStatusMessage(DeploymentStatus status) {
+		this.status = status;
+		this.action = status.getAction();
+		this.command = status.getCommand();
+		this.message = status.getMessage();
+	}
 
-	public static String getTranslatedMessage(ProgressEvent event, IProject project) {
-		DeploymentStatus status = event.getDeploymentStatus();
-		if (status != null) {
-			String result = translateCommand(status.getCommand()) + " ";
-			result = result.concat("project " + project.getName()) + " ";			
-			return result.concat((status.getState().toString())) + getMessageSuffix(status.getState());
-		}
-		return "";
+	public ActionType getAction() {
+		return action;
 	}
-	
-	private static String getMessageSuffix(StateType state) {
-		if(state == StateType.RUNNING) {
-			return "...";
-		} 
-		return ".";
+
+
+	public CommandType getCommand() {
+		return command;
 	}
 
-	private static String translateCommand(CommandType type) {
-		if (type == CommandType.DISTRIBUTE) {
-			return "Distributing";
-		}
-
-		if (type == CommandType.START) {
-			return "Starting";
-		}
-
-		if (type == CommandType.REDEPLOY) {
-			return "Redeploying";
-		}
-
-		if (type == CommandType.UNDEPLOY) {
-			return "Undeploying";
-		}
-		
-		if (type == CommandType.STOP) {
-			return "Stopping";
-		}
 
-		return "";
+	public String getMessage() {
+		return message;
+	}
+	
+	/* (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 * 
+	 * [ActionType CommandType] message
+	 */
+	public String toString() {
+		StringBuffer buffer = new StringBuffer();
+		buffer.append("[").append(action).append(" ").append(command).append("] ").append(message);
+		return buffer.toString();
 	}
 
 }

Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/internal/GeronimoServerBehaviour.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/internal/GeronimoServerBehaviour.java?rev=359865&r1=359864&r2=359865&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/internal/GeronimoServerBehaviour.java
(original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/internal/GeronimoServerBehaviour.java
Thu Dec 29 10:18:05 2005
@@ -16,6 +16,7 @@
 package org.apache.geronimo.core.internal;
 
 import java.net.MalformedURLException;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
@@ -85,9 +86,7 @@
 				+ getRMINamingPort() + "/JMXConnector";
 	}
 
-	private Kernel getKernel() {
-
-		int tries = MAX_TRIES;
+	private Kernel getKernel(int attempts) {
 
 		if (kernel == null) {
 
@@ -98,9 +97,9 @@
 				String url = getJMXServiceURL();
 				Trace.trace(Trace.INFO, url);
 				JMXServiceURL address = new JMXServiceURL(url);
+				Thread.sleep(3000);
 				do {
 					try {
-
 						JMXConnector jmxConnector = JMXConnectorFactory
 								.connect(address, map);
 						MBeanServerConnection mbServerConnection = jmxConnector
@@ -109,18 +108,10 @@
 						Trace.trace(Trace.INFO, "Connected to kernel.");
 						break;
 					} catch (Exception e) {
-						Thread.sleep(3000);
-						tries--;
-						if (tries != 0) {
-							Trace
-									.trace(Trace.WARNING,
-											"Couldn't connect to kernel.  Trying again...");
-						} else {
-							Trace.trace(Trace.SEVERE,
-									"Connection to Geronimo kernel failed.", e);
-						}
+						Trace.trace(Trace.WARNING, "Kernel connection failed. "
+								+ --attempts + " attempts left.");
 					}
-				} while (tries > 0);
+				} while (attempts > 0);
 			} catch (MalformedURLException e) {
 				e.printStackTrace();
 			} catch (InterruptedException e) {
@@ -131,42 +122,64 @@
 		return kernel;
 	}
 
-	protected void setServerStarted() {
-
-		boolean started = false;
-
-		GBeanQuery query = new GBeanQuery(null,
-				PersistentConfigurationList.class.getName());
+	private Kernel getKernel() {
+		return getKernel(1);
+	}
 
-		for (int tries = MAX_TRIES; tries > 0 && !started; tries--) {
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jst.server.generic.core.internal.GenericServerBehaviour#setServerStarted()
+	 */
+	protected void setServerStarted() {
+		for (int tries = MAX_TRIES; tries > 0; tries--) {
 			try {
 				Thread.sleep(5000);
 			} catch (InterruptedException e1) {
+				// ignore
 			}
-			Set configLists = getKernel().listGBeans(query);
-			if (!configLists.isEmpty()) {
-				ObjectName on = (ObjectName) configLists.toArray()[0];
-				try {
-					Boolean b = (Boolean) getKernel().getAttribute(on,
-							"kernelFullyStarted");
-					if (b.booleanValue()) {
-						Trace.trace(Trace.INFO, "kernelFullyStarted = true");
-						setServerState(IServer.STATE_STARTED);
-						started = true;
-					} else {
-						Trace.trace(Trace.INFO, "kernelFullyStarted = false");
-					}
-				} catch (GBeanNotFoundException e) {
-				} catch (NoSuchAttributeException e) {
-				} catch (Exception e) {
-					e.printStackTrace();
-				}
-			} else {
-				Trace.trace(Trace.INFO, "configList is Empty");
+			boolean isFullyStarted = isKernelFullyStarted();
+			Trace.trace(Trace.INFO, "kernelFullyStarted = " + isFullyStarted
+					+ ", " + (tries - 1) + " attempts left.");
+			if (isFullyStarted) {
+				setServerState(IServer.STATE_STARTED);
+				break;
 			}
 		}
 	}
 
+	private boolean isKernelAlive() {
+		return kernel != null && kernel.isRunning();
+	}
+
+	private boolean isKernelFullyStarted() {
+		Set configLists = getKernel(MAX_TRIES).listGBeans(
+				new GBeanQuery(null, PersistentConfigurationList.class
+						.getName()));
+		if (!configLists.isEmpty()) {
+			ObjectName on = (ObjectName) configLists.toArray()[0];
+			try {
+				Boolean b = (Boolean) getKernel().getAttribute(on,
+						"kernelFullyStarted");
+				return b.booleanValue();
+			} catch (GBeanNotFoundException e) {
+				// ignore
+			} catch (NoSuchAttributeException e) {
+				// ignore
+			} catch (Exception e) {
+				e.printStackTrace();
+			}
+		} else {
+			Trace.trace(Trace.INFO, "configLists is empty");
+		}
+		return false;
+	}
+
+	private boolean isRuntimeDeployerRunning() {
+		// TODO Implement Me
+		return true;
+	}
+
 	/*
 	 * (non-Javadoc)
 	 * 
@@ -176,22 +189,20 @@
 	 */
 	public void publishModule(int kind, int deltaKind, IModule[] module,
 			IProgressMonitor monitor) throws CoreException {
-		
-		Trace.trace(Trace.INFO, ">> publishModule(), deltaKind = " + kind + ", size = " +
module.length);
+		Trace.trace(Trace.INFO, ">> publishModule(), deltaKind = " + kind);
+		Trace.trace(Trace.INFO, Arrays.asList(module).toString());
 		_monitor = monitor;
 
 		if (deltaKind != NO_CHANGE && module.length == 1) {
 			invokeCommand(deltaKind, module[0]);
 		}
-		
-		Trace.trace(Trace.INFO, "<< publishModule()");
 
+		Trace.trace(Trace.INFO, "<< publishModule()");
 	}
 
 	private void invokeCommand(int deltaKind, IModule module)
 			throws CoreException {
-
-		Trace.trace(Trace.INFO, ">> invokeCommand() " + module.toString());
+		Trace.trace(Trace.INFO, ">> invokeCommand()");
 
 		switch (deltaKind) {
 		case ADDED: {
@@ -210,17 +221,15 @@
 			throw new IllegalArgumentException();
 		}
 
-		Trace.trace(Trace.INFO, "<< invokeCommand() " + module.toString());
-
+		Trace.trace(Trace.INFO, "<< invokeCommand()");
 	}
 
 	private void doDeploy(IModule module) throws CoreException {
-
 		Trace.trace(Trace.INFO, ">> doDeploy() " + module.toString());
 
-		IDeploymentCommand op = DeploymentCommandFactory
+		IDeploymentCommand cmd = DeploymentCommandFactory
 				.createDistributeCommand(module, getServer());
-		IStatus status = op.execute(_monitor);
+		IStatus status = cmd.execute(_monitor);
 
 		if (!status.isOK()) {
 			doFail(status, Messages.DISTRIBUTE_FAIL);
@@ -229,11 +238,9 @@
 		if (status instanceof DeploymentCmdStatus) {
 			TargetModuleID[] ids = ((DeploymentCmdStatus) status)
 					.getResultTargetModuleIDs();
-
-			op = DeploymentCommandFactory.createStartCommand(ids, module,
+			cmd = DeploymentCommandFactory.createStartCommand(ids, module,
 					getServer());
-
-			status = op.execute(_monitor);
+			status = cmd.execute(_monitor);
 
 			if (!status.isOK()) {
 				doFail(status, Messages.START_FAIL);
@@ -241,17 +248,14 @@
 		}
 
 		Trace.trace(Trace.INFO, "<< doDeploy() " + module.toString());
-
 	}
 
 	private void doRedeploy(IModule module) throws CoreException {
-
 		Trace.trace(Trace.INFO, ">> doRedeploy() " + module.toString());
 
-		IDeploymentCommand op = DeploymentCommandFactory.createRedeployCommand(
-				module, getServer());
-
-		IStatus status = op.execute(_monitor);
+		IDeploymentCommand cmd = DeploymentCommandFactory
+				.createRedeployCommand(module, getServer());
+		IStatus status = cmd.execute(_monitor);
 
 		if (!status.isOK()) {
 			doFail(status, Messages.REDEPLOY_FAIL);
@@ -261,29 +265,25 @@
 	}
 
 	private void doUndeploy(IModule module) throws CoreException {
-
 		Trace.trace(Trace.INFO, ">> doUndeploy() " + module.toString());
 
-		IDeploymentCommand op = DeploymentCommandFactory.createStopCommand(
+		IDeploymentCommand cmd = DeploymentCommandFactory.createStopCommand(
 				module, getServer());
-
-		IStatus status = op.execute(_monitor);
+		IStatus status = cmd.execute(_monitor);
 
 		if (!status.isOK()) {
 			doFail(status, Messages.STOP_FAIL);
 		}
 
-		op = DeploymentCommandFactory
-				.createUndeployCommand(module, getServer());
-
-		status = op.execute(_monitor);
+		cmd = DeploymentCommandFactory.createUndeployCommand(module,
+				getServer());
+		status = cmd.execute(_monitor);
 
 		if (!status.isOK()) {
 			doFail(status, Messages.UNDEPLOY_FAIL);
 		}
 
 		Trace.trace(Trace.INFO, "<< doUndeploy()" + module.toString());
-
 	}
 
 	private void doFail(IStatus status, String message) throws CoreException {
@@ -309,6 +309,12 @@
 				getServer());
 	}
 
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.wst.server.core.model.ServerBehaviourDelegate#setupLaunchConfiguration(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy,
+	 *      org.eclipse.core.runtime.IProgressMonitor)
+	 */
 	public void setupLaunchConfiguration(
 			ILaunchConfigurationWorkingCopy workingCopy,
 			IProgressMonitor monitor) throws CoreException {



Mime
View raw message