[111608] Assembly support
diff --git a/plugins/org.eclipse.jst.server.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.jst.server.core/META-INF/MANIFEST.MF
index d53a1db..9842a89 100644
--- a/plugins/org.eclipse.jst.server.core/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.jst.server.core/META-INF/MANIFEST.MF
@@ -15,5 +15,6 @@
org.eclipse.debug.core,
org.eclipse.jdt.core,
org.eclipse.jdt.launching,
- org.eclipse.wst.server.core
+ org.eclipse.wst.server.core,
+ org.eclipse.wst.common.project.facet.core
Eclipse-AutoStart: true
diff --git a/plugins/org.eclipse.jst.server.core/plugin.xml b/plugins/org.eclipse.jst.server.core/plugin.xml
index 23eb5da..9d49dc8 100644
--- a/plugins/org.eclipse.jst.server.core/plugin.xml
+++ b/plugins/org.eclipse.jst.server.core/plugin.xml
@@ -88,4 +88,54 @@
class="org.eclipse.jst.server.core.internal.J2EELaunchableClient"/>
</extension>
+<!--
+ <extension point="org.eclipse.wst.common.project.facet.core.runtimes">
+ <runtime-component-type
+ id="org.eclipse.jst.server.tomcat">
+ <icon>images/tomcat.gif</icon>
+ </runtime-component-type>
+
+ <runtime-component-version
+ type="org.eclipse.jst.server.tomcat" version="5.5">
+ <delegate
+ class="org.eclipse.wst.common.project.facet.base.TomcatRuntimeComponentDelegate"/>
+ </runtime-component-version>
+
+ <runtime-component-version
+ type="org.eclipse.jst.server.tomcat"
+ version="4.1">
+ <delegate
+ class="org.eclipse.wst.common.project.facet.base.TomcatRuntimeComponentDelegate"/>
+ </runtime-component-version>
+
+ <adapter>
+ <runtime-component
+ id="org.eclipse.jst.server.tomcat"/>
+ <factory
+ class="org.eclipse.wst.common.project.facet.base.TomcatClasspathProvider$Factory"/>
+ <type
+ class="org.eclipse.wst.common.project.facet.core.runtime.classpath.IClasspathProvider"/>
+ </adapter>
+
+ <supported>
+ <runtime-component
+ id="org.eclipse.jst.server.tomcat"
+ version="5.5"
+ allow-newer="true"/>
+ <facet
+ id="web"
+ version="2.4"/>
+ </supported>
+
+ <supported>
+ <runtime-component
+ id="tomcat"
+ version="4.1"
+ allow-newer="true"/>
+ <facet
+ id="web"
+ version="2.3"/>
+ </supported>
+ </extension>
+-->
</plugin>
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/IEnterpriseApplication.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/IEnterpriseApplication.java
index 2c85105..924ffec 100644
--- a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/IEnterpriseApplication.java
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/IEnterpriseApplication.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.jst.server.core;
-import org.eclipse.core.runtime.IPath;
import org.eclipse.wst.server.core.IModule;
/**
* A representation of a J2EE enterprise application (EAR file).
@@ -32,36 +31,19 @@
/**
* Returns the modules contained within this EAR. The returned modules will
- * all be adaptable to IJ2EEModule.
+ * either be J2EE modules (which will be adaptable to IJ2EEModule) and
+ * utility jars contained in the EAR.
*
* @return a possibly empty array of modules contained within this application
*/
public IModule[] getModules();
/**
- * Returns the URI of the given J2EE module within this
- * enterprise application.
+ * Returns the URI of the given module within this enterprise application.
*
* @param module a module within this application
* @return the URI of the given module, or <code>null</code> if the URI could
* not be found
*/
- public String getURI(IJ2EEModule module);
-
- /**
- * Returns <code>true</code> if this EAR supports loose modules and <code>false</code>
- * otherwise.
- *
- * @return returns <code>true</code> if this module contains loose modules, or
- * <code>false</code> otherwise
- */
- public boolean containsLooseModules();
-
- /**
- * Returns the location of the root of the application. This should
- * be an absolute path that is not workbench relative.
- *
- * @return the absolute path to the root of this application
- */
- public IPath getLocation();
+ public String getURI(IModule module);
}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/IJ2EEModule.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/IJ2EEModule.java
index eb46dac..b09030a 100644
--- a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/IJ2EEModule.java
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/IJ2EEModule.java
@@ -9,8 +9,6 @@
* IBM Corporation - Initial API and implementation
*******************************************************************************/
package org.eclipse.jst.server.core;
-
-import org.eclipse.core.runtime.IPath;
/**
* An abstract J2EE module that can be deployed to a server.
*
@@ -29,34 +27,4 @@
* @return the J2EE specification version
*/
public String getJ2EESpecificationVersion();
-
- /**
- * Returns the location of the root of the module. This should
- * be an absolute path that is not workbench relative.
- *
- * @return the absolute path to the root of this application
- */
- public IPath getLocation();
-
- /**
- * Returns true if this is a binary (zipped) module, and
- * false if it is expanded.
- *
- * <p>If true, members() should return only a single element -
- * the binary (jar or zip file) that contains the contents of
- * this module. (a single IModuleResource, e.g.
- * myejb.jar) Also, getLocation() should return the full path
- * up to and including the binary itself. (e.g.
- * c:\temp\myejb.jar)</p>
- *
- * <p>If false, members() should return the entire contents
- * of the module, starting at the root. There should be no
- * preceeding directory structure. (an array of
- * IModuleResources, e.g. index.html, WEB-INF/web.xml,
- * ...) In this case, getLocation() should return the path to
- * the root folder containing these resources.</p>
- *
- * @return boolean
- */
- public boolean isBinary();
}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/ILooseArchive.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/ILooseArchive.java
deleted file mode 100644
index ba845b0..0000000
--- a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/ILooseArchive.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * 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.jst.server.core;
-
-import org.eclipse.core.runtime.IPath;
-/**
- * A loose archive. Used to represent utility jars in J2EE modules.
- * <p>
- * <b>Provisional API:</b> This class/interface is part of an interim API that is still under development and expected to
- * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
- * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
- * (repeatedly) as the API evolves.
- * </p>
- * @plannedfor 1.0
- */
-public interface ILooseArchive {
- /**
- * Returns the location of the root of the loose utility. This should
- * be an absolute path that is not workbench relative.
- *
- * @return org.eclipse.core.runtime.IPath
- */
- public IPath getLocation();
-
- /**
- * Returns true if this is a binary (zipped) archive, and
- * false if it is expanded.
- *
- * <p>If true, members() should return only a single element -
- * the binary (jar or zip file) that contains the contents of
- * this module. (a single IPublishableResource, e.g.
- * myejb.jar) Also, getLocation() should return the full path
- * up to and including the binary itself. (e.g.
- * c:\temp\myejb.jar)</p>
- *
- * <p>If false, members() should return the entire contents
- * of the module, starting at the root. There should be no
- * preceeding directory structure. (an array of
- * IPublishableResources, e.g. index.html, WEB-INF/web.xml,
- * ...) In this case, getLocation() should return the path to
- * the root folder containing these resources.</p>
- *
- * @return boolean
- */
- public boolean isBinary();
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/ILooseArchiveSupport.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/ILooseArchiveSupport.java
deleted file mode 100644
index 5e5fbdf..0000000
--- a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/ILooseArchiveSupport.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * 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.jst.server.core;
-
-import org.eclipse.wst.server.core.IModule;
-/**
- * Used to represent loose archive support in a J2EE module.
- * <p>
- * <b>Provisional API:</b> This class/interface is part of an interim API that is still under development and expected to
- * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
- * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
- * (repeatedly) as the API evolves.
- * </p>
- * @plannedfor 1.0
- */
-public interface ILooseArchiveSupport {
- /**
- * Return the loose archives that are contained within this enterprise
- * application. The returned modules will all be adaptable to ILooseArchive.
- *
- * @return a possibly empty array of modules contained within this application
- */
- public IModule[] getLooseArchives();
-
- /**
- * Returns the URI of the given loose archive within this
- * enterprise application.
- *
- * @param archive a loose archive
- * @return the URI of the given archive, or <code>null</code> if the URI could
- * not be found
- */
- public String getURI(ILooseArchive archive);
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/IWebModule.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/IWebModule.java
index b12bcd7..b9e2189 100644
--- a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/IWebModule.java
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/IWebModule.java
@@ -9,6 +9,8 @@
* IBM Corporation - Initial API and implementation
*******************************************************************************/
package org.eclipse.jst.server.core;
+
+import org.eclipse.wst.server.core.IModule;
/**
* A J2EE web module.
* <p>
@@ -40,14 +42,20 @@
* @return java.lang.String
*/
public String getContextRoot();
-
+
/**
- * Returns false if the files in this module are placed in the
- * correct structure for testing before publishing. Returns true
- * if the file system resources must be published before they will
- * work.
- *
- * @return boolean
+ * Returns the utility modules contained within this WAR.
+ *
+ * @return a possibly empty array of modules contained within this application
*/
- public boolean isPublishRequired();
+ public IModule[] getModules();
+
+ /**
+ * Returns the URI of the given contained module.
+ *
+ * @param module a module
+ * @return the URI of the given module, or <code>null</code> if the URI could
+ * not be found
+ */
+ public String getURI(IModule module);
}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/RuntimeBridge.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/RuntimeBridge.java
new file mode 100644
index 0000000..c2b7de7
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/RuntimeBridge.java
@@ -0,0 +1,130 @@
+/******************************************************************************
+ * 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
+ ******************************************************************************/
+package org.eclipse.jst.server.core.internal;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.IVMInstall2;
+import org.eclipse.jdt.launching.IVMInstallType;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.jst.server.core.ClasspathRuntimeTargetHandler;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponentVersion;
+import org.eclipse.wst.common.project.facet.core.runtime.RuntimeManager;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.IRuntimeTargetHandler;
+import org.eclipse.wst.server.core.ServerCore;
+/**
+ *
+ */
+public final class RuntimeBridge {
+ private static Map mappings = new HashMap();
+
+ static {
+ mappings.put("org.eclipse.jst.server.tomcat.runtime.55", RuntimeManager.get()
+ .getRuntimeComponentType("tomcat").getVersion("5.5"));
+
+ mappings.put("org.eclipse.jst.server.tomcat.runtime.41", RuntimeManager.get()
+ .getRuntimeComponentType("tomcat").getVersion("4.1"));
+ }
+
+ public static void port() {
+ final IRuntime[] runtimes = ServerCore.getRuntimes();
+
+ for (int i = 0; i < runtimes.length; i++) {
+ final IRuntime runtime = runtimes[i];
+ final String name = runtime.getName();
+
+ if (!RuntimeManager.get().isRuntimeDefined(name)) {
+ final String type = runtime.getRuntimeType().getId();
+ final IRuntimeComponentVersion mapped = (IRuntimeComponentVersion)
+ mappings.get(type);
+
+ if (mapped != null) {
+ final List components = new ArrayList();
+
+ Map properties;
+
+ properties = new HashMap();
+ properties.put("location", runtime.getLocation().toPortableString());
+ properties.put("name", name);
+
+ components.add(RuntimeManager.get().createRuntimeComponent(mapped, properties));
+
+ IGenericRuntime gr = (IGenericRuntime) runtime.loadAdapter(IGenericRuntime.class, null);
+ IVMInstall vmInstall = gr.getVMInstall();
+ IVMInstall2 vmInstall2 = (IVMInstall2) vmInstall;
+
+ /*final ClasspathRuntimeTargetHandler cphandler = getClasspathHandler(runtime);
+
+ final IPath jrecontainer = findJreContainer(cphandler
+ .getDelegateClasspathEntries(runtime, null));
+
+ final IVMInstallType vminstalltype = JavaRuntime
+ .getVMInstallType(jrecontainer.segment(1));
+
+ final IVMInstall2 vminstall = (IVMInstall2) vminstalltype
+ .findVMInstallByName(jrecontainer.segment(2));*/
+
+ final String jvmver = vmInstall2.getJavaVersion();
+ final IRuntimeComponentVersion rcv;
+
+ if (jvmver.startsWith("1.4")) {
+ rcv = RuntimeManager.get().getRuntimeComponentType("standard.jre")
+ .getVersion("1.4");
+ } else if (jvmver.startsWith("1.5")) {
+ rcv = RuntimeManager.get().getRuntimeComponentType("standard.jre")
+ .getVersion("5.0");
+ } else {
+ continue;
+ }
+
+ properties = new HashMap();
+ properties.put("name", vmInstall.getName());
+ components.add(RuntimeManager.get().createRuntimeComponent(rcv, properties));
+
+ RuntimeManager.get().defineRuntime(name, components, null);
+ }
+ }
+ }
+ }
+
+ private static ClasspathRuntimeTargetHandler getClasspathHandler(final IRuntime r) {
+ final IRuntimeTargetHandler[] handlers = ServerCore.getRuntimeTargetHandlers();
+
+ for (int j = 0; j < handlers.length; j++) {
+ final IRuntimeTargetHandler handler = handlers[j];
+
+ if (handler.supportsRuntimeType(r.getRuntimeType())) {
+ return (ClasspathRuntimeTargetHandler) handler
+ .getAdapter(ClasspathRuntimeTargetHandler.class);
+ }
+ }
+
+ throw new IllegalStateException();
+ }
+
+ private static IPath findJreContainer(final IClasspathEntry[] cpentries) {
+ for (int i = 0; i < cpentries.length; i++) {
+ final IPath path = cpentries[i].getPath();
+
+ if (path.segment(0).equals(JavaRuntime.JRE_CONTAINER))
+ return path;
+ }
+
+ throw new IllegalStateException();
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/TomcatClasspathProvider.java b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/TomcatClasspathProvider.java
new file mode 100644
index 0000000..d0b2f9c
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.core/sjavacore/org/eclipse/jst/server/core/internal/TomcatClasspathProvider.java
@@ -0,0 +1,63 @@
+/******************************************************************************
+ * 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
+ ******************************************************************************/
+package org.eclipse.jst.server.core.internal;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponent;
+import org.eclipse.wst.common.project.facet.core.runtime.classpath.IClasspathProvider;
+/**
+ *
+ */
+public final class TomcatClasspathProvider implements IClasspathProvider {
+ private static final IProjectFacet WEB_FEATURE = ProjectFacetsManager.getProjectFacet("web");
+
+ private final IRuntimeComponent rc;
+
+ public TomcatClasspathProvider(final IRuntimeComponent rc) {
+ this.rc = rc;
+ }
+
+ public List getClasspathEntries(final IProjectFacetVersion fv) {
+ if (fv.getProjectFacet() == WEB_FEATURE) {
+ IPath path = new Path(RuntimeClasspathContainer.SERVER_CONTAINER + "/org.eclipse.jst.server.tomcat.runtimeTarget");
+ path = path.append(rc.getProperty("name"));
+
+ final IClasspathEntry cpentry = JavaCore.newContainerEntry(path);
+
+ return Collections.singletonList(cpentry);
+ }
+
+ return null;
+ }
+
+ public static final class Factory implements IAdapterFactory {
+ private static final Class[] ADAPTER_TYPES = { IClasspathProvider.class };
+
+ public Object getAdapter(final Object adaptable, final Class adapterType) {
+ final IRuntimeComponent rc = (IRuntimeComponent) adaptable;
+ return new TomcatClasspathProvider(rc);
+ }
+
+ public Class[] getAdapterList() {
+ return ADAPTER_TYPES;
+ }
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.jst.server.tomcat.core/META-INF/MANIFEST.MF
index c3bc683..d6a4808 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.jst.server.tomcat.core/META-INF/MANIFEST.MF
@@ -8,7 +8,6 @@
Bundle-Localization: plugin
Export-Package: org.eclipse.jst.server.tomcat.core.internal;x-friends:="org.eclipse.jst.server.tomcat.ui",
org.eclipse.jst.server.tomcat.core.internal.command;x-friends:="org.eclipse.jst.server.tomcat.ui",
- org.eclipse.jst.server.tomcat.core.internal.project.facet,
org.eclipse.jst.server.tomcat.core.internal.xml;x-friends:="org.eclipse.jst.server.tomcat.ui",
org.eclipse.jst.server.tomcat.core.internal.xml.server32;x-friends:="org.eclipse.jst.server.tomcat.ui",
org.eclipse.jst.server.tomcat.core.internal.xml.server40;x-friends:="org.eclipse.jst.server.tomcat.ui"
@@ -19,6 +18,5 @@
org.eclipse.jdt.core,
org.eclipse.jdt.launching,
org.eclipse.wst.server.core,
- org.eclipse.jst.server.core,
- org.eclipse.wst.common.project.facet.core
+ org.eclipse.jst.server.core
Eclipse-AutoStart: true
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/plugin.xml b/plugins/org.eclipse.jst.server.tomcat.core/plugin.xml
index e433387..e31c34d 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/plugin.xml
+++ b/plugins/org.eclipse.jst.server.tomcat.core/plugin.xml
@@ -192,10 +192,10 @@
id="org.eclipse.jst.server.tomcat.core.contextTask"
typeIds="org.eclipse.jst.server.tomcat.*"
class="org.eclipse.jst.server.tomcat.core.internal.ContextPublishTaskDelegate"/>
-<!-- <publishTask
+ <publishTask
id="org.eclipse.jst.server.tomcat.core.publishTask"
typeIds="org.eclipse.jst.server.tomcat.*"
- class="org.eclipse.jst.server.tomcat.core.internal.PublishTask"/>-->
+ class="org.eclipse.jst.server.tomcat.core.internal.PublishTask"/>
</extension>
</plugin>
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/FileUtil.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/FileUtil.java
index a7574bc..3147409 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/FileUtil.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/FileUtil.java
@@ -12,8 +12,17 @@
import java.io.*;
import java.net.URL;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+import java.util.zip.ZipInputStream;
+import java.util.zip.ZipOutputStream;
+
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.*;
import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.server.core.model.IModuleFile;
+import org.eclipse.wst.server.core.model.IModuleFolder;
+import org.eclipse.wst.server.core.model.IModuleResource;
/**
* Utility class with an assortment of useful file methods.
*/
@@ -159,7 +168,7 @@
File[] files = dir.listFiles();
int size = files.length;
monitor = ProgressUtil.getMonitorFor(monitor);
- monitor.beginTask(NLS.bind(Messages.deletingTask, new String[] {dir.getAbsolutePath()}), size * 10);
+ monitor.beginTask(NLS.bind(Messages.deletingTask, new String[] { dir.getAbsolutePath() }), size * 10);
// cycle through files
for (int i = 0; i < size; i++) {
@@ -218,7 +227,7 @@
// delete file if it can't be found or isn't the correct type
if (!found) {
if (isDir)
- deleteDirectory(toFiles[i], new NullProgressMonitor());
+ deleteDirectory(toFiles[i], null);
else
toFiles[i].delete();
}
@@ -277,4 +286,198 @@
Trace.trace(Trace.SEVERE, "Error smart copying directory " + from + " - " + to, e);
}
}
+
+ protected static void copy(IModuleResource[] resources, IPath path) throws CoreException {
+ if (resources == null)
+ return;
+
+ int size = resources.length;
+ for (int i = 0; i < size; i++) {
+ copy(resources[i], path);
+ }
+ }
+
+ protected static void copy(IModuleResource resource, IPath path) throws CoreException {
+ if (resource instanceof IModuleFolder) {
+ IModuleFolder folder = (IModuleFolder) resource;
+ copy(folder.members(), path);
+ } else {
+ IModuleFile mf = (IModuleFile) resource;
+ IFile file = (IFile) mf.getAdapter(IFile.class);
+ IPath path3 = path.append(mf.getModuleRelativePath()).append(mf.getName());
+ File f = path3.toFile().getParentFile();
+ if (!f.exists())
+ f.mkdirs();
+ FileUtil.copyFile(file.getContents(), path3.toOSString());
+ }
+ }
+
+ protected static void copyFile(IModuleFile mf, IPath path) throws CoreException {
+ IFile file = (IFile) mf.getAdapter(IFile.class);
+ copyFile(file.getContents(), path.toOSString());
+ }
+
+ protected static void smartCopy(IModuleResource[] resources, IPath path, IProgressMonitor monitor) throws CoreException {
+ if (resources == null)
+ return;
+
+ File toDir = path.toFile();
+ File[] toFiles = toDir.listFiles();
+ int fromSize = resources.length;
+
+ if (toDir.exists() && toDir.isDirectory()) {
+ int toSize = toFiles.length;
+ // check if this exact file exists in the new directory
+ for (int i = 0; i < toSize; i++) {
+ String name = toFiles[i].getName();
+ boolean isDir = toFiles[i].isDirectory();
+ boolean found = false;
+ for (int j = 0; j < fromSize; j++) {
+ if (name.equals(resources[j].getName()) && isDir == resources[j] instanceof IModuleFolder)
+ found = true;
+ }
+
+ // delete file if it can't be found or isn't the correct type
+ if (!found) {
+ if (isDir)
+ deleteDirectory(toFiles[i], null);
+ else
+ toFiles[i].delete();
+ }
+ if (monitor.isCanceled())
+ return;
+ }
+ } else {
+ if (toDir.isFile())
+ toDir.delete();
+ toDir.mkdir();
+ }
+
+ monitor.worked(50);
+
+ // cycle through files and only copy when it doesn't exist
+ // or is newer
+ toFiles = toDir.listFiles();
+ int toSize = toFiles.length;
+ int dw = 0;
+ if (toSize > 0)
+ dw = 500 / toSize;
+
+ for (int i = 0; i < fromSize; i++) {
+ IModuleResource current = resources[i];
+
+ // check if this is a new or newer file
+ boolean copy = true;
+ boolean currentIsDir = current instanceof IModuleFolder;
+ if (!currentIsDir) {
+ //String name = current.getName();
+ //IModuleFile mf = (IModuleFile) current;
+
+ //long mod = mf.getModificationStamp();
+ // TODO
+ /*for (int j = 0; j < toSize; j++) {
+ if (name.equals(toFiles[j].getName()) && mod <= toFiles[j].lastModified())
+ copy = false;
+ }*/
+ }
+
+ if (copy) {
+ //String fromFile = current.getAbsolutePath();
+ IPath toPath = path.append(current.getName());
+ if (!currentIsDir) {
+ IModuleFile mf = (IModuleFile) current;
+ copyFile(mf, toPath);
+ monitor.worked(dw);
+ } else { //if (currentIsDir) {
+ IModuleFolder folder = (IModuleFolder) current;
+ IModuleResource[] children = folder.members();
+ monitor.subTask(NLS.bind(Messages.copyingTask, new String[] {resources[i].getName(), current.getName()}));
+ smartCopy(children, toPath, ProgressUtil.getSubMonitorFor(monitor, dw));
+ }
+ }
+ if (monitor.isCanceled())
+ return;
+ }
+ monitor.worked(500 - dw * toSize);
+ monitor.done();
+ }
+
+ public static void createJar(IModuleResource[] resource, IPath jarPath) throws Exception {
+ ZipFile zip = new ZipFile(jarPath.toFile());
+ BufferedOutputStream bout = new BufferedOutputStream(new FileOutputStream(jarPath.toFile()));
+ ZipOutputStream zout = new ZipOutputStream(bout);
+
+ //ZipEntry ze = new ZipEntry();
+ //zout.putNextEntry(e);
+ }
+
+ /**
+ * Expand a zip file to a given directory.
+ *
+ * @param zipFile java.io.File
+ * @param dir java.io.File
+ * @param monitor
+ */
+ /*public static void expandZip(File zipFile, File dir, IProgressMonitor monitor) {
+ ZipInputStream zis = null;
+
+ try {
+ // first, count number of items in zip file
+ zis = new ZipInputStream(new FileInputStream(zipFile));
+ int count = 0;
+ while (zis.getNextEntry() != null)
+ count++;
+
+ monitor = ProgressUtil.getMonitorFor(monitor);
+ monitor.beginTask(ServerPlugin.getResource("%unZippingTask", new String[] {zipFile.getName()}), count);
+
+ zis = new ZipInputStream(new FileInputStream(zipFile));
+ ZipEntry ze = zis.getNextEntry();
+
+ FileOutputStream out = null;
+
+ while (ze != null) {
+ try {
+ monitor.subTask(ServerPlugin.getResource("%expandingTask", new String[] {ze.getName()}));
+ File f = new File(dir, ze.getName());
+
+ if (ze.isDirectory()) {
+ out = null;
+ f.mkdirs();
+ } else {
+ out = new FileOutputStream(f);
+
+ int avail = zis.read(buf);
+ while (avail > 0) {
+ out.write(buf, 0, avail);
+ avail = zis.read(buf);
+ }
+ }
+ } catch (FileNotFoundException ex) {
+ Trace.trace(Trace.SEVERE, "Error extracting " + ze.getName() + " from zip " + zipFile.getAbsolutePath(), ex);
+ } finally {
+ try {
+ if (out != null)
+ out.close();
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+ ze = zis.getNextEntry();
+ monitor.worked(1);
+ if (monitor.isCanceled())
+ return;
+ }
+ monitor.done();
+ } catch (Exception e) {
+ Trace.trace(Trace.SEVERE, "Error expanding zip file " + zipFile.getAbsolutePath(), e);
+ } finally {
+ try {
+ if (zis != null)
+ zis.close();
+ } catch (Exception ex) {
+ // ignore
+ }
+ }
+ }*/
}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/PublishOperation2.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/PublishOperation2.java
index db319b0..8f91468 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/PublishOperation2.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/PublishOperation2.java
@@ -18,7 +18,9 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.model.IModuleFile;
+import org.eclipse.wst.server.core.model.IModuleFolder;
import org.eclipse.wst.server.core.model.IModuleResource;
import org.eclipse.wst.server.core.model.IModuleResourceDelta;
import org.eclipse.wst.server.core.model.PublishOperation;
@@ -47,36 +49,42 @@
}
public void execute(IProgressMonitor monitor, IAdaptable info) throws CoreException {
- IModuleResourceDelta[] delta = server.getPublishedResourceDelta(new IModule[] { module });
-
- IPath path = server.getTempDirectory();
+ IPath path = server.getTempDirectory().append("webapps");
path = path.append(module.getName());
+ if (kind == IServer.PUBLISH_CLEAN) { // clean and republish from scratch
+ FileUtil.deleteDirectory(path.toFile(), monitor);
+ }
+
+ if (kind == IServer.PUBLISH_CLEAN || kind == IServer.PUBLISH_FULL) {
+ ProjectModule pm = (ProjectModule) module.loadAdapter(ProjectModule.class, monitor);
+ IModuleResource[] mr = pm.members();
+ copy(mr, path);
+ return;
+ }
+
+ IModuleResourceDelta[] delta = server.getPublishedResourceDelta(new IModule[] { module });
+
int size = delta.length;
for (int i = 0; i < size; i++) {
handleDelta(path, delta[i]);
}
-
- ProjectModule pm = (ProjectModule) module.loadAdapter(ProjectModule.class, monitor);
- IModuleResource[] mr = pm.members();
- System.out.println(mr);
- //copy(pm.members(), path);
}
protected void handleDelta(IPath path, IModuleResourceDelta delta) throws CoreException {
IModuleResource resource = delta.getModuleResource();
- int kind = delta.getKind();
+ int kind2 = delta.getKind();
if (resource instanceof IModuleFile) {
IModuleFile file = (IModuleFile) resource;
- if (kind == IModuleResourceDelta.REMOVED)
+ if (kind2 == IModuleResourceDelta.REMOVED)
deleteFile(path, file);
else
copyFile(path, file);
return;
}
- if (kind == IModuleResourceDelta.ADDED) {
+ if (kind2 == IModuleResourceDelta.ADDED) {
IPath path2 = path.append(resource.getModuleRelativePath()).append(resource.getName());
path2.toFile().mkdirs();
} else if (kind == IModuleResourceDelta.REMOVED) {
@@ -105,7 +113,7 @@
}
- /*protected void copy(IModuleResource[] resources, IPath path) throws CoreException {
+ protected void copy(IModuleResource[] resources, IPath path) throws CoreException {
if (resources == null)
return;
@@ -128,5 +136,5 @@
f.mkdirs();
FileUtil.copyFile(file.getContents(), path3.toOSString());
}
- }*/
+ }
}
\ No newline at end of file
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 0c789d2..66b28f9 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
@@ -25,7 +25,6 @@
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
-import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.ServerPort;
/**
* Tomcat v3.2 server configuration.
@@ -55,16 +54,7 @@
public Tomcat32Configuration(IFolder path) {
super(path);
}
-
- /**
- * Return the root of the docbase parameter.
- *
- * @return java.lang.String
- */
- protected String getDocBaseRoot() {
- return "";
- }
-
+
/**
* Returns the main server port.
* @return TomcatServerPort
@@ -78,7 +68,17 @@
}
return null;
}
-
+
+ /**
+ * Returns the prefix that is used in front of the
+ * web module path property. (e.g. "webapps")
+ *
+ * @return java.lang.String
+ */
+ public String getDocBasePrefix() {
+ return "webapps/";
+ }
+
/**
* Returns the mime mappings.
* @return java.util.List
@@ -91,25 +91,6 @@
}
/**
- * Returns the prefix that is used in front of the
- * web module path property. (e.g. "webapps")
- *
- * @return java.lang.String
- */
- public String getPathPrefix() {
- return "webapps";
- }
-
- /**
- * Return the docBase of the ROOT web module.
- *
- * @return java.lang.String
- */
- protected String getROOTModuleDocBase() {
- return "webapps/ROOT";
- }
-
- /**
* Returns the server object (root of server.xml).
* @return org.eclipse.jst.server.tomcat.internal.xml.server32.Server
*/
@@ -471,70 +452,44 @@
Trace.trace(Trace.SEVERE, "Error adding web module", e);
}
}
-
+
/**
* Localize the web projects in this configuration.
*
* @param path a path
- * @param serverType a server type
- * @param runtime a runtime
+ * @param server2 a server type
* @param monitor a progress monitor
*/
- public void localizeConfiguration(IPath path, TomcatServer serverType, IRuntime runtime, IProgressMonitor monitor) {
+ public void localizeConfiguration(IPath path, TomcatServer server2, IProgressMonitor monitor) {
try {
monitor = ProgressUtil.getMonitorFor(monitor);
monitor.beginTask(Messages.updatingConfigurationTask, 100);
-
+
Tomcat32Configuration config = new Tomcat32Configuration(null);
config.load(path, ProgressUtil.getSubMonitorFor(monitor, 30));
-
+
if (monitor.isCanceled())
return;
-
- if (serverType.isTestEnvironment()) {
- config.server.getContextManager().setHome(runtime.getLocation().toOSString());
+
+ if (server2.isTestEnvironment()) {
+ IPath tomcatPath = path.removeLastSegments(1);
+ config.server.getContextManager().setHome(tomcatPath.toOSString());
config.isServerDirty = true;
- } else {
- //IServerConfigurationWorkingCopy scwc = config.getServerConfiguration().createWorkingCopy();
- //Tomcat32Configuration cfg = (Tomcat32Configuration) scwc.getAdapter(Tomcat32Configuration.class);
- config.localizeWebModules();
}
-
monitor.worked(40);
-
+
if (monitor.isCanceled())
return;
-
+
config.save(path, false, ProgressUtil.getSubMonitorFor(monitor, 30));
-
+
if (!monitor.isCanceled())
monitor.done();
} catch (Exception e) {
Trace.trace(Trace.SEVERE, "Error localizing configuration", e);
}
}
-
- /**
- * Go through all of the web modules and make the document
- * base "local" to the configuration.
- */
- protected void localizeWebModules() {
- List modules = getWebModules();
- int size = modules.size();
- for (int i = 0; i < size; i++) {
- WebModule module = (WebModule) modules.get(i);
- String memento = module.getMemento();
- if (memento != null && memento.length() > 0) {
- // update document base to a relative ref
- String docBase = getPathPrefix() + module.getPath();
- if (docBase.startsWith("/") || docBase.startsWith("\\"))
- docBase = docBase.substring(1);
- modifyWebModule(i, docBase, module.getPath(), module.isReloadable());
- }
- }
- }
-
/**
* Change the extension of a mime mapping.
*
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 52c2634..a91b96e 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
@@ -56,15 +56,6 @@
public Tomcat40Configuration(IFolder path) {
super(path);
}
-
- /**
- * Returns the root of the docbase parameter.
- *
- * @return java.lang.String
- */
- protected String getDocBaseRoot() {
- return "webapps/";
- }
/**
* Return the port number.
@@ -89,25 +80,6 @@
}
/**
- * Returns the prefix that is used in front of the
- * web module path property. (e.g. "webapps")
- *
- * @return java.lang.String
- */
- public String getPathPrefix() {
- return "";
- }
-
- /**
- * Return the docBase of the ROOT web module.
- *
- * @return java.lang.String
- */
- protected String getROOTModuleDocBase() {
- return "ROOT";
- }
-
- /**
* Returns a list of ServerPorts that this configuration uses.
*
* @return java.util.List
@@ -483,65 +455,6 @@
Trace.trace(Trace.SEVERE, "Error adding web module " + module.getPath(), e);
}
}
-
- /**
- * Localize the web projects in this configuration.
- *
- * @param path a path
- * @param server2 a server type
- * @param monitor a progress monitor
- */
- public void localizeConfiguration(IPath path, TomcatServer server2, IProgressMonitor monitor) {
- try {
- monitor = ProgressUtil.getMonitorFor(monitor);
- monitor.beginTask(Messages.updatingConfigurationTask, 100);
-
- Tomcat40Configuration config = new Tomcat40Configuration(null);
- config.load(path, ProgressUtil.getSubMonitorFor(monitor, 40));
-
- if (monitor.isCanceled())
- return;
-
- if (!server2.isTestEnvironment()) {
- //IServerConfigurationWorkingCopy scwc = config.getServerConfiguration().createWorkingCopy();
- //Tomcat40Configuration cfg = (Tomcat40Configuration) scwc.getAdapter(Tomcat40Configuration.class);
- config.localizeWebModules();
- }
-
- monitor.worked(20);
-
- if (monitor.isCanceled())
- return;
-
- config.save(path, false, ProgressUtil.getSubMonitorFor(monitor, 40));
-
- if (!monitor.isCanceled())
- monitor.done();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error localizing configuration", e);
- }
- }
-
- /**
- * Go through all of the web modules and make the document
- * base "local" to the configuration.
- */
- protected void localizeWebModules() {
- List modules = getWebModules();
-
- int size = modules.size();
- for (int i = 0; i < size; i++) {
- WebModule module = (WebModule) modules.get(i);
- String memento = module.getMemento();
- if (memento != null && memento.length() > 0) {
- // update document base to a relative ref
- String docBase = getPathPrefix() + module.getPath();
- if (docBase.startsWith("/") || docBase.startsWith("\\"))
- docBase = docBase.substring(1);
- modifyWebModule(i, docBase, module.getPath(), module.isReloadable());
- }
- }
- }
/**
* Change the extension of a mime mapping.
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 6f0989c..5e7ab87 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
@@ -58,15 +58,6 @@
public Tomcat41Configuration(IFolder path) {
super(path);
}
-
- /**
- * Returns the root of the docbase parameter.
- *
- * @return java.lang.String
- */
- protected String getDocBaseRoot() {
- return "webapps/";
- }
/**
* Return the port number.
@@ -89,26 +80,7 @@
public List getMimeMappings() {
return webAppDocument.getMimeMappings();
}
-
- /**
- * Returns the prefix that is used in front of the
- * web module path property. (e.g. "webapps")
- *
- * @return java.lang.String
- */
- public String getPathPrefix() {
- return "";
- }
-
- /**
- * Return the docBase of the ROOT web module.
- *
- * @return java.lang.String
- */
- protected String getROOTModuleDocBase() {
- return "ROOT";
- }
-
+
/**
* Returns a list of ServerPorts that this configuration uses.
*
@@ -510,65 +482,6 @@
}
/**
- * Localize the web projects in this configuration.
- *
- * @param path a path
- * @param server2 a server type
- * @param runtime a runtime
- * @param monitor a progress monitor
- */
- public void localizeConfiguration(IPath path, TomcatServer server2, TomcatRuntime runtime, IProgressMonitor monitor) {
- try {
- monitor = ProgressUtil.getMonitorFor(monitor);
- monitor.beginTask(Messages.updatingConfigurationTask, 100);
-
- Tomcat41Configuration config = new Tomcat41Configuration(null);
- config.load(path, ProgressUtil.getSubMonitorFor(monitor, 40));
-
- if (monitor.isCanceled())
- return;
-
- if (!server2.isTestEnvironment()) {
- //IServerConfigurationWorkingCopy scwc = config.getServerConfiguration().createWorkingCopy();
- //Tomcat41Configuration cfg = (Tomcat41Configuration) scwc.getAdapter(Tomcat41Configuration.class);
- config.localizeWebModules();
- }
- monitor.worked(20);
-
- if (monitor.isCanceled())
- return;
-
- config.save(path, false, ProgressUtil.getSubMonitorFor(monitor, 40));
-
- if (!monitor.isCanceled())
- monitor.done();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error localizing configuration", e);
- }
- }
-
- /**
- * Go through all of the web modules and make the document
- * base "local" to the configuration.
- */
- protected void localizeWebModules() {
- List modules = getWebModules();
-
- int size = modules.size();
- for (int i = 0; i < size; i++) {
- WebModule module = (WebModule) modules.get(i);
- String memento = module.getMemento();
- if (memento != null && memento.length() > 0) {
- // update document base to a relative ref
- String docBase = getPathPrefix() + module.getPath();
- if (docBase.startsWith("/") || docBase.startsWith("\\"))
- docBase = docBase.substring(1);
- modifyWebModule(i, docBase, module.getPath(), module.isReloadable());
- }
- }
- }
-
- /**
* Change the extension of a mime mapping.
*
* @param index
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 3943e37..e3051d9 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
@@ -52,15 +52,6 @@
public Tomcat50Configuration(IFolder path) {
super(path);
}
-
- /**
- * Returns the root of the docbase parameter.
- *
- * @return java.lang.String
- */
- protected String getDocBaseRoot() {
- return "webapps/";
- }
/**
* Return the port number.
@@ -83,26 +74,7 @@
public List getMimeMappings() {
return webAppDocument.getMimeMappings();
}
-
- /**
- * Returns the prefix that is used in front of the
- * web module path property. (e.g. "webapps")
- *
- * @return java.lang.String
- */
- public String getPathPrefix() {
- return "";
- }
-
- /**
- * Return the docBase of the ROOT web module.
- *
- * @return java.lang.String
- */
- protected String getROOTModuleDocBase() {
- return "ROOT";
- }
-
+
/**
* Returns a list of ServerPorts that this configuration uses.
*
@@ -489,65 +461,6 @@
}
/**
- * Localize the web projects in this configuration.
- *
- * @param path a path
- * @param server2 a server type
- * @param runtime a runtime
- * @param monitor a progress monitor
- */
- public void localizeConfiguration(IPath path, TomcatServer server2, TomcatRuntime runtime, IProgressMonitor monitor) {
- try {
- monitor = ProgressUtil.getMonitorFor(monitor);
- monitor.beginTask(Messages.updatingConfigurationTask, 100);
-
- Tomcat50Configuration config = new Tomcat50Configuration(null);
- config.load(path, ProgressUtil.getSubMonitorFor(monitor, 40));
-
- if (monitor.isCanceled())
- return;
-
- if (!server2.isTestEnvironment()) {
- //IServerConfigurationWorkingCopy scwc = config.getServerConfiguration().createWorkingCopy();
- //Tomcat50Configuration cfg = (Tomcat50Configuration) scwc.getAdapter(Tomcat50Configuration.class);
- config.localizeWebModules();
- }
- monitor.worked(20);
-
- if (monitor.isCanceled())
- return;
-
- config.save(path, false, ProgressUtil.getSubMonitorFor(monitor, 40));
-
- if (!monitor.isCanceled())
- monitor.done();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error localizing configuration", e);
- }
- }
-
- /**
- * Go through all of the web modules and make the document
- * base "local" to the configuration.
- */
- protected void localizeWebModules() {
- List modules = getWebModules();
-
- int size = modules.size();
- for (int i = 0; i < size; i++) {
- WebModule module = (WebModule) modules.get(i);
- String memento = module.getMemento();
- if (memento != null && memento.length() > 0) {
- // update document base to a relative ref
- String docBase = getPathPrefix() + module.getPath();
- if (docBase.startsWith("/") || docBase.startsWith("\\"))
- docBase = docBase.substring(1);
- modifyWebModule(i, docBase, module.getPath(), module.isReloadable());
- }
- }
- }
-
- /**
* Change the extension of a mime mapping.
*
* @param index
@@ -557,7 +470,7 @@
webAppDocument.modifyMimeMapping(index, map);
firePropertyChangeEvent(MODIFY_MAPPING_PROPERTY, new Integer(index), map);
}
-
+
/**
* Modify the port with the given id.
*
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 a3472db..46535af 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
@@ -50,15 +50,6 @@
public Tomcat55Configuration(IFolder path) {
super(path);
}
-
- /**
- * Returns the root of the docbase parameter.
- *
- * @return java.lang.String
- */
- protected String getDocBaseRoot() {
- return "webapps/";
- }
/**
* Return the port number.
@@ -81,26 +72,7 @@
public List getMimeMappings() {
return webAppDocument.getMimeMappings();
}
-
- /**
- * Returns the prefix that is used in front of the
- * web module path property. (e.g. "webapps")
- *
- * @return java.lang.String
- */
- public String getPathPrefix() {
- return "";
- }
-
- /**
- * Return the docBase of the ROOT web module.
- *
- * @return java.lang.String
- */
- protected String getROOTModuleDocBase() {
- return "ROOT";
- }
-
+
/**
* Returns a list of ServerPorts that this configuration uses.
*
@@ -487,65 +459,6 @@
}
/**
- * Localize the web projects in this configuration.
- *
- * @param path a path
- * @param server2 a server type
- * @param runtime a runtime
- * @param monitor a progress monitor
- */
- public void localizeConfiguration(IPath path, TomcatServer server2, TomcatRuntime runtime, IProgressMonitor monitor) {
- try {
- monitor = ProgressUtil.getMonitorFor(monitor);
- monitor.beginTask(Messages.updatingConfigurationTask, 100);
-
- Tomcat55Configuration config = new Tomcat55Configuration(null);
- config.load(path, ProgressUtil.getSubMonitorFor(monitor, 40));
-
- if (monitor.isCanceled())
- return;
-
- if (!server2.isTestEnvironment()) {
- //IServerConfigurationWorkingCopy scwc = config.getServerConfiguration().createWorkingCopy();
- //Tomcat55Configuration cfg = (Tomcat55Configuration) scwc.getAdapter(Tomcat55Configuration.class);
- config.localizeWebModules();
- }
- monitor.worked(20);
-
- if (monitor.isCanceled())
- return;
-
- config.save(path, false, ProgressUtil.getSubMonitorFor(monitor, 40));
-
- if (!monitor.isCanceled())
- monitor.done();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error localizing configuration", e);
- }
- }
-
- /**
- * Go through all of the web modules and make the document
- * base "local" to the configuration.
- */
- protected void localizeWebModules() {
- List modules = getWebModules();
-
- int size = modules.size();
- for (int i = 0; i < size; i++) {
- WebModule module = (WebModule) modules.get(i);
- String memento = module.getMemento();
- if (memento != null && memento.length() > 0) {
- // update document base to a relative ref
- String docBase = getPathPrefix() + module.getPath();
- if (docBase.startsWith("/") || docBase.startsWith("\\"))
- docBase = docBase.substring(1);
- modifyWebModule(i, docBase, module.getPath(), module.isReloadable());
- }
- }
- }
-
- /**
* Change the extension of a mime mapping.
*
* @param index
@@ -555,7 +468,7 @@
webAppDocument.modifyMimeMapping(index, map);
firePropertyChangeEvent(MODIFY_MAPPING_PROPERTY, new Integer(index), map);
}
-
+
/**
* Modify the port with the given id.
*
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 a3a362c..0ac9ba9 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
@@ -196,13 +196,10 @@
return Status.OK_STATUS;
}
-
- /**
- * Returns the root of the docbase parameter.
- *
- * @return java.lang.String
- */
- protected abstract String getDocBaseRoot();
+
+ public void localizeConfiguration(IPath path, TomcatServer server, IProgressMonitor monitor) {
+ // do nothing
+ }
/**
* Returns the main server port.
@@ -216,7 +213,9 @@
*
* @return java.lang.String
*/
- public abstract String getPathPrefix();
+ public String getDocBasePrefix() {
+ return "";
+ }
/**
* Returns the partial URL applicable to this module.
@@ -256,13 +255,6 @@
return null;
}
- /**
- * Return the docBase of the ROOT web module.
- *
- * @return java.lang.String
- */
- protected abstract String getROOTModuleDocBase();
-
protected abstract void save(IFolder folder, IProgressMonitor monitor) throws CoreException;
protected void firePropertyChangeEvent(String propertyName, Object oldValue, Object newValue) {
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 ca30a7a..96b37f6 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
@@ -208,6 +208,17 @@
* Returns the child module(s) of this module.
*/
public IModule[] getChildModules(IModule[] module) {
+ if (module == null)
+ return null;
+
+ if (module.length == 1) {
+ IWebModule webModule = (IWebModule) module[0].loadAdapter(IWebModule.class, null);
+ if (webModule != null) {
+ /*IModule[] modules = webModule.getModules();
+ if (modules != null)
+ System.out.println(modules.length);*/
+ }
+ }
return new IModule[0];
}
@@ -304,7 +315,7 @@
throw new CoreException(status);
TomcatConfiguration config = getTomcatConfiguration();
-
+
if (add != null) {
int size = add.length;
for (int i = 0; i < size; i++) {
@@ -313,8 +324,8 @@
String contextRoot = module.getContextRoot();
if (contextRoot != null && !contextRoot.startsWith("/") && contextRoot.length() > 0)
contextRoot = "/" + contextRoot;
- WebModule module2 = new WebModule(contextRoot,
- module.getLocation().toOSString(), module3.getId(), true);
+ String docBase = config.getDocBasePrefix() + module3.getName();
+ WebModule module2 = new WebModule(contextRoot, docBase, module3.getId(), true);
config.addWebModule(-1, module2);
}
}
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 d91e50c..ea3bc04 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
@@ -31,6 +31,7 @@
import org.eclipse.wst.server.core.*;
import org.eclipse.wst.server.core.internal.Server;
import org.eclipse.wst.server.core.model.*;
+import org.eclipse.wst.server.core.util.ProjectModule;
import org.eclipse.wst.server.core.util.SocketUtil;
/**
* Generic Tomcat server.
@@ -60,14 +61,14 @@
return (TomcatRuntime) getServer().getRuntime().loadAdapter(TomcatRuntime.class, null);
}
-
+
public ITomcatVersionHandler getTomcatVersionHandler() {
if (getServer().getRuntime() == null || getTomcatRuntime() == null)
return null;
return getTomcatRuntime().getVersionHandler();
}
-
+
public TomcatConfiguration getTomcatConfiguration() throws CoreException {
return getTomcatServer().getTomcatConfiguration();
}
@@ -205,7 +206,7 @@
confDir = installDir;
monitor = ProgressUtil.getMonitorFor(monitor);
- monitor.beginTask(Messages.publishServerTask, 500);
+ monitor.beginTask(Messages.publishServerTask, 600);
IStatus status = getTomcatConfiguration().cleanupServer(confDir, installDir, ProgressUtil.getSubMonitorFor(monitor, 100));
if (status != null && !status.isOK())
@@ -215,6 +216,8 @@
if (status != null && !status.isOK())
throw new CoreException(status);
+ getTomcatConfiguration().localizeConfiguration(confDir.append("conf"), getTomcatServer(), ProgressUtil.getSubMonitorFor(monitor, 100));
+
monitor.done();
setServerPublishState(IServer.PUBLISH_STATE_NONE);
@@ -250,10 +253,15 @@
}
} else {
IWebModule webModule = (IWebModule) module.loadAdapter(IWebModule.class, null);
- IPath from = webModule.getLocation();
IPath to = getServer().getRuntime().getLocation().append("webapps").append(webModule.getContextRoot());
+ /*IPath from = webModule.getLocation();
FileUtil.smartCopyDirectory(from.toOSString(), to.toOSString(), monitor);
- p.put(module.getId(), to.toOSString());
+ p.put(module.getId(), to.toOSString());*/
+
+ ProjectModule pm = (ProjectModule) module.loadAdapter(ProjectModule.class, monitor);
+ IModuleResource[] mr = pm.members();
+ FileUtil.smartCopy(mr, to, monitor);
+
setModulePublishState(moduleTree, IServer.PUBLISH_STATE_NONE);
}
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/project/facet/RuntimeBridge.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/project/facet/RuntimeBridge.java
deleted file mode 100644
index fc53c38..0000000
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/project/facet/RuntimeBridge.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/******************************************************************************
- * 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
- ******************************************************************************/
-
-package org.eclipse.jst.server.tomcat.core.internal.project.facet;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.launching.IVMInstall2;
-import org.eclipse.jdt.launching.IVMInstallType;
-import org.eclipse.jdt.launching.JavaRuntime;
-import org.eclipse.jst.server.core.ClasspathRuntimeTargetHandler;
-import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponentVersion;
-import org.eclipse.wst.common.project.facet.core.runtime.RuntimeManager;
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.IRuntimeTargetHandler;
-import org.eclipse.wst.server.core.ServerCore;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class RuntimeBridge
-{
- private static Map mappings = new HashMap();
-
- static
- {
- mappings.put( "org.eclipse.jst.server.tomcat.runtime.55",
- RuntimeManager.get().getRuntimeComponentType( "tomcat" ).getVersion( "5.5" ) );
-
- mappings.put( "org.eclipse.jst.server.tomcat.runtime.41",
- RuntimeManager.get().getRuntimeComponentType( "tomcat" ).getVersion( "4.1" ) );
- }
-
- public static void port()
- {
- final IRuntime[] runtimes = ServerCore.getRuntimes();
-
- for( int i = 0; i < runtimes.length; i++ )
- {
- final IRuntime runtime = runtimes[ i ];
- final String name = runtime.getName();
-
- if( ! RuntimeManager.get().isRuntimeDefined( name ) )
- {
- final String type = runtime.getRuntimeType().getId();
-
- final IRuntimeComponentVersion mapped
- = (IRuntimeComponentVersion) mappings.get( type );
-
- if( mapped != null )
- {
- final List components = new ArrayList();
-
- Map properties;
-
- properties = new HashMap();
- properties.put( "location", runtime.getLocation().toPortableString() );
- properties.put( "name", name );
-
- components.add( RuntimeManager.get().createRuntimeComponent( mapped, properties ) );
-
- final ClasspathRuntimeTargetHandler cphandler
- = getClasspathHandler( runtime );
-
- final IPath jrecontainer
- = findJreContainer( cphandler.getDelegateClasspathEntries( runtime, null ) );
-
- final IVMInstallType vminstalltype
- = JavaRuntime.getVMInstallType( jrecontainer.segment( 1 ) );
-
- final IVMInstall2 vminstall
- = (IVMInstall2) vminstalltype.findVMInstallByName( jrecontainer.segment( 2 ) );
-
- final String jvmver = vminstall.getJavaVersion();
- final IRuntimeComponentVersion rcv;
-
- if( jvmver.startsWith( "1.4" ) )
- {
- rcv = RuntimeManager.get().getRuntimeComponentType( "standard.jre" ).getVersion( "1.4" );
- }
- else if( jvmver.startsWith( "1.5" ) )
- {
- rcv = RuntimeManager.get().getRuntimeComponentType( "standard.jre" ).getVersion( "5.0" );
- }
- else
- {
- continue;
- }
-
- properties = new HashMap();
- properties.put( "name", jrecontainer.segment( 2 ) );
-
- components.add( RuntimeManager.get().createRuntimeComponent( rcv, properties ) );
-
- RuntimeManager.get().defineRuntime( name, components, null );
- }
- }
- }
- }
-
- private static ClasspathRuntimeTargetHandler getClasspathHandler( final IRuntime r )
- {
- final IRuntimeTargetHandler[] handlers
- = ServerCore.getRuntimeTargetHandlers();
-
- for( int j = 0; j < handlers.length; j++ )
- {
- final IRuntimeTargetHandler handler = handlers[ j ];
-
- if( handler.supportsRuntimeType( r.getRuntimeType() ) )
- {
- return (ClasspathRuntimeTargetHandler) handler.getAdapter( ClasspathRuntimeTargetHandler.class );
- }
- }
-
- throw new IllegalStateException();
- }
-
- private static IPath findJreContainer( final IClasspathEntry[] cpentries )
- {
- for( int i = 0; i < cpentries.length; i++ )
- {
- final IPath path = cpentries[ i ].getPath();
-
- if( path.segment( 0 ).equals( JavaRuntime.JRE_CONTAINER ) )
- {
- return path;
- }
- }
-
- throw new IllegalStateException();
- }
-
-}
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/project/facet/StandardJreClasspathProvider.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/project/facet/StandardJreClasspathProvider.java
deleted file mode 100644
index ec1614b..0000000
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/project/facet/StandardJreClasspathProvider.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/******************************************************************************
- * 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
- ******************************************************************************/
-
-package org.eclipse.jst.server.tomcat.core.internal.project.facet;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.launching.JavaRuntime;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponent;
-import org.eclipse.wst.common.project.facet.core.runtime.classpath.IClasspathProvider;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class StandardJreClasspathProvider
-
- implements IClasspathProvider
-
-{
- private static final IProjectFacet JAVA_FEATURE
- = ProjectFacetsManager.getProjectFacet( "java" );
-
- private static final String STANDARD_VM_TYPE
- = "org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType";
-
-
- private final IRuntimeComponent rc;
-
- public StandardJreClasspathProvider( final IRuntimeComponent rc )
- {
- this.rc = rc;
- }
-
- public List getClasspathEntries( final IProjectFacetVersion fv )
- {
- if( fv.getProjectFacet() == JAVA_FEATURE )
- {
- IPath path = new Path( JavaRuntime.JRE_CONTAINER );
- path = path.append( STANDARD_VM_TYPE );
- path = path.append( rc.getProperty( "name" ) );
-
- final IClasspathEntry cpentry = JavaCore.newContainerEntry( path );
-
- return Collections.singletonList( cpentry );
- }
-
- return null;
- }
-
- public static final class Factory
-
- implements IAdapterFactory
-
- {
- private static final Class[] ADAPTER_TYPES
- = { IClasspathProvider.class };
-
- public Object getAdapter( final Object adaptable,
- final Class adapterType )
- {
- final IRuntimeComponent rc = (IRuntimeComponent) adaptable;
- return new StandardJreClasspathProvider( rc );
- }
-
- public Class[] getAdapterList()
- {
- return ADAPTER_TYPES;
- }
- }
-
-
-}
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/project/facet/TomcatClasspathProvider.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/project/facet/TomcatClasspathProvider.java
deleted file mode 100644
index 210b157..0000000
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/project/facet/TomcatClasspathProvider.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/******************************************************************************
- * 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
- ******************************************************************************/
-
-package org.eclipse.jst.server.tomcat.core.internal.project.facet;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponent;
-import org.eclipse.wst.common.project.facet.core.runtime.classpath.IClasspathProvider;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class TomcatClasspathProvider
-
- implements IClasspathProvider
-
-{
- private static final IProjectFacet WEB_FEATURE
- = ProjectFacetsManager.getProjectFacet( "web" );
-
- private final IRuntimeComponent rc;
-
- public TomcatClasspathProvider( final IRuntimeComponent rc )
- {
- this.rc = rc;
- }
-
- public List getClasspathEntries( final IProjectFacetVersion fv )
- {
- if( fv.getProjectFacet() == WEB_FEATURE )
- {
- IPath path = new Path( "org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget" );
- path = path.append( rc.getProperty( "name" ) );
-
- final IClasspathEntry cpentry = JavaCore.newContainerEntry( path );
-
- return Collections.singletonList( cpentry );
- }
-
- return null;
- }
-
- public static final class Factory
-
- implements IAdapterFactory
-
- {
- private static final Class[] ADAPTER_TYPES
- = { IClasspathProvider.class };
-
- public Object getAdapter( final Object adaptable,
- final Class adapterType )
- {
- final IRuntimeComponent rc = (IRuntimeComponent) adaptable;
- return new TomcatClasspathProvider( rc );
- }
-
- public Class[] getAdapterList()
- {
- return ADAPTER_TYPES;
- }
- }
-
-}
diff --git a/plugins/org.eclipse.jst.server.tomcat.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.jst.server.tomcat.ui/META-INF/MANIFEST.MF
index 92749a6..75c8d8b 100644
--- a/plugins/org.eclipse.jst.server.tomcat.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.jst.server.tomcat.ui/META-INF/MANIFEST.MF
@@ -7,8 +7,7 @@
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Export-Package: org.eclipse.jst.server.tomcat.ui.internal;x-internal:=true,
- org.eclipse.jst.server.tomcat.ui.internal.editor;x-internal:=true,
- org.eclipse.jst.server.tomcat.ui.internal.project.facet
+ org.eclipse.jst.server.tomcat.ui.internal.editor;x-internal:=true
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.expressions,
org.eclipse.ui,
@@ -20,7 +19,5 @@
org.eclipse.wst.server.core,
org.eclipse.wst.server.ui,
org.eclipse.jst.server.core,
- org.eclipse.jst.server.tomcat.core,
- org.eclipse.wst.common.project.facet.core,
- org.eclipse.wst.common.project.facet.ui
+ org.eclipse.jst.server.tomcat.core
Eclipse-AutoStart: true
diff --git a/plugins/org.eclipse.jst.server.tomcat.ui/icons/obj16/jre.GIF b/plugins/org.eclipse.jst.server.tomcat.ui/icons/obj16/jre.GIF
deleted file mode 100644
index 2038b22..0000000
--- a/plugins/org.eclipse.jst.server.tomcat.ui/icons/obj16/jre.GIF
+++ /dev/null
Binary files differ
diff --git a/plugins/org.eclipse.jst.server.tomcat.ui/plugin.xml b/plugins/org.eclipse.jst.server.tomcat.ui/plugin.xml
index a680762..eafb85b 100644
--- a/plugins/org.eclipse.jst.server.tomcat.ui/plugin.xml
+++ b/plugins/org.eclipse.jst.server.tomcat.ui/plugin.xml
@@ -136,82 +136,5 @@
class="org.eclipse.jst.server.tomcat.ui.internal.TomcatLaunchConfigurationTabGroup">
</launchConfigurationTabGroup>
</extension>
-
- <extension point="org.eclipse.wst.common.project.facet.core.runtimes">
-
- <runtime-component-type id="standard.jre">
- <icon>icons/obj16/jre.gif</icon>
- </runtime-component-type>
-
- <runtime-component-version type="standard.jre" version="1.4">
- <delegate class="org.eclipse.wst.common.project.facet.base.StandardJreRuntimeComponentDelegate"/>
- </runtime-component-version>
-
- <runtime-component-version type="standard.jre" version="5.0">
- <delegate class="org.eclipse.wst.common.project.facet.base.StandardJreRuntimeComponentDelegate"/>
- </runtime-component-version>
-
- <adapter>
- <runtime-component id="standard.jre"/>
- <factory class="org.eclipse.jst.server.tomcat.core.internal.project.facet.StandardJreClasspathProvider$Factory"/>
- <type class="org.eclipse.wst.common.project.facet.core.runtime.classpath.IClasspathProvider"/>
- </adapter>
-
- <adapter>
- <runtime-component id="standard.jre"/>
- <factory class="org.eclipse.jst.server.tomcat.ui.internal.project.facet.StandardJreLabelProvider$Factory"/>
- <type class="org.eclipse.wst.common.project.facet.ui.IRuntimeComponentLabelProvider"/>
- </adapter>
-
- <supported>
- <runtime-component id="standard.jre" version="1.4"/>
- <facet id="java" version="1.4"/>
- </supported>
-
- <supported>
- <runtime-component id="standard.jre" version="5.0"/>
- <facet id="java" version="5.0"/>
- </supported>
-
- <runtime-component-type id="tomcat">
- <icon>icons/obj16/tomcat.gif</icon>
- </runtime-component-type>
-
- <runtime-component-version type="tomcat" version="5.5">
- <delegate class="org.eclipse.jst.server.tomcat.core.internal.project.facet.TomcatRuntimeComponentDelegate"/>
- </runtime-component-version>
-
- <runtime-component-version type="tomcat" version="4.1">
- <delegate class="org.eclipse.jst.server.tomcat.core.internal.project.facet.TomcatRuntimeComponentDelegate"/>
- </runtime-component-version>
-
- <adapter>
- <runtime-component id="tomcat"/>
- <factory class="org.eclipse.jst.server.tomcat.core.internal.project.facet.TomcatClasspathProvider$Factory"/>
- <type class="org.eclipse.wst.common.project.facet.core.runtime.classpath.IClasspathProvider"/>
- </adapter>
-
- <adapter>
- <runtime-component id="tomcat"/>
- <factory class="org.eclipse.jst.server.tomcat.ui.internal.project.facet.TomcatLabelProvider$Factory"/>
- <type class="org.eclipse.wst.common.project.facet.ui.IRuntimeComponentLabelProvider"/>
- </adapter>
-
- <supported>
- <runtime-component id="tomcat" version="5.5" allow-newer="true"/>
- <facet id="web" version="2.4"/>
- </supported>
-
- <supported>
- <runtime-component id="tomcat" version="4.1" allow-newer="true"/>
- <facet id="web" version="2.3"/>
- </supported>
-
- <supported>
- <runtime-component any="true"/>
- <facet id="utility"/>
- </supported>
-
- </extension>
</plugin>
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.tomcat.ui/tomcatui/org/eclipse/jst/server/tomcat/ui/internal/editor/WebModuleDialog.java b/plugins/org.eclipse.jst.server.tomcat.ui/tomcatui/org/eclipse/jst/server/tomcat/ui/internal/editor/WebModuleDialog.java
index d17c7ed..3ad0637 100644
--- a/plugins/org.eclipse.jst.server.tomcat.ui/tomcatui/org/eclipse/jst/server/tomcat/ui/internal/editor/WebModuleDialog.java
+++ b/plugins/org.eclipse.jst.server.tomcat.ui/tomcatui/org/eclipse/jst/server/tomcat/ui/internal/editor/WebModuleDialog.java
@@ -239,8 +239,8 @@
String contextRoot = module2.getContextRoot();
if (contextRoot != null && !contextRoot.startsWith("/") && contextRoot.length() > 0)
contextRoot = "/" + contextRoot;
- module = new WebModule(contextRoot, module2.getLocation().toOSString(), module.getMemento(), module.isReloadable());
- docBase.setText(module2.getLocation().toOSString());
+ module = new WebModule(contextRoot, "[workspace]", module.getMemento(), module.isReloadable());
+ docBase.setText("[workspace]");
} catch (Exception e) {
// ignore
}
diff --git a/plugins/org.eclipse.jst.server.tomcat.ui/tomcatui/org/eclipse/jst/server/tomcat/ui/internal/project/facet/StandardJreLabelProvider.java b/plugins/org.eclipse.jst.server.tomcat.ui/tomcatui/org/eclipse/jst/server/tomcat/ui/internal/project/facet/StandardJreLabelProvider.java
deleted file mode 100644
index 86bd351..0000000
--- a/plugins/org.eclipse.jst.server.tomcat.ui/tomcatui/org/eclipse/jst/server/tomcat/ui/internal/project/facet/StandardJreLabelProvider.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/******************************************************************************
- * 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
- ******************************************************************************/
-
-package org.eclipse.jst.server.tomcat.ui.internal.project.facet;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.jdt.launching.IVMInstall;
-import org.eclipse.jdt.launching.JavaRuntime;
-import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponent;
-import org.eclipse.wst.common.project.facet.ui.IRuntimeComponentLabelProvider;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class StandardJreLabelProvider
-
- implements IRuntimeComponentLabelProvider
-
-{
- private static final String TYPE
- = "org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType";
-
- private final IRuntimeComponent rc;
-
- public StandardJreLabelProvider( final IRuntimeComponent rc )
- {
- this.rc = rc;
- }
-
- public String getLabel()
- {
- final String name = this.rc.getProperty( "name" );
-
- final IVMInstall install
- = JavaRuntime.getVMInstallType( TYPE ).findVMInstallByName( name );
-
- final StringBuffer buf = new StringBuffer();
-
- buf.append( "Standard JRE " );
- buf.append( this.rc.getRuntimeComponentVersion().getVersionString() );
- buf.append( " [" );
- buf.append( install.getInstallLocation().toString() );
- buf.append( "]" );
-
- return buf.toString();
- }
-
- 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 StandardJreLabelProvider( rc );
- }
-
- public Class[] getAdapterList()
- {
- return ADAPTER_TYPES;
- }
- }
-
-
-}
diff --git a/plugins/org.eclipse.jst.server.tomcat.ui/tomcatui/org/eclipse/jst/server/tomcat/ui/internal/project/facet/TomcatLabelProvider.java b/plugins/org.eclipse.jst.server.tomcat.ui/tomcatui/org/eclipse/jst/server/tomcat/ui/internal/project/facet/TomcatLabelProvider.java
deleted file mode 100644
index f0414af..0000000
--- a/plugins/org.eclipse.jst.server.tomcat.ui/tomcatui/org/eclipse/jst/server/tomcat/ui/internal/project/facet/TomcatLabelProvider.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/******************************************************************************
- * 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
- ******************************************************************************/
-
-package org.eclipse.jst.server.tomcat.ui.internal.project.facet;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponent;
-import org.eclipse.wst.common.project.facet.ui.IRuntimeComponentLabelProvider;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class TomcatLabelProvider
-
- implements IRuntimeComponentLabelProvider
-
-{
- private final IRuntimeComponent rc;
-
- public TomcatLabelProvider( final IRuntimeComponent rc )
- {
- this.rc = rc;
- }
-
- public String getLabel()
- {
- final IPath location
- = Path.fromPortableString( this.rc.getProperty( "location" ) );
-
- final StringBuffer buf = new StringBuffer();
-
- buf.append( "Apache Tomcat " );
- buf.append( this.rc.getRuntimeComponentVersion().getVersionString() );
- buf.append( " [" );
- buf.append( location.toOSString() );
- buf.append( "]" );
-
- return buf.toString();
- }
-
- 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 TomcatLabelProvider( rc );
- }
-
- public Class[] getAdapterList()
- {
- return ADAPTER_TYPES;
- }
- }
-
-}
diff --git a/plugins/org.eclipse.jst.server.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.jst.server.ui/META-INF/MANIFEST.MF
index ccbbc63..43f1d31 100644
--- a/plugins/org.eclipse.jst.server.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.jst.server.ui/META-INF/MANIFEST.MF
@@ -19,5 +19,7 @@
org.eclipse.wst.server.ui,
org.eclipse.jst.server.core,
org.eclipse.ui.ide,
- org.eclipse.jdt.ui
+ org.eclipse.jdt.ui,
+ org.eclipse.wst.common.project.facet.core,
+ org.eclipse.wst.common.project.facet.ui
Eclipse-AutoStart: true
diff --git a/plugins/org.eclipse.jst.server.ui/plugin.xml b/plugins/org.eclipse.jst.server.ui/plugin.xml
index 70c7f15..f9b2cb4 100644
--- a/plugins/org.eclipse.jst.server.ui/plugin.xml
+++ b/plugins/org.eclipse.jst.server.ui/plugin.xml
@@ -59,4 +59,16 @@
name="%cactusServletTestCase"/>
</extension>
+<!--
+ <extension point="org.eclipse.wst.common.project.facet.core.runtimes">
+ <adapter>
+ <runtime-component
+ id="org.eclipse.jst.server.tomcat"/>
+ <factory
+ class="org.eclipse.wst.common.project.facet.base.TomcatLabelProvider$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/TomcatLabelProvider.java b/plugins/org.eclipse.jst.server.ui/sjavaui/org/eclipse/jst/server/ui/internal/TomcatLabelProvider.java
new file mode 100644
index 0000000..1feeedd
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.ui/sjavaui/org/eclipse/jst/server/ui/internal/TomcatLabelProvider.java
@@ -0,0 +1,55 @@
+/******************************************************************************
+ * 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
+ ******************************************************************************/
+package org.eclipse.jst.server.ui.internal;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponent;
+import org.eclipse.wst.common.project.facet.ui.IRuntimeComponentLabelProvider;
+/**
+ *
+ */
+public final class TomcatLabelProvider implements IRuntimeComponentLabelProvider {
+ private final IRuntimeComponent rc;
+
+ public TomcatLabelProvider(final IRuntimeComponent rc) {
+ this.rc = rc;
+ }
+
+ public String getLabel() {
+ final IPath location = Path.fromPortableString(rc.getProperty("location"));
+
+ final StringBuffer buf = new StringBuffer();
+
+ buf.append("Apache Tomcat ");
+ //buf.append(rc.getRuntimeComponentType());
+ buf.append(rc.getRuntimeComponentVersion().getVersionString());
+ buf.append(" [");
+ buf.append(location.toOSString());
+ buf.append("]");
+
+ return buf.toString();
+ }
+
+ 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 TomcatLabelProvider(rc);
+ }
+
+ public Class[] getAdapterList() {
+ return ADAPTER_TYPES;
+ }
+ }
+}
\ No newline at end of file