geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sppa...@apache.org
Subject svn commit: r416463 - in /geronimo/devtools/eclipse-plugin/trunk/plugins: org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/ org.apache.geronimo.st.v1.core/src/org/apache/geronimo/st/v1/core/ org.apache.geronimo.st.v11.core/src/org/apache/ger...
Date Thu, 22 Jun 2006 20:44:59 GMT
Author: sppatel
Date: Thu Jun 22 13:44:58 2006
New Revision: 416463

URL: http://svn.apache.org/viewvc?rev=416463&view=rev
Log:
fix getpublishdirectory()

Modified:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GenericGeronimoServerBehaviour.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/GeronimoServerBehaviour.java

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GenericGeronimoServerBehaviour.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GenericGeronimoServerBehaviour.java?rev=416463&r1=416462&r2=416463&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GenericGeronimoServerBehaviour.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GenericGeronimoServerBehaviour.java
Thu Jun 22 13:44:58 2006
@@ -15,6 +15,7 @@
  */
 package org.apache.geronimo.st.core;
 
+import java.net.URL;
 import java.util.Arrays;
 import java.util.Map;
 import java.util.Timer;
@@ -29,8 +30,10 @@
 import org.apache.geronimo.st.core.internal.Messages;
 import org.apache.geronimo.st.core.internal.Trace;
 import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.debug.core.ILaunch;
 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
