[571002] Keep the top-level folders when installing a server
    Also, update the Tomcat v9 versions and add v10 installable

Signed-off-by: Nitin Dahyabhai <thatnitind@gmail.com>
Change-Id: I6b82add63ffdb8141b2ce2b98cca18733da2a2e4
diff --git a/features/org.eclipse.jst.server_adapters.ext.feature/feature.xml b/features/org.eclipse.jst.server_adapters.ext.feature/feature.xml
index 711b884..f253e6e 100644
--- a/features/org.eclipse.jst.server_adapters.ext.feature/feature.xml
+++ b/features/org.eclipse.jst.server_adapters.ext.feature/feature.xml
@@ -14,7 +14,7 @@
 <feature

       id="org.eclipse.jst.server_adapters.ext.feature"

       label="%featureName"

-      version="3.4.0.qualifier"

+      version="3.4.100.qualifier"

       provider-name="%providerName"

       license-feature="org.eclipse.license"

       license-feature-version="1.0.1.qualifier">

diff --git a/features/org.eclipse.jst.server_adapters.ext.feature/pom.xml b/features/org.eclipse.jst.server_adapters.ext.feature/pom.xml
index 1fc3a62..05a31f0 100644
--- a/features/org.eclipse.jst.server_adapters.ext.feature/pom.xml
+++ b/features/org.eclipse.jst.server_adapters.ext.feature/pom.xml
@@ -22,7 +22,7 @@
 

   <groupId>org.eclipse.webtools.servertools</groupId>

   <artifactId>org.eclipse.jst.server_adapters.ext.feature</artifactId>

-  <version>3.4.0-SNAPSHOT</version>

+  <version>3.4.100-SNAPSHOT</version>

   <packaging>eclipse-feature</packaging>

 

   <build>

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 fb09adc..5178425 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
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.jst.server.tomcat.core; singleton:=true
-Bundle-Version: 1.1.1200.qualifier
+Bundle-Version: 1.1.1300.qualifier
 Bundle-Activator: org.eclipse.jst.server.tomcat.core.internal.TomcatPlugin
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
@@ -17,7 +17,7 @@
  org.eclipse.debug.core;bundle-version="[3.2.0,4.0.0)",
  org.eclipse.jdt.core;bundle-version="[3.2.0,4.0.0)",
  org.eclipse.jdt.launching;bundle-version="[3.10.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.10.200,2.0.0)",
  org.eclipse.jst.server.core;bundle-version="[1.0.103,2.0.0)",
  org.eclipse.jst.common.project.facet.core;bundle-version="[1.1.0,2.0.0)",
  org.eclipse.wst.common.modulecore;bundle-version="[1.1.0,2.0.0)",
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/plugin.properties b/plugins/org.eclipse.jst.server.tomcat.core/plugin.properties
index ebcec03..fa381f9 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/plugin.properties
+++ b/plugins/org.eclipse.jst.server.tomcat.core/plugin.properties
@@ -70,7 +70,7 @@
 tomcat90ServerDescription=Publishes and runs J2EE and Java EE Web projects and server configurations to a local Tomcat server.
 
 tomcat100ServerType=Tomcat v10.0 Server
-tomcat100ServerDescription=Publishes and runs J2EE and Java EE Web projects and server configurations to a local Tomcat server.
+tomcat100ServerDescription=Publishes and runs J2EE, Java EE, and Jakarta EE Web projects and server configurations to a local Tomcat server.
 
 tomcatLaunchConfigurationType=Apache Tomcat
 
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/plugin.xml b/plugins/org.eclipse.jst.server.tomcat.core/plugin.xml
index 38f635d..df20b59 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/plugin.xml
+++ b/plugins/org.eclipse.jst.server.tomcat.core/plugin.xml
@@ -776,22 +776,39 @@
         archiveSize="11538389"
         fileCount="627"
         os="win32"/>
+
     <runtime
         id="org.eclipse.jst.server.tomcat.runtime.90"
         licenseUrl="http://www.apache.org/licenses/LICENSE-2.0.txt"
