[182850] Create WST/HTTP preview server
diff --git a/features/org.eclipse.jst.server_core.feature/feature.xml b/features/org.eclipse.jst.server_core.feature/feature.xml
index ff9c8df..cbbef2a 100644
--- a/features/org.eclipse.jst.server_core.feature/feature.xml
+++ b/features/org.eclipse.jst.server_core.feature/feature.xml
@@ -33,13 +33,6 @@
unpack="false"/>
<plugin
- id="org.eclipse.jst.server.preview"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
id="org.eclipse.jst.server.generic.core"
download-size="0"
install-size="0"
diff --git a/features/org.eclipse.wst.server_core.feature/feature.xml b/features/org.eclipse.wst.server_core.feature/feature.xml
index 50258a1..a1a0a8e 100644
--- a/features/org.eclipse.wst.server_core.feature/feature.xml
+++ b/features/org.eclipse.wst.server_core.feature/feature.xml
@@ -41,4 +41,11 @@
install-size="0"
version="0.0.0"
unpack="false"/>
+
+ <plugin
+ id="org.eclipse.wst.server.preview"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
</feature>
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.core/component.xml b/plugins/org.eclipse.jst.server.core/component.xml
index b916dc2..34b77d8 100644
--- a/plugins/org.eclipse.jst.server.core/component.xml
+++ b/plugins/org.eclipse.jst.server.core/component.xml
@@ -20,8 +20,6 @@
<plugin id="org.eclipse.jst.server.ui" fragment="false"/>
- <plugin id="org.eclipse.jst.server.preview" fragment="false"/>
-
<plugin id="org.eclipse.jst.server.generic.core" fragment="false"/>
<plugin id="org.eclipse.jst.server.generic.ui" fragment="false"/>
diff --git a/plugins/org.eclipse.jst.server.core/plugin.properties b/plugins/org.eclipse.jst.server.core/plugin.properties
index c509419..0b0bdb9 100644
--- a/plugins/org.eclipse.jst.server.core/plugin.properties
+++ b/plugins/org.eclipse.jst.server.core/plugin.properties
@@ -28,10 +28,10 @@
launchableJndi=JNDI Object
launchableJndiDescription=Silently start an object locatable by JNDI.
-previewRuntimeTypeName=Preview
-previewRuntimeTypeDescription=A runtime that represents a set of J2EE runtime libraries.
+previewRuntimeTypeName=J2EE Preview
+previewRuntimeTypeDescription=A runtime for building J2EE web modules.
-previewServerTypeName=Preview
-previewServerTypeDescription=A server to preview Web modules.
+previewServerTypeName=J2EE Preview
+previewServerTypeDescription=A server to preview J2EE web modules.
-previewLaunchConfigurationType=Preview Server Launch
\ No newline at end of file
+previewLaunchConfigurationType=J2EE Preview
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.core/plugin.xml b/plugins/org.eclipse.jst.server.core/plugin.xml
index 8115db2..43f3fc6 100644
--- a/plugins/org.eclipse.jst.server.core/plugin.xml
+++ b/plugins/org.eclipse.jst.server.core/plugin.xml
@@ -192,7 +192,7 @@
version="1.0"/>
</extension>
-<extension point="org.eclipse.wst.server.core.runtimeTypes">
+ <extension point="org.eclipse.wst.server.core.runtimeTypes">
<runtimeType
id="org.eclipse.jst.server.preview.runtime"
name="%previewRuntimeTypeName"
@@ -273,7 +273,7 @@
version="1.0"/>
</extension>
-<extension point="org.eclipse.debug.core.sourcePathComputers">
+ <extension point="org.eclipse.debug.core.sourcePathComputers">
<sourcePathComputer
id="org.eclipse.jst.server.core.preview.sourcePathComputer"
class="org.eclipse.jst.server.core.internal.preview.PreviewSourcePathComputerDelegate"/>
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/preview/PreviewLaunchConfigurationDelegate.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/preview/PreviewLaunchConfigurationDelegate.java
index 87196c1..03e12fb 100644
--- a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/preview/PreviewLaunchConfigurationDelegate.java
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/preview/PreviewLaunchConfigurationDelegate.java
@@ -40,10 +40,10 @@
"javax.servlet",
"javax.servlet.jsp",
"org.mortbay.jetty",
- "org.eclipse.jst.server.preview"
+ "org.eclipse.wst.server.preview"
};
- private static final String MAIN_CLASS = "org.eclipse.jst.server.preview.internal.PreviewStarter";
+ private static final String MAIN_CLASS = "org.eclipse.wst.server.preview.internal.PreviewStarter";
public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
IServer server = ServerUtil.getServer(configuration);
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/preview/PreviewServer.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/preview/PreviewServer.java
index 5c77733..1a8e2c2 100644
--- a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/preview/PreviewServer.java
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/preview/PreviewServer.java
@@ -124,7 +124,7 @@
}
public int getPort() {
- return getAttribute(PreviewServer.PROPERTY_PORT, 80);
+ return getAttribute(PreviewServer.PROPERTY_PORT, 8080);
}
public void setPort(int port) {
diff --git a/plugins/org.eclipse.jst.server.ui/plugin.xml b/plugins/org.eclipse.jst.server.ui/plugin.xml
index 4a5fd18..51c27ff 100644
--- a/plugins/org.eclipse.jst.server.ui/plugin.xml
+++ b/plugins/org.eclipse.jst.server.ui/plugin.xml
@@ -134,12 +134,4 @@
class="org.eclipse.jst.server.ui.internal.preview.PreviewLaunchConfigurationTabGroup">
</launchConfigurationTabGroup>
</extension>
-
- <extension point="org.eclipse.wst.common.project.facet.core.runtimes">
- <adapter>
- <runtime-component id="org.eclipse.jst.server.preview.runtime"/>
- <factory class="org.eclipse.jst.server.ui.internal.RuntimeLabelProvider$Factory"/>
- <type class="org.eclipse.wst.common.project.facet.ui.IRuntimeComponentLabelProvider"/>
- </adapter>
- </extension>
</plugin>
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.ui/sjavaui/org/eclipse/jst/server/ui/internal/preview/PreviewLaunchConfigurationTabGroup.java b/plugins/org.eclipse.jst.server.ui/sjavaui/org/eclipse/jst/server/ui/internal/preview/PreviewLaunchConfigurationTabGroup.java
index 36ce1ac..51851cf 100644
--- a/plugins/org.eclipse.jst.server.ui/sjavaui/org/eclipse/jst/server/ui/internal/preview/PreviewLaunchConfigurationTabGroup.java
+++ b/plugins/org.eclipse.jst.server.ui/sjavaui/org/eclipse/jst/server/ui/internal/preview/PreviewLaunchConfigurationTabGroup.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
+ * Copyright (c) 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -25,7 +25,7 @@
*/
public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[6];
- tabs[0] = new ServerLaunchConfigurationTab(new String[] { "org.eclipse.jst.server.tomcat" });
+ tabs[0] = new ServerLaunchConfigurationTab(new String[] { "org.eclipse.jst.server.preview" });
tabs[0].setLaunchConfigurationDialog(dialog);
tabs[1] = new JavaArgumentsTab();
tabs[1].setLaunchConfigurationDialog(dialog);
diff --git a/plugins/org.eclipse.wst.server.core/component.xml b/plugins/org.eclipse.wst.server.core/component.xml
index de0ab8d..0cdeb67 100644
--- a/plugins/org.eclipse.wst.server.core/component.xml
+++ b/plugins/org.eclipse.wst.server.core/component.xml
@@ -76,4 +76,6 @@
<plugin id="org.eclipse.wst.server.http.core" fragment="false"/>
<plugin id="org.eclipse.wst.server.http.ui" fragment="false"/>
+
+ <plugin id="org.eclipse.wst.server.preview" fragment="false"/>
</component>
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.http.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.wst.server.http.core/META-INF/MANIFEST.MF
index 5f06d1e..28ec686 100644
--- a/plugins/org.eclipse.wst.server.http.core/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.wst.server.http.core/META-INF/MANIFEST.MF
@@ -11,6 +11,7 @@
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
org.eclipse.core.commands;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.wst.server.core;bundle-version="[1.0.204,2.0.0)"
+ org.eclipse.wst.server.core;bundle-version="[1.0.204,2.0.0)",
+ org.eclipse.debug.core;bundle-version="[3.3.0,4.0.0)"
Eclipse-LazyStart: true
Bundle-RequiredExecutionEnvironment: J2SE-1.4
diff --git a/plugins/org.eclipse.wst.server.http.core/plugin.properties b/plugins/org.eclipse.wst.server.http.core/plugin.properties
index 2d780b2..d3b0850 100644
--- a/plugins/org.eclipse.wst.server.http.core/plugin.properties
+++ b/plugins/org.eclipse.wst.server.http.core/plugin.properties
@@ -16,3 +16,11 @@
httpServerType=HTTP Server
httpServerDescription=Publishes and runs projects on an HTTP server.
+
+previewRuntimeTypeName=HTTP Preview
+previewRuntimeTypeDescription=A runtime to build static Web modules.
+
+previewServerTypeName=HTTP Preview
+previewServerTypeDescription=A server to preview static Web modules.
+
+previewLaunchConfigurationType=HTTP Preview
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.http.core/plugin.xml b/plugins/org.eclipse.wst.server.http.core/plugin.xml
index 9ecc1f9..8a43f60 100644
--- a/plugins/org.eclipse.wst.server.http.core/plugin.xml
+++ b/plugins/org.eclipse.wst.server.http.core/plugin.xml
@@ -25,7 +25,6 @@
runtime="true"
initialState="started"
hasConfiguration="false"
- launchModes="run"
runtimeTypeId="org.eclipse.wst.server.http.runtime"
class="org.eclipse.wst.server.http.core.internal.HttpServer"
behaviourClass="org.eclipse.wst.server.http.core.internal.HttpServerBehaviour"/>
@@ -55,7 +54,7 @@
</extension>
<extension point="org.eclipse.jst.server.core.runtimeFacetMappings">
- <runtimeFacetMapping
+ <runtimeFacetMapping
runtimeTypeId="org.eclipse.wst.server.http.runtime"
runtime-component="org.eclipse.wst.server.http.runtime"
version="1.0"/>
@@ -67,4 +66,75 @@
class="org.eclipse.wst.server.http.core.internal.HttpLaunchableAdapterDelegate"
typeIds="org.eclipse.wst.server.http.server"/>
</extension>
-</plugin>
\ No newline at end of file
+
+
+
+
+
+ <extension point="org.eclipse.wst.server.core.runtimeTypes">
+ <runtimeType
+ id="org.eclipse.wst.server.preview.runtime"
+ name="%previewRuntimeTypeName"
+ description="%previewRuntimeTypeDescription"
+ class="org.eclipse.wst.server.http.core.internal.preview.PreviewRuntime">
+ <moduleType
+ types="wst.web"
+ versions="1.0"/>
+ </runtimeType>
+ </extension>
+
+ <extension point="org.eclipse.wst.server.core.serverTypes">
+ <serverType
+ id="org.eclipse.wst.server.preview.server"
+ name="%previewServerTypeName"
+ description="%previewServerTypeDescription"
+ supportsRemoteHosts="false"
+ runtime="true"
+ initialState="stopped"
+ hasConfiguration="false"
+ launchModes="run,debug,profile"
+ launchConfigId="org.eclipse.wst.server.core.preview.launchConfigurationType"
+ runtimeTypeId="org.eclipse.wst.server.preview.runtime"
+ class="org.eclipse.wst.server.http.core.internal.preview.PreviewServer"
+ behaviourClass="org.eclipse.wst.server.http.core.internal.preview.PreviewServerBehaviour"/>
+ </extension>
+
+ <extension point="org.eclipse.wst.common.project.facet.core.runtimes">
+ <runtime-component-type
+ id="org.eclipse.wst.server.preview.runtime"/>
+
+ <runtime-component-version
+ type="org.eclipse.wst.server.preview.runtime"
+ version="1.0"/>
+
+ <supported>
+ <runtime-component
+ id="org.eclipse.wst.server.preview.runtime"
+ version="1.0"/>
+ <facet
+ id="wst.web"
+ version="1.0"/>
+ </supported>
+ </extension>
+
+ <extension point="org.eclipse.jst.server.core.runtimeFacetMappings">
+ <runtimeFacetMapping
+ runtimeTypeId="org.eclipse.wst.server.preview.runtime"
+ runtime-component="org.eclipse.wst.server.preview.runtime"
+ version="1.0"/>
+ </extension>
+
+ <extension point="org.eclipse.debug.core.launchConfigurationTypes">
+ <launchConfigurationType
+ id="org.eclipse.wst.server.core.preview.launchConfigurationType"
+ name="%previewLaunchConfigurationType"
+ delegate="org.eclipse.wst.server.http.core.internal.preview.PreviewLaunchConfigurationDelegate"
+ modes="run,debug,profile"/>
+ </extension>
+
+ <extension point="org.eclipse.wst.server.core.launchableAdapters">
+ <launchableAdapter
+ id="org.eclipse.wst.server.core.preview.server"
+ class="org.eclipse.wst.server.http.core.internal.preview.PreviewLaunchableAdapterDelegate"/>
+ </extension>
+</plugin>
diff --git a/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/Messages.java b/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/Messages.java
index f50bf70..8dae1de 100644
--- a/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/Messages.java
+++ b/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/Messages.java
@@ -22,6 +22,8 @@
public static String actionModifyPrefixURL;
public static String actionModifyPublishing;
+ public static String errorPortInUse;
+
static {
NLS.initializeMessages(HttpCorePlugin.PLUGIN_ID + ".internal.Messages", Messages.class);
}
diff --git a/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/Messages.properties b/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/Messages.properties
index becc420..520bbe8 100644
--- a/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/Messages.properties
+++ b/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/Messages.properties
@@ -16,3 +16,6 @@
httpPort=HTTP Port
canModifyModules=Web modules can be modified.
+
+errorPortInUse=Port {0} required by {1} is already in use. The server may already be running in another process, or a system process may be using the port. \
+ To start this server you will need to stop the other process or change the port number(s).
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.preview/src/org/eclipse/jst/server/preview/internal/IMemento.java b/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/preview/IMemento.java
similarity index 98%
copy from plugins/org.eclipse.jst.server.preview/src/org/eclipse/jst/server/preview/internal/IMemento.java
copy to plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/preview/IMemento.java
index 46476dd..f3dea63 100644
--- a/plugins/org.eclipse.jst.server.preview/src/org/eclipse/jst/server/preview/internal/IMemento.java
+++ b/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/preview/IMemento.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - Initial API and implementation
**********************************************************************/
-package org.eclipse.jst.server.preview.internal;
+package org.eclipse.wst.server.http.core.internal.preview;
import java.util.List;
/**
diff --git a/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/preview/PingThread.java b/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/preview/PingThread.java
new file mode 100644
index 0000000..4dc2515
--- /dev/null
+++ b/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/preview/PingThread.java
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.server.http.core.internal.preview;
+
+import java.io.FileNotFoundException;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLConnection;
+
+import org.eclipse.wst.server.http.core.internal.Trace;
+import org.eclipse.wst.server.core.IServer;
+/**
+ * Thread used to ping server to test when it is started.
+ */
+public class PingThread {
+ // delay before pinging starts
+ private static final int PING_DELAY = 2000;
+
+ // delay between pings
+ private static final int PING_INTERVAL = 250;
+
+ // maximum number of pings before giving up
+ private int maxPings = 40;
+
+ private boolean stop = false;
+ private String url;
+ private IServer server;
+ private PreviewServerBehaviour behaviour;
+
+ /**
+ * Create a new PingThread.
+ *
+ * @param server
+ * @param url
+ * @param behaviour
+ */
+ public PingThread(IServer server, String url, PreviewServerBehaviour behaviour) {
+ super();
+ this.server = server;
+ this.url = url;
+ this.behaviour = behaviour;
+ Thread t = new Thread("Preview Ping Thread") {
+ public void run() {
+ ping();
+ }
+ };
+ t.setDaemon(true);
+ t.start();
+ }
+
+ /**
+ * Ping the server until it is started. Then set the server
+ * state to STATE_STARTED.
+ */
+ protected void ping() {
+ int count = 0;
+ try {
+ Thread.sleep(PING_DELAY);
+ } catch (Exception e) {
+ // ignore
+ }
+ while (!stop) {
+ try {
+ if (count == maxPings) {
+ try {
+ server.stop(false);
+ } catch (Exception e) {
+ Trace.trace(Trace.FINEST, "Ping: could not stop server");
+ }
+ stop = true;
+ break;
+ }
+ count++;
+
+ Trace.trace(Trace.FINEST, "Ping: pinging " + count);
+ URL pingUrl = new URL(url);
+ URLConnection conn = pingUrl.openConnection();
+ ((HttpURLConnection)conn).getResponseCode();
+
+ // ping worked - server is up
+ if (!stop) {
+ Trace.trace(Trace.FINEST, "Ping: success");
+ Thread.sleep(200);
+ behaviour.setServerStarted();
+ }
+ stop = true;
+ } catch (FileNotFoundException fe) {
+ try {
+ Thread.sleep(200);
+ } catch (Exception e) {
+ // ignore
+ }
+ behaviour.setServerStarted();
+ stop = true;
+ } catch (Exception e) {
+ Trace.trace(Trace.FINEST, "Ping: failed");
+ // pinging failed
+ if (!stop) {
+ try {
+ Thread.sleep(PING_INTERVAL);
+ } catch (InterruptedException e2) {
+ // ignore
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Tell the pinging to stop.
+ */
+ public void stop() {
+ Trace.trace(Trace.FINEST, "Ping: stopping");
+ stop = true;
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/preview/PreviewLaunchConfigurationDelegate.java b/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/preview/PreviewLaunchConfigurationDelegate.java
new file mode 100644
index 0000000..2aa0132
--- /dev/null
+++ b/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/preview/PreviewLaunchConfigurationDelegate.java
@@ -0,0 +1,155 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.server.http.core.internal.preview;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.debug.core.model.LaunchConfigurationDelegate;
+import org.eclipse.osgi.service.environment.Constants;
+import org.eclipse.wst.server.http.core.internal.HttpCorePlugin;
+import org.eclipse.wst.server.http.core.internal.Trace;
+
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.ServerUtil;
+import org.osgi.framework.Bundle;
+/**
+ *
+ */
+public class PreviewLaunchConfigurationDelegate extends LaunchConfigurationDelegate {
+ private static final String[] REQUIRED_BUNDLE_IDS = new String[] {
+ "org.eclipse.core.runtime",
+ "org.apache.commons.logging",
+ "javax.servlet",
+ "javax.servlet.jsp",
+ "org.mortbay.jetty",
+ "org.eclipse.wst.server.preview"
+ };
+
+ private static final String[] fgCandidateJavaFiles = {"javaw", "javaw.exe", "java",
+ "java.exe", "j9w", "j9w.exe", "j9", "j9.exe"};
+ private static final String[] fgCandidateJavaLocations = {"bin" + File.separatorChar,
+ "jre" + File.separatorChar + "bin" + File.separatorChar};
+
+ private static final String MAIN_CLASS = "org.eclipse.wst.server.preview.internal.PreviewStarter";
+
+ public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
+ IServer server = ServerUtil.getServer(configuration);
+ if (server == null) {
+ Trace.trace(Trace.FINEST, "Launch configuration could not find server");
+ // throw CoreException();
+ return;
+ }
+
+ PreviewServerBehaviour previewServer = (PreviewServerBehaviour) server.loadAdapter(PreviewServerBehaviour.class, null);
+
+ int size = REQUIRED_BUNDLE_IDS.length;
+ //String[] jars = new String[size];
+ StringBuffer cp = new StringBuffer();
+ for (int i = 0; i < size; i++) {
+ Bundle b = Platform.getBundle(REQUIRED_BUNDLE_IDS[i]);
+ IPath path = null;
+ if (b != null)
+ path = PreviewRuntime.getJarredPluginPath(b);
+ if (path == null)
+ throw new CoreException(new Status(IStatus.ERROR, HttpCorePlugin.PLUGIN_ID, "Could not find required bundle " + REQUIRED_BUNDLE_IDS[i]));
+
+ if (i == 5 && path.append("bin").toFile().exists())
+ path = path.append("bin");
+
+ if (i > 0)
+ cp.append(File.pathSeparator);
+ cp.append(path.toOSString());
+ }
+
+ List cmds = new ArrayList();
+
+ // jre
+ File java = getJavaExecutable();
+ if (java == null)
+ throw new CoreException(new Status(IStatus.ERROR, HttpCorePlugin.PLUGIN_ID, "Could not find JRE executable"));
+
+ cmds.add(java.getAbsolutePath());
+
+ cmds.add("-classpath");
+ cmds.add(cp.toString());
+
+ cmds.add(MAIN_CLASS);
+
+ cmds.add(previewServer.getTempDirectory().append("preview.xml").toOSString());
+
+ //setDefaultSourceLocator(launch, configuration);
+
+ // launch the configuration
+ previewServer.setupLaunch(launch, mode, monitor);
+
+ try {
+ String[] cmdLine = new String[cmds.size()];
+ cmds.toArray(cmdLine);
+ Process p = DebugPlugin.exec(cmdLine, null);
+ if (p != null) {
+ IProcess pr = DebugPlugin.newProcess(launch, p, "Preview!");
+ if (pr != null)
+ launch.addProcess(pr);
+ }
+ previewServer.setProcess(launch.getProcesses()[0]);
+ } catch (Exception e) {
+ Trace.trace(Trace.SEVERE, "Problem creating preview process");
+ }
+ }
+
+ protected static File getJavaExecutable() {
+ // do not detect on the Mac OS
+ if (Platform.getOS().equals(Constants.OS_MACOSX))
+ return null;
+
+ // Retrieve the 'java.home' system property. If that directory doesn't exist,
+ // return null.
+ File javaHome;
+ try {
+ javaHome = new File(System.getProperty("java.home")).getCanonicalFile();
+ } catch (IOException e) {
+ return null;
+ }
+ if (!javaHome.exists())
+ return null;
+
+ // Find the 'java' executable file under the java home directory. If it can't be
+ // found, return null.
+ return findJavaExecutable(javaHome);
+ }
+
+ protected static File findJavaExecutable(File vmInstallLocation) {
+ // Try each candidate in order. The first one found wins. Thus, the order
+ // of fgCandidateJavaLocations and fgCandidateJavaFiles is significant.
+ for (int i = 0; i < fgCandidateJavaFiles.length; i++) {
+ for (int j = 0; j < fgCandidateJavaLocations.length; j++) {
+ File javaFile = new File(vmInstallLocation, fgCandidateJavaLocations[j] + fgCandidateJavaFiles[i]);
+ if (javaFile.isFile()) {
+ return javaFile;
+ }
+ }
+ }
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/preview/PreviewLaunchableAdapterDelegate.java b/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/preview/PreviewLaunchableAdapterDelegate.java
new file mode 100644
index 0000000..dadcaf7
--- /dev/null
+++ b/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/preview/PreviewLaunchableAdapterDelegate.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.server.http.core.internal.preview;
+
+import java.net.URL;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.wst.server.http.core.internal.Trace;
+import org.eclipse.wst.server.core.IModuleArtifact;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.model.LaunchableAdapterDelegate;
+import org.eclipse.wst.server.core.util.HttpLaunchable;
+import org.eclipse.wst.server.core.util.WebResource;
+
+public class PreviewLaunchableAdapterDelegate extends LaunchableAdapterDelegate {
+ /*
+ * @see LaunchableAdapterDelegate#getLaunchable(IServer, IModuleArtifact)
+ */
+ public Object getLaunchable(IServer server, IModuleArtifact moduleArtifact) throws CoreException {
+ if (server == null || moduleArtifact == null)
+ return null;
+
+ PreviewServer server2 = (PreviewServer) server.loadAdapter(PreviewServer.class, null);
+ if (server2 == null)
+ return null;
+
+ try {
+ URL url = server2.getModuleRootURL(moduleArtifact.getModule());
+
+ if (moduleArtifact instanceof WebResource) {
+ WebResource resource = (WebResource) moduleArtifact;
+ String path = resource.getPath().toString();
+
+ if (path.startsWith("/"))
+ path = path.substring(1);
+ url = new URL(url.toExternalForm() + "/" + path);
+ }
+ return new HttpLaunchable(url);
+ } catch (Exception e) {
+ Trace.trace(Trace.SEVERE, "Error in launchable adapter", e);
+ }
+
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/preview/PreviewRuntime.java b/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/preview/PreviewRuntime.java
new file mode 100644
index 0000000..5f13ed7
--- /dev/null
+++ b/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/preview/PreviewRuntime.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.server.http.core.internal.preview;
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.wst.server.core.model.RuntimeDelegate;
+import org.osgi.framework.Bundle;
+/**
+ *
+ */
+public class PreviewRuntime extends RuntimeDelegate {
+ public static final String ID = "org.eclipse.jst.server.preview.runtime";
+
+ /**
+ * Create a new preview runtime.
+ */
+ public PreviewRuntime() {
+ // do nothing
+ }
+
+ /**
+ * Returns the path that corresponds to the specified bundle.
+ *
+ * @return a path
+ */
+ protected static Path getPluginPath(Bundle bundle) {
+ try {
+ URL installURL = bundle.getEntry("/");
+ URL localURL = FileLocator.toFileURL(installURL);
+ return new Path(localURL.getFile());
+ } catch (IOException ioe) {
+ return null;
+ }
+ }
+
+ protected static IPath getJarredPluginPath(Bundle bundle) {
+ Path runtimeLibFullPath = null;
+ String jarPluginLocation = bundle.getLocation().substring(7);
+
+ // handle case where jars are installed outside of eclipse installation
+ Path jarPluginPath = new Path(jarPluginLocation);
+ if (jarPluginPath.isAbsolute())
+ runtimeLibFullPath = jarPluginPath;
+ // handle normal case where all plugins under eclipse install
+ else {
+ int ind = jarPluginLocation.lastIndexOf(":");
+ if (ind > 0)
+ jarPluginLocation = jarPluginLocation.substring(ind+1);
+
+ String installPath = Platform.getInstallLocation().getURL().getPath();
+ runtimeLibFullPath = new Path(installPath+"/"+jarPluginLocation);
+ }
+ return runtimeLibFullPath;
+ }
+
+ /**
+ * @see RuntimeDelegate#setDefaults(IProgressMonitor)
+ */
+ public void setDefaults(IProgressMonitor monitor) {
+ getRuntimeWorkingCopy().setLocation(new Path(""));
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/preview/PreviewServer.java b/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/preview/PreviewServer.java
new file mode 100644
index 0000000..fffa9d0
--- /dev/null
+++ b/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/preview/PreviewServer.java
@@ -0,0 +1,171 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.server.http.core.internal.preview;
+
+import java.net.URL;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.wst.server.http.core.internal.HttpCorePlugin;
+import org.eclipse.wst.server.http.core.internal.Messages;
+import org.eclipse.wst.server.http.core.internal.Trace;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.IRuntimeType;
+import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
+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.core.ServerCore;
+import org.eclipse.wst.server.core.ServerPort;
+import org.eclipse.wst.server.core.model.IURLProvider;
+import org.eclipse.wst.server.core.model.ServerDelegate;
+import org.eclipse.wst.server.core.util.IStaticWeb;
+/**
+ * Generic HTTP server.
+ */
+public class PreviewServer extends ServerDelegate implements IURLProvider {
+ public static final String ID = "org.eclipse.jst.server.preview.server";
+
+ public static final String PROPERTY_PORT = "port";
+
+ /**
+ * PreviewServer.
+ */
+ public PreviewServer() {
+ super();
+ }
+
+ protected void initialize() {
+ // do nothing
+ }
+
+ public PreviewRuntime getPreviewRuntime() {
+ if (getServer().getRuntime() == null)
+ return null;
+
+ return (PreviewRuntime) getServer().getRuntime().loadAdapter(PreviewRuntime.class, null);
+ }
+
+ /**
+ * Return the root URL of this module.
+ *
+ * @param module a module
+ * @return java.net.URL
+ */
+ public URL getModuleRootURL(IModule module) {
+ try {
+ String base = "http://localhost";
+
+ int port = getPort();
+ URL url = null;
+ if (port == 80)
+ url = new URL(base + "/");
+ else
+ url = new URL(base + ":" + port + "/");
+
+ String type = module.getModuleType().getId();
+ if ("wst.web".equals(type)) {
+ IStaticWeb staticWeb = (IStaticWeb) module.loadAdapter(IStaticWeb.class, null);
+ return new URL(url, staticWeb.getContextRoot());
+ }
+ return url;
+ } catch (Exception e) {
+ Trace.trace(Trace.SEVERE, "Could not get root URL", e);
+ return null;
+ }
+ }
+
+ /*
+ * Returns the child module(s) of this module.
+ */
+ public IModule[] getChildModules(IModule[] module) {
+ return new IModule[0];
+ }
+
+ /*
+ * Returns the root module(s) of this module.
+ */
+ public IModule[] getRootModules(IModule module) throws CoreException {
+ return new IModule[] { module };
+ }
+
+ /**
+ * Returns true if the given project is supported by this server, and false
+ * otherwise.
+ *
+ * @param add modules
+ * @param remove modules
+ * @return the status
+ */
+ public IStatus canModifyModules(IModule[] add, IModule[] remove) {
+ return new Status(IStatus.OK, HttpCorePlugin.PLUGIN_ID, 0, Messages.canModifyModules, null);
+ }
+
+ public ServerPort[] getServerPorts() {
+ int port = getPort();
+ ServerPort[] ports = { new ServerPort("http", Messages.httpPort, port, "http") };
+ return ports;
+ }
+
+ public int getPort() {
+ return getAttribute(PreviewServer.PROPERTY_PORT, 8080);
+ }
+
+ public void setPort(int port) {
+ setAttribute(PreviewServer.PROPERTY_PORT, port);
+ }
+
+ public static IServer createPreviewServer(String serverName) {
+ try {
+ NullProgressMonitor monitor = new NullProgressMonitor();
+ IRuntimeType runtimeType = ServerCore.findRuntimeType(PreviewRuntime.ID);
+ IRuntimeWorkingCopy runtimeCopy = runtimeType.createRuntime(PreviewRuntime.ID, monitor);
+ IRuntime runtime = runtimeCopy.save(true, monitor);
+
+ IServerType serverType = ServerCore.findServerType(ID);
+ IServerWorkingCopy workingCopy = serverType.createServer(ID, null, runtime, monitor);
+ workingCopy.setName(serverName);
+ workingCopy.setHost("localhost");
+ return workingCopy.save(true, monitor);
+ } catch (Exception e) {
+ Trace.trace(Trace.SEVERE, "Error creating server", e);
+ }
+
+ return null;
+ }
+
+ public static IServer findPreviewServer(String id) {
+ IServer[] servers = ServerCore.getServers();
+ for (int i = 0; i < servers.length; i++) {
+ if (servers[i].getId().equals(id)) {
+ return servers[i];
+ }
+ }
+ return null;
+ }
+
+ public void modifyModules(IModule[] add, IModule[] remove, IProgressMonitor monitor) throws CoreException {
+ // do nothing
+ }
+
+ /**
+ * Return a string representation of this object.
+ *
+ * @return java.lang.String
+ */
+ public String toString() {
+ return "PreviewServer";
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/preview/PreviewServerBehaviour.java b/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/preview/PreviewServerBehaviour.java
new file mode 100644
index 0000000..980aaba
--- /dev/null
+++ b/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/preview/PreviewServerBehaviour.java
@@ -0,0 +1,305 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.server.http.core.internal.preview;
+
+import java.io.IOException;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugEvent;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.IDebugEventSetListener;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.model.IDebugTarget;
+import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.ServerPort;
+import org.eclipse.wst.server.core.model.IModuleResource;
+import org.eclipse.wst.server.core.model.IModuleResourceDelta;
+import org.eclipse.wst.server.core.model.ServerBehaviourDelegate;
+import org.eclipse.wst.server.core.util.IStaticWeb;
+import org.eclipse.wst.server.core.util.PublishUtil;
+import org.eclipse.wst.server.core.util.SocketUtil;
+import org.eclipse.wst.server.http.core.internal.HttpCorePlugin;
+import org.eclipse.wst.server.http.core.internal.Messages;
+import org.eclipse.wst.server.http.core.internal.Trace;
+/**
+ * Generic Http server.
+ */
+public class PreviewServerBehaviour extends ServerBehaviourDelegate {
+ // the thread used to ping the server to check for startup
+ protected transient PingThread ping = null;
+ protected transient IProcess process;
+ protected transient IDebugEventSetListener processListener;
+
+ /**
+ * PreviewServer.
+ */
+ public PreviewServerBehaviour() {
+ super();
+ }
+
+ public void initialize(IProgressMonitor monitor) {
+ // do nothing
+ }
+
+ public PreviewRuntime getPreviewRuntime() {
+ if (getServer().getRuntime() == null)
+ return null;
+
+ return (PreviewRuntime) getServer().getRuntime().loadAdapter(PreviewRuntime.class, null);
+ }
+
+ public PreviewServer getPreviewServer() {
+ return (PreviewServer) getServer().getAdapter(PreviewServer.class);
+ }
+
+ /**
+ * Returns the runtime base path for relative paths in the server
+ * configuration.
+ *
+ * @return the base path
+ */
+ public IPath getRuntimeBaseDirectory() {
+ return getServer().getRuntime().getLocation();
+ }
+
+ /**
+ * Setup for starting the server.
+ *
+ * @param launch ILaunch
+ * @param launchMode String
+ * @param monitor IProgressMonitor
+ * @throws CoreException if anything goes wrong
+ */
+ protected void setupLaunch(ILaunch launch, String launchMode, IProgressMonitor monitor) throws CoreException {
+ // check that ports are free
+ ServerPort[] ports = getPreviewServer().getServerPorts();
+ int port = ports[0].getPort();
+
+ if (SocketUtil.isPortInUse(port, 5))
+ throw new CoreException(new Status(IStatus.ERROR, HttpCorePlugin.PLUGIN_ID, 0, NLS.bind(Messages.errorPortInUse, new String[] {port + "", getServer().getName()}), null));
+
+ // generate preview config file
+ XMLMemento memento = XMLMemento.createWriteRoot("server");
+ memento.putInteger("port", port);
+
+ IModule[] modules = getServer().getModules();
+ int size = modules.length;
+ for (int i = 0; i < size; i++) {
+ IMemento mod = memento.createChild("module");
+ mod.putString("name", modules[i].getName());
+ String type = modules[i].getModuleType().getId();
+ if ("wst.web".equals(type)) {
+ IStaticWeb staticWeb = (IStaticWeb) modules[i].loadAdapter(IStaticWeb.class, null);
+ mod.putString("context", staticWeb.getContextRoot());
+ mod.putString("type", "static");
+ }
+ mod.putString("path", getModulePublishDirectory(modules[i]).toPortableString());
+ }
+ try {
+ memento.saveToFile(getTempDirectory().append("preview.xml").toOSString());
+ } catch (IOException e) {
+ Trace.trace(Trace.SEVERE, "Could not write preview config", e);
+ throw new CoreException(new Status(IStatus.ERROR, HttpCorePlugin.PLUGIN_ID, 0, "Could not write preview configuration", null));
+ }
+
+ setServerRestartState(false);
+ setServerState(IServer.STATE_STARTING);
+ setMode(launchMode);
+
+ // ping server to check for startup
+ try {
+ String url = "http://localhost";
+ if (port != 80)
+ url += ":" + port;
+ ping = new PingThread(getServer(), url, this);
+ } catch (Exception e) {
+ Trace.trace(Trace.SEVERE, "Can't ping for Tomcat startup.");
+ }
+ }
+
+ protected 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++) {
+ Object obj = events[i].getSource();
+
+ if (!(obj instanceof IDebugTarget))
+ continue;
+
+ IDebugTarget target = (IDebugTarget) obj;
+ IProcess targetProcess = target.getProcess();
+
+ if (process != null && process.equals(targetProcess)
+ && events[i].getKind() == DebugEvent.TERMINATE) {
+ DebugPlugin.getDefault().removeDebugEventListener(this);
+ stopImpl();
+ }
+ }
+ }
+ }
+ };
+ DebugPlugin.getDefault().addDebugEventListener(processListener);
+ }
+
+ protected void setServerStarted() {
+ setServerState(IServer.STATE_STARTED);
+ }
+
+ protected void stopImpl() {
+ if (ping != null) {
+ ping.stop();
+ ping = null;
+ }
+ if (process != null) {
+ process = null;
+ DebugPlugin.getDefault().removeDebugEventListener(processListener);
+ processListener = null;
+ }
+ setServerState(IServer.STATE_STOPPED);
+ }
+
+ protected void publishServer(int kind, IProgressMonitor monitor) throws CoreException {
+ monitor = ProgressUtil.getMonitorFor(monitor);
+ monitor.done();
+
+ setServerPublishState(IServer.PUBLISH_STATE_NONE);
+ }
+
+ /*
+ * Publishes the given module to the server.
+ */
+ protected void publishModule(int kind, int deltaKind, IModule[] moduleTree, IProgressMonitor monitor) throws CoreException {
+ IModule module = moduleTree[moduleTree.length - 1];
+ IPath to = getModulePublishDirectory(module);
+
+ if (kind == IServer.PUBLISH_CLEAN || deltaKind == ServerBehaviourDelegate.REMOVED) {
+ IStatus[] status = PublishUtil.deleteDirectory(to.toFile(), monitor);
+ throwException(status);
+ }
+
+ IModuleResource[] res = getResources(moduleTree);
+ IStatus[] status = PublishUtil.publishSmart(res, to, monitor);
+ throwException(status);
+
+ setModulePublishState(moduleTree, IServer.PUBLISH_STATE_NONE);
+ }
+
+ /**
+ * Utility method to throw a CoreException based on the contents of a list of
+ * error and warning status.
+ *
+ * @param status a List containing error and warning IStatus
+ * @throws CoreException
+ */
+ private static void throwException(IStatus[] status) throws CoreException {
+ if (status == null || status.length == 0)
+ return;
+
+ if (status.length == 1)
+ throw new CoreException(status[0]);
+
+ String message = Messages.errorPublish;
+ MultiStatus status2 = new MultiStatus(HttpCorePlugin.PLUGIN_ID, 0, status, message, null);
+ throw new CoreException(status2);
+ }
+
+ public void restart(String launchMode) throws CoreException {
+ setServerState(IServer.STATE_STOPPED);
+ setServerState(IServer.STATE_STARTED);
+ }
+
+ /**
+ * Cleanly shuts down and terminates the server.
+ *
+ * @param force <code>true</code> to kill the server
+ */
+ public void stop(boolean force) {
+ if (force) {
+ terminate();
+ return;
+ }
+ int state = getServer().getServerState();
+ if (state == IServer.STATE_STOPPED)
+ return;
+ else if (state == IServer.STATE_STARTING || state == IServer.STATE_STOPPING) {
+ terminate();
+ return;
+ }
+
+ // should really try to stop normally
+ terminate();
+ }
+
+ /**
+ * Terminates the server.
+ */
+ protected void terminate() {
+ if (getServer().getServerState() == IServer.STATE_STOPPED)
+ return;
+
+ try {
+ setServerState(IServer.STATE_STOPPING);
+ Trace.trace(Trace.FINEST, "Killing the HTTP process");
+ if (process != null && !process.isTerminated())
+ process.terminate();
+
+ stopImpl();
+ } catch (Exception e) {
+ Trace.trace(Trace.SEVERE, "Error killing the process", e);
+ }
+ }
+
+ protected IPath getTempDirectory() {
+ return super.getTempDirectory();
+ }
+
+ /**
+ * Returns the module's publish path.
+ *
+ * @param module a module
+ * @return the publish directory for the module
+ */
+ protected IPath getModulePublishDirectory(IModule module) {
+ return getTempDirectory().append(module.getName());
+ }
+
+ /**
+ * Return a string representation of this object.
+ *
+ * @return java.lang.String
+ */
+ public String toString() {
+ return "PreviewServer";
+ }
+
+ protected IModuleResourceDelta[] getPublishedResourceDelta(IModule[] module) {
+ return super.getPublishedResourceDelta(module);
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/preview/PreviewStartup.java b/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/preview/PreviewStartup.java
new file mode 100644
index 0000000..dd3ee44
--- /dev/null
+++ b/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/preview/PreviewStartup.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.server.http.core.internal.preview;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.wst.server.http.core.internal.Trace;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.IRuntimeType;
+import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
+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.core.ServerCore;
+import org.eclipse.wst.server.core.internal.IStartup;
+
+public class PreviewStartup implements IStartup {
+ private static final String ID = "xyz";
+
+ public void startup() {
+ // create runtime
+ IRuntime[] runtimes = ServerCore.getRuntimes();
+ IRuntime runtime = null;
+
+ int size = runtimes.length;
+ for (int i = 0; i < size; i++) {
+ if (runtimes[i].getRuntimeType() != null && PreviewRuntime.ID.equals(runtimes[i].getRuntimeType().getId())) {
+ if (ID.equals(runtimes[i].getId()))
+ runtime = runtimes[i];
+ }
+ }
+
+ if (runtime == null) {
+ try {
+ IRuntimeType runtimeType = ServerCore.findRuntimeType(PreviewRuntime.ID);
+ IRuntimeWorkingCopy wc = runtimeType.createRuntime(ID, null);
+ wc.setName("My Preview");
+ wc.setReadOnly(true);
+ runtime = wc.save(true, null);
+ } catch (CoreException ce) {
+ Trace.trace(Trace.WARNING, "Could not create default preview runtime");
+ }
+ }
+
+ // create server
+ IServer[] servers = ServerCore.getServers();
+
+ boolean found = false;
+ size = servers.length;
+ for (int i = 0; i < size; i++) {
+ if (servers[i].getServerType() != null && PreviewServer.ID.equals(servers[i].getServerType().getId())) {
+ if (ID.equals(servers[i].getId()))
+ found = true;
+ }
+ }
+
+ if (!found) {
+ try {
+ IServerType serverType = ServerCore.findServerType(PreviewServer.ID);
+ IServerWorkingCopy wc = serverType.createServer(ID, null, runtime, null);
+ wc.setName("My preview");
+ wc.setHost("localhost");
+ wc.setReadOnly(true);
+ wc.save(true, null);
+ } catch (CoreException ce) {
+ Trace.trace(Trace.WARNING, "Could not create default preview server");
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/preview/ProgressUtil.java b/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/preview/ProgressUtil.java
new file mode 100644
index 0000000..b327474
--- /dev/null
+++ b/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/preview/ProgressUtil.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.server.http.core.internal.preview;
+
+import org.eclipse.core.runtime.*;
+/**
+ * Progress Monitor utility.
+ */
+public class ProgressUtil {
+ /**
+ * ProgressUtil constructor comment.
+ */
+ private ProgressUtil() {
+ super();
+ }
+
+ /**
+ * Return a valid progress monitor.
+ *
+ * @param monitor org.eclipse.core.runtime.IProgressMonitor
+ * @return org.eclipse.core.runtime.IProgressMonitor
+ */
+ public static IProgressMonitor getMonitorFor(IProgressMonitor monitor) {
+ if (monitor == null)
+ return new NullProgressMonitor();
+ return monitor;
+ }
+
+ /**
+ * Return a sub-progress monitor with the given amount on the
+ * current progress monitor.
+ *
+ * @param monitor org.eclipse.core.runtime.IProgressMonitor
+ * @param ticks int
+ * @return org.eclipse.core.runtime.IProgressMonitor
+ */
+ public static IProgressMonitor getSubMonitorFor(IProgressMonitor monitor, int ticks) {
+ if (monitor == null)
+ return new NullProgressMonitor();
+ if (monitor instanceof NullProgressMonitor)
+ return monitor;
+ return new SubProgressMonitor(monitor, ticks);
+ }
+
+ /**
+ * Return a sub-progress monitor with the given amount on the
+ * current progress monitor.
+ *
+ * @param monitor org.eclipse.core.runtime.IProgressMonitor
+ * @param ticks a number of ticks
+ * @param style a style
+ * @return org.eclipse.core.runtime.IProgressMonitor
+ */
+ public static IProgressMonitor getSubMonitorFor(IProgressMonitor monitor, int ticks, int style) {
+ if (monitor == null)
+ return new NullProgressMonitor();
+ if (monitor instanceof NullProgressMonitor)
+ return monitor;
+ return new SubProgressMonitor(monitor, ticks, style);
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.preview/src/org/eclipse/jst/server/preview/internal/XMLMemento.java b/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/preview/XMLMemento.java
similarity index 96%
copy from plugins/org.eclipse.jst.server.preview/src/org/eclipse/jst/server/preview/internal/XMLMemento.java
copy to plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/preview/XMLMemento.java
index 0409585..be13600 100644
--- a/plugins/org.eclipse.jst.server.preview/src/org/eclipse/jst/server/preview/internal/XMLMemento.java
+++ b/plugins/org.eclipse.wst.server.http.core/src/org/eclipse/wst/server/http/core/internal/preview/XMLMemento.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - Initial API and implementation
*******************************************************************************/
-package org.eclipse.jst.server.preview.internal;
+package org.eclipse.wst.server.http.core.internal.preview;
import java.io.*;
import java.util.*;
@@ -257,16 +257,16 @@
}
/**
- * Loads a memento from the given file.
+ * Loads a memento from the given filename.
*
- * @param file a file
+ * @param filename java.lang.String
* @exception java.io.IOException
* @return a memento
*/
- public static IMemento loadMemento(File file) throws IOException {
+ public static IMemento loadMemento(String filename) throws IOException {
InputStream in = null;
try {
- in = new BufferedInputStream(new FileInputStream(file));
+ in = new BufferedInputStream(new FileInputStream(filename));
return XMLMemento.createReadRoot(in);
} finally {
try {
diff --git a/plugins/org.eclipse.wst.server.http.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.wst.server.http.ui/META-INF/MANIFEST.MF
index 4283674..f9289b6 100644
--- a/plugins/org.eclipse.wst.server.http.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.wst.server.http.ui/META-INF/MANIFEST.MF
@@ -12,6 +12,8 @@
org.eclipse.ui.forms;bundle-version="[3.2.0,4.0.0)",
org.eclipse.wst.server.core;bundle-version="[1.0.204,2.0.0)",
org.eclipse.wst.server.ui;bundle-version="[1.0.103,1.1.0)",
- org.eclipse.wst.server.http.core;bundle-version="[1.0.0,2.0.0)"
+ org.eclipse.wst.server.http.core;bundle-version="[1.0.0,2.0.0)",
+ org.eclipse.debug.ui;bundle-version="[3.3.0,4.0.0)",
+ org.eclipse.wst.common.project.facet.ui;bundle-version="[1.2.0,2.0.0)"
Eclipse-LazyStart: true
Bundle-RequiredExecutionEnvironment: J2SE-1.4
diff --git a/plugins/org.eclipse.wst.server.http.ui/icons/obj16/preview.gif b/plugins/org.eclipse.wst.server.http.ui/icons/obj16/preview.gif
new file mode 100644
index 0000000..b51ae39
--- /dev/null
+++ b/plugins/org.eclipse.wst.server.http.ui/icons/obj16/preview.gif
Binary files differ
diff --git a/plugins/org.eclipse.wst.server.http.ui/plugin.xml b/plugins/org.eclipse.wst.server.http.ui/plugin.xml
index 1ecf6b5..fde56f2 100644
--- a/plugins/org.eclipse.wst.server.http.ui/plugin.xml
+++ b/plugins/org.eclipse.wst.server.http.ui/plugin.xml
@@ -8,6 +8,19 @@
typeIds="org.eclipse.wst.server.http.runtime,org.eclipse.wst.server.http.server"/>
</extension>
+ <extension point="org.eclipse.wst.common.project.facet.ui.images">
+ <image runtime-component-type="org.eclipse.wst.server.http.runtime"
+ path="icons/obj16/server.gif"/>
+ </extension>
+
+ <extension point="org.eclipse.wst.common.project.facet.core.runtimes">
+ <adapter>
+ <runtime-component id="org.eclipse.wst.server.http.runtime"/>
+ <factory class="org.eclipse.wst.server.http.ui.internal.preview.RuntimeLabelProvider$Factory"/>
+ <type class="org.eclipse.wst.common.project.facet.ui.IRuntimeComponentLabelProvider"/>
+ </adapter>
+ </extension>
+
<extension point="org.eclipse.wst.server.ui.wizardFragments">
<fragment
id="org.eclipse.wst.server.http.runtime.wizard"
@@ -30,4 +43,41 @@
typeIds="org.eclipse.wst.server.http.server"
class="org.eclipse.wst.server.http.ui.internal.HttpSection"/>
</extension>
+
+
+ <extension point="org.eclipse.wst.server.ui.serverImages">
+ <image
+ id="org.eclipse.wst.server.http.ui"
+ typeIds="org.eclipse.wst.server.preview.runtime,org.eclipse.wst.server.preview.server"
+ icon="icons/obj16/preview.gif"/>
+ </extension>
+
+ <extension point="org.eclipse.wst.common.project.facet.ui.images">
+ <image runtime-component-type="org.eclipse.wst.server.preview.runtime"
+ path="icons/obj16/preview.gif"/>
+ </extension>
+
+ <extension point="org.eclipse.wst.common.project.facet.core.runtimes">
+ <adapter>
+ <runtime-component id="org.eclipse.wst.server.preview.runtime"/>
+ <factory class="org.eclipse.wst.server.http.ui.internal.preview.RuntimeLabelProvider$Factory"/>
+ <type class="org.eclipse.wst.common.project.facet.ui.IRuntimeComponentLabelProvider"/>
+ </adapter>
+ </extension>
+
+ <extension point="org.eclipse.debug.ui.launchConfigurationTypeImages">
+ <launchConfigurationTypeImage
+ id="org.eclipse.wst.server.ui.preview.launchConfigurationTypeImage"
+ configTypeID="org.eclipse.wst.server.core.preview.launchConfigurationType"
+ icon="icons/obj16/preview.gif">
+ </launchConfigurationTypeImage>
+ </extension>
+
+ <extension point="org.eclipse.debug.ui.launchConfigurationTabGroups">
+ <launchConfigurationTabGroup
+ id="org.eclipse.wst.server.ui.preview.launchConfigurationTabGroup"
+ type="org.eclipse.wst.server.core.preview.launchConfigurationType"
+ class="org.eclipse.wst.server.http.ui.internal.preview.PreviewLaunchConfigurationTabGroup">
+ </launchConfigurationTabGroup>
+ </extension>
</plugin>
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.http.ui/src/org/eclipse/wst/server/http/ui/internal/preview/PreviewLaunchConfigurationTabGroup.java b/plugins/org.eclipse.wst.server.http.ui/src/org/eclipse/wst/server/http/ui/internal/preview/PreviewLaunchConfigurationTabGroup.java
new file mode 100644
index 0000000..8a8ce3d
--- /dev/null
+++ b/plugins/org.eclipse.wst.server.http.ui/src/org/eclipse/wst/server/http/ui/internal/preview/PreviewLaunchConfigurationTabGroup.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.server.http.ui.internal.preview;
+
+import org.eclipse.debug.ui.*;
+
+import org.eclipse.wst.server.ui.ServerLaunchConfigurationTab;
+/**
+ * A debug tab group for launching Tomcat.
+ */
+public class PreviewLaunchConfigurationTabGroup extends AbstractLaunchConfigurationTabGroup {
+ /*
+ * @see ILaunchConfigurationTabGroup#createTabs(ILaunchConfigurationDialog, String)
+ */
+ public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
+ ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[2];
+ tabs[0] = new ServerLaunchConfigurationTab(new String[] { "org.eclipse.wst.server.preview" });
+ tabs[0].setLaunchConfigurationDialog(dialog);
+ /*tabs[1] = new SourceLookupTab();
+ tabs[1].setLaunchConfigurationDialog(dialog);
+ tabs[2] = new EnvironmentTab();
+ tabs[2].setLaunchConfigurationDialog(dialog);*/
+ tabs[1] = new CommonTab();
+ tabs[1].setLaunchConfigurationDialog(dialog);
+ setTabs(tabs);
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.http.ui/src/org/eclipse/wst/server/http/ui/internal/preview/RuntimeLabelProvider.java b/plugins/org.eclipse.wst.server.http.ui/src/org/eclipse/wst/server/http/ui/internal/preview/RuntimeLabelProvider.java
new file mode 100644
index 0000000..2f9f815
--- /dev/null
+++ b/plugins/org.eclipse.wst.server.http.ui/src/org/eclipse/wst/server/http/ui/internal/preview/RuntimeLabelProvider.java
@@ -0,0 +1,43 @@
+/******************************************************************************
+ * Copyright (c) 2005 BEA Systems, Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Konstantin Komissarchik - initial API and implementation
+ * IBM Corporation - Support for all server types
+ ******************************************************************************/
+package org.eclipse.wst.server.http.ui.internal.preview;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponent;
+import org.eclipse.wst.common.project.facet.ui.IRuntimeComponentLabelProvider;
+/**
+ *
+ */
+public final class RuntimeLabelProvider implements IRuntimeComponentLabelProvider {
+ private final IRuntimeComponent rc;
+
+ public RuntimeLabelProvider(final IRuntimeComponent rc) {
+ this.rc = rc;
+ }
+
+ public String getLabel() {
+ return rc.getProperty("type");
+ }
+
+ public static final class Factory implements IAdapterFactory {
+ private static final Class[] ADAPTER_TYPES = { IRuntimeComponentLabelProvider.class };
+
+ public Object getAdapter(final Object adaptable, final Class adapterType) {
+ final IRuntimeComponent rc = (IRuntimeComponent) adaptable;
+ return new RuntimeLabelProvider(rc);
+ }
+
+ public Class[] getAdapterList() {
+ return ADAPTER_TYPES;
+ }
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.preview/.classpath b/plugins/org.eclipse.wst.server.preview/.classpath
similarity index 100%
rename from plugins/org.eclipse.jst.server.preview/.classpath
rename to plugins/org.eclipse.wst.server.preview/.classpath
diff --git a/plugins/org.eclipse.wst.server.preview/.cvsignore b/plugins/org.eclipse.wst.server.preview/.cvsignore
new file mode 100644
index 0000000..36a2b74
--- /dev/null
+++ b/plugins/org.eclipse.wst.server.preview/.cvsignore
@@ -0,0 +1,7 @@
+bin
+build.xml
+org.eclipse.wst.server.core_3.0.0.jar
+temp.folder
+@dot
+src.zip
+javaCompiler...args
diff --git a/plugins/org.eclipse.wst.server.preview/.options b/plugins/org.eclipse.wst.server.preview/.options
new file mode 100644
index 0000000..b7f8390
--- /dev/null
+++ b/plugins/org.eclipse.wst.server.preview/.options
@@ -0,0 +1,4 @@
+# Debugging options for the org.eclipse.wst.server.preview plugin
+
+# Turn on general debugging
+org.eclipse.wst.server.preview/debug=true
diff --git a/plugins/org.eclipse.wst.server.preview/.project b/plugins/org.eclipse.wst.server.preview/.project
new file mode 100644
index 0000000..7ad37a7
--- /dev/null
+++ b/plugins/org.eclipse.wst.server.preview/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.wst.server.preview</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.wst.server.preview/.settings/org.eclipse.core.resources.prefs b/plugins/org.eclipse.wst.server.preview/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..c8be432
--- /dev/null
+++ b/plugins/org.eclipse.wst.server.preview/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+#Fri Nov 10 17:11:35 HST 2006
+eclipse.preferences.version=1
+encoding/<project>=ISO-8859-1
diff --git a/plugins/org.eclipse.wst.server.preview/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.wst.server.preview/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..c6a69e9
--- /dev/null
+++ b/plugins/org.eclipse.wst.server.preview/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,74 @@
+#Tue Jan 16 16:59:15 EST 2007
+eclipse.preferences.version=1
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.builder.duplicateResourceTask=error
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch,*.testsuite,*.deploy,*.location,*.execution,*.datapool,*.artifact,*.html,*.svg
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.classpath.exclusionPatterns=disabled
+org.eclipse.jdt.core.classpath.multipleOutputLocations=disabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=error
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=error
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=ignore
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.incompatibleJDKLevel=warning
+org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/plugins/org.eclipse.wst.server.preview/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.eclipse.wst.server.preview/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000..584bdff
--- /dev/null
+++ b/plugins/org.eclipse.wst.server.preview/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,4 @@
+#Fri Nov 10 18:06:11 HST 2006
+eclipse.preferences.version=1
+internal.default.compliance=user
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?>\n<templates/>
diff --git a/plugins/org.eclipse.wst.server.preview/.settings/org.eclipse.pde.prefs b/plugins/org.eclipse.wst.server.preview/.settings/org.eclipse.pde.prefs
new file mode 100644
index 0000000..08a60e5
--- /dev/null
+++ b/plugins/org.eclipse.wst.server.preview/.settings/org.eclipse.pde.prefs
@@ -0,0 +1,14 @@
+#Sat Apr 22 18:36:14 EDT 2006
+compilers.incompatible-environment=0
+compilers.p.build=0
+compilers.p.deprecated=1
+compilers.p.no-required-att=0
+compilers.p.not-externalized-att=2
+compilers.p.unknown-attribute=0
+compilers.p.unknown-class=0
+compilers.p.unknown-element=0
+compilers.p.unknown-resource=0
+compilers.p.unresolved-ex-points=0
+compilers.p.unresolved-import=0
+compilers.use-project=true
+eclipse.preferences.version=1
diff --git a/plugins/org.eclipse.jst.server.preview/META-INF/MANIFEST.MF b/plugins/org.eclipse.wst.server.preview/META-INF/MANIFEST.MF
similarity index 65%
rename from plugins/org.eclipse.jst.server.preview/META-INF/MANIFEST.MF
rename to plugins/org.eclipse.wst.server.preview/META-INF/MANIFEST.MF
index cf4276b..2b9ae14 100644
--- a/plugins/org.eclipse.jst.server.preview/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.wst.server.preview/META-INF/MANIFEST.MF
@@ -1,12 +1,12 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.jst.server.preview; singleton:=true
+Bundle-SymbolicName: org.eclipse.wst.server.preview; singleton:=true
Bundle-Version: 1.0.0.qualifier
-Bundle-Activator: org.eclipse.jst.server.preview.internal.PreviewServerPlugin
+Bundle-Activator: org.eclipse.wst.server.preview.internal.PreviewServerPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
-Export-Package: org.eclipse.jst.server.preview.internal
+Export-Package: org.eclipse.wst.server.preview.internal
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
org.mortbay.jetty
Eclipse-LazyStart: true
diff --git a/plugins/org.eclipse.jst.server.preview/about.html b/plugins/org.eclipse.wst.server.preview/about.html
similarity index 100%
rename from plugins/org.eclipse.jst.server.preview/about.html
rename to plugins/org.eclipse.wst.server.preview/about.html
diff --git a/plugins/org.eclipse.jst.server.preview/build.properties b/plugins/org.eclipse.wst.server.preview/build.properties
similarity index 100%
rename from plugins/org.eclipse.jst.server.preview/build.properties
rename to plugins/org.eclipse.wst.server.preview/build.properties
diff --git a/plugins/org.eclipse.jst.server.preview/plugin.properties b/plugins/org.eclipse.wst.server.preview/plugin.properties
similarity index 100%
rename from plugins/org.eclipse.jst.server.preview/plugin.properties
rename to plugins/org.eclipse.wst.server.preview/plugin.properties
diff --git a/plugins/org.eclipse.jst.server.preview/plugin.xml b/plugins/org.eclipse.wst.server.preview/plugin.xml
similarity index 79%
rename from plugins/org.eclipse.jst.server.preview/plugin.xml
rename to plugins/org.eclipse.wst.server.preview/plugin.xml
index e4a9aed..a2e804c 100644
--- a/plugins/org.eclipse.jst.server.preview/plugin.xml
+++ b/plugins/org.eclipse.wst.server.preview/plugin.xml
@@ -5,8 +5,7 @@
<extension id="preview"
point="org.eclipse.core.runtime.applications">
<application visible="false">
- <run class="org.eclipse.jst.server.preview.internal.PreviewApplication"/>
+ <run class="org.eclipse.wst.server.preview.internal.PreviewApplication"/>
</application>
</extension>
-
</plugin>
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.preview/src/org/eclipse/jst/server/preview/internal/IMemento.java b/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/IMemento.java
similarity index 98%
rename from plugins/org.eclipse.jst.server.preview/src/org/eclipse/jst/server/preview/internal/IMemento.java
rename to plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/IMemento.java
index 46476dd..b7a09ce 100644
--- a/plugins/org.eclipse.jst.server.preview/src/org/eclipse/jst/server/preview/internal/IMemento.java
+++ b/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/IMemento.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - Initial API and implementation
**********************************************************************/
-package org.eclipse.jst.server.preview.internal;
+package org.eclipse.wst.server.preview.internal;
import java.util.List;
/**
diff --git a/plugins/org.eclipse.jst.server.preview/src/org/eclipse/jst/server/preview/internal/Messages.java b/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/Messages.java
similarity index 96%
rename from plugins/org.eclipse.jst.server.preview/src/org/eclipse/jst/server/preview/internal/Messages.java
rename to plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/Messages.java
index 32d871e..d0d3b8a 100644
--- a/plugins/org.eclipse.jst.server.preview/src/org/eclipse/jst/server/preview/internal/Messages.java
+++ b/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/Messages.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - Initial API and implementation
**********************************************************************/
-package org.eclipse.jst.server.preview.internal;
+package org.eclipse.wst.server.preview.internal;
import org.eclipse.osgi.util.NLS;
/**
diff --git a/plugins/org.eclipse.jst.server.preview/src/org/eclipse/jst/server/preview/internal/Messages.properties b/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/Messages.properties
similarity index 100%
rename from plugins/org.eclipse.jst.server.preview/src/org/eclipse/jst/server/preview/internal/Messages.properties
rename to plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/Messages.properties
diff --git a/plugins/org.eclipse.jst.server.preview/src/org/eclipse/jst/server/preview/internal/Module.java b/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/Module.java
similarity index 98%
rename from plugins/org.eclipse.jst.server.preview/src/org/eclipse/jst/server/preview/internal/Module.java
rename to plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/Module.java
index 75f8c58..7828b9f 100644
--- a/plugins/org.eclipse.jst.server.preview/src/org/eclipse/jst/server/preview/internal/Module.java
+++ b/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/Module.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - Initial API and implementation
*******************************************************************************/
-package org.eclipse.jst.server.preview.internal;
+package org.eclipse.wst.server.preview.internal;
import java.io.File;
import java.util.ArrayList;
diff --git a/plugins/org.eclipse.jst.server.preview/src/org/eclipse/jst/server/preview/internal/PreviewApplication.java b/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/PreviewApplication.java
similarity index 94%
rename from plugins/org.eclipse.jst.server.preview/src/org/eclipse/jst/server/preview/internal/PreviewApplication.java
rename to plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/PreviewApplication.java
index 0967751..2bfcf6c 100644
--- a/plugins/org.eclipse.jst.server.preview/src/org/eclipse/jst/server/preview/internal/PreviewApplication.java
+++ b/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/PreviewApplication.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - Initial API and implementation
*******************************************************************************/
-package org.eclipse.jst.server.preview.internal;
+package org.eclipse.wst.server.preview.internal;
import org.eclipse.equinox.app.IApplication;
import org.eclipse.equinox.app.IApplicationContext;
diff --git a/plugins/org.eclipse.jst.server.preview/src/org/eclipse/jst/server/preview/internal/PreviewServerPlugin.java b/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/PreviewServerPlugin.java
similarity index 62%
rename from plugins/org.eclipse.jst.server.preview/src/org/eclipse/jst/server/preview/internal/PreviewServerPlugin.java
rename to plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/PreviewServerPlugin.java
index bc82a53..5e9d2bd 100644
--- a/plugins/org.eclipse.jst.server.preview/src/org/eclipse/jst/server/preview/internal/PreviewServerPlugin.java
+++ b/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/PreviewServerPlugin.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - Initial API and implementation
*******************************************************************************/
-package org.eclipse.jst.server.preview.internal;
+package org.eclipse.wst.server.preview.internal;
import org.eclipse.core.runtime.*;
import org.osgi.framework.BundleContext;
@@ -16,7 +16,7 @@
*
*/
public class PreviewServerPlugin extends Plugin {
- public static final String PLUGIN_ID = "org.eclipse.jst.server.preview.core";
+ public static final String PLUGIN_ID = "org.eclipse.wst.server.preview";
// singleton instance of this class
private static PreviewServerPlugin singleton;
@@ -54,13 +54,4 @@
public void stop(BundleContext context2) throws Exception {
super.stop(context2);
}
-
- /* D:\jres\jdk1.5.0_01\bin\javaw.exe -Xms40m -Xmx256m
- * -classpath D:\dev\wtp\eclipse\plugins\org.eclipse.equinox.launcher_1.0.0.v20070208a.jar
- * org.eclipse.equinox.launcher.Main -launcher D:\dev\wtp\eclipse\eclipse -name Eclipse
- * -showsplash 600 -product org.eclipse.sdk.ide -data D:\dev\wtp\runtime-workspace5
- * -configuration file:D:/dev/wtp/workspace/.metadata/.plugins/org.eclipse.pde.core/New_configuration/
- * -dev file:D:/dev/wtp/workspace/.metadata/.plugins/org.eclipse.pde.core/New_configuration/dev.properties
- * -pdelaunch -debug D:\dev\wtp\workspace\.metadata\.plugins\org.eclipse.pde.core\New_configuration/.options
- * -os win32 -ws win32 -arch x86 -consolelog*/
}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.preview/src/org/eclipse/jst/server/preview/internal/PreviewStarter.java b/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/PreviewStarter.java
similarity index 98%
rename from plugins/org.eclipse.jst.server.preview/src/org/eclipse/jst/server/preview/internal/PreviewStarter.java
rename to plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/PreviewStarter.java
index 1211caa..d589036 100644
--- a/plugins/org.eclipse.jst.server.preview/src/org/eclipse/jst/server/preview/internal/PreviewStarter.java
+++ b/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/PreviewStarter.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - Initial API and implementation
*******************************************************************************/
-package org.eclipse.jst.server.preview.internal;
+package org.eclipse.wst.server.preview.internal;
import java.io.File;
diff --git a/plugins/org.eclipse.jst.server.preview/src/org/eclipse/jst/server/preview/internal/ServerConfig.java b/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/ServerConfig.java
similarity index 97%
rename from plugins/org.eclipse.jst.server.preview/src/org/eclipse/jst/server/preview/internal/ServerConfig.java
rename to plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/ServerConfig.java
index 3238e67..b1745c1 100644
--- a/plugins/org.eclipse.jst.server.preview/src/org/eclipse/jst/server/preview/internal/ServerConfig.java
+++ b/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/ServerConfig.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - Initial API and implementation
*******************************************************************************/
-package org.eclipse.jst.server.preview.internal;
+package org.eclipse.wst.server.preview.internal;
import java.io.File;
import java.util.ArrayList;
diff --git a/plugins/org.eclipse.jst.server.preview/src/org/eclipse/jst/server/preview/internal/Servlet.java b/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/Servlet.java
similarity index 92%
rename from plugins/org.eclipse.jst.server.preview/src/org/eclipse/jst/server/preview/internal/Servlet.java
rename to plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/Servlet.java
index 4d24809..8b166ca 100644
--- a/plugins/org.eclipse.jst.server.preview/src/org/eclipse/jst/server/preview/internal/Servlet.java
+++ b/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/Servlet.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - Initial API and implementation
*******************************************************************************/
-package org.eclipse.jst.server.preview.internal;
+package org.eclipse.wst.server.preview.internal;
public class Servlet {
protected String name;
diff --git a/plugins/org.eclipse.jst.server.preview/src/org/eclipse/jst/server/preview/internal/Trace.java b/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/Trace.java
similarity index 96%
rename from plugins/org.eclipse.jst.server.preview/src/org/eclipse/jst/server/preview/internal/Trace.java
rename to plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/Trace.java
index f42c15f..8a86d64 100644
--- a/plugins/org.eclipse.jst.server.preview/src/org/eclipse/jst/server/preview/internal/Trace.java
+++ b/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/Trace.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - Initial API and implementation
*******************************************************************************/
-package org.eclipse.jst.server.preview.internal;
+package org.eclipse.wst.server.preview.internal;
/**
* Helper class to route trace output.
*/
diff --git a/plugins/org.eclipse.jst.server.preview/src/org/eclipse/jst/server/preview/internal/XMLMemento.java b/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/XMLMemento.java
similarity index 99%
rename from plugins/org.eclipse.jst.server.preview/src/org/eclipse/jst/server/preview/internal/XMLMemento.java
rename to plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/XMLMemento.java
index 0409585..9281c2a 100644
--- a/plugins/org.eclipse.jst.server.preview/src/org/eclipse/jst/server/preview/internal/XMLMemento.java
+++ b/plugins/org.eclipse.wst.server.preview/src/org/eclipse/wst/server/preview/internal/XMLMemento.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - Initial API and implementation
*******************************************************************************/
-package org.eclipse.jst.server.preview.internal;
+package org.eclipse.wst.server.preview.internal;
import java.io.*;
import java.util.*;