@@ -342,6 +345,26 @@
 	protected void initialize(IProgressMonitor monitor) {
 		Trace.trace(Trace.INFO, "GeronimoServerBehavior.initialize()");
 		startUpdateServerStateTask();
+	}
+	
+	protected IPath getModulePath(IModule[] module, URL baseURL) {
+		IPath modulePath = new Path(baseURL.getFile());
+
+		if (module.length == 2) {
+			IModule workingModule = module[module.length -1];
+			modulePath = modulePath.append(workingModule.getName());
+			if (GeronimoUtils.isWebModule(workingModule)) {
+				modulePath = modulePath.addFileExtension(".war");
+			} else if (GeronimoUtils.isEjbJarModule(workingModule)) {
+				modulePath = modulePath.addFileExtension(".jar");
+			} else if (GeronimoUtils.isRARModule(workingModule)) {
+				modulePath = modulePath.addFileExtension(".rar");
+			} else if (GeronimoUtils.isEarModule(workingModule)) {
+				modulePath = modulePath.addFileExtension(".ear");
+			}
+		}
+
+		return modulePath;
 	}
 
 	/*

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/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v1.core/src/org/apache/geronimo/st/v1/core/GeronimoServerBehaviour.java?rev=416463&r1=416462&r2=416463&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
Thu Jun 22 13:44:58 2006
@@ -180,27 +180,11 @@
 			return null;
 		
 		try {
-			IModule workingModule = module[0];
-			String configId = getConfigId(workingModule);
+			String configId = getConfigId(module[0]);
 			ObjectName on = Configuration.getConfigurationObjectName(URI.create(configId));
 			GBeanData data = kernel.getGBeanData(on);
-			URL url = (URL) data.getAttribute("baseURL");
-			IPath modulePath = new Path(url.getFile());
-			if(module.length == 2) {
-				workingModule = module[1];
-				modulePath = modulePath.append(workingModule.getName());
-			} 
-			
-			if(GeronimoUtils.isWebModule(workingModule)) {
-				modulePath = modulePath.addFileExtension(".war");
-			} else if(GeronimoUtils.isEjbJarModule(workingModule)) {
-				modulePath = modulePath.addFileExtension(".jar");
-			} else if(GeronimoUtils.isRARModule(workingModule)) {
-				modulePath = modulePath.addFileExtension(".rar");
-			} else if(GeronimoUtils.isEarModule(workingModule)) {
-				modulePath = modulePath.addFileExtension(".ear");
-			}
-			
+			URL url = (URL) data.getAttribute("baseURL");	
+			return getModulePath(module, url);
 		} catch (MalformedObjectNameException e) {
 			e.printStackTrace();
 		} catch (GBeanNotFoundException e) {

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/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/org/apache/geronimo/st/v11/core/GeronimoServerBehaviour.java?rev=416463&r1=416462&r2=416463&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
Thu Jun 22 13:44:58 2006
@@ -17,6 +17,7 @@
 
 import java.io.IOException;
 import java.net.MalformedURLException;
+import java.net.URL;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
@@ -31,24 +32,32 @@
 import org.apache.geronimo.deployment.plugin.TargetImpl;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
+import org.apache.geronimo.kernel.InternalKernelException;
 import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.config.Configuration;
+import org.apache.geronimo.kernel.config.InvalidConfigException;
 import org.apache.geronimo.kernel.config.PersistentConfigurationList;
+import org.apache.geronimo.kernel.repository.Artifact;
 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;
+import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.debug.core.ILaunch;
 import org.eclipse.wst.server.core.IModule;
 import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.internal.IModulePublishHelper;
 import org.eclipse.wst.server.core.util.SocketUtil;
 
-public class GeronimoServerBehaviour extends GenericGeronimoServerBehaviour {
-	
+public class GeronimoServerBehaviour extends GenericGeronimoServerBehaviour implements IModulePublishHelper
{
+
 	static {
 		try {
 			JMXAgent.getInstance().start();
@@ -108,7 +117,8 @@
 				} catch (SecurityException e) {
 					throw e;
 				} catch (Exception e) {
-					Trace.trace(Trace.WARNING, "Kernel connection failed." + url);
+					Trace.trace(Trace.WARNING, "Kernel connection failed."
+							+ url);
 				}
 			} catch (MalformedURLException e) {
 				e.printStackTrace();
@@ -177,7 +187,8 @@
 	}
 
 	protected void setupLaunch(ILaunch launch, String launchMode, IProgressMonitor monitor)
throws CoreException {
-		if (SocketUtil.isLocalhost(getServer().getHost()) && getGeronimoServer().isRunFromWorkspace())
{
+		if (SocketUtil.isLocalhost(getServer().getHost())
+				&& getGeronimoServer().isRunFromWorkspace()) {
 			getServer().addServerListener(new ConfigStoreInstaller());
 		}
 		super.setupLaunch(launch, launchMode, monitor);
@@ -195,13 +206,42 @@
 			if (!set.isEmpty()) {
 				AbstractName name = (AbstractName) set.toArray()[0];
 				Target target = new TargetImpl(name, null);
-				return new Target[]{target};
+				return new Target[] { target };
 			}
 		}
 		return null;
 	}
-	
-	/* (non-Javadoc)
+
+	public IPath getPublishDirectory(IModule[] module) {
+		if (module == null || module.length == 0)
+			return null;
+		
+		if(getGeronimoServer().isRunFromWorkspace()) {
+			//TODO fix me, see if project root, component root, or output container should be returned
+			return module[module.length - 1].getProject().getLocation();
+		} else {
+			try {
+				String configId = getConfigId(module[0]);
+				Artifact artifact = Artifact.create(configId);
+				AbstractName name = Configuration.getConfigurationAbstractName(artifact);
+				GBeanData data = kernel.getGBeanData(name);
+				URL url = (URL) data.getAttribute("baseURL");
+				return getModulePath(module, url);
+			} catch (InvalidConfigException e) {
+				e.printStackTrace();
+			} catch (GBeanNotFoundException e) {
+				e.printStackTrace();
+			} catch (InternalKernelException e) {
+				e.printStackTrace();
+			}			
+		}
+
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
 	 * @see org.apache.geronimo.st.core.GenericGeronimoServerBehaviour#getContextClassLoader()
 	 */
 	protected ClassLoader getContextClassLoader() {



Mime
View raw message