-        archiveUrl="http://archive.apache.org/dist/tomcat/tomcat-9/v9.0.41/bin/apache-tomcat-9.0.41.tar.gz"
-        archivePath="apache-tomcat-9.0.41"
-        archiveSize="11442169"
+        archiveUrl="http://archive.apache.org/dist/tomcat/tomcat-9/v9.0.43/bin/apache-tomcat-9.0.43.tar.gz"
+        archivePath="apache-tomcat-9.0.43"
+        archiveSize="11483588"
         fileCount="639"
         os="linux,macosx"/>
     <runtime
         id="org.eclipse.jst.server.tomcat.runtime.90"
         licenseUrl="http://www.apache.org/licenses/LICENSE-2.0.txt"
-        archiveUrl="http://archive.apache.org/dist/tomcat/tomcat-9/v9.0.41/bin/apache-tomcat-9.0.41.zip"
-        archivePath="apache-tomcat-9.0.41"
-        archiveSize="11983597"
+        archiveUrl="http://archive.apache.org/dist/tomcat/tomcat-9/v9.0.43/bin/apache-tomcat-9.0.43.zip"
+        archivePath="apache-tomcat-9.0.43"
+        archiveSize="12022644"
         fileCount="639"
         os="win32"/>
 
+    <runtime
+        id="org.eclipse.jst.server.tomcat.runtime.100"
+        licenseUrl="http://www.apache.org/licenses/LICENSE-2.0.txt"
+        archiveUrl="http://archive.apache.org/dist/tomcat/tomcat-10/v10.0.2/bin/apache-tomcat-10.0.2.tar.gz"
+        archivePath="apache-tomcat-10.0.2"
+        archiveSize="11353990"
+        fileCount="639"
+        os="linux,macosx"/>
+    <runtime
+        id="org.eclipse.jst.server.tomcat.runtime.100"
+        licenseUrl="http://www.apache.org/licenses/LICENSE-2.0.txt"
+        archiveUrl="http://archive.apache.org/dist/tomcat/tomcat-10/v10.0.2/bin/apache-tomcat-10.0.2.zip"
+        archivePath="apache-tomcat-10.0.2"
+        archiveSize="11897156"
+        fileCount="639"
+        os="win32"/>
   </extension>
 </plugin>
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/pom.xml b/plugins/org.eclipse.jst.server.tomcat.core/pom.xml
index fb20a65..d2163ac 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/pom.xml
+++ b/plugins/org.eclipse.jst.server.tomcat.core/pom.xml
@@ -22,6 +22,6 @@
 
   <groupId>org.eclipse.webtools.servertools</groupId>
   <artifactId>org.eclipse.jst.server.tomcat.core</artifactId>
-  <version>1.1.1200-SNAPSHOT</version>
+  <version>1.1.1300-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
 </project>
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 a9bb217..a13b2c7 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
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.jst.server.tomcat.ui; singleton:=true
-Bundle-Version: 1.1.900.qualifier
+Bundle-Version: 1.1.1000.qualifier
 Bundle-Activator: org.eclipse.jst.server.tomcat.ui.internal.TomcatUIPlugin
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
@@ -18,7 +18,7 @@
  org.eclipse.debug.ui;bundle-version="[3.2.0,4.0.0)",
  org.eclipse.jdt.debug.ui;bundle-version="[3.2.0,4.0.0)",
  org.eclipse.jdt.launching;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.10.200,2.0.0)",
  org.eclipse.wst.server.ui;bundle-version="[1.0.204,2.0.0)",
  org.eclipse.jst.server.core;bundle-version="[1.0.103,2.0.0)",
  org.eclipse.jst.server.ui;bundle-version="[1.0.103,2.0.0)",
diff --git a/plugins/org.eclipse.jst.server.tomcat.ui/pom.xml b/plugins/org.eclipse.jst.server.tomcat.ui/pom.xml
index 41ff9f7..c0b8f87 100644
--- a/plugins/org.eclipse.jst.server.tomcat.ui/pom.xml
+++ b/plugins/org.eclipse.jst.server.tomcat.ui/pom.xml
@@ -22,6 +22,6 @@
 

   <groupId>org.eclipse.webtools.servertools</groupId>

   <artifactId>org.eclipse.jst.server.tomcat.ui</artifactId>

-  <version>1.1.900-SNAPSHOT</version>

+  <version>1.1.1000-SNAPSHOT</version>

   <packaging>eclipse-plugin</packaging>

 </project>

diff --git a/plugins/org.eclipse.jst.server.tomcat.ui/tomcatui/org/eclipse/jst/server/tomcat/ui/internal/TomcatRuntimeComposite.java b/plugins/org.eclipse.jst.server.tomcat.ui/tomcatui/org/eclipse/jst/server/tomcat/ui/internal/TomcatRuntimeComposite.java
index d57a324..22383a0 100644
--- a/plugins/org.eclipse.jst.server.tomcat.ui/tomcatui/org/eclipse/jst/server/tomcat/ui/internal/TomcatRuntimeComposite.java
+++ b/plugins/org.eclipse.jst.server.tomcat.ui/tomcatui/org/eclipse/jst/server/tomcat/ui/internal/TomcatRuntimeComposite.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2003, 2010 IBM Corporation and others.
+ * Copyright (c) 2003, 2021 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License 2.0
  * which accompanies this distribution, and is available at
@@ -234,8 +234,13 @@
 							return Status.OK_STATUS;
 						}
 					};
-					
-					installDir.setText(selectedDirectory);
+					if (ir.getArchivePath() != null) {
+						installDir.setText(new Path(selectedDirectory).addTrailingSeparator().append(ir.getArchivePath()).toString());
+					}
+					else {
+						installDir.setText(selectedDirectory);
+					}
+
 					jobListener = new JobChangeAdapter() {
 						public void done(IJobChangeEvent event) {
 							installRuntimeJob.removeJobChangeListener(this);
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IInstallableRuntime.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IInstallableRuntime.java
index 442afaf..4361b36 100644
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IInstallableRuntime.java
+++ b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IInstallableRuntime.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2021 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License 2.0
  * which accompanies this distribution, and is available at
@@ -33,12 +33,19 @@
 	public String getId();
 
 	/**
+	 * Provide the top-level path in the archive
+	 * @return
+	 */
+	public String getArchivePath();
+
+	/**
 	 * Provides a name for this runtime.
 	 * 
 	 * @return a name
 	 */
 	public String getName();
 
+
 	/**
 	 * Downloads the license from the update site.
 	 * 
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/InstallableRuntime.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/InstallableRuntime.java
index 4ce3e19..3b25304 100644
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/InstallableRuntime.java
+++ b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/InstallableRuntime.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2005, 2010 IBM Corporation and others.
+ * Copyright (c) 2005, 2021 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License 2.0
  * which accompanies this distribution, and is available at
@@ -62,6 +62,15 @@
 		return null;
 	}
 
+	public String getArchivePath() {
+		try {
+			return element.getAttribute("archivePath");
+		} catch (Exception e) {
+			// ignore
+		}
+		return null;
+	}
+
 	public String getBundleId() {
 		try {
 			return element.getAttribute("bundleId");
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/InstallableRuntime2.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/InstallableRuntime2.java
index 9a97838..ee115b8 100644
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/InstallableRuntime2.java
+++ b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/InstallableRuntime2.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2007, 2015 IBM Corporation and others.
+ * Copyright (c) 2007, 2021 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License 2.0
  * which accompanies this distribution, and is available at
@@ -12,14 +12,7 @@
  *******************************************************************************/
 package org.eclipse.wst.server.core.internal;
 
-import java.io.BufferedInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
+import java.io.*;
 import java.net.URL;
 import java.util.zip.GZIPInputStream;
 import java.util.zip.ZipEntry;
@@ -319,11 +312,6 @@
 		while (entry != null) {
 			String name = entry.getName();
 			progress.subTask(NLS.bind(Messages.taskUncompressing, name));
-			if (archivePath != null && name.startsWith(archivePath)) {
-				name = name.substring(archivePath.length());
-				if (name.length() > 1)
-					name = name.substring(1);
-			}
 			
 			if (name != null && name.length() > 0) {
 				if (entry.isDirectory())
@@ -361,11 +349,6 @@
 		while (entry != null) {
 			String name = entry.getName();
 			progress.subTask(NLS.bind(Messages.taskUncompressing, name));
-			if (archivePath != null && name.startsWith(archivePath)) {
-				name = name.substring(archivePath.length());
-				if (name.length() > 1)
-					name = name.substring(1);
-			}
 			
 			if (name != null && name.length() > 0) {
 				if (entry.getFileType() == TarEntry.DIRECTORY)