You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by mc...@apache.org on 2010/05/01 12:30:30 UTC
svn commit: r939969 - in /geronimo/devtools/eclipse-plugin/trunk/plugins:
org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/
org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/
org.apache.geronimo.st.v30.c...
Author: mcconne
Date: Sat May 1 10:30:30 2010
New Revision: 939969
URL: http://svn.apache.org/viewvc?rev=939969&view=rev
Log:
Fix starting of servers prior to 3.0
Modified:
geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/GeronimoRuntimeDelegate.java
geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java
geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviourDelegate.java
geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerRuntimeTargetHandler.java
geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/internal/Messages.java
geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/internal/Messages.properties
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/GeronimoRuntimeDelegate.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/GeronimoRuntimeDelegate.java?rev=939969&r1=939968&r2=939969&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/GeronimoRuntimeDelegate.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/GeronimoRuntimeDelegate.java Sat May 1 10:30:30 2010
@@ -107,20 +107,20 @@ abstract public class GeronimoRuntimeDel
int count = 0;
int limit = 4;
if (version.startsWith("3")){
- //for version 3.0+
-
- count = runtimeLoc.append("lib").toFile().exists() ? ++count : count;
- count = runtimeLoc.append("repository").toFile().exists() ? ++count : count;
-
- limit = 2;
-
+ //for version 3.0+
+
+ count = runtimeLoc.append("lib").toFile().exists() ? ++count : count;
+ count = runtimeLoc.append("repository").toFile().exists() ? ++count : count;
+
+ limit = 2;
+
}else{
- //for version before 3.0
- count = runtimeLoc.append("bin/server.jar").toFile().exists() ? ++count : count;
- count = runtimeLoc.append("bin/deployer.jar").toFile().exists() ? ++count : count;
- count = runtimeLoc.append("lib").toFile().exists() ? ++count : count;
- count = runtimeLoc.append("repository").toFile().exists() ? ++count : count;
-
+ //for version before 3.0
+ count = runtimeLoc.append("bin/server.jar").toFile().exists() ? ++count : count;
+ count = runtimeLoc.append("bin/deployer.jar").toFile().exists() ? ++count : count;
+ count = runtimeLoc.append("lib").toFile().exists() ? ++count : count;
+ count = runtimeLoc.append("repository").toFile().exists() ? ++count : count;
+
}
if (count == 0) {
@@ -128,29 +128,29 @@ abstract public class GeronimoRuntimeDel
}
if (count < limit) {
-
- // part of a server image was found, don't let install happen
- return new Status(IStatus.ERROR, Activator.PLUGIN_ID,
- PARTIAL_IMAGE, Messages.bind(Messages.missingContent,
- getRuntime().getName()), null);
+
+ // part of a server image was found, don't let install happen
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ PARTIAL_IMAGE, Messages.bind(Messages.missingContent,
+ getRuntime().getName()), null);
}
String detectedVersion = detectVersion();
if (detectedVersion == null) {
- return new Status(IStatus.WARNING, Activator.PLUGIN_ID,
- INCORRECT_VERSION, Messages.bind(Messages.noVersion,
- getRuntime().getName()), null);
- }
+ return new Status(IStatus.WARNING, Activator.PLUGIN_ID,
+ INCORRECT_VERSION, Messages.bind(Messages.noVersion,
+ getRuntime().getName()), null);
+ }
if (!detectedVersion.startsWith(getRuntime().getRuntimeType()
- .getVersion())) {
- String runtimeVersion = getRuntime().getRuntimeType().getVersion();
- String message = NLS.bind(Messages.incorrectVersion,
- new String[] { getRuntime().getName(),
- runtimeVersion,
- detectedVersion });
+ .getVersion())) {
+ String runtimeVersion = getRuntime().getRuntimeType().getVersion();
+ String message = NLS.bind(Messages.incorrectVersion,
+ new String[] { getRuntime().getName(),
+ runtimeVersion,
+ detectedVersion });
// GD332 allow version > if it's a SNAPSHOT
int severity = IStatus.ERROR;
if (detectedVersion.endsWith("-SNAPSHOT")
@@ -159,7 +159,7 @@ abstract public class GeronimoRuntimeDel
}
return new Status(severity, Activator.PLUGIN_ID, INCORRECT_VERSION,
message, null);
- }
+ }
return Status.OK_STATUS;
}
@@ -258,28 +258,28 @@ abstract public class GeronimoRuntimeDel
}
if (systemjarURL != null) {
- try {
- String version = null;
- JarFile jar = new JarFile(systemjarURL.getFile());
- Enumeration<JarEntry> entries = jar.entries();
- while(entries.hasMoreElements()){
- JarEntry entry = entries.nextElement();
- if (entry.getName().indexOf("geronimo-version.properties")!=-1 ||
- entry.getName().indexOf("server-version.properties")!=-1 ){
- InputStream is = jar.getInputStream(entry);
- Properties properties = new Properties();
- properties.load(is);
- version = properties.getProperty("version");
- is.close();
- }
- }
- jar.close();
- return version;
-
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ try {
+ String version = null;
+ JarFile jar = new JarFile(systemjarURL.getFile());
+ Enumeration<JarEntry> entries = jar.entries();
+ while(entries.hasMoreElements()){
+ JarEntry entry = entries.nextElement();
+ if (entry.getName().indexOf("geronimo-version.properties")!=-1 ||
+ entry.getName().indexOf("server-version.properties")!=-1 ){
+ InputStream is = jar.getInputStream(entry);
+ Properties properties = new Properties();
+ properties.load(is);
+ version = properties.getProperty("version");
+ is.close();
+ }
+ }
+ jar.close();
+ return version;
+
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
return null;
}
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java?rev=939969&r1=939968&r2=939969&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java Sat May 1 10:30:30 2010
@@ -88,23 +88,23 @@ import org.eclipse.wst.server.core.util.
*/
abstract public class GeronimoServerBehaviourDelegate extends ServerBehaviourDelegate implements IGeronimoServerBehavior {
- public static final int TIMER_TASK_INTERVAL = 20;
-
- public static final int TIMER_TASK_DELAY = 20;
+ public static final int TIMER_TASK_INTERVAL = 20;
+
+ public static final int TIMER_TASK_DELAY = 20;
- protected IProgressMonitor _monitor;
+ protected IProgressMonitor _monitor;
- protected Timer timer = null;
+ protected Timer timer = null;
- protected PingThread pingThread;
+ protected PingThread pingThread;
- protected transient IProcess process;
+ protected transient IProcess process;
- protected transient IDebugEventSetListener processListener;
+ protected transient IDebugEventSetListener processListener;
public static final String ERROR_SETUP_LAUNCH_CONFIGURATION = "errorInSetupLaunchConfiguration";
- abstract protected ClassLoader getContextClassLoader();
+ abstract protected ClassLoader getContextClassLoader();
/*
@@ -149,53 +149,53 @@ abstract public class GeronimoServerBeha
}
- /**
- * @param launch
- * @param launchMode
- * @param monitor
- * @throws CoreException
- */
- synchronized protected void setupLaunch(ILaunch launch, String launchMode, IProgressMonitor monitor) throws CoreException {
+ /**
+ * @param launch
+ * @param launchMode
+ * @param monitor
+ * @throws CoreException
+ */
+ synchronized protected void setupLaunch(ILaunch launch, String launchMode, IProgressMonitor monitor) throws CoreException {
Trace.tracePoint("Entry", "GeronimoServerBehaviourDelegate.setupLaunch", launch, launchMode, monitor);
- if (!SocketUtil.isLocalhost(getServer().getHost()))
- return;
+ if (!SocketUtil.isLocalhost(getServer().getHost()))
+ return;
- ServerPort[] ports = getServer().getServerPorts(null);
- for (int i = 0; i < ports.length; i++) {
- ServerPort sp = ports[i];
- if (SocketUtil.isPortInUse(ports[i].getPort(), 5))
- throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, Messages.bind(Messages.errorPortInUse, Integer.toString(sp.getPort()), sp.getName()), null));
- }
-
- stopUpdateServerStateTask();
- setServerState(IServer.STATE_STARTING);
- setMode(launchMode);
-
- IServerListener listener = new IServerListener() {
- public void serverChanged(ServerEvent event) {
- int eventKind = event.getKind();
- if ((eventKind & ServerEvent.STATE_CHANGE) != 0) {
- int state = event.getServer().getServerState();
- if (state == IServer.STATE_STARTED
- || state == IServer.STATE_STOPPED) {
- GeronimoServerBehaviourDelegate.this.getServer().removeServerListener(this);
- startUpdateServerStateTask();
- }
- }
- }
- };
+ ServerPort[] ports = getServer().getServerPorts(null);
+ for (int i = 0; i < ports.length; i++) {
+ ServerPort sp = ports[i];
+ if (SocketUtil.isPortInUse(ports[i].getPort(), 5))
+ throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, Messages.bind(Messages.errorPortInUse, Integer.toString(sp.getPort()), sp.getName()), null));
+ }
- getServer().addServerListener(listener);
+ stopUpdateServerStateTask();
+ setServerState(IServer.STATE_STARTING);
+ setMode(launchMode);
+
+ IServerListener listener = new IServerListener() {
+ public void serverChanged(ServerEvent event) {
+ int eventKind = event.getKind();
+ if ((eventKind & ServerEvent.STATE_CHANGE) != 0) {
+ int state = event.getServer().getServerState();
+ if (state == IServer.STATE_STARTED
+ || state == IServer.STATE_STOPPED) {
+ GeronimoServerBehaviourDelegate.this.getServer().removeServerListener(this);
+ startUpdateServerStateTask();
+ }
+ }
+ }
+ };
+
+ getServer().addServerListener(listener);
Trace.tracePoint("Exit ", "GeronimoServerBehaviourDelegate.setupLaunch");
- }
+ }
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.server.core.model.ServerBehaviourDelegate#stop(boolean)
- */
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.server.core.model.ServerBehaviourDelegate#stop(boolean)
+ */
synchronized public void stop(final boolean force) {
Trace.tracePoint("Entry", "GeronimoServerBehaviourDelegate.stop", force);
@@ -218,16 +218,16 @@ abstract public class GeronimoServerBeha
Trace.tracePoint("Exit ", "GeronimoServerBehaviourDelegate.stop");
}
- /*
- * Override this method to be able to process in-place shared lib entries and restart the shared lib configuration for all projects prior
- * to publishing each IModule.
- *
- * This overridden method also fixes WTP Bugzilla 123676 to prevent duplicate repdeloys if both parent and child modules have deltas.
- *
- * (non-Javadoc)
- * @see org.eclipse.wst.server.core.model.ServerBehaviourDelegate#publishModules(int, java.util.List, java.util.List, org.eclipse.core.runtime.MultiStatus, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void publishModules(int kind, List modules, List deltaKind, MultiStatus multi, IProgressMonitor monitor) {
+ /*
+ * Override this method to be able to process in-place shared lib entries and restart the shared lib configuration for all projects prior
+ * to publishing each IModule.
+ *
+ * This overridden method also fixes WTP Bugzilla 123676 to prevent duplicate repdeloys if both parent and child modules have deltas.
+ *
+ * (non-Javadoc)
+ * @see org.eclipse.wst.server.core.model.ServerBehaviourDelegate#publishModules(int, java.util.List, java.util.List, org.eclipse.core.runtime.MultiStatus, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ protected void publishModules(int kind, List modules, List deltaKind, MultiStatus multi, IProgressMonitor monitor) {
Trace.tracePoint("Entry", "GeronimoServerBehaviourDelegate.publishModules", deltaKindToString(kind), Arrays.asList(modules).toString(), Arrays.asList(deltaKind).toString(), multi, monitor);
//
@@ -236,76 +236,76 @@ abstract public class GeronimoServerBeha
// based on any discovered dependencies.
//
if (modules != null && modules.size() > 0) {
- List list = getOrderedModules(this.getServer(),modules, deltaKind);
+ List list = getOrderedModules(this.getServer(),modules, deltaKind);
modules = (List) list.get(0);
deltaKind = (List) list.get(1);
}
- IStatus status = Status.OK_STATUS;
- if (modules != null && modules.size() > 0 && getGeronimoServer().isInPlaceSharedLib()) {
- List rootModules = new ArrayList<IModule>();
- for(int i = 0; i < modules.size(); i++) {
- IModule[] module = (IModule[]) modules.get(i);
- if(!rootModules.contains(module[0])) {
- rootModules.add(module[0]);
- }
- }
- IModule[] toProcess = (IModule[])rootModules.toArray(new IModule[rootModules.size()]);
- status = updateSharedLib(toProcess, ProgressUtil.getSubMonitorFor(monitor, 1000));
- }
- if(status.isOK()) {
- if (modules == null)
- return;
-
- int size = modules.size();
- if (size == 0)
- return;
-
- if (monitor.isCanceled())
- return;
-
- List rootModulesPublished = new ArrayList<IModule>();
- for (int i = 0; i < size; i++) {
- IModule[] module = (IModule[]) modules.get(i);
- int moduleDeltaKind = ((Integer)deltaKind.get(i)).intValue();
- //has the root of this module been published already?
- if(!rootModulesPublished.contains(module[0])) {
- status = publishModule(kind, module, moduleDeltaKind, ProgressUtil.getSubMonitorFor(monitor, 3000));
- if (status != null && !status.isOK())
- multi.add(status);
- //cache published root modules to compare against to prevent dup redeploys
- if(moduleDeltaKind != NO_CHANGE) {
- rootModulesPublished.add(module[0]);
- }
- } else {
- setModulePublishState(module, IServer.PUBLISH_STATE_NONE);
- Trace.trace(Trace.INFO, "root module for " + Arrays.asList(module).toString() + " already published. Skipping.");
- }
- }
- } else {
- multi.add(status);
- }
+ IStatus status = Status.OK_STATUS;
+ if (modules != null && modules.size() > 0 && getGeronimoServer().isInPlaceSharedLib()) {
+ List rootModules = new ArrayList<IModule>();
+ for(int i = 0; i < modules.size(); i++) {
+ IModule[] module = (IModule[]) modules.get(i);
+ if(!rootModules.contains(module[0])) {
+ rootModules.add(module[0]);
+ }
+ }
+ IModule[] toProcess = (IModule[])rootModules.toArray(new IModule[rootModules.size()]);
+ status = updateSharedLib(toProcess, ProgressUtil.getSubMonitorFor(monitor, 1000));
+ }
+ if(status.isOK()) {
+ if (modules == null)
+ return;
+
+ int size = modules.size();
+ if (size == 0)
+ return;
+
+ if (monitor.isCanceled())
+ return;
+
+ List rootModulesPublished = new ArrayList<IModule>();
+ for (int i = 0; i < size; i++) {
+ IModule[] module = (IModule[]) modules.get(i);
+ int moduleDeltaKind = ((Integer)deltaKind.get(i)).intValue();
+ //has the root of this module been published already?
+ if(!rootModulesPublished.contains(module[0])) {
+ status = publishModule(kind, module, moduleDeltaKind, ProgressUtil.getSubMonitorFor(monitor, 3000));
+ if (status != null && !status.isOK())
+ multi.add(status);
+ //cache published root modules to compare against to prevent dup redeploys
+ if(moduleDeltaKind != NO_CHANGE) {
+ rootModulesPublished.add(module[0]);
+ }
+ } else {
+ setModulePublishState(module, IServer.PUBLISH_STATE_NONE);
+ Trace.trace(Trace.INFO, "root module for " + Arrays.asList(module).toString() + " already published. Skipping.");
+ }
+ }
+ } else {
+ multi.add(status);
+ }
Trace.tracePoint("Exit ", "GeronimoServerBehaviourDelegate.publishModules");
- }
+ }
+
+ /*
+ * This method is used to invoke DependencyHelper of different version
+ */
+ abstract protected List getOrderedModules(IServer server, List modules, List deltaKind);
- /*
- * This method is used to invoke DependencyHelper of different version
- */
- abstract protected List getOrderedModules(IServer server, List modules, List deltaKind);
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.server.core.model.ServerBehaviourDelegate#publishModule(int,
- * int, org.eclipse.wst.server.core.IModule[],
- * org.eclipse.core.runtime.IProgressMonitor)
- */
- public void publishModule(int kind, int deltaKind, IModule[] module, IProgressMonitor monitor) throws CoreException {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.server.core.model.ServerBehaviourDelegate#publishModule(int,
+ * int, org.eclipse.wst.server.core.IModule[],
+ * org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void publishModule(int kind, int deltaKind, IModule[] module, IProgressMonitor monitor) throws CoreException {
Trace.tracePoint("Entry", "GeronimoServerBehaviourDelegate.publishModule", deltaKindToString(kind), deltaKindToString(deltaKind), Arrays.asList(module).toString(), monitor);
- _monitor = monitor;
+ _monitor = monitor;
setModuleStatus(module, null);
setModulePublishState(module, IServer.PUBLISH_STATE_NONE);
@@ -330,29 +330,29 @@ abstract public class GeronimoServerBeha
}
// Trace.tracePoint("Exit ", "GeronimoServerBehaviourDelegate.publishModule");
- }
+ }
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.server.core.model.ServerBehaviourDelegate#publishFinish(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void publishFinish(IProgressMonitor monitor) throws CoreException {
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.server.core.model.ServerBehaviourDelegate#publishFinish(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void publishFinish(IProgressMonitor monitor) throws CoreException {
Trace.tracePoint("Entry", "GeronimoServerBehaviourDelegate.publishFinish", monitor);
- IModule[] modules = this.getServer().getModules();
- boolean allpublished = true;
- for (int i = 0; i < modules.length; i++) {
- if (this.getServer().getModulePublishState(new IModule[] { modules[i] }) != IServer.PUBLISH_STATE_NONE)
- allpublished = false;
- }
- if (allpublished)
- setServerPublishState(IServer.PUBLISH_STATE_NONE);
+ IModule[] modules = this.getServer().getModules();
+ boolean allpublished = true;
+ for (int i = 0; i < modules.length; i++) {
+ if (this.getServer().getModulePublishState(new IModule[] { modules[i] }) != IServer.PUBLISH_STATE_NONE)
+ allpublished = false;
+ }
+ if (allpublished)
+ setServerPublishState(IServer.PUBLISH_STATE_NONE);
- GeronimoConnectionFactory.getInstance().destroy(getServer());
+ GeronimoConnectionFactory.getInstance().destroy(getServer());
Trace.tracePoint("Exit ", "GeronimoServerBehaviourDelegate.publishFinish");
- }
+ }
/**
@@ -369,28 +369,28 @@ abstract public class GeronimoServerBeha
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.server.core.model.ServerBehaviourDelegate#dispose()
- */
- public void dispose() {
- stopUpdateServerStateTask();
- }
-
- public abstract String getRuntimeClass();
-
- public void setServerStarted() {
- setServerState(IServer.STATE_STARTED);
- }
-
- public void setServerStopped() {
- setServerState(IServer.STATE_STOPPED);
- }
-
- public IGeronimoServer getGeronimoServer() {
- return (IGeronimoServer) getServer().loadAdapter(IGeronimoServer.class, null);
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.server.core.model.ServerBehaviourDelegate#dispose()
+ */
+ public void dispose() {
+ stopUpdateServerStateTask();
+ }
+
+ public abstract String getRuntimeClass();
+
+ public void setServerStarted() {
+ setServerState(IServer.STATE_STARTED);
+ }
+
+ public void setServerStopped() {
+ setServerState(IServer.STATE_STOPPED);
+ }
+
+ public IGeronimoServer getGeronimoServer() {
+ return (IGeronimoServer) getServer().loadAdapter(IGeronimoServer.class, null);
+ }
protected void terminate() {
@@ -419,121 +419,121 @@ abstract public class GeronimoServerBeha
}
- protected void stopImpl() {
- if (process != null) {
- process = null;
- DebugPlugin.getDefault().removeDebugEventListener(processListener);
- processListener = null;
- }
- setServerState(IServer.STATE_STOPPED);
- }
+ protected void stopImpl() {
+ if (process != null) {
+ process = null;
+ DebugPlugin.getDefault().removeDebugEventListener(processListener);
+ processListener = null;
+ }
+ setServerState(IServer.STATE_STOPPED);
+ }
- protected void invokeCommand(int deltaKind, IModule module) throws CoreException {
+ protected void invokeCommand(int deltaKind, IModule module) throws CoreException {
Trace.tracePoint("Entry", "GeronimoServerBehaviourDelegate.invokeCommand", deltaKindToString(deltaKind), module.getName());
-
- ClassLoader old = Thread.currentThread().getContextClassLoader();
- try {
- ClassLoader cl = getContextClassLoader();
- if (cl != null)
- Thread.currentThread().setContextClassLoader(cl);
- switch (deltaKind) {
- case ADDED: {
- doAdded(module, null);
- break;
- }
- case CHANGED: {
- doChanged(module, null);
- break;
- }
- case REMOVED: {
- doRemoved(module);
- break;
- }
- case NO_CHANGE: {
- doNoChange(module);
- break;
- }
- default:
- throw new IllegalArgumentException();
- }
- } catch (CoreException e) {
- throw e;
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- Thread.currentThread().setContextClassLoader(old);
- }
+
+ ClassLoader old = Thread.currentThread().getContextClassLoader();
+ try {
+ ClassLoader cl = getContextClassLoader();
+ if (cl != null)
+ Thread.currentThread().setContextClassLoader(cl);
+ switch (deltaKind) {
+ case ADDED: {
+ doAdded(module, null);
+ break;
+ }
+ case CHANGED: {
+ doChanged(module, null);
+ break;
+ }
+ case REMOVED: {
+ doRemoved(module);
+ break;
+ }
+ case NO_CHANGE: {
+ doNoChange(module);
+ break;
+ }
+ default:
+ throw new IllegalArgumentException();
+ }
+ } catch (CoreException e) {
+ throw e;
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ Thread.currentThread().setContextClassLoader(old);
+ }
Trace.tracePoint("Exit ", "GeronimoServerBehaviourDelegate.invokeCommand");
- }
+ }
- /**
- * @param module
- * @param configId the forced configId to process this method, passed in when this method is invoked from doChanged()
- * @throws Exception
- */
- protected void doAdded(IModule module, String configId) throws Exception {
+ /**
+ * @param module
+ * @param configId the forced configId to process this method, passed in when this method is invoked from doChanged()
+ * @throws Exception
+ */
+ protected void doAdded(IModule module, String configId) throws Exception {
Trace.tracePoint("Entry", "GeronimoServerBehaviourDelegate.doAdded", module.getName(), configId);
-
- configId = getLastKnowConfigurationId(module, configId);
- if (configId == null) {
- IStatus status = distribute(module);
- if (!status.isOK()) {
- doFail(status, Messages.DISTRIBUTE_FAIL);
- }
-
- TargetModuleID[] ids = updateServerModuleConfigIDMap(module, status);
-
- status = start(ids);
- if (!status.isOK()) {
- doFail(status, Messages.START_FAIL);
- }
- } else {
- //either (1) a configuration with the same module id exists already on the server
- //or (2) the module now has a different configId and the configuration on the server using
- //the old id as specified in the project-configId map should be uninstalled.
- doChanged(module, configId);
- }
+
+ configId = getLastKnowConfigurationId(module, configId);
+ if (configId == null) {
+ IStatus status = distribute(module);
+ if (!status.isOK()) {
+ doFail(status, Messages.DISTRIBUTE_FAIL);
+ }
+
+ TargetModuleID[] ids = updateServerModuleConfigIDMap(module, status);
+
+ status = start(ids);
+ if (!status.isOK()) {
+ doFail(status, Messages.START_FAIL);
+ }
+ } else {
+ //either (1) a configuration with the same module id exists already on the server
+ //or (2) the module now has a different configId and the configuration on the server using
+ //the old id as specified in the project-configId map should be uninstalled.
+ doChanged(module, configId);
+ }
Trace.tracePoint("Exit ", "GeronimoServerBehaviourDelegate.doAdded");
- }
+ }
- /**
- * @param module
- * @param configId the forced configId to process this method, passed in when invoked from doAdded()
- * @throws Exception
- */
- protected void doChanged(IModule module, String configId) throws Exception {
+ /**
+ * @param module
+ * @param configId the forced configId to process this method, passed in when invoked from doAdded()
+ * @throws Exception
+ */
+ protected void doChanged(IModule module, String configId) throws Exception {
Trace.tracePoint("Entry", "GeronimoServerBehaviourDelegate.doChanged", module.getName(), configId);
-
- configId = getLastKnowConfigurationId(module, configId);
- if(configId != null) {
- String moduleConfigId = getConfigId(module);
- if(moduleConfigId.equals(configId)) {
-
- if (this.getServerDelegate().isNotRedeployJSPFiles()&&!this.isRemote() && GeronimoUtils.isWebModule(module)
- && !module.isExternal()) {
- // if only jsp files changed, no redeploy needed
- if (findAndReplaceJspFiles(module, configId))
- return;
- }
-
- IStatus status = reDeploy(module);
- if (!status.isOK()) {
- doFail(status, Messages.REDEPLOY_FAIL);
- }
- } else {
- //different configIds from what needs to be undeployed to what will be deployed
- doRemoved(module);
- doAdded(module, null);
- }
- } else {
- //The checked configuration no longer exists on the server
- doAdded(module, configId);
- }
+
+ configId = getLastKnowConfigurationId(module, configId);
+ if(configId != null) {
+ String moduleConfigId = getConfigId(module);
+ if(moduleConfigId.equals(configId)) {
+
+ if (this.getServerDelegate().isNotRedeployJSPFiles()&&!this.isRemote() && GeronimoUtils.isWebModule(module)
+ && !module.isExternal()) {
+ // if only jsp files changed, no redeploy needed
+ if (findAndReplaceJspFiles(module, configId))
+ return;
+ }
+
+ IStatus status = reDeploy(module);
+ if (!status.isOK()) {
+ doFail(status, Messages.REDEPLOY_FAIL);
+ }
+ } else {
+ //different configIds from what needs to be undeployed to what will be deployed
+ doRemoved(module);
+ doAdded(module, null);
+ }
+ } else {
+ //The checked configuration no longer exists on the server
+ doAdded(module, configId);
+ }
Trace.tracePoint("Exit ", "GeronimoServerBehaviourDelegate.doChanged");
- }
+ }
@@ -648,151 +648,151 @@ abstract public class GeronimoServerBeha
}
- private String getLastKnowConfigurationId(IModule module, String configId) throws Exception {
+ private String getLastKnowConfigurationId(IModule module, String configId) throws Exception {
Trace.tracePoint("Entry ", "GeronimoServerBehaviourDelegate.getLastKnowConfigurationId", module.getName(), configId);
- //use the correct configId, second from the .metadata, then from the plan
- configId = configId != null ? configId : DeploymentUtils.getLastKnownConfigurationId(module, getServer());
+ //use the correct configId, second from the .metadata, then from the plan
+ configId = configId != null ? configId : DeploymentUtils.getLastKnownConfigurationId(module, getServer());
Trace.tracePoint("Exit ", "GeronimoServerBehaviourDelegate.getLastKnowConfigurationId", configId);
- return configId;
- }
+ return configId;
+ }
- protected void doRemoved(IModule module) throws Exception {
+ protected void doRemoved(IModule module) throws Exception {
Trace.tracePoint("Entry", "GeronimoServerBehaviourDelegate.doRemoved", module.getName());
- IStatus status = unDeploy(module);
- if (!status.isOK()) {
- doFail(status, Messages.UNDEPLOY_FAIL);
- }
-
- ModuleArtifactMapper.getInstance().removeEntry(getServer(), module.getProject());
+ IStatus status = unDeploy(module);
+ if (!status.isOK()) {
+ doFail(status, Messages.UNDEPLOY_FAIL);
+ }
+
+ ModuleArtifactMapper.getInstance().removeEntry(getServer(), module.getProject());
Trace.tracePoint("Exit ", "GeronimoServerBehaviourDelegate.doRemoved");
- }
-
- protected void doNoChange(IModule module) throws Exception {
+ }
+
+ protected void doNoChange(IModule module) throws Exception {
Trace.tracePoint("Entry", "GeronimoServerBehaviourDelegate.doNoChange", module.getName());
-
- if(DeploymentUtils.getLastKnownConfigurationId(module, getServer()) != null) {
- start(module);
- } else {
- doAdded(module, null);
- }
-
+
+ if(DeploymentUtils.getLastKnownConfigurationId(module, getServer()) != null) {
+ start(module);
+ } else {
+ doAdded(module, null);
+ }
+
Trace.tracePoint("Exit ", "GeronimoServerBehaviourDelegate.doNoChange");
- }
+ }
- protected void doRestart(IModule module) throws Exception {
+ protected void doRestart(IModule module) throws Exception {
Trace.tracePoint("Entry", "GeronimoServerBehaviourDelegate.doRestart", module.getName());
-
- IStatus status = stop(module);
- if (!status.isOK()) {
- doFail(status, Messages.STOP_FAIL);
- }
-
- status = start(module);
- if (!status.isOK()) {
- doFail(status, Messages.START_FAIL);
- }
+
+ IStatus status = stop(module);
+ if (!status.isOK()) {
+ doFail(status, Messages.STOP_FAIL);
+ }
+
+ status = start(module);
+ if (!status.isOK()) {
+ doFail(status, Messages.START_FAIL);
+ }
Trace.tracePoint("Exit ", "GeronimoServerBehaviourDelegate.doRestart");
- }
-
- private TargetModuleID[] updateServerModuleConfigIDMap(IModule module, IStatus status) {
- TargetModuleID[] ids = ((DeploymentCmdStatus) status).getResultTargetModuleIDs();
- ModuleArtifactMapper mapper = ModuleArtifactMapper.getInstance();
- mapper.addEntry(getServer(), module.getProject(), ids[0].getModuleID());
- return ids;
- }
-
- protected void doFail(IStatus status, String message) throws CoreException {
- MultiStatus ms = new MultiStatus(Activator.PLUGIN_ID, 0, message, null);
- ms.addAll(status);
- throw new CoreException(ms);
- }
-
- protected IStatus distribute(IModule module) throws Exception {
- IDeploymentCommand cmd = DeploymentCommandFactory.createDistributeCommand(module, getServer());
- return cmd.execute(_monitor);
- }
-
- protected IStatus start(IModule module) throws Exception {
- TargetModuleID id = DeploymentUtils.getTargetModuleID(getServer(), module);
- IDeploymentCommand cmd = DeploymentCommandFactory.createStartCommand(new TargetModuleID[] { id }, module, getServer());
- return cmd.execute(_monitor);
- }
-
- protected IStatus start(TargetModuleID[] ids) throws Exception {
- IDeploymentCommand cmd = DeploymentCommandFactory.createStartCommand(ids, null, getServer());
- return cmd.execute(_monitor);
- }
-
- protected IStatus stop(IModule module) throws Exception {
- IDeploymentCommand cmd = DeploymentCommandFactory.createStopCommand(module, getServer());
- return cmd.execute(_monitor);
- }
-
- protected IStatus unDeploy(IModule module) throws Exception {
- IDeploymentCommand cmd = DeploymentCommandFactory.createUndeployCommand(module, getServer());
- return cmd.execute(_monitor);
- }
-
- protected IStatus reDeploy(IModule module) throws Exception {
- IDeploymentCommand cmd = DeploymentCommandFactory.createRedeployCommand(module, getServer());
- return cmd.execute(_monitor);
- }
-
- public Map getServerInstanceProperties() {
- return getRuntimeDelegate().getServerInstanceProperties();
- }
-
- protected GeronimoRuntimeDelegate getRuntimeDelegate() {
- GeronimoRuntimeDelegate rd = (GeronimoRuntimeDelegate) getServer().getRuntime().getAdapter(GeronimoRuntimeDelegate.class);
- if (rd == null)
- rd = (GeronimoRuntimeDelegate) getServer().getRuntime().loadAdapter(GeronimoRuntimeDelegate.class, new NullProgressMonitor());
- return rd;
- }
-
- protected GeronimoServerDelegate getServerDelegate() {
- GeronimoServerDelegate sd = (GeronimoServerDelegate) getServer().getAdapter(GeronimoServerDelegate.class);
- if (sd == null)
- sd = (GeronimoServerDelegate) getServer().loadAdapter(GeronimoServerDelegate.class, new NullProgressMonitor());
- return sd;
- }
-
- protected boolean isRemote() {
- return getServer().getServerType().supportsRemoteHosts()
- && !SocketUtil.isLocalhost(getServer().getHost());
- }
-
- protected void setupLaunchClasspath(ILaunchConfigurationWorkingCopy wc, IVMInstall vmInstall) throws CoreException {
- List<IRuntimeClasspathEntry> cp = new ArrayList<IRuntimeClasspathEntry>();
-
- String version = getServer().getRuntime().getRuntimeType().getVersion();
-
- if (version.startsWith("3")) {
- //get required jar file
- IPath libPath = getServer().getRuntime().getLocation().append("/lib");
- for (String jarFile: libPath.toFile().list()){
- IPath serverJar = libPath.append("/"+jarFile);
- cp.add(JavaRuntime.newArchiveRuntimeClasspathEntry(serverJar));
- }
-
- }else{
- //for 1.1,2.0,2.1,2.2
- IPath serverJar = getServer().getRuntime().getLocation().append("/lib/server.jar");
- cp.add(JavaRuntime.newArchiveRuntimeClasspathEntry(serverJar));
- }
- // merge existing classpath with server classpath
- IRuntimeClasspathEntry[] existingCps = JavaRuntime.computeUnresolvedRuntimeClasspath(wc);
+ }
+
+ private TargetModuleID[] updateServerModuleConfigIDMap(IModule module, IStatus status) {
+ TargetModuleID[] ids = ((DeploymentCmdStatus) status).getResultTargetModuleIDs();
+ ModuleArtifactMapper mapper = ModuleArtifactMapper.getInstance();
+ mapper.addEntry(getServer(), module.getProject(), ids[0].getModuleID());
+ return ids;
+ }
+
+ protected void doFail(IStatus status, String message) throws CoreException {
+ MultiStatus ms = new MultiStatus(Activator.PLUGIN_ID, 0, message, null);
+ ms.addAll(status);
+ throw new CoreException(ms);
+ }
+
+ protected IStatus distribute(IModule module) throws Exception {
+ IDeploymentCommand cmd = DeploymentCommandFactory.createDistributeCommand(module, getServer());
+ return cmd.execute(_monitor);
+ }
+
+ protected IStatus start(IModule module) throws Exception {
+ TargetModuleID id = DeploymentUtils.getTargetModuleID(getServer(), module);
+ IDeploymentCommand cmd = DeploymentCommandFactory.createStartCommand(new TargetModuleID[] { id }, module, getServer());
+ return cmd.execute(_monitor);
+ }
+
+ protected IStatus start(TargetModuleID[] ids) throws Exception {
+ IDeploymentCommand cmd = DeploymentCommandFactory.createStartCommand(ids, null, getServer());
+ return cmd.execute(_monitor);
+ }
- for (int i = 0; i < existingCps.length; i++) {
+ protected IStatus stop(IModule module) throws Exception {
+ IDeploymentCommand cmd = DeploymentCommandFactory.createStopCommand(module, getServer());
+ return cmd.execute(_monitor);
+ }
+
+ protected IStatus unDeploy(IModule module) throws Exception {
+ IDeploymentCommand cmd = DeploymentCommandFactory.createUndeployCommand(module, getServer());
+ return cmd.execute(_monitor);
+ }
+
+ protected IStatus reDeploy(IModule module) throws Exception {
+ IDeploymentCommand cmd = DeploymentCommandFactory.createRedeployCommand(module, getServer());
+ return cmd.execute(_monitor);
+ }
+
+ public Map getServerInstanceProperties() {
+ return getRuntimeDelegate().getServerInstanceProperties();
+ }
+
+ protected GeronimoRuntimeDelegate getRuntimeDelegate() {
+ GeronimoRuntimeDelegate rd = (GeronimoRuntimeDelegate) getServer().getRuntime().getAdapter(GeronimoRuntimeDelegate.class);
+ if (rd == null)
+ rd = (GeronimoRuntimeDelegate) getServer().getRuntime().loadAdapter(GeronimoRuntimeDelegate.class, new NullProgressMonitor());
+ return rd;
+ }
+
+ protected GeronimoServerDelegate getServerDelegate() {
+ GeronimoServerDelegate sd = (GeronimoServerDelegate) getServer().getAdapter(GeronimoServerDelegate.class);
+ if (sd == null)
+ sd = (GeronimoServerDelegate) getServer().loadAdapter(GeronimoServerDelegate.class, new NullProgressMonitor());
+ return sd;
+ }
+
+ protected boolean isRemote() {
+ return getServer().getServerType().supportsRemoteHosts()
+ && !SocketUtil.isLocalhost(getServer().getHost());
+ }
+
+ protected void setupLaunchClasspath(ILaunchConfigurationWorkingCopy wc, IVMInstall vmInstall) throws CoreException {
+ List<IRuntimeClasspathEntry> cp = new ArrayList<IRuntimeClasspathEntry>();
+
+ String version = getServer().getRuntime().getRuntimeType().getVersion();
+
+ if (version.startsWith("3")) {
+ //get required jar file
+ IPath libPath = getServer().getRuntime().getLocation().append("/lib");
+ for (String jarFile: libPath.toFile().list()){
+ IPath serverJar = libPath.append("/"+jarFile);
+ cp.add(JavaRuntime.newArchiveRuntimeClasspathEntry(serverJar));
+ }
+
+ }else{
+ //for 1.1,2.0,2.1,2.2
+ IPath serverJar = getServer().getRuntime().getLocation().append("/bin/server.jar");
+ cp.add(JavaRuntime.newArchiveRuntimeClasspathEntry(serverJar));
+ }
+ // merge existing classpath with server classpath
+ IRuntimeClasspathEntry[] existingCps = JavaRuntime.computeUnresolvedRuntimeClasspath(wc);
+
+ for (int i = 0; i < existingCps.length; i++) {
Trace.trace(Trace.INFO, "cpentry: " + cp );
- if (cp.contains(existingCps[i]) == false) {
- cp.add(existingCps[i]);
- }
- }
+ if (cp.contains(existingCps[i]) == false) {
+ cp.add(existingCps[i]);
+ }
+ }
//
// Add classpath entries from any selected classpath containers
@@ -811,185 +811,185 @@ abstract public class GeronimoServerBeha
}
}
- wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, convertCPEntryToMemento(cp));
- wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, false);
- }
-
- private List convertCPEntryToMemento(List cpEntryList) {
- List<String> list = new ArrayList<String>(cpEntryList.size());
- Iterator iterator = cpEntryList.iterator();
- while (iterator.hasNext()) {
- IRuntimeClasspathEntry entry = (IRuntimeClasspathEntry) iterator.next();
- try {
- list.add(entry.getMemento());
- } catch (CoreException e) {
- Trace.trace(Trace.SEVERE, "Could not resolve classpath entry: "
- + entry, e);
- }
- }
- return list;
- }
-
- public void setProcess(final IProcess newProcess) {
- if (process != null)
- return;
-
- process = newProcess;
- if (processListener != null)
- DebugPlugin.getDefault().removeDebugEventListener(processListener);
- if (newProcess == null)
- return;
-
- processListener = new IDebugEventSetListener() {
- public void handleDebugEvents(DebugEvent[] events) {
- if (events != null) {
- int size = events.length;
- for (int i = 0; i < size; i++) {
- if (process != null
- && process.equals(events[i].getSource())
- && events[i].getKind() == DebugEvent.TERMINATE) {
- DebugPlugin.getDefault().removeDebugEventListener(this);
- stopImpl();
- }
- }
- }
- }
- };
- DebugPlugin.getDefault().addDebugEventListener(processListener);
- }
+ wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, convertCPEntryToMemento(cp));
+ wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, false);
+ }
+
+ private List convertCPEntryToMemento(List cpEntryList) {
+ List<String> list = new ArrayList<String>(cpEntryList.size());
+ Iterator iterator = cpEntryList.iterator();
+ while (iterator.hasNext()) {
+ IRuntimeClasspathEntry entry = (IRuntimeClasspathEntry) iterator.next();
+ try {
+ list.add(entry.getMemento());
+ } catch (CoreException e) {
+ Trace.trace(Trace.SEVERE, "Could not resolve classpath entry: "
+ + entry, e);
+ }
+ }
+ return list;
+ }
- protected void startPingThread() {
+ public void setProcess(final IProcess newProcess) {
+ if (process != null)
+ return;
+
+ process = newProcess;
+ if (processListener != null)
+ DebugPlugin.getDefault().removeDebugEventListener(processListener);
+ if (newProcess == null)
+ return;
+
+ processListener = new IDebugEventSetListener() {
+ public void handleDebugEvents(DebugEvent[] events) {
+ if (events != null) {
+ int size = events.length;
+ for (int i = 0; i < size; i++) {
+ if (process != null
+ && process.equals(events[i].getSource())
+ && events[i].getKind() == DebugEvent.TERMINATE) {
+ DebugPlugin.getDefault().removeDebugEventListener(this);
+ stopImpl();
+ }
+ }
+ }
+ }
+ };
+ DebugPlugin.getDefault().addDebugEventListener(processListener);
+ }
+
+ protected void startPingThread() {
Trace.tracePoint("Entry", "GeronimoServerBehaviourDelegate.startPingThread");
- pingThread = new PingThread(this, getServer());
- pingThread.start();
+ pingThread = new PingThread(this, getServer());
+ pingThread.start();
Trace.tracePoint("Exit ", "GeronimoServerBehaviourDelegate.startPingThread");
- }
-
- protected void stopPingThread() {
+ }
+
+ protected void stopPingThread() {
Trace.tracePoint("Entry", "GeronimoServerBehaviourDelegate.stopPingThread");
- if (pingThread != null) {
- pingThread.interrupt();
- pingThread = null;
- }
+ if (pingThread != null) {
+ pingThread.interrupt();
+ pingThread = null;
+ }
Trace.tracePoint("Exit ", "GeronimoServerBehaviourDelegate.stopPingThread");
- }
-
- protected abstract void stopKernel();
+ }
+
+ protected abstract void stopKernel();
- public void startUpdateServerStateTask() {
+ public void startUpdateServerStateTask() {
Trace.tracePoint("Entry", "GeronimoServerBehaviourDelegate.startUpdateServerStateTask", getServer().getName());
- timer = new Timer(true);
- timer.schedule(new UpdateServerStateTask(this, getServer()), TIMER_TASK_DELAY * 1000, TIMER_TASK_INTERVAL * 1000);
+ timer = new Timer(true);
+ timer.schedule(new UpdateServerStateTask(this, getServer()), TIMER_TASK_DELAY * 1000, TIMER_TASK_INTERVAL * 1000);
Trace.tracePoint("Exit ", "GeronimoServerBehaviourDelegate.startUpdateServerStateTask");
- }
+ }
- public void stopUpdateServerStateTask() {
- Trace.tracePoint("Entry", "GeronimoServerBehaviourDelegate.stopUpdateServerStateTask", getServer().getName());
+ public void stopUpdateServerStateTask() {
+ Trace.tracePoint("Entry", "GeronimoServerBehaviourDelegate.stopUpdateServerStateTask");
- if (timer != null)
- timer.cancel();
+ if (timer != null)
+ timer.cancel();
Trace.tracePoint("Exit ", "GeronimoServerBehaviourDelegate.stopUpdateServerStateTask");
- }
+ }
- protected IPath getModulePath(IModule[] module, URL baseURL) {
+ protected IPath getModulePath(IModule[] module, URL baseURL) {
Trace.tracePoint("Entry", "GeronimoServerBehaviourDelegate.getModulePath", Arrays.asList(module).toString(), baseURL);
- IPath modulePath = new Path(baseURL.getFile());
+ 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");
- } else if (GeronimoUtils.isAppClientModule(workingModule)) {
- modulePath = modulePath.addFileExtension("jar");
- }
- }
+ 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");
+ } else if (GeronimoUtils.isAppClientModule(workingModule)) {
+ modulePath = modulePath.addFileExtension("jar");
+ }
+ }
Trace.tracePoint("Exit ", "GeronimoServerBehaviourDelegate.getModulePath", modulePath);
- return modulePath;
- }
+ return modulePath;
+ }
- public MBeanServerConnection getServerConnection() throws Exception {
- Map map = new HashMap();
- String user = getGeronimoServer().getAdminID();
- String password = getGeronimoServer().getAdminPassword();
- String port = getGeronimoServer().getRMINamingPort();
- map.put("jmx.remote.credentials", new String[] { user, password });
- map.put("java.naming.factory.initial", "com.sun.jndi.rmi.registry.RegistryContextFactory");
- map.put("java.naming.factory.url.pkgs", "org.apache.geronimo.naming");
- map.put("java.naming.provider.url", "rmi://" + getServer().getHost()
- + ":" + port);
-
- String url = getGeronimoServer().getJMXServiceURL();
- if (url != null) {
- try {
- JMXServiceURL address = new JMXServiceURL(url);
- JMXConnector jmxConnector;
- try {
- jmxConnector = JMXConnectorFactory.connect(address, map);
- } catch (SecurityException se) {
- //FIXME once GERONIMO-3467 JIRA is fixed
- Thread.sleep(10000);
- jmxConnector = JMXConnectorFactory.connect(address, map);
- }
- MBeanServerConnection connection = jmxConnector.getMBeanServerConnection();
- Trace.trace(Trace.INFO, "Connected to kernel. " + url);
- return connection;
- } catch (MalformedURLException e) {
- e.printStackTrace();
- }
- }
-
- return null;
- }
-
- public Target[] getTargets() {
- return null;
- }
-
- public static String deltaKindToString(int kind) {
- switch(kind) {
- case NO_CHANGE:
- return "NO_CHANGE";
- case ADDED:
- return "ADDED";
- case CHANGED:
- return "CHANGED";
- case REMOVED:
- return "REMOVED";
- }
- return Integer.toString(kind);
- }
-
- public String getConfigId(IModule module) throws Exception {
- return getGeronimoServer().getVersionHandler().getConfigID(module);
- }
-
- private IStatus updateSharedLib(IModule[] module, IProgressMonitor monitor) {
- IDataModel model = DataModelFactory.createDataModel(new SharedLibEntryDataModelProvider());
- model.setProperty(ISharedLibEntryCreationDataModelProperties.MODULES, module);
- model.setProperty(ISharedLibEntryCreationDataModelProperties.SERVER, getServer());
- IDataModelOperation op = new SharedLibEntryCreationOperation(model);
- try {
- op.execute(monitor, null);
- } catch (ExecutionException e) {
- return new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, e.getMessage(), e.getCause());
- }
- return Status.OK_STATUS;
- }
-
+ public MBeanServerConnection getServerConnection() throws Exception {
+ Map map = new HashMap();
+ String user = getGeronimoServer().getAdminID();
+ String password = getGeronimoServer().getAdminPassword();
+ String port = getGeronimoServer().getRMINamingPort();
+ map.put("jmx.remote.credentials", new String[] { user, password });
+ map.put("java.naming.factory.initial", "com.sun.jndi.rmi.registry.RegistryContextFactory");
+ map.put("java.naming.factory.url.pkgs", "org.apache.geronimo.naming");
+ map.put("java.naming.provider.url", "rmi://" + getServer().getHost()
+ + ":" + port);
+
+ String url = getGeronimoServer().getJMXServiceURL();
+ if (url != null) {
+ try {
+ JMXServiceURL address = new JMXServiceURL(url);
+ JMXConnector jmxConnector;
+ try {
+ jmxConnector = JMXConnectorFactory.connect(address, map);
+ } catch (SecurityException se) {
+ //FIXME once GERONIMO-3467 JIRA is fixed
+ Thread.sleep(10000);
+ jmxConnector = JMXConnectorFactory.connect(address, map);
+ }
+ MBeanServerConnection connection = jmxConnector.getMBeanServerConnection();
+ Trace.trace(Trace.INFO, "Connected to kernel. " + url);
+ return connection;
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ }
+ }
+
+ return null;
+ }
+
+ public Target[] getTargets() {
+ return null;
+ }
+
+ public static String deltaKindToString(int kind) {
+ switch(kind) {
+ case NO_CHANGE:
+ return "NO_CHANGE";
+ case ADDED:
+ return "ADDED";
+ case CHANGED:
+ return "CHANGED";
+ case REMOVED:
+ return "REMOVED";
+ }
+ return Integer.toString(kind);
+ }
+
+ public String getConfigId(IModule module) throws Exception {
+ return getGeronimoServer().getVersionHandler().getConfigID(module);
+ }
+
+ private IStatus updateSharedLib(IModule[] module, IProgressMonitor monitor) {
+ IDataModel model = DataModelFactory.createDataModel(new SharedLibEntryDataModelProvider());
+ model.setProperty(ISharedLibEntryCreationDataModelProperties.MODULES, module);
+ model.setProperty(ISharedLibEntryCreationDataModelProperties.SERVER, getServer());
+ IDataModelOperation op = new SharedLibEntryCreationOperation(model);
+ try {
+ op.execute(monitor, null);
+ } catch (ExecutionException e) {
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, e.getMessage(), e.getCause());
+ }
+ return Status.OK_STATUS;
+ }
+
}
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviourDelegate.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviourDelegate.java?rev=939969&r1=939968&r2=939969&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviourDelegate.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviourDelegate.java Sat May 1 10:30:30 2010
@@ -781,7 +781,7 @@ abstract public class GeronimoServerBeha
}else{
//for 1.1,2.0,2.1,2.2
- IPath serverJar = getServer().getRuntime().getLocation().append("/lib/server.jar");
+ IPath serverJar = getServer().getRuntime().getLocation().append("/bin/server.jar");
cp.add(JavaRuntime.newArchiveRuntimeClasspathEntry(serverJar));
}
// merge existing classpath with server classpath
@@ -890,7 +890,7 @@ abstract public class GeronimoServerBeha
}
public void stopUpdateServerStateTask() {
- Trace.tracePoint("Entry", "GeronimoServerBehaviourDelegate.stopUpdateServerStateTask", getServer().getName());
+ Trace.tracePoint("Entry", "GeronimoServerBehaviourDelegate.stopUpdateServerStateTask");
if (timer != null)
timer.cancel();
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerRuntimeTargetHandler.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerRuntimeTargetHandler.java?rev=939969&r1=939968&r2=939969&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerRuntimeTargetHandler.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerRuntimeTargetHandler.java Sat May 1 10:30:30 2010
@@ -35,7 +35,18 @@ public class GeronimoServerRuntimeTarget
* @see org.eclipse.jst.server.core.RuntimeClasspathProviderDelegate#getClasspathContainerLabel(org.eclipse.wst.server.core.IRuntime)
*/
public String getClasspathContainerLabel(IRuntime runtime) {
- return Messages.targetRuntime;
+ String version = runtime.getRuntimeType().getVersion();
+ if (version.equals("1.1")) {
+ return Messages.target11runtime;
+ }else if (version.equals("2.0")) {
+ return Messages.target20runtime;
+ }
+ else if (version.equals("2.1")) {
+ return Messages.target21runtime;
+ }if (version.equals("2.2")) {
+ return Messages.target22runtime;
+ }
+ return Messages.target30runtime;
}
/* (non-Javadoc)
@@ -51,17 +62,99 @@ public class GeronimoServerRuntimeTarget
IPath path = runtime.getLocation().append("lib");
addLibraryEntries(list, path.toFile(), true);
- //TODO: review list here when server 3.0 is ready
- IPath javaMailSpec = runtime.getLocation().append("repository/org/apache/geronimo/javamail/geronimo-javamail_1.4_mail/");
- IPath jstlSpec = runtime.getLocation().append("repository/org/apache/geronimo/bundles/jstl/");
- IPath myfacesSpec = runtime.getLocation().append("repository/org/apache/myfaces/core/myfaces-api/");
- IPath myfacesImplSpec = runtime.getLocation().append("repository/org/apache/myfaces/core/myfaces-impl/");
- IPath jdbcSpec = runtime.getLocation().append("repository/org/apache/geronimo/framework/geronimo-jdbc/");
- addLibraryEntries(list, javaMailSpec.toFile(), true);
- addLibraryEntries(list, jstlSpec.toFile(), true);
- addLibraryEntries(list, myfacesSpec.toFile(), true);
- addLibraryEntries(list, myfacesImplSpec.toFile(), true);
- addLibraryEntries(list, jdbcSpec.toFile(), true);
+ String version = runtime.getRuntimeType().getVersion();
+
+ if (version.equals("1.0")) {
+ IPath specPath = runtime.getLocation().append("repository/org.apache.geronimo.specs/jars/");
+ addLibraryEntries(list, specPath.toFile(), false);
+ }
+ else if (version.equals("1.1")) {
+ IPath specPath = runtime.getLocation().append("repository/org/apache/geronimo/specs/geronimo-j2ee_1.4_spec/1.1/geronimo-j2ee_1.4_spec-1.1.jar");
+ //hack to add servlet/jsp spec jars to little G
+ if (!specPath.toFile().exists()) {
+ IPath servletSpec =runtime.getLocation().append("repository/org/apache/geronimo/specs/geronimo-servlet_2.4_spec/1.0.1/geronimo-servlet_2.4_spec-1.0.1.jar");
+ IPath jspSpec = runtime.getLocation().append("repository/org/apache/geronimo/specs/geronimo-jsp_2.0_spec/1.0.1/geronimo-jsp_2.0_spec-1.0.1.jar");
+ list.add(JavaCore.newLibraryEntry(servletSpec, null, null));
+ list.add(JavaCore.newLibraryEntry(jspSpec, null, null));
+ }
+ else {
+ list.add(JavaCore.newLibraryEntry(specPath, null, null));
+ }
+ }
+ else {
+ IPath specPath = runtime.getLocation().append("repository/org/apache/geronimo/specs/");
+ addLibraryEntries(list, specPath.toFile(), true);
+
+ //
+ // Add spec jars that are not in the specs directory (per Geronimo configs jee-specs)
+ //
+ if (version.startsWith("2.0")) {
+ IPath javaMailSpec = runtime.getLocation().append("repository/org/apache/geronimo/javamail/geronimo-javamail_1.4_mail/");
+ IPath jaxbApiSpec = runtime.getLocation().append("repository/javax/xml/bind/jaxb-api/");
+ IPath jabxImplSpec = runtime.getLocation().append("repository/com/sun/xml/bind/jaxb-impl/");
+ IPath jaxwsApiSpec = runtime.getLocation().append("repository/org/apache/axis2/axis2-jaxws-api/");
+ IPath saajApiSpec = runtime.getLocation().append("repository/org/apache/axis2/axis2-saaj-api/");
+ IPath jstlSpec = runtime.getLocation().append("repository/jstl/jstl/");
+ IPath myfacesSpec = runtime.getLocation().append("repository/org/apache/myfaces/core/myfaces-api/");
+ IPath jdbcSpec = runtime.getLocation().append("repository/org/apache/geronimo/modules/geronimo-jdbc/");
+ addLibraryEntries(list, javaMailSpec.toFile(), true);
+ addLibraryEntries(list, jaxbApiSpec.toFile(), true);
+ addLibraryEntries(list, jabxImplSpec.toFile(), true);
+ addLibraryEntries(list, jaxwsApiSpec.toFile(), true);
+ addLibraryEntries(list, saajApiSpec.toFile(), true);
+ addLibraryEntries(list, jstlSpec.toFile(), true);
+ addLibraryEntries(list, myfacesSpec.toFile(), true);
+ addLibraryEntries(list, jdbcSpec.toFile(), true);
+ }
+ if (version.startsWith("2.1")) {
+ IPath javaMailSpec = runtime.getLocation().append("repository/org/apache/geronimo/javamail/geronimo-javamail_1.4_mail/");
+ IPath jaxbApiSpec = runtime.getLocation().append("repository/javax/xml/bind/jaxb-api/");
+ IPath jabxImplSpec = runtime.getLocation().append("repository/com/sun/xml/bind/jaxb-impl/");
+ IPath jaxwsApiSpec = runtime.getLocation().append("repository/org/apache/axis2/axis2-jaxws-api/");
+ IPath jstlSpec = runtime.getLocation().append("repository/jstl/jstl/");
+ IPath myfacesSpec = runtime.getLocation().append("repository/org/apache/myfaces/core/myfaces-api/");
+ IPath myfacesImplSpec = runtime.getLocation().append("repository/org/apache/myfaces/core/myfaces-impl/");
+ IPath jdbcSpec = runtime.getLocation().append("repository/org/apache/geronimo/framework/geronimo-jdbc/");
+ addLibraryEntries(list, javaMailSpec.toFile(), true);
+ addLibraryEntries(list, jaxbApiSpec.toFile(), true);
+ addLibraryEntries(list, jabxImplSpec.toFile(), true);
+ addLibraryEntries(list, jaxwsApiSpec.toFile(), true);
+ addLibraryEntries(list, jstlSpec.toFile(), true);
+ addLibraryEntries(list, myfacesSpec.toFile(), true);
+ addLibraryEntries(list, myfacesImplSpec.toFile(), true);
+ addLibraryEntries(list, jdbcSpec.toFile(), true);
+ }
+ if (version.startsWith("2.2")) {
+ //TODO: review list here when server 2.2 is ready
+ IPath javaMailSpec = runtime.getLocation().append("repository/org/apache/geronimo/javamail/geronimo-javamail_1.4_mail/");
+ IPath jabxImplSpec = runtime.getLocation().append("repository/com/sun/xml/bind/jaxb-impl/");
+ IPath jstlSpec = runtime.getLocation().append("repository/javax/servlet/jstl");
+ IPath myfacesSpec = runtime.getLocation().append("repository/org/apache/myfaces/core/myfaces-api/");
+ IPath myfacesImplSpec = runtime.getLocation().append("repository/org/apache/myfaces/core/myfaces-impl/");
+ IPath jdbcSpec = runtime.getLocation().append("repository/org/apache/geronimo/framework/geronimo-jdbc/");
+ addLibraryEntries(list, javaMailSpec.toFile(), true);
+ addLibraryEntries(list, jabxImplSpec.toFile(), true);
+ addLibraryEntries(list, jstlSpec.toFile(), true);
+ addLibraryEntries(list, myfacesSpec.toFile(), true);
+ addLibraryEntries(list, myfacesImplSpec.toFile(), true);
+ addLibraryEntries(list, jdbcSpec.toFile(), true);
+ }
+ if (version.startsWith("3.0")) {
+ //TODO: review list here when server 3.0 is ready
+ IPath javaMailSpec = runtime.getLocation().append("repository/org/apache/geronimo/javamail/geronimo-javamail_1.4_mail/");
+ IPath jabxImplSpec = runtime.getLocation().append("repository/com/sun/xml/bind/jaxb-impl/");
+ IPath jstlSpec = runtime.getLocation().append("repository/javax/servlet/jstl");
+ IPath myfacesSpec = runtime.getLocation().append("repository/org/apache/myfaces/core/myfaces-api/");
+ IPath myfacesImplSpec = runtime.getLocation().append("repository/org/apache/myfaces/core/myfaces-impl/");
+ IPath jdbcSpec = runtime.getLocation().append("repository/org/apache/geronimo/framework/geronimo-jdbc/");
+ addLibraryEntries(list, javaMailSpec.toFile(), true);
+ addLibraryEntries(list, jabxImplSpec.toFile(), true);
+ addLibraryEntries(list, jstlSpec.toFile(), true);
+ addLibraryEntries(list, myfacesSpec.toFile(), true);
+ addLibraryEntries(list, myfacesImplSpec.toFile(), true);
+ addLibraryEntries(list, jdbcSpec.toFile(), true);
+ }
+ }
return(IClasspathEntry[])list.toArray(new IClasspathEntry[list.size()]);
}
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/internal/Messages.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/internal/Messages.java?rev=939969&r1=939968&r2=939969&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/internal/Messages.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/internal/Messages.java Sat May 1 10:30:30 2010
@@ -38,7 +38,11 @@ public class Messages extends NLS {
public static String errorJRE;
- public static String targetRuntime;
+ public static String target11runtime;
+ public static String target20runtime;
+ public static String target21runtime;
+ public static String target22runtime;
+ public static String target30runtime;
public static String incorrectVersion;
public static String noVersion;
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/internal/Messages.properties
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/internal/Messages.properties?rev=939969&r1=939968&r2=939969&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/internal/Messages.properties (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/internal/Messages.properties Sat May 1 10:30:30 2010
@@ -23,7 +23,11 @@ UNDEPLOY_FAIL=Undeploy of module failed.
REDEPLOY_FAIL=Redeploy of module failed. See log for details.
DM_CONNECTION_FAIL=Connection to deployment manager failed. See log for details.
-targetRuntime=Geronimo v3.0 Runtime
+target11runtime=Geronimo v1.1 Runtime
+target20runtime=Geronimo v2.0 Runtime
+target21runtime=Geronimo v2.1 Runtime
+target22runtime=Geronimo v2.2 Runtime
+target30Runtime=Geronimo v3.0 Runtime
incorrectVersion=An incorrect version of {0} was detected. Version {1} was expected, but version {2} was found.
noVersion=A {0} installation was detected, however the version could not be verified.