geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sppa...@apache.org
Subject svn commit: r398695 - in /geronimo/devtools/eclipse-plugin/trunk/plugins: org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/ org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/commands/ org.apache.geronimo.st.v1.core/src/org/apache/g...
Date Mon, 01 May 2006 21:38:31 GMT
Author: sppatel
Date: Mon May  1 14:38:28 2006
New Revision: 398695

URL: http://svn.apache.org/viewcvs?rev=398695&view=rev
Log:
configure targets

Modified:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/IGeronimoServerBehavior.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/commands/DeploymentCommandFactory.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/commands/DistributeCommand.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v1.core/src/org/apache/geronimo/st/v1/core/GeronimoServerBehaviour.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/org/apache/geronimo/st/v11/core/ConfigStoreInstaller.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/org/apache/geronimo/st/v11/core/GeronimoServerBehaviour.java

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/IGeronimoServerBehavior.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/IGeronimoServerBehavior.java?rev=398695&r1=398694&r2=398695&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/IGeronimoServerBehavior.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/IGeronimoServerBehavior.java
Mon May  1 14:38:28 2006
@@ -15,6 +15,8 @@
  */
 package org.apache.geronimo.st.core;
 
+import javax.enterprise.deploy.spi.Target;
+
 public interface IGeronimoServerBehavior {
 
 	public boolean isFullyStarted();
@@ -24,5 +26,7 @@
 	public void setServerStarted();
 
 	public void setServerStopped();
+	
+	public Target[] getTargets();
 
 }

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/commands/DeploymentCommandFactory.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/commands/DeploymentCommandFactory.java?rev=398695&r1=398694&r2=398695&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/commands/DeploymentCommandFactory.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/commands/DeploymentCommandFactory.java
Mon May  1 14:38:28 2006
@@ -16,11 +16,13 @@
 package org.apache.geronimo.st.core.commands;
 
 import javax.enterprise.deploy.spi.DeploymentManager;
+import javax.enterprise.deploy.spi.Target;
 import javax.enterprise.deploy.spi.TargetModuleID;
 import javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException;
 
 import org.apache.geronimo.st.core.Activator;
 import org.apache.geronimo.st.core.GeronimoConnectionFactory;
+import org.apache.geronimo.st.core.IGeronimoServerBehavior;
 import org.apache.geronimo.st.core.internal.Messages;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IStatus;
@@ -45,9 +47,10 @@
 	 * @return
 	 * @throws CoreException
 	 */
