Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordeboer2004-12-02 14:53:01 +0000
committerdeboer2004-12-02 14:53:01 +0000
commit6c28603e95e3bcd3e5774d17a28dadcd989e0286 (patch)
tree3db16008c5130d3f784a72451c1e0c9446b5b084
parent27d5e0be1fc352596b0725d890ad7e8c5ee0adba (diff)
downloadwebtools.servertools-ServerToolsAPI.tar.gz
webtools.servertools-ServerToolsAPI.tar.xz
webtools.servertools-ServerToolsAPI.zip
*** empty log message ***ServerToolsAPI
-rw-r--r--plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat32Configuration.java4
-rw-r--r--plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat40Configuration.java4
-rw-r--r--plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat41Configuration.java4
-rw-r--r--plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat50Configuration.java4
-rw-r--r--plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat55Configuration.java4
-rw-r--r--plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatConfiguration.java20
-rw-r--r--plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServer.java39
-rw-r--r--plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServerBehaviour.java2
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerAttributes.java3
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerWorkingCopy.java4
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ResourceManager.java8
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Server.java13
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerType.java40
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerWorkingCopy.java12
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/ServerDelegate.java4
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/AddRemoveModulesAction.java4
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/task/TempSaveServerTask.java4
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/tree/SwitchConfigurationAction.java16
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewManualServerComposite.java29
19 files changed, 145 insertions, 73 deletions
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat32Configuration.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat32Configuration.java
index 20eb5b25d..8d2ae4911 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat32Configuration.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat32Configuration.java
@@ -56,7 +56,7 @@ public class Tomcat32Configuration extends TomcatConfiguration {
/**
* Tomcat32Configuration constructor comment.
*/
- public Tomcat32Configuration(IPath path) {
+ public Tomcat32Configuration(IFolder path) {
super(path);
}
@@ -494,7 +494,7 @@ public class Tomcat32Configuration extends TomcatConfiguration {
monitor = ProgressUtil.getMonitorFor(monitor);
monitor.beginTask(TomcatPlugin.getResource("%updatingConfigurationTask"), 100);
- Tomcat32Configuration config = new Tomcat32Configuration(path);
+ Tomcat32Configuration config = new Tomcat32Configuration(null);
config.load(path, ProgressUtil.getSubMonitorFor(monitor, 30));
if (monitor.isCanceled())
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat40Configuration.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat40Configuration.java
index 824d2d2f6..3dc4210eb 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat40Configuration.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat40Configuration.java
@@ -60,7 +60,7 @@ public class Tomcat40Configuration extends TomcatConfiguration {
/**
* Tomcat40Configuration constructor comment.
*/
- public Tomcat40Configuration(IPath path) {
+ public Tomcat40Configuration(IFolder path) {
super(path);
}
@@ -489,7 +489,7 @@ public class Tomcat40Configuration extends TomcatConfiguration {
monitor = ProgressUtil.getMonitorFor(monitor);
monitor.beginTask(TomcatPlugin.getResource("%updatingConfigurationTask"), 100);
- Tomcat40Configuration config = new Tomcat40Configuration(path);
+ Tomcat40Configuration config = new Tomcat40Configuration(null);
config.load(path, ProgressUtil.getSubMonitorFor(monitor, 40));
if (monitor.isCanceled())
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat41Configuration.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat41Configuration.java
index b14caed9a..1ff47c115 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat41Configuration.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat41Configuration.java
@@ -61,7 +61,7 @@ public class Tomcat41Configuration extends TomcatConfiguration {
/**
* Tomcat41Configuration constructor comment.
*/
- public Tomcat41Configuration(IPath path) {
+ public Tomcat41Configuration(IFolder path) {
super(path);
}
@@ -506,7 +506,7 @@ public class Tomcat41Configuration extends TomcatConfiguration {
monitor = ProgressUtil.getMonitorFor(monitor);
monitor.beginTask(TomcatPlugin.getResource("%updatingConfigurationTask"), 100);
- Tomcat41Configuration config = new Tomcat41Configuration(path);
+ Tomcat41Configuration config = new Tomcat41Configuration(null);
config.load(path, ProgressUtil.getSubMonitorFor(monitor, 40));
if (monitor.isCanceled())
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat50Configuration.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat50Configuration.java
index 1fea1d0b7..bbe71a927 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat50Configuration.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat50Configuration.java
@@ -48,7 +48,7 @@ public class Tomcat50Configuration extends TomcatConfiguration {
/**
* Tomcat50Configuration constructor comment.
*/
- public Tomcat50Configuration(IPath path) {
+ public Tomcat50Configuration(IFolder path) {
super(path);
}
@@ -486,7 +486,7 @@ public class Tomcat50Configuration extends TomcatConfiguration {
monitor = ProgressUtil.getMonitorFor(monitor);
monitor.beginTask(TomcatPlugin.getResource("%updatingConfigurationTask"), 100);
- Tomcat50Configuration config = new Tomcat50Configuration(path);
+ Tomcat50Configuration config = new Tomcat50Configuration(null);
config.load(path, ProgressUtil.getSubMonitorFor(monitor, 40));
if (monitor.isCanceled())
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat55Configuration.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat55Configuration.java
index dc367bf31..15be680f4 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat55Configuration.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat55Configuration.java
@@ -48,7 +48,7 @@ public class Tomcat55Configuration extends TomcatConfiguration {
/**
* Tomcat55Configuration constructor comment.
*/
- public Tomcat55Configuration(IPath path) {
+ public Tomcat55Configuration(IFolder path) {
super(path);
}
@@ -486,7 +486,7 @@ public class Tomcat55Configuration extends TomcatConfiguration {
monitor = ProgressUtil.getMonitorFor(monitor);
monitor.beginTask(TomcatPlugin.getResource("%updatingConfigurationTask"), 100);
- Tomcat55Configuration config = new Tomcat55Configuration(path);
+ Tomcat55Configuration config = new Tomcat55Configuration(null);
config.load(path, ProgressUtil.getSubMonitorFor(monitor, 40));
if (monitor.isCanceled())
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatConfiguration.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatConfiguration.java
index f34da6547..a35f52fda 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatConfiguration.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatConfiguration.java
@@ -47,7 +47,7 @@ public abstract class TomcatConfiguration implements ITomcatConfiguration, ITomc
public static final String ADD_WEB_MODULE_PROPERTY = "addWebModule";
public static final String REMOVE_WEB_MODULE_PROPERTY = "removeWebModule";
- protected IPath configPath;
+ protected IFolder configPath;
// property change listeners
private transient List propertyListeners;
@@ -55,7 +55,7 @@ public abstract class TomcatConfiguration implements ITomcatConfiguration, ITomc
/**
* TomcatConfiguration constructor comment.
*/
- public TomcatConfiguration(IPath path) {
+ public TomcatConfiguration(IFolder path) {
super();
this.configPath = path;
/*try {
@@ -65,7 +65,7 @@ public abstract class TomcatConfiguration implements ITomcatConfiguration, ITomc
}*/
}
- protected IPath getPath() {
+ protected IFolder getFolder() {
return configPath;
}
@@ -98,10 +98,10 @@ public abstract class TomcatConfiguration implements ITomcatConfiguration, ITomc
if (folder != null)
backupFolder(folder, confDir, backup, ms, monitor);
else {
- IPath path = config.getConfigurationDataPath();*/
- backupPath(configPath, confDir, backup, ms, monitor);
+ IPath path = config.getConfigurationDataPath();
+ backupPath(configPath, confDir, backup, ms, monitor);*/
+ backupFolder(getFolder(), confDir, backup, ms, monitor);
//}
-
} catch (Exception e) {
Trace.trace("backupAndPublish() error", e);
IStatus s = new Status(IStatus.ERROR, TomcatPlugin.PLUGIN_ID, 0, TomcatPlugin.getResource("%errorPublishConfiguration", new String[] {e.getLocalizedMessage()}), e);
@@ -253,7 +253,9 @@ public abstract class TomcatConfiguration implements ITomcatConfiguration, ITomc
* @param forceSave boolean
* @exception java.io.IOException
*/
- protected abstract void save(IPath path, boolean forceSave, IProgressMonitor monitor) throws CoreException;
+ //protected abstract void save(IPath path, boolean forceSave, IProgressMonitor monitor) throws CoreException;
+
+ protected abstract void save(IFolder folder, IProgressMonitor monitor) throws CoreException;
protected void firePropertyChangeEvent(String propertyName, Object oldValue, Object newValue) {
if (propertyListeners == null)
@@ -304,9 +306,9 @@ public abstract class TomcatConfiguration implements ITomcatConfiguration, ITomc
load(runtime.getLocation().append("conf"), monitor);
}*/
- public abstract void load(IPath path, IProgressMonitor monitor) throws CoreException;
+ protected abstract void load(IPath path, IProgressMonitor monitor) throws CoreException;
- //public abstract void load(IFolder folder, IProgressMonitor monitor) throws CoreException;
+ protected abstract void load(IFolder folder, IProgressMonitor monitor) throws CoreException;
public abstract void addWebModule(int index, ITomcatWebModule module);
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServer.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServer.java
index 19b2c5a6f..79514ae26 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServer.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServer.java
@@ -15,6 +15,7 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.*;
import org.eclipse.debug.core.*;
import org.eclipse.debug.core.model.IProcess;
@@ -72,29 +73,28 @@ public class TomcatServer extends ServerDelegate implements ITomcatServer, ITomc
public TomcatConfiguration getTomcatConfiguration() {
if (configuration == null) {
- //IPath path = getServer().getServerConfiguration();
- //if (path == null)
- IPath path = null;
+ IFolder folder = getServer().getServerConfiguration();
+ /*IPath path = null;
if (getServerWC() != null && getServerWC().getRuntime() != null)
path = getServerWC().getRuntime().getLocation().append("conf");
else if (getServer() != null && getServer().getRuntime() != null)
path = getServer().getRuntime().getLocation().append("conf");
else
- return null;
+ return null;*/
String id = getServer().getServerType().getId();
if (id.indexOf("32") > 0)
- configuration = new Tomcat32Configuration(path);
+ configuration = new Tomcat32Configuration(folder);
else if (id.indexOf("40") > 0)
- configuration = new Tomcat40Configuration(path);
+ configuration = new Tomcat40Configuration(folder);
else if (id.indexOf("41") > 0)
- configuration = new Tomcat41Configuration(path);
+ configuration = new Tomcat41Configuration(folder);
else if (id.indexOf("50") > 0)
- configuration = new Tomcat50Configuration(path);
+ configuration = new Tomcat50Configuration(folder);
else if (id.indexOf("55") > 0)
- configuration = new Tomcat55Configuration(path);
+ configuration = new Tomcat55Configuration(folder);
try {
- configuration.load(path, null);
+ configuration.load(folder, null);
} catch (CoreException ce) {
// ignore
}
@@ -107,15 +107,15 @@ public class TomcatServer extends ServerDelegate implements ITomcatServer, ITomc
String id = getServer().getServerType().getId();
if (id.indexOf("32") > 0)
- configuration = new Tomcat32Configuration(path);
+ configuration = new Tomcat32Configuration(null);
else if (id.indexOf("40") > 0)
- configuration = new Tomcat40Configuration(path);
+ configuration = new Tomcat40Configuration(null);
else if (id.indexOf("41") > 0)
- configuration = new Tomcat41Configuration(path);
+ configuration = new Tomcat41Configuration(null);
else if (id.indexOf("50") > 0)
- configuration = new Tomcat50Configuration(path);
+ configuration = new Tomcat50Configuration(null);
else if (id.indexOf("55") > 0)
- configuration = new Tomcat55Configuration(path);
+ configuration = new Tomcat55Configuration(null);
try {
configuration.load(path, monitor);
} catch (CoreException ce) {
@@ -123,6 +123,11 @@ public class TomcatServer extends ServerDelegate implements ITomcatServer, ITomc
}
}
+ public void saveConfiguration(IProgressMonitor monitor) throws CoreException {
+ TomcatConfiguration config = getTomcatConfiguration();
+ config.save(getServer().getServerConfiguration(), monitor);
+ }
+
/**
* Return the root URL of this module.
* @param module org.eclipse.wst.server.core.model.IModule
@@ -133,7 +138,7 @@ public class TomcatServer extends ServerDelegate implements ITomcatServer, ITomc
if (module == null || !(module instanceof IWebModule))
return null;
- IPath serverConfig = getServer().getServerConfiguration();
+ IFolder serverConfig = getServer().getServerConfiguration();
if (serverConfig == null)
return null;
@@ -495,6 +500,6 @@ public class TomcatServer extends ServerDelegate implements ITomcatServer, ITomc
}
}
}
- config.save(config.getPath(), true, monitor);
+ config.save(config.getFolder(), monitor);
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServerBehaviour.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServerBehaviour.java
index 5ac0abaee..88aaec51b 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServerBehaviour.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServerBehaviour.java
@@ -195,6 +195,8 @@ public class TomcatServerBehaviour extends ServerBehaviourDelegate implements IT
IPath from = webModule.getLocation();
IPath to = getServer().getRuntime().getLocation().append("webapps").append(webModule.getContextRoot());
FileUtil.smartCopyDirectory(from.toOSString(), to.toOSString(), monitor);
+
+ setModulePublishState(module, IServer.PUBLISH_STATE_NONE);
}
/**
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerAttributes.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerAttributes.java
index 158017d4a..05301b7dd 100644
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerAttributes.java
+++ b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerAttributes.java
@@ -11,6 +11,7 @@
package org.eclipse.wst.server.core;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.*;
/**
* Represents a server instance. Every server is an instance of a
@@ -175,7 +176,7 @@ public interface IServerAttributes extends IElement, IAdaptable {
*
* @return the server configuration, or <code>null</code> if none
*/
- public IPath getServerConfiguration();
+ public IFolder getServerConfiguration();
/**
* Returns the server extension for this server.
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerWorkingCopy.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerWorkingCopy.java
index 5208d9275..0bc45e130 100644
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerWorkingCopy.java
+++ b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerWorkingCopy.java
@@ -11,8 +11,8 @@
package org.eclipse.wst.server.core;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
/**
* A working copy server object used for formulating changes
@@ -78,7 +78,7 @@ public interface IServerWorkingCopy extends IServerAttributes, IElementWorkingCo
*
* @param configuration the server configuration, or <code>null</code> if none
*/
- public void setServerConfiguration(IPath configuration);
+ public void setServerConfiguration(IFolder configuration);
/**
* Returns the server instance that this working copy is
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ResourceManager.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ResourceManager.java
index 2312f2cf9..f068760a2 100644
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ResourceManager.java
+++ b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ResourceManager.java
@@ -66,8 +66,6 @@ public class ResourceManager {
// module events listeners
protected transient List moduleEventListeners;
- protected static List serverProjects = new ArrayList();
-
/**
* Resource listener - tracks changes on server resources so that
* we can reload/drop server instances and configurations that
@@ -119,7 +117,7 @@ public class ResourceManager {
* @param delta org.eclipse.core.resources.IResourceDelta
*/
protected void projectChanged(IProject project, IResourceDelta delta) {
- if (serverProjects.contains(project)) {
+ if (!ServerCore.getProjectProperties(project).isServerProject()) {
Trace.trace(Trace.RESOURCES, "Not a server project: " + project.getName());
return;
}
@@ -277,10 +275,8 @@ public class ResourceManager {
if (projects != null) {
int size = projects.length;
for (int i = 0; i < size; i++) {
- if (ServerCore.getProjectProperties(projects[i]).isServerProject()) {
- serverProjects.add(projects[i]);
+ if (ServerCore.getProjectProperties(projects[i]).isServerProject())
loadFromProject(projects[i]);
- }
}
}
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Server.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Server.java
index d4fc79fae..3f492a7d4 100644
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Server.java
+++ b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Server.java
@@ -13,7 +13,9 @@ package org.eclipse.wst.server.core.internal;
import java.util.*;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.*;
import org.eclipse.debug.core.*;
import org.osgi.framework.Bundle;
@@ -37,7 +39,7 @@ public class Server extends Base implements IServer {
protected ServerBehaviourDelegate behaviourDelegate;
protected IRuntime runtime;
- protected IPath configuration;
+ protected IFolder configuration;
protected String mode;
protected int serverState = STATE_UNKNOWN;
@@ -114,7 +116,7 @@ public class Server extends Base implements IServer {
/* (non-Javadoc)
* @see com.ibm.wtp.server.core.IServer2#getServerConfiguration()
*/
- public IPath getServerConfiguration() {
+ public IFolder getServerConfiguration() {
return configuration;
}
@@ -619,8 +621,7 @@ public class Server extends Base implements IServer {
public boolean canPublish() {
// can't publish if the server is starting or stopping
int state = getServerState();
- if (state == STATE_STARTING ||
- state == STATE_STOPPING)
+ if (state == STATE_STARTING || state == STATE_STOPPING)
return false;
// can't publish if there is no configuration
@@ -1546,7 +1547,7 @@ public class Server extends Base implements IServer {
String configPath = getAttribute(CONFIGURATION_ID, (String)null);
configuration = null;
if (configPath != null)
- configuration = new Path(configPath);
+ configuration = ResourcesPlugin.getWorkspace().getRoot().getFolder(new Path(configPath));
}
protected void setInternal(ServerWorkingCopy wc) {
@@ -1567,7 +1568,7 @@ public class Server extends Base implements IServer {
memento.putString("server-type", serverType.getId());
if (configuration != null)
- memento.putString(CONFIGURATION_ID, configuration.toPortableString());
+ memento.putString(CONFIGURATION_ID, configuration.getFullPath().toString());
else
memento.putString(CONFIGURATION_ID, null);
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerType.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerType.java
index a982cc8df..c7c4d7d10 100644
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerType.java
+++ b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerType.java
@@ -11,6 +11,10 @@
package org.eclipse.wst.server.core.internal;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -177,6 +181,13 @@ public class ServerType implements IServerType, IOrdered {
if (runtime != null)
swc.setRuntime(runtime);
+ if (swc.getServerType().hasServerConfiguration()) {
+ // TODO: config
+ ((Server)swc).importConfiguration(runtime, null);
+ IFolder folder = getServerProject().getFolder("cfg");
+ swc.setServerConfiguration(folder);
+ }
+
//TODO: import server config
/* IServerConfigurationWorkingCopy config = null;
if (hasServerConfiguration()) {
@@ -194,6 +205,35 @@ public class ServerType implements IServerType, IOrdered {
return swc;
}
+ public static IProject getServerProject() {
+ IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ if (projects != null) {
+ int size = projects.length;
+ for (int i = 0; i < size; i++) {
+ if (ServerCore.getProjectProperties(projects[i]).isServerProject())
+ return projects[i];
+ }
+ }
+
+ String s = findUnusedServerProjectName();
+ return ResourcesPlugin.getWorkspace().getRoot().getProject(s);
+ }
+
+ /**
+ * Finds an unused project name to use as a server project.
+ *
+ * @return java.lang.String
+ */
+ protected static String findUnusedServerProjectName() {
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ String name = ServerPlugin.getResource("%defaultServerProjectName", "");
+ int count = 1;
+ while (root.getProject(name).exists()) {
+ name = ServerPlugin.getResource("%defaultServerProjectName", ++count + "");
+ }
+ return name;
+ }
+
/**
* Return the timeout (in ms) that should be used to wait for the server to start.
* Returns -1 if there is no timeout.
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerWorkingCopy.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerWorkingCopy.java
index 1ea3aa6d6..8c1e1160c 100644
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerWorkingCopy.java
+++ b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerWorkingCopy.java
@@ -16,6 +16,8 @@ import java.util.List;
import java.util.Map;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.*;
import org.eclipse.wst.server.core.*;
import org.eclipse.wst.server.core.model.ServerDelegate;
@@ -111,12 +113,12 @@ public class ServerWorkingCopy extends Server implements IServerWorkingCopy {
setAttribute(PROP_HOSTNAME, host);
}
- public void setServerConfiguration(IPath config) {
+ public void setServerConfiguration(IFolder config) {
this.configuration = config;
if (configuration == null)
setAttribute(CONFIGURATION_ID, (String)null);
else
- setAttribute(CONFIGURATION_ID, configuration.toPortableString());
+ setAttribute(CONFIGURATION_ID, configuration.getFullPath().toString());
}
public void setFile(IFile file) {
@@ -177,6 +179,12 @@ public class ServerWorkingCopy extends Server implements IServerWorkingCopy {
server.setInternal(this);
server.doSave(monitor);
+ IFolder folder = getServerConfiguration();
+ if (folder != null && !folder.exists()) {
+ folder.create(IResource.FORCE, true, null);
+ }
+ //ResourcesPlugin.getWorkspace().getRoot().g
+ getDelegate().saveConfiguration(monitor);
wch.setDirty(false);
return server;
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/ServerDelegate.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/ServerDelegate.java
index 0f591df7a..eeee2baf2 100644
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/ServerDelegate.java
+++ b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/ServerDelegate.java
@@ -326,4 +326,8 @@ public abstract class ServerDelegate {
public void importConfiguration(IRuntime runtime, IProgressMonitor monitor) {
// do nothing
}
+
+ public void saveConfiguration(IProgressMonitor monitor) throws CoreException {
+ // do nothing
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/AddRemoveModulesAction.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/AddRemoveModulesAction.java
index e6d643d21..cfa48e30b 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/AddRemoveModulesAction.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/AddRemoveModulesAction.java
@@ -13,7 +13,7 @@ package org.eclipse.wst.server.ui.internal.actions;
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.MessageDialog;
@@ -32,7 +32,7 @@ public class AddRemoveModulesAction implements IServerAction {
public boolean supports(IServer server) {
if (server == null)
return false;
- IPath configuration = server.getServerConfiguration();
+ IFolder configuration = server.getServerConfiguration();
return (!server.getServerType().hasServerConfiguration() || configuration != null);
}
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/task/TempSaveServerTask.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/task/TempSaveServerTask.java
index dc481cb54..2b729574c 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/task/TempSaveServerTask.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/task/TempSaveServerTask.java
@@ -15,6 +15,7 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.wst.server.core.*;
+import org.eclipse.wst.server.core.internal.Server;
import org.eclipse.wst.server.core.util.Task;
import org.eclipse.wst.server.ui.internal.EclipseUtil;
/**
@@ -46,6 +47,9 @@ public class TempSaveServerTask extends Task {
workingCopy = server.createWorkingCopy();
workingCopy.setRuntime(runtime);
+ if (workingCopy.getServerType().hasServerConfiguration()) {
+ ((Server)workingCopy).importConfiguration(runtime, null);
+ }
getTaskModel().putObject(ITaskModel.TASK_SERVER, workingCopy);
}
}
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/tree/SwitchConfigurationAction.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/tree/SwitchConfigurationAction.java
index d4ffcb5ed..ecc68738e 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/tree/SwitchConfigurationAction.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/tree/SwitchConfigurationAction.java
@@ -10,7 +10,7 @@
**********************************************************************/
package org.eclipse.wst.server.ui.internal.view.tree;
-import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.action.Action;
@@ -20,31 +20,27 @@ import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.IServerType;
import org.eclipse.wst.server.core.IServerWorkingCopy;
import org.eclipse.wst.server.ui.ServerUICore;
-import org.eclipse.wst.server.ui.internal.EclipseUtil;
-import org.eclipse.wst.server.ui.internal.ImageResource;
-import org.eclipse.wst.server.ui.internal.ProgressUtil;
-import org.eclipse.wst.server.ui.internal.ServerLabelProvider;
-import org.eclipse.wst.server.ui.internal.Trace;
+import org.eclipse.wst.server.ui.internal.*;
import org.eclipse.swt.widgets.Shell;
/**
* Action to add or remove configuration to/from a server.
*/
public class SwitchConfigurationAction extends Action {
protected IServer server;
- protected IPath config;
+ protected IFolder config;
protected Shell shell;
protected IStatus status;
/**
* SwitchConfigurationAction constructor comment.
*/
- public SwitchConfigurationAction(Shell shell, String label, IServer server, IPath config) {
+ public SwitchConfigurationAction(Shell shell, String label, IServer server, IFolder config) {
super(label);
this.shell = shell;
this.server = server;
this.config = config;
- IPath tempConfig = server.getServerConfiguration();
+ IFolder tempConfig = server.getServerConfiguration();
if ((tempConfig == null && config == null) || (tempConfig != null && tempConfig.equals(config)))
setChecked(true);
@@ -60,7 +56,7 @@ public class SwitchConfigurationAction extends Action {
}
public void run() {
- IPath tempConfig = server.getServerConfiguration();
+ IFolder tempConfig = server.getServerConfiguration();
if ((tempConfig == null && config == null) || (tempConfig != null && tempConfig.equals(config)))
return;
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewManualServerComposite.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewManualServerComposite.java
index 7176927b7..9daaabd7d 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewManualServerComposite.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewManualServerComposite.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,6 +14,7 @@ import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.Dialog;
@@ -30,12 +31,9 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.help.WorkbenchHelp;
import org.eclipse.wst.server.core.*;
+import org.eclipse.wst.server.core.internal.Server;
import org.eclipse.wst.server.core.util.SocketUtil;
-import org.eclipse.wst.server.ui.internal.ContextIds;
-import org.eclipse.wst.server.ui.internal.ProgressUtil;
-import org.eclipse.wst.server.ui.internal.SWTUtil;
-import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
-import org.eclipse.wst.server.ui.internal.Trace;
+import org.eclipse.wst.server.ui.internal.*;
import org.eclipse.wst.server.ui.internal.viewers.ServerTypeComposite;
/**
* Wizard page used to create a server and configuration at the same time.
@@ -131,8 +129,15 @@ public class NewManualServerComposite extends Composite {
public void widgetSelected(SelectionEvent e) {
try {
runtime = runtimes[runtimeCombo.getSelectionIndex()];
- if (server != null)
+ if (server != null) {
server.setRuntime(runtime);
+ if (server.getServerType().hasServerConfiguration()) {
+ // TODO: config
+ ((Server)server).importConfiguration(runtime, null);
+ IFolder folder = WizardUtil.getServerProject().getFolder("cfg");
+ server.setServerConfiguration(folder);
+ }
+ }
} catch (Exception ex) {
// ignore
}
@@ -194,8 +199,16 @@ public class NewManualServerComposite extends Composite {
server.setHost(host);
ServerUtil.setServerDefaultName(server);
- if (serverType.hasRuntime() && server.getRuntime() == null)
+ if (serverType.hasRuntime() && server.getRuntime() == null) {
server.setRuntime(runtime);
+
+ if (server.getServerType().hasServerConfiguration()) {
+ // TODO: config
+ ((Server)server).importConfiguration(runtime, null);
+ IFolder folder = WizardUtil.getServerProject().getFolder("cfg");
+ server.setServerConfiguration(folder);
+ }
+ }
}
} catch (CoreException cex) {
ce[0] = cex;

Back to the top