-	public static IDeploymentCommand createDistributeCommand(IModule module,
-			IServer server, boolean inPlace) throws CoreException {
-		return new SynchronizedDeploymentOp(new DistributeCommand(module, getDeploymentManager(server),
inPlace));
+	public static IDeploymentCommand createDistributeCommand(IModule module, IServer server,
boolean inPlace) throws CoreException {
+		IGeronimoServerBehavior gs = (IGeronimoServerBehavior) server.loadAdapter(IGeronimoServerBehavior.class,
null);
+		Target[] targets = gs.getTargets();
+		return new SynchronizedDeploymentOp(new DistributeCommand(module, getDeploymentManager(server),
targets, inPlace));
 	}
 
 	/**

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/commands/DistributeCommand.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/commands/DistributeCommand.java?rev=398695&r1=398694&r2=398695&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/commands/DistributeCommand.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/commands/DistributeCommand.java
Mon May  1 14:38:28 2006
@@ -20,19 +20,28 @@
 import javax.enterprise.deploy.shared.CommandType;
 import javax.enterprise.deploy.spi.DeploymentManager;
 import javax.enterprise.deploy.spi.Target;
+
 import org.apache.geronimo.st.core.DeploymentUtils;
+import org.apache.geronimo.st.core.internal.Trace;
+import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
+import org.eclipse.wst.common.componentcore.internal.StructureEdit;
+import org.eclipse.wst.common.componentcore.internal.WorkbenchComponent;
+import org.eclipse.wst.common.componentcore.internal.impl.WorkbenchComponentImpl;
 import org.eclipse.wst.server.core.IModule;
 
 class DistributeCommand extends AbstractDeploymentCommand {
-	
+
 	boolean inPlace;
-	
-	public DistributeCommand(IModule module, DeploymentManager dm, boolean inPlace) {
+
+	Target[] targets;
+
+	public DistributeCommand(IModule module, DeploymentManager dm, Target[] targets, boolean
inPlace) {
 		super(dm, module);
 		this.inPlace = inPlace;
+		this.targets = targets;
 	}
 
 	/*
@@ -41,15 +50,25 @@
 	 * @see org.apache.geronimo.core.commands.IDeploymentCommand#execute(org.eclipse.core.runtime.IProgressMonitor)
 	 */
 	public IStatus execute(IProgressMonitor monitor) {
-		Target[] targets = getDeploymentManager().getTargets();
+		if (targets == null)
+			targets = getDeploymentManager().getTargets();
+
 		File file = null;
-		
-		if(inPlace) {
-			file = getModule().getProject().getLocation().toFile();
+
+		if (inPlace) {
+			StructureEdit moduleCore = StructureEdit.getStructureEditForRead(getModule().getProject());
+			try {
+				WorkbenchComponent component = moduleCore.getComponent();
+				IPath loc = ((WorkbenchComponentImpl) component).getDefaultSourceRoot();
+				file = getModule().getProject().findMember(loc).getLocation().toFile();
+			} finally {
+				if (moduleCore != null)
+					moduleCore.dispose();
+			}
 		} else {
 			file = DeploymentUtils.createJarFile(getModule());
 		}
-		
+
 		return new DeploymentCmdStatus(Status.OK_STATUS, getDeploymentManager().distribute(targets,
file, null));
 	}
 
@@ -61,6 +80,5 @@
 	public CommandType getCommandType() {
 		return CommandType.DISTRIBUTE;
 	}
-	
 
 }

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v1.core/src/org/apache/geronimo/st/v1/core/GeronimoServerBehaviour.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v1.core/src/org/apache/geronimo/st/v1/core/GeronimoServerBehaviour.java?rev=398695&r1=398694&r2=398695&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v1.core/src/org/apache/geronimo/st/v1/core/GeronimoServerBehaviour.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v1.core/src/org/apache/geronimo/st/v1/core/GeronimoServerBehaviour.java
Mon May  1 14:38:28 2006
@@ -22,6 +22,7 @@
 import java.util.Map;
 import java.util.Set;
 
+import javax.enterprise.deploy.spi.Target;
 import javax.management.MBeanServerConnection;
 import javax.management.ObjectName;
 import javax.management.remote.JMXConnector;
@@ -159,6 +160,14 @@
 	 */
 	public String getConfigId(IModule module) {
 		return GeronimoV1Utils.getConfigId(module);
+	}
+	
+	
+	/* (non-Javadoc)
+	 * @see org.apache.geronimo.st.core.IGeronimoServerBehavior#getTargets()
+	 */
+	public Target[] getTargets() {
+		return null;
 	}
 	
 	/* (non-Javadoc)

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/org/apache/geronimo/st/v11/core/ConfigStoreInstaller.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/org/apache/geronimo/st/v11/core/ConfigStoreInstaller.java?rev=398695&r1=398694&r2=398695&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/org/apache/geronimo/st/v11/core/ConfigStoreInstaller.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/org/apache/geronimo/st/v11/core/ConfigStoreInstaller.java
Mon May  1 14:38:28 2006
@@ -9,8 +9,8 @@
 import javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException;
 import javax.enterprise.deploy.spi.status.ProgressObject;
 
-import org.apache.geronimo.deployment.plugin.GeronimoDeploymentManager;
 import org.apache.geronimo.deployment.plugin.TargetModuleIDImpl;
+import org.apache.geronimo.deployment.plugin.jmx.JMXDeploymentManager;
 import org.apache.geronimo.st.core.GeronimoConnectionFactory;
 import org.apache.geronimo.st.jmxagent.Activator;
 import org.apache.geronimo.st.v11.core.internal.Trace;
@@ -22,35 +22,30 @@
 public class ConfigStoreInstaller implements IServerListener {
 
 	public void serverChanged(ServerEvent event) {
-		Trace.trace(Trace.INFO, "--> ConfigStoreInstaller.serverChanged()");
 		if (event.getKind() == (ServerEvent.SERVER_CHANGE | ServerEvent.STATE_CHANGE)) {
 			if (event.getServer().getServerState() == IServer.STATE_STARTED) {
 				install(event.getServer());
 			}
 		}
-		Trace.trace(Trace.INFO, "<-- ConfigStoreInstaller().serverChanged()");
 	}
 
 	private void install(IServer server) {
 		Trace.trace(Trace.INFO, "--> ConfigStoreInstaller.install()");
 		try {
 
-			GeronimoDeploymentManager dm = (GeronimoDeploymentManager) GeronimoConnectionFactory
-					.getInstance().getDeploymentManager(server);
+			JMXDeploymentManager dm = (JMXDeploymentManager) GeronimoConnectionFactory.getInstance().getDeploymentManager(server);
+			dm.setInPlace(false);
 
 			Target target = dm.getTargets()[0];
 			Trace.trace(Trace.INFO, "target name: " + target.getName());
 
-			File jar = new File(resolveFromBundle(
-					"/lib/config-store-service-1.0-SNAPSHOT.jar").getFile());
+			File jar = new File(resolveFromBundle("/lib/config-store-service-1.0-SNAPSHOT.jar").getFile());
 			File plan = new File(resolveFromBundle("/plan.xml").getFile());
 
-			ProgressObject po = dm.distribute(new Target[] { target }, jar,
-					plan);
+			ProgressObject po = dm.distribute(new Target[] { target }, jar, plan);
 			waitForCompletion(po);
 
-			TargetModuleID id = new TargetModuleIDImpl(target,
-					Activator.SERVICE_ID);
+			TargetModuleID id = new TargetModuleIDImpl(target, Activator.SERVICE_ID);
 
 			po = dm.start(new TargetModuleID[] { id });
 			waitForCompletion(po);
@@ -63,8 +58,7 @@
 
 	private URL resolveFromBundle(String path) {
 		try {
-			return Platform.resolve(Activator.getDefault().getBundle()
-					.getEntry(path));
+			return Platform.resolve(Activator.getDefault().getBundle().getEntry(path));
 		} catch (IOException e) {
 			e.printStackTrace();
 		}

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/org/apache/geronimo/st/v11/core/GeronimoServerBehaviour.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/org/apache/geronimo/st/v11/core/GeronimoServerBehaviour.java?rev=398695&r1=398694&r2=398695&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/org/apache/geronimo/st/v11/core/GeronimoServerBehaviour.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/org/apache/geronimo/st/v11/core/GeronimoServerBehaviour.java
Mon May  1 14:38:28 2006
@@ -15,17 +15,20 @@
  */
 package org.apache.geronimo.st.v11.core;
 
+import java.io.IOException;
 import java.net.MalformedURLException;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
 
+import javax.enterprise.deploy.spi.Target;
 import javax.management.MBeanServerConnection;
 import javax.management.remote.JMXConnector;
 import javax.management.remote.JMXConnectorFactory;
 import javax.management.remote.JMXServiceURL;
 import javax.naming.directory.NoSuchAttributeException;
 
+import org.apache.geronimo.deployment.plugin.TargetImpl;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
@@ -34,6 +37,7 @@
 import org.apache.geronimo.st.core.GenericGeronimoServerBehaviour;
 import org.apache.geronimo.st.core.GeronimoConnectionFactory;
 import org.apache.geronimo.st.jmxagent.Activator;
+import org.apache.geronimo.st.jmxagent.JMXAgent;
 import org.apache.geronimo.st.v11.core.internal.Trace;
 import org.apache.geronimo.system.jmx.KernelDelegate;
 import org.eclipse.core.runtime.CoreException;
@@ -91,10 +95,8 @@
 					return null;
 				JMXServiceURL address = new JMXServiceURL(url);
 				try {
-					JMXConnector jmxConnector = JMXConnectorFactory.connect(
-							address, map);
-					MBeanServerConnection mbServerConnection = jmxConnector
-							.getMBeanServerConnection();
+					JMXConnector jmxConnector = JMXConnectorFactory.connect(address, map);
+					MBeanServerConnection mbServerConnection = jmxConnector.getMBeanServerConnection();
 					kernel = new KernelDelegate(mbServerConnection);
 					Trace.trace(Trace.INFO, "Connected to kernel.");
 				} catch (SecurityException e) {
@@ -125,11 +127,7 @@
 				stop(true);
 			}
 		} catch (Exception e) {
-			Activator
-					.log(
-							Status.WARNING,
-							"Geronimo Server may have been terminated manually outside of workspace.",
-							e);
+			Activator.log(Status.WARNING, "Geronimo Server may have been terminated manually outside
of workspace.", e);
 			kernel = null;
 		}
 		return false;
@@ -142,14 +140,12 @@
 	 */
 	public boolean isFullyStarted() {
 		if (isKernelAlive()) {
-			AbstractNameQuery query = new AbstractNameQuery(
-					PersistentConfigurationList.class.getName());
+			AbstractNameQuery query = new AbstractNameQuery(PersistentConfigurationList.class.getName());
 			Set configLists = kernel.listGBeans(query);
 			if (!configLists.isEmpty()) {
 				AbstractName on = (AbstractName) configLists.toArray()[0];
 				try {
-					Boolean b = (Boolean) kernel.getAttribute(on,
-							"kernelFullyStarted");
+					Boolean b = (Boolean) kernel.getAttribute(on, "kernelFullyStarted");
 					return b.booleanValue();
 				} catch (GBeanNotFoundException e) {
 					// ignore
@@ -174,11 +170,33 @@
 		return GeronimoV11Utils.getConfigId(module);
 	}
 
-	protected void setupLaunch(ILaunch launch, String launchMode,
-			IProgressMonitor monitor) throws CoreException {
+	protected void setupLaunch(ILaunch launch, String launchMode, IProgressMonitor monitor)
throws CoreException {
 		if (SocketUtil.isLocalhost(getServer().getHost())) {
-			getServer().addServerListener(new ConfigStoreInstaller());
+			try {
+				JMXAgent.getInstance().start();
+				getServer().addServerListener(new ConfigStoreInstaller());
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
 		}
 		super.setupLaunch(launch, launchMode, monitor);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.st.core.IGeronimoServerBehavior#getTargets()
+	 */
+	public Target[] getTargets() {
+		if (getGeronimoServer().isTestEnvironment()) {
+			AbstractNameQuery query = new AbstractNameQuery("org.apache.geronimo.devtools.EclipseAwareConfigurationStore");
+			Set set = getKernel().listGBeans(query);
+			if (!set.isEmpty()) {
+				AbstractName name = (AbstractName) set.toArray()[0];
+				Target target = new TargetImpl(name, null);
+				return new Target[]{target};
+			}
+		}
+		return null;
 	}
 }



Mime
View raw message