API changes
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/plugin.properties b/plugins/org.eclipse.jst.server.tomcat.core/plugin.properties
index e130fc2..c5e8c4a 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/plugin.properties
+++ b/plugins/org.eclipse.jst.server.tomcat.core/plugin.properties
@@ -32,66 +32,49 @@
serverLocatorDescription=Search for Apache Tomcat v3.2, v4.0, v4.1, and v5.0 servers.
# runtime target
-targetJRE=Tomcat JRE
target32runtime=Tomcat v3.2 runtime
target40runtime=Tomcat v4.0 runtime
target41runtime=Tomcat v4.1 runtime
target50runtime=Tomcat v5.0 runtime
+target55runtime=Tomcat v5.5 runtime
# --------------- Servers and Configurations ---------------
tomcat32ServerType=Tomcat v3.2 Server
-tomcat32ServerShortType=Local Server
tomcat32ServerDescription=Publishes and runs J2EE Web projects and server configurations to a local Tomcat server.
tomcat32ConfigurationType=Tomcat v3.2 Server Configuration
-tomcat32ConfigurationShortType=Server Configuration
tomcat32ConfigurationDescription=A server configuration for Tomcat version 3.2.
tomcat40ServerType=Tomcat v4.0 Server
-tomcat40ServerShortType=Local Server
tomcat40ServerDescription=Publishes and runs J2EE Web projects and server configurations to a local Tomcat server.
tomcat40ConfigurationType=Tomcat v4.0 Server Configuration
-tomcat40ConfigurationShortType=Server Configuration
tomcat40ConfigurationDescription=A server configuration for Tomcat version 4.0.
tomcat41ServerType=Tomcat v4.1 Server
-tomcat41ServerShortType=Local Server
tomcat41ServerDescription=Publishes and runs J2EE Web projects and server configurations to a local Tomcat server.
tomcat41ConfigurationType=Tomcat v4.1 Server Configuration
-tomcat41ConfigurationShortType=Server Configuration
tomcat41ConfigurationDescription=A server configuration for Tomcat version 4.1.
tomcat50ServerType=Tomcat v5.0 Server
-tomcat50ServerShortType=Local Server
tomcat50ServerDescription=Publishes and runs J2EE Web projects and server configurations to a local Tomcat server.
tomcat50ConfigurationType=Tomcat v5.0 Server Configuration
-tomcat50ConfigurationShortType=Server Configuration
tomcat50ConfigurationDescription=A server configuration for Tomcat version 5.0.
tomcat55ServerType=Tomcat v5.5 Server
-tomcat55ServerShortType=Local Server
tomcat55ServerDescription=Publishes and runs J2EE Web projects and server configurations to a local Tomcat server.
tomcat55ConfigurationType=Tomcat v5.5 Server Configuration
-tomcat55ConfigurationShortType=Server Configuration
tomcat55ConfigurationDescription=A server configuration for Tomcat version 5.5.
# --------------- Tasks (progress monitors) ---------------
savingTask=Saving...
loadingTask=Loading...
-creatingTask=Creating...
updatingConfigurationTask=Updating run-time configuration...
-publishTask=Publishing to Tomcat...
publishConfigurationTask=Publishing the configuration...
-publishTempDirectoryTask=Updating the temp directory...
-publishCopyTask=Copying module {0}...
-publishExpandTask=Expanding module {0}...
-publishProjectTask=Publishing project {0}...
publisherPublishTask=Publishing {0}...
-publisherDeleteTask=Deleting {0}...
tomcatLaunchConfigurationType=Apache Tomcat
@@ -114,41 +97,28 @@
configurationEditorActionEditWebModuleDescription=Change Web module path from {0} to {1}
# --------------- General ---------------
-startingServer=Starting Tomcat server {0}. Debugging is disabled and breakpoints will be ignored.
-debuggingServer=Starting Tomcat server {0} in debug mode. Breakpoints are enabled.
-profilingServer=Starting Tomcat server {0}. Profiling is enabled and debugging has been disabled.
-errorInvalidConfiguration=Invalid server configuration
canAddModule=Web module can be added to the server.
canModifyModules=Web modules can be modified.
# --------------- Errors and Info ---------------
-errorTitle=Tomcat Error
errorInstallDir=The Tomcat installation directory is not correct. Edit the server and change the installation directory.
errorJRE=The JRE could not be found. Edit the server and change the JRE location.
errorPortInUse=Port {0} required by {1} is already in use.
-errorCouldNotLaunch=Tomcat could not be launched successfully.
-errorCouldNotFindDebugPort=Could not find a valid port for debugging.
-errorCouldNotLoadServer=Could not find a valid Tomcat server at the specified location.
errorCouldNotLoadConfiguration=Could not find a valid Tomcat server configuration at the specified location.
-errorCouldNotSaveServer=Could not save the Tomcat server: {0}.
errorCouldNotSaveConfiguration=Could not save the Tomcat server configuration: {0}.
errorPublishConfiguration=Could not publish server configuration: {0}.
errorWebModulesOnly=Tomcat only supports running J2EE Web modules.
-errorCancelled=Cancelled
errorSpec32=Tomcat version 3.2 only supports J2EE 1.2 Web modules
errorSpec40=Tomcat version 4.0 only supports J2EE 1.2 and 1.3 Web modules
errorSpec41=Tomcat version 4.1 only supports J2EE 1.2 and 1.3 Web modules
errorSpec50=Tomcat version 5.0 only supports J2EE 1.2 and 1.3 and 1.4 Web modules
errorSpec55=Tomcat version 5.5 only supports J2EE 1.2 and 1.3 and 1.4 Web modules
errorInstallDir=The Tomcat installation directory is not correct.
-errorJREDir=The JDK installation directory is not correct.
-errorRuntimeName=Enter a name for the runtime.
-errorDuplicateRuntimeName=Name is already in use.
-publishingStarted=Publishing started successfully
-publishingStopped=Publishing ended successfully
-
-infoPublishSuccess=Publishing was successful
-infoDefaultAvailable=A Tomcat server is available.
-
-projectCleanupSuccess=Old project {0} was removed successfully.
+# Actions (used in undo/redo menus)
+serverEditorActionSetSecure=set security
+serverEditorActionSetSecureDescription=Set the Tomcat security
+serverEditorActionSetDebugMode=set Tomcat debug mode
+serverEditorActionSetDebugModeDescription=Set Tomcat in debug mode
+serverEditorActionSetTestEnvironment=run modules from workspace
+serverEditorActionSetTestEnvironmentDescription=Run modules from the workspace
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/plugin.xml b/plugins/org.eclipse.jst.server.tomcat.core/plugin.xml
index e232912..c330f72 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/plugin.xml
+++ b/plugins/org.eclipse.jst.server.tomcat.core/plugin.xml
@@ -3,130 +3,108 @@
<plugin id="org.eclipse.jst.server.tomcat.core"
name="%pluginName"
- version="3.0.0"
+ version="1.0.0"
provider-name="%providerName"
class="org.eclipse.jst.server.tomcat.core.internal.TomcatPlugin">
<runtime>
<library name="tomcatcore.jar">
<export name="*"/>
- <packages prefixes="org.eclipse.jst.server.tomcat.core"/>
</library>
</runtime>
<requires>
- <import plugin="org.eclipse.core.runtime" />
- <import plugin="org.eclipse.core.resources" />
- <import plugin="org.eclipse.debug.core" />
- <import plugin="org.eclipse.jdt.core" />
- <import plugin="org.eclipse.jdt.debug" />
- <import plugin="org.eclipse.jdt.launching" />
- <import plugin="org.eclipse.wst.server.core" />
- <import plugin="org.eclipse.jst.server.core" />
+ <import plugin="org.eclipse.core.runtime"/>
+ <import plugin="org.eclipse.core.resources"/>
+ <import plugin="org.eclipse.debug.core"/>
+ <import plugin="org.eclipse.jdt.core"/>
+ <import plugin="org.eclipse.jdt.launching"/>
+ <import plugin="org.eclipse.wst.server.core"/>
+ <import plugin="org.eclipse.jst.server.core"/>
</requires>
<extension point="org.eclipse.wst.server.core.runtimeTypes">
<runtimeType
- id="org.eclipse.jst.server.tomcat.32.runtime"
+ id="org.eclipse.jst.server.tomcat.runtime.32"
name="%runtimeTypeTomcat32Label"
description="%runtimeTypeTomcat32Description"
vendor="%apache"
version="3.2"
order="50"
- class="org.eclipse.jst.server.tomcat.core.internal.TomcatRuntime"
- workingCopyClass="org.eclipse.jst.server.tomcat.core.internal.TomcatRuntimeWorkingCopy">
+ class="org.eclipse.jst.server.tomcat.core.internal.TomcatRuntime">
<moduleType
types="j2ee.web"
versions="1.2"/>
</runtimeType>
<runtimeType
- id="org.eclipse.jst.server.tomcat.40.runtime"
+ id="org.eclipse.jst.server.tomcat.runtime.40"
name="%runtimeTypeTomcat40Label"
description="%runtimeTypeTomcat40Description"
vendor="%apache"
version="4.0"
order="52"
- class="org.eclipse.jst.server.tomcat.core.internal.TomcatRuntime"
- workingCopyClass="org.eclipse.jst.server.tomcat.core.internal.TomcatRuntimeWorkingCopy">
+ class="org.eclipse.jst.server.tomcat.core.internal.TomcatRuntime">
<moduleType
types="j2ee.web"
versions="1.2, 1.3"/>
</runtimeType>
<runtimeType
- id="org.eclipse.jst.server.tomcat.41.runtime"
+ id="org.eclipse.jst.server.tomcat.runtime.41"
name="%runtimeTypeTomcat41Label"
description="%runtimeTypeTomcat41Description"
vendor="%apache"
version="4.1"
order="54"
- class="org.eclipse.jst.server.tomcat.core.internal.TomcatRuntime"
- workingCopyClass="org.eclipse.jst.server.tomcat.core.internal.TomcatRuntimeWorkingCopy">
+ class="org.eclipse.jst.server.tomcat.core.internal.TomcatRuntime">
<moduleType
types="j2ee.web"
versions="1.2, 1.3"/>
</runtimeType>
<runtimeType
- id="org.eclipse.jst.server.tomcat.50.runtime"
+ id="org.eclipse.jst.server.tomcat.runtime.50"
name="%runtimeTypeTomcat50Label"
description="%runtimeTypeTomcat50Description"
vendor="%apache"
version="5.0"
order="56"
- class="org.eclipse.jst.server.tomcat.core.internal.TomcatRuntime"
- workingCopyClass="org.eclipse.jst.server.tomcat.core.internal.TomcatRuntimeWorkingCopy">
+ class="org.eclipse.jst.server.tomcat.core.internal.TomcatRuntime">
<moduleType
types="j2ee.web"
versions="1.2, 1.3, 1.4"/>
</runtimeType>
<runtimeType
- id="org.eclipse.jst.server.tomcat.55.runtime"
+ id="org.eclipse.jst.server.tomcat.runtime.55"
name="%runtimeTypeTomcat55Label"
description="%runtimeTypeTomcat55Description"
vendor="%apache"
version="5.5"
order="58"
- class="org.eclipse.jst.server.tomcat.core.internal.TomcatRuntime"
- workingCopyClass="org.eclipse.jst.server.tomcat.core.internal.TomcatRuntimeWorkingCopy">
+ class="org.eclipse.jst.server.tomcat.core.internal.TomcatRuntime">
<moduleType
types="j2ee.web"
versions="1.2, 1.3, 1.4"/>
</runtimeType>
</extension>
-
+
<extension point="org.eclipse.wst.server.core.runtimeLocators">
<runtimeLocator
id="org.eclipse.jst.server.tomcat.runtime.locator"
name="%runtimeLocatorLabel"
description="%runtimeLocatorDescription"
+ typeIds="org.eclipse.jst.server.tomcat.runtime.*"
class="org.eclipse.jst.server.tomcat.core.internal.TomcatRuntimeLocator"/>
</extension>
-
+
<extension point="org.eclipse.wst.server.core.runtimeTargetHandlers">
<runtimeTargetHandler
- id="org.eclipse.jst.server.tomcat.runtimeTarget.v32"
- runtimeTypeIds="org.eclipse.jst.server.tomcat.32.runtime"
- class="org.eclipse.jst.server.tomcat.core.internal.Tomcat32RuntimeTargetHandler"/>
- <runtimeTargetHandler
- id="org.eclipse.jst.server.tomcat.runtimeTarget.v40"
- runtimeTypeIds="org.eclipse.jst.server.tomcat.40.runtime"
- class="org.eclipse.jst.server.tomcat.core.internal.Tomcat40RuntimeTargetHandler"/>
- <runtimeTargetHandler
- id="org.eclipse.jst.server.tomcat.runtimeTarget.v41"
- runtimeTypeIds="org.eclipse.jst.server.tomcat.41.runtime"
- class="org.eclipse.jst.server.tomcat.core.internal.Tomcat41RuntimeTargetHandler"/>
- <runtimeTargetHandler
- id="org.eclipse.jst.server.tomcat.runtimeTarget.v50"
- runtimeTypeIds="org.eclipse.jst.server.tomcat.50.runtime"
- class="org.eclipse.jst.server.tomcat.core.internal.Tomcat50RuntimeTargetHandler"/>
- <runtimeTargetHandler
- id="org.eclipse.jst.server.tomcat.runtimeTarget.v55"
- runtimeTypeIds="org.eclipse.jst.server.tomcat.55.runtime"
- class="org.eclipse.jst.server.tomcat.core.internal.Tomcat55RuntimeTargetHandler"/>
+ id="org.eclipse.jst.server.tomcat.runtimeTarget"
+ runtimeTypeIds="org.eclipse.jst.server.tomcat.runtime.*"
+ class="org.eclipse.jst.server.tomcat.core.internal.TomcatRuntimeTargetHandler"/>
</extension>
<extension point="org.eclipse.wst.server.core.serverTypes">
@@ -134,144 +112,107 @@
id="org.eclipse.jst.server.tomcat.32"
name="%tomcat32ServerType"
description="%tomcat32ServerDescription"
- hosts="localhost"
+ supportsRemoteHosts="false"
runtime="true"
order="50"
- monitorable="true"
+ startTimeout="45000"
+ stopTimeout="15000"
initialState="stopped"
- configurationTypeId="org.eclipse.jst.server.tomcat.32"
+ hasConfiguration="true"
launchConfigId="org.eclipse.jst.server.tomcat.core.launchConfigurationType"
- runtimeTypeId="org.eclipse.jst.server.tomcat.32.runtime"
+ runtimeTypeId="org.eclipse.jst.server.tomcat.runtime.32"
class="org.eclipse.jst.server.tomcat.core.internal.TomcatServer"
- workingCopyClass="org.eclipse.jst.server.tomcat.core.internal.TomcatServerWorkingCopy">
+ behaviourClass="org.eclipse.jst.server.tomcat.core.internal.TomcatServerBehaviour">
</serverType>
<serverType
id="org.eclipse.jst.server.tomcat.40"
name="%tomcat40ServerType"
description="%tomcat40ServerDescription"
- hosts="localhost"
+ supportsRemoteHosts="false"
runtime="true"
order="52"
- monitorable="true"
+ startTimeout="45000"
+ stopTimeout="15000"
initialState="stopped"
- configurationTypeId="org.eclipse.jst.server.tomcat.40"
+ hasConfiguration="true"
launchConfigId="org.eclipse.jst.server.tomcat.core.launchConfigurationType"
- runtimeTypeId="org.eclipse.jst.server.tomcat.40.runtime"
+ runtimeTypeId="org.eclipse.jst.server.tomcat.runtime.40"
class="org.eclipse.jst.server.tomcat.core.internal.TomcatServer"
- workingCopyClass="org.eclipse.jst.server.tomcat.core.internal.TomcatServerWorkingCopy">
+ behaviourClass="org.eclipse.jst.server.tomcat.core.internal.TomcatServerBehaviour">
</serverType>
<serverType
id="org.eclipse.jst.server.tomcat.41"
name="%tomcat41ServerType"
description="%tomcat41ServerDescription"
- hosts="localhost"
+ supportsRemoteHosts="false"
runtime="true"
order="54"
- monitorable="true"
+ startTimeout="45000"
+ stopTimeout="15000"
initialState="stopped"
- configurationTypeId="org.eclipse.jst.server.tomcat.41"
+ hasConfiguration="true"
launchConfigId="org.eclipse.jst.server.tomcat.core.launchConfigurationType"
- runtimeTypeId="org.eclipse.jst.server.tomcat.41.runtime"
+ runtimeTypeId="org.eclipse.jst.server.tomcat.runtime.41"
class="org.eclipse.jst.server.tomcat.core.internal.TomcatServer"
- workingCopyClass="org.eclipse.jst.server.tomcat.core.internal.TomcatServerWorkingCopy">
+ behaviourClass="org.eclipse.jst.server.tomcat.core.internal.TomcatServerBehaviour">
</serverType>
<serverType
id="org.eclipse.jst.server.tomcat.50"
name="%tomcat50ServerType"
description="%tomcat50ServerDescription"
- hosts="localhost"
+ supportsRemoteHosts="false"
runtime="true"
order="56"
- monitorable="true"
+ startTimeout="45000"
+ stopTimeout="15000"
initialState="stopped"
- configurationTypeId="org.eclipse.jst.server.tomcat.50"
+ hasConfiguration="true"
launchConfigId="org.eclipse.jst.server.tomcat.core.launchConfigurationType"
- runtimeTypeId="org.eclipse.jst.server.tomcat.50.runtime"
+ runtimeTypeId="org.eclipse.jst.server.tomcat.runtime.50"
class="org.eclipse.jst.server.tomcat.core.internal.TomcatServer"
- workingCopyClass="org.eclipse.jst.server.tomcat.core.internal.TomcatServerWorkingCopy">
+ behaviourClass="org.eclipse.jst.server.tomcat.core.internal.TomcatServerBehaviour">
</serverType>
<serverType
id="org.eclipse.jst.server.tomcat.55"
name="%tomcat55ServerType"
description="%tomcat55ServerDescription"
- hosts="localhost"
+ supportsRemoteHosts="false"
runtime="true"
order="58"
- monitorable="true"
+ startTimeout="45000"
+ stopTimeout="15000"
initialState="stopped"
- configurationTypeId="org.eclipse.jst.server.tomcat.55"
+ hasConfiguration="true"
launchConfigId="org.eclipse.jst.server.tomcat.core.launchConfigurationType"
- runtimeTypeId="org.eclipse.jst.server.tomcat.55.runtime"
+ runtimeTypeId="org.eclipse.jst.server.tomcat.runtime.55"
class="org.eclipse.jst.server.tomcat.core.internal.TomcatServer"
- workingCopyClass="org.eclipse.jst.server.tomcat.core.internal.TomcatServerWorkingCopy">
+ behaviourClass="org.eclipse.jst.server.tomcat.core.internal.TomcatServerBehaviour">
</serverType>
- </extension>
-
- <extension point="org.eclipse.wst.server.core.serverLocators">
+ </extension>
+
+ <extension point="org.eclipse.wst.server.core.serverLocators">
<serverLocator
id="org.eclipse.jst.server.tomcat.server.locator"
name="%serverLocatorLabel"
description="%serverLocatorDescription"
- hosts="local"
+ supportsRemoteHosts="false"
+ typeIds="org.eclipse.jst.server.tomcat.*"
class="org.eclipse.jst.server.tomcat.core.internal.TomcatServerLocator"/>
</extension>
-
- <extension point="org.eclipse.wst.server.core.serverConfigurationTypes">
- <serverConfigurationType
- id="org.eclipse.jst.server.tomcat.32"
- name="%tomcat32ConfigurationType"
- description="%tomcat32ConfigurationDescription"
- isFolder="true"
- class="org.eclipse.jst.server.tomcat.core.internal.Tomcat32Configuration"
- workingCopyClass="org.eclipse.jst.server.tomcat.core.internal.Tomcat32ConfigurationWorkingCopy">
- </serverConfigurationType>
- <serverConfigurationType
- id="org.eclipse.jst.server.tomcat.40"
- name="%tomcat40ConfigurationType"
- description="%tomcat40ConfigurationDescription"
- isFolder="true"
- class="org.eclipse.jst.server.tomcat.core.internal.Tomcat40Configuration"
- workingCopyClass="org.eclipse.jst.server.tomcat.core.internal.Tomcat40ConfigurationWorkingCopy">
- </serverConfigurationType>
- <serverConfigurationType
- id="org.eclipse.jst.server.tomcat.41"
- name="%tomcat41ConfigurationType"
- description="%tomcat41ConfigurationDescription"
- isFolder="true"
- class="org.eclipse.jst.server.tomcat.core.internal.Tomcat41Configuration"
- workingCopyClass="org.eclipse.jst.server.tomcat.core.internal.Tomcat41ConfigurationWorkingCopy">
- </serverConfigurationType>
- <serverConfigurationType
- id="org.eclipse.jst.server.tomcat.50"
- name="%tomcat50ConfigurationType"
- description="%tomcat50ConfigurationDescription"
- isFolder="true"
- class="org.eclipse.jst.server.tomcat.core.internal.Tomcat50Configuration"
- workingCopyClass="org.eclipse.jst.server.tomcat.core.internal.Tomcat50ConfigurationWorkingCopy">
- </serverConfigurationType>
- <serverConfigurationType
- id="org.eclipse.jst.server.tomcat.55"
- name="%tomcat55ConfigurationType"
- description="%tomcat55ConfigurationDescription"
- isFolder="true"
- class="org.eclipse.jst.server.tomcat.core.internal.Tomcat55Configuration"
- workingCopyClass="org.eclipse.jst.server.tomcat.core.internal.Tomcat55ConfigurationWorkingCopy">
- </serverConfigurationType>
- </extension>
- <extension point="org.eclipse.wst.server.core.launchableAdapters">
- <launchableAdapter
- class="org.eclipse.jst.server.tomcat.core.internal.TomcatLaunchableAdapterDelegate"
- id="org.eclipse.jst.server.tomcat.web"/>
- </extension>
+ <extension point="org.eclipse.wst.server.core.launchableAdapters">
+ <launchableAdapter
+ class="org.eclipse.jst.server.tomcat.core.internal.TomcatLaunchableAdapterDelegate"
+ id="org.eclipse.jst.server.tomcat.web"/>
+ </extension>
- <extension point="org.eclipse.debug.core.sourcePathComputers">
+ <extension point="org.eclipse.debug.core.sourcePathComputers">
<sourcePathComputer
id="org.eclipse.jst.server.tomcat.core.sourcePathComputer"
class="org.eclipse.jst.server.tomcat.core.internal.TomcatSourcePathComputerDelegate"/>
- </extension>
+ </extension>
- <extension point="org.eclipse.debug.core.launchConfigurationTypes">
+ <extension point="org.eclipse.debug.core.launchConfigurationTypes">
<launchConfigurationType
id="org.eclipse.jst.server.tomcat.core.launchConfigurationType"
name="%tomcatLaunchConfigurationType"
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/IMimeMapping.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/IMimeMapping.java
index e269443..54badf5 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/IMimeMapping.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/IMimeMapping.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,19 +8,22 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core;
/**
*
*/
public interface IMimeMapping {
/**
* Returns the extension.
- * @return java.lang.String
+ *
+ * @return the extension
*/
public String getExtension();
/**
* Returns the mime type.
- * @return java.lang.String
+ *
+ * @return the mime type
*/
public String getMimeType();
}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/ITomcatConfiguration.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/ITomcatConfiguration.java
index e0a2b4b..fbb6ca1 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/ITomcatConfiguration.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/ITomcatConfiguration.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,29 +8,31 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
-import java.util.List;
+package org.eclipse.jst.server.tomcat.core;
-import org.eclipse.wst.server.core.model.IServerConfigurationDelegate;
+import java.util.List;
/**
*
*/
-public interface ITomcatConfiguration extends IServerConfigurationDelegate {
+public interface ITomcatConfiguration {
/**
* Returns a list of mime mappings.
- * @return java.util.List
+ *
+ * @return mime mappings
*/
public List getMimeMappings();
/**
* Returns a list of ServerPorts that this configuration uses.
*
- * @return java.util.List
+ * @return the server ports
*/
public List getServerPorts();
/**
* Return a list of the web modules in this server.
- * @return java.util.List
+ *
+ * @return the web modules
*/
public List getWebModules();
-}
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/ITomcatConfigurationWorkingCopy.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/ITomcatConfigurationWorkingCopy.java
index 3028367..1f73e3b 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/ITomcatConfigurationWorkingCopy.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/ITomcatConfigurationWorkingCopy.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,9 +8,9 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
-import org.eclipse.wst.server.core.model.IServerConfigurationWorkingCopyDelegate;
+package org.eclipse.jst.server.tomcat.core;
-public interface ITomcatConfigurationWorkingCopy extends ITomcatConfiguration, IServerConfigurationWorkingCopyDelegate {
+public interface ITomcatConfigurationWorkingCopy extends ITomcatConfiguration {
/**
* Add a web module.
*
@@ -22,6 +21,7 @@
/**
* Change a web module.
+ *
* @param index int
* @param docBase java.lang.String
* @param path java.lang.String
@@ -30,7 +30,8 @@
public void modifyWebModule(int index, String docBase, String path, boolean reloadable);
/**
- * Removes a web module.
+ * Remove a web module.
+ *
* @param index int
*/
public void removeWebModule(int index);
@@ -45,6 +46,7 @@
/**
* Change a mime mapping.
+ *
* @param index int
* @param map MimeMapping
*/
@@ -59,8 +61,9 @@
public void modifyServerPort(String id, int port);
/**
- * Removes a mime mapping.
+ * Remove a mime mapping.
+ *
* @param index int
*/
public void removeMimeMapping(int index);
-}
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/ITomcatRuntime.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/ITomcatRuntime.java
index 203ef25..8386a7e 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/ITomcatRuntime.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/ITomcatRuntime.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,20 +8,26 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core;
+
import java.util.List;
import org.eclipse.jdt.launching.IVMInstall;
-
-import org.eclipse.wst.server.core.model.IRuntimeDelegate;
/**
*
*/
-public interface ITomcatRuntime extends IRuntimeDelegate {
- public String getVMInstallTypeId();
-
- public String getVMInstallId();
-
+public interface ITomcatRuntime {
+ /**
+ * Return the VM install (installed JRE) that this runtime is using.
+ *
+ * @return the current VM install
+ */
public IVMInstall getVMInstall();
-
+
+ /**
+ * Returns the runtime classpath that is used by this runtime.
+ *
+ * @return the runtime classpath
+ */
public List getRuntimeClasspath();
}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/ITomcatRuntimeWorkingCopy.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/ITomcatRuntimeWorkingCopy.java
index 2be3301..e11b214 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/ITomcatRuntimeWorkingCopy.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/ITomcatRuntimeWorkingCopy.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,10 +8,18 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
-import org.eclipse.wst.server.core.model.IRuntimeWorkingCopyDelegate;
+package org.eclipse.jst.server.tomcat.core;
+
+import org.eclipse.jdt.launching.IVMInstall;
+
/**
*
*/
-public interface ITomcatRuntimeWorkingCopy extends ITomcatRuntime, IRuntimeWorkingCopyDelegate {
- public void setVMInstall(String typeId, String id);
+public interface ITomcatRuntimeWorkingCopy extends ITomcatRuntime {
+ /**
+ * Set the VM install (installed JRE) that this runtime is using.
+ *
+ * @param vmInstall the VM install to use
+ */
+ public void setVMInstall(IVMInstall vmInstall);
}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/ITomcatServer.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/ITomcatServer.java
index d22ca1c..66352ca 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/ITomcatServer.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/ITomcatServer.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,23 +8,20 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.model.IProcess;
+package org.eclipse.jst.server.tomcat.core;
-import org.eclipse.wst.server.core.model.IServerDelegate;
import org.eclipse.wst.server.core.model.IURLProvider;
/**
*
*/
-public interface ITomcatServer extends IServerDelegate, IURLProvider {
+public interface ITomcatServer extends IURLProvider {
public static final String PROPERTY_SECURE = "secure";
public static final String PROPERTY_DEBUG = "debug";
public static final String PROPERTY_TEST_ENVIRONMENT = "testEnvironment";
/**
- * Returns true if the process is set to run in debug mode.
+ * Returns <code>true</code> if the server is set to run in Tomcat debug mode, and
+ * <code>false</code> otherwise.
* This feature only works with Tomcat v4.0.
*
* @return boolean
@@ -38,36 +34,26 @@
* @return boolean
*/
public boolean isSecure();
-
+
/**
- * Returns true if this is a test (run code out of the workbench) environment server.
+ * Returns true if this is a test (publish and run code out of the
+ * workbench) environment server.
*
* @return boolean
*/
public boolean isTestEnvironment();
-
+
/**
* Returns the main class that is used to launch the Tomcat server.
*
* @return
*/
public String getRuntimeClass();
-
- /**
- * Set the process that is monitored for Tomcat startup and shutdown.
- * Warning: Do not call this method unless you know what you're doing;
- * it should only be used in rare cases.
- *
- * @param newProcess
- */
- public void setProcess(IProcess newProcess);
/**
- * Setup for starting the server.
+ * Return the Tomcat configuration model.
*
- * @param launch ILaunch
- * @param launchMode String
- * @param monitor IProgressMonitor
+ * @return
*/
- public void setupLaunch(ILaunch launch, String launchMode, IProgressMonitor monitor) throws CoreException;
+ public ITomcatConfiguration getServerConfiguration();
}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/ITomcatServerBehaviour.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/ITomcatServerBehaviour.java
new file mode 100644
index 0000000..4c51a08
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/ITomcatServerBehaviour.java
@@ -0,0 +1,45 @@
+/**********************************************************************
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.jst.server.tomcat.core;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.model.IProcess;
+/**
+ *
+ */
+public interface ITomcatServerBehaviour {
+ /**
+ * Returns the main class that is used to launch the Tomcat server.
+ *
+ * @return
+ */
+ public String getRuntimeClass();
+
+ /**
+ * Set the process that is monitored for Tomcat startup and shutdown.
+ * Warning: Do not call this method unless you know what you're doing;
+ * it should only be used in rare cases.
+ *
+ * @param newProcess
+ */
+ public void setProcess(IProcess newProcess);
+
+ /**
+ * Setup for starting the server.
+ *
+ * @param launch ILaunch
+ * @param launchMode String
+ * @param monitor IProgressMonitor
+ */
+ public void setupLaunch(ILaunch launch, String launchMode, IProgressMonitor monitor) throws CoreException;
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/ITomcatServerWorkingCopy.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/ITomcatServerWorkingCopy.java
index 2d54aa4..b8a09c4 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/ITomcatServerWorkingCopy.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/ITomcatServerWorkingCopy.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,13 +8,13 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
-import org.eclipse.wst.server.core.model.IServerWorkingCopyDelegate;
+package org.eclipse.jst.server.tomcat.core;
/**
*
*/
-public interface ITomcatServerWorkingCopy extends ITomcatServer, IServerWorkingCopyDelegate {
+public interface ITomcatServerWorkingCopy extends ITomcatServer {
/**
- * Sets this process to debug mode. This feature only works
+ * Sets this process to Tomcat debug mode. This feature only works
* with Tomcat v4.0 and above.
*
* @param b boolean
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/ITomcatWebModule.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/ITomcatWebModule.java
index 5edf606..edc32b3 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/ITomcatWebModule.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/ITomcatWebModule.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,8 +8,9 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core;
/**
- *
+ * A Web module deployed on Tomcat.
*/
public interface ITomcatWebModule {
/**
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/WebModule.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/WebModule.java
index 8bb2640..5f41129 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/WebModule.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/WebModule.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,6 +8,7 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core;
/**
* A Web module.
*/
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/ITomcatVersionHandler.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/ITomcatVersionHandler.java
index caddc6f..9bc75ad 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/ITomcatVersionHandler.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/ITomcatVersionHandler.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,12 +8,13 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal;
+
import java.util.List;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jst.server.j2ee.IWebModule;
-
/**
*
*/
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/MimeMapping.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/MimeMapping.java
index 6954b41..0afd4a6 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/MimeMapping.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/MimeMapping.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,6 +8,8 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal;
+
import org.eclipse.jst.server.tomcat.core.IMimeMapping;
/**
* A mime mapping.
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/PingThread.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/PingThread.java
deleted file mode 100644
index 89802ae..0000000
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/PingThread.java
+++ /dev/null
@@ -1,110 +0,0 @@
-package org.eclipse.jst.server.tomcat.core.internal;
-/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- **********************************************************************/
-import java.io.FileNotFoundException;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.net.URLConnection;
-
-import org.eclipse.debug.core.ILaunchManager;
-
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.IServerState;
-/**
- * Thread used to ping server to test when it is started.
- */
-public class PingThread extends Thread {
- // delay before pinging starts
- private static final int PING_DELAY = 2000;
-
- // delay between pings
- private static final int PING_INTERVAL = 250;
-
- // maximum number of pings before giving up
- private static final int MAX_PINGS = 56; // total: 16 seconds
-
- private boolean stop = false;
- private String mode;
- private String url = "";
- private TomcatServer serverType;
- private IServerState control;
-
- public PingThread(TomcatServer serverType, IServerState control, String url, String mode) { super();
- this.control = control;
- this.url = url;
- this.mode = mode;
- this.serverType = serverType;
- setDaemon(true);
- }
-
- /**
- * Ping the server until it is started. Then set the server
- * state to SERVER_STARTED.
- */
- public void run() {
- int count = 0;
- try {
- sleep(PING_DELAY);
- } catch (Exception e) { }
- while (!stop) {
- try {
- if (count == MAX_PINGS) {
- serverType.stop();
- stop = true;
- break;
- }
- Trace.trace(Trace.FINEST, "Ping: pinging");
- URL pingUrl = new URL(url);
- URLConnection conn = pingUrl.openConnection();
- ((HttpURLConnection)conn).getResponseCode();
- count++;
-
- // ping worked - server is up
- if (!stop) {
- Trace.trace(Trace.FINEST, "Ping: success");
- Thread.sleep(200);
- if (ILaunchManager.DEBUG_MODE.equals(mode))
- control.setServerState(IServer.SERVER_STARTED_DEBUG);
- else if (ILaunchManager.PROFILE_MODE.equals(mode))
- control.setServerState(IServer.SERVER_STARTED_PROFILE);
- else
- control.setServerState(IServer.SERVER_STARTED);
- }
- stop = true;
- } catch (FileNotFoundException fe) {
- try { Thread.sleep(200); } catch (Exception e) { }
- if (ILaunchManager.DEBUG_MODE.equals(mode))
- control.setServerState(IServer.SERVER_STARTED_DEBUG);
- else if (ILaunchManager.PROFILE_MODE.equals(mode))
- control.setServerState(IServer.SERVER_STARTED_PROFILE);
- else
- control.setServerState(IServer.SERVER_STARTED);
- stop = true;
- } catch (Exception e) {
- Trace.trace(Trace.FINEST, "Ping: failed");
- // pinging failed
- if (!stop) {
- try {
- sleep(PING_INTERVAL);
- } catch (InterruptedException e2) { }
- }
- }
- }
- }
-
- /**
- * Tell the pinging to stop.
- */
- public void stopPinging() {
- //Trace.trace("Ping: stopping");
- stop = true;
- }
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/ProgressUtil.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/ProgressUtil.java
new file mode 100644
index 0000000..85bdce2
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/ProgressUtil.java
@@ -0,0 +1,68 @@
+/**********************************************************************
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal;
+
+import org.eclipse.core.runtime.*;
+/**
+ * Progress Monitor utility.
+ */
+public class ProgressUtil {
+ /**
+ * ProgressUtil constructor comment.
+ */
+ private ProgressUtil() {
+ super();
+ }
+
+ /**
+ * Return a valid progress monitor.
+ *
+ * @param monitor org.eclipse.core.runtime.IProgressMonitor
+ * @return org.eclipse.core.runtime.IProgressMonitor
+ */
+ public static IProgressMonitor getMonitorFor(IProgressMonitor monitor) {
+ if (monitor == null)
+ return new NullProgressMonitor();
+ return monitor;
+ }
+
+ /**
+ * Return a sub-progress monitor with the given amount on the
+ * current progress monitor.
+ *
+ * @param monitor org.eclipse.core.runtime.IProgressMonitor
+ * @param ticks int
+ * @return org.eclipse.core.runtime.IProgressMonitor
+ */
+ public static IProgressMonitor getSubMonitorFor(IProgressMonitor monitor, int ticks) {
+ if (monitor == null)
+ return new NullProgressMonitor();
+ if (monitor instanceof NullProgressMonitor)
+ return monitor;
+ return new SubProgressMonitor(monitor, ticks);
+ }
+
+ /**
+ * Return a sub-progress monitor with the given amount on the
+ * current progress monitor.
+ *
+ * @param monitor org.eclipse.core.runtime.IProgressMonitor
+ * @param ticks int
+ * @return org.eclipse.core.runtime.IProgressMonitor
+ */
+ public static IProgressMonitor getSubMonitorFor(IProgressMonitor monitor, int ticks, int style) {
+ if (monitor == null)
+ return new NullProgressMonitor();
+ if (monitor instanceof NullProgressMonitor)
+ return monitor;
+ return new SubProgressMonitor(monitor, ticks, style);
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.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 2da373b..c057d77 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
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,6 +8,8 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal;
+
import java.io.*;
import java.util.ArrayList;
import java.util.Iterator;
@@ -17,6 +18,8 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.*;
+import org.eclipse.jst.server.tomcat.core.IMimeMapping;
+import org.eclipse.jst.server.tomcat.core.ITomcatWebModule;
import org.eclipse.jst.server.tomcat.core.WebModule;
import org.eclipse.jst.server.tomcat.core.internal.xml.Factory;
import org.eclipse.jst.server.tomcat.core.internal.xml.XMLUtil;
@@ -28,8 +31,8 @@
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
-import org.eclipse.wst.server.core.model.IServerPort;
-import org.eclipse.wst.server.core.util.ProgressUtil;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.IServerPort;
import org.eclipse.wst.server.core.util.ServerPort;
/**
* Tomcat v3.2 server configuration.
@@ -54,8 +57,8 @@
/**
* Tomcat32Configuration constructor comment.
*/
- public Tomcat32Configuration() {
- super();
+ public Tomcat32Configuration(IFolder path) {
+ super(path);
}
/**
@@ -449,4 +452,178 @@
throw new CoreException(new Status(IStatus.ERROR, TomcatPlugin.PLUGIN_ID, 0, TomcatPlugin.getResource("%errorCouldNotSaveConfiguration", new String[] {e.getLocalizedMessage()}), e));
}
}
-}
+
+
+ /**
+ * Adds a mime mapping.
+ * @param map MimeMapping
+ */
+ public void addMimeMapping(int index, IMimeMapping map) {
+ webAppDocument.addMimeMapping(index, map);
+ firePropertyChangeEvent(ADD_MAPPING_PROPERTY, new Integer(index), map);
+ }
+
+ /**
+ * Add a web module.
+ * @param module org.eclipse.jst.server.tomcat.WebModule
+ */
+ public void addWebModule(int index, ITomcatWebModule module) {
+ try {
+ ContextManager contextManager = server.getContextManager();
+ Context context = (Context) contextManager.createElement(index, "Context");
+
+ context.setPath(module.getPath());
+ context.setDocBase(module.getDocumentBase());
+ context.setReloadable(module.isReloadable() ? "true" : "false");
+ if (module.getMemento() != null && module.getMemento().length() > 0)
+ context.setSource(module.getMemento());
+ isServerDirty = true;
+ firePropertyChangeEvent(ADD_WEB_MODULE_PROPERTY, null, module);
+ } catch (Exception e) {
+ Trace.trace("Error adding web module", e);
+ }
+ }
+
+ /**
+ * Localize the web projects in this configuration.
+ *
+ * @param file java.io.File
+ * @param monitor org.eclipse.core.runtime.IProgressMonitor
+ */
+ public void localizeConfiguration(IPath path, TomcatServer serverType, IRuntime runtime, IProgressMonitor monitor) {
+ try {
+ monitor = ProgressUtil.getMonitorFor(monitor);
+ monitor.beginTask(TomcatPlugin.getResource("%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());
+ 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("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 int
+ * @param newExtension java.lang.String
+ */
+ public void modifyMimeMapping(int index, IMimeMapping map) {
+ webAppDocument.modifyMimeMapping(index, map);
+ firePropertyChangeEvent(MODIFY_MAPPING_PROPERTY, new Integer(index), map);
+ }
+
+ /**
+ * Modify the port with the given id.
+ *
+ * @param id java.lang.String
+ * @param port int
+ */
+ public void modifyServerPort(String id, int port) {
+ try {
+ int con = Integer.parseInt(id);
+ Connector connector = server.getContextManager().getConnector(con);
+
+ int size = connector.getParameterCount();
+ for (int i = 0; i < size; i++) {
+ Parameter p = connector.getParameter(i);
+ if ("port".equals(p.getName())) {
+ p.setValue(port + "");
+ isServerDirty = true;
+ firePropertyChangeEvent(MODIFY_PORT_PROPERTY, id, new Integer(port));
+ return;
+ }
+ }
+ } catch (Exception e) {
+ Trace.trace("Error modifying server port " + id, e);
+ }
+ }
+
+ /**
+ * Change a web module.
+ * @param index int
+ * @param docBase java.lang.String
+ * @param path java.lang.String
+ * @param reloadable boolean
+ */
+ public void modifyWebModule(int index, String docBase, String path, boolean reloadable) {
+ try {
+ ContextManager contextManager = server.getContextManager();
+ Context context = contextManager.getContext(index);
+ context.setPath(path);
+ context.setDocBase(docBase);
+ context.setReloadable(reloadable ? "true" : "false");
+ isServerDirty = true;
+ WebModule module = new WebModule(path, docBase, null, reloadable);
+ firePropertyChangeEvent(MODIFY_WEB_MODULE_PROPERTY, new Integer(index), module);
+ } catch (Exception e) {
+ Trace.trace("Error modifying web module " + index, e);
+ }
+ }
+
+ /**
+ * Removes a mime mapping.
+ * @param index int
+ */
+ public void removeMimeMapping(int index) {
+ webAppDocument.removeMimeMapping(index);
+ firePropertyChangeEvent(REMOVE_MAPPING_PROPERTY, null, new Integer(index));
+ }
+
+ /**
+ * Removes a web module.
+ * @param index int
+ */
+ public void removeWebModule(int index) {
+ try {
+ ContextManager contextManager = server.getContextManager();
+ contextManager.removeElement("Context", index);
+ isServerDirty = true;
+ firePropertyChangeEvent(REMOVE_WEB_MODULE_PROPERTY, null, new Integer(index));
+ } catch (Exception e) {
+ Trace.trace("Error removing web module " + index, e);
+ }
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat32ConfigurationWorkingCopy.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat32ConfigurationWorkingCopy.java
deleted file mode 100644
index 823ff60..0000000
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat32ConfigurationWorkingCopy.java
+++ /dev/null
@@ -1,229 +0,0 @@
-package org.eclipse.jst.server.tomcat.core.internal;
-/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- **********************************************************************/
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jst.server.tomcat.core.IMimeMapping;
-import org.eclipse.jst.server.tomcat.core.ITomcatConfigurationWorkingCopy;
-import org.eclipse.jst.server.tomcat.core.ITomcatWebModule;
-import org.eclipse.jst.server.tomcat.core.WebModule;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server32.Connector;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server32.Context;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server32.ContextManager;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server32.Parameter;
-
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.IServerConfigurationWorkingCopy;
-import org.eclipse.wst.server.core.util.ProgressUtil;
-/**
- * Tomcat v3.2 server configuration.
- */
-public class Tomcat32ConfigurationWorkingCopy extends Tomcat32Configuration implements ITomcatConfigurationWorkingCopy {
- protected IServerConfigurationWorkingCopy wc;
-
- /**
- * Tomcat32Configuration constructor comment.
- */
- public Tomcat32ConfigurationWorkingCopy() {
- super();
- }
-
- public void initialize(IServerConfigurationWorkingCopy wc2) {
- this.wc = wc2;
- }
-
- public void setDefaults() { }
-
- public void handleSave(byte id, IProgressMonitor monitor) { }
-
- /**
- * Adds a mime mapping.
- * @param map MimeMapping
- */
- public void addMimeMapping(int index, IMimeMapping map) {
- webAppDocument.addMimeMapping(index, map);
- firePropertyChangeEvent(ADD_MAPPING_PROPERTY, new Integer(index), map);
- }
-
- /**
- * Add a web module.
- * @param module org.eclipse.jst.server.tomcat.WebModule
- */
- public void addWebModule(int index, ITomcatWebModule module) {
- try {
- ContextManager contextManager = server.getContextManager();
- Context context = (Context) contextManager.createElement(index, "Context");
-
- context.setPath(module.getPath());
- context.setDocBase(module.getDocumentBase());
- context.setReloadable(module.isReloadable() ? "true" : "false");
- if (module.getMemento() != null && module.getMemento().length() > 0)
- context.setSource(module.getMemento());
- isServerDirty = true;
- firePropertyChangeEvent(ADD_WEB_MODULE_PROPERTY, null, module);
- } catch (Exception e) {
- Trace.trace("Error adding web module", e);
- }
- }
-
- /**
- * Localize the web projects in this configuration.
- *
- * @param file java.io.File
- * @param monitor org.eclipse.core.runtime.IProgressMonitor
- */
- public void localizeConfiguration(IPath path, TomcatServer serverType, IRuntime runtime, IProgressMonitor monitor) {
- try {
- monitor = ProgressUtil.getMonitorFor(monitor);
- monitor.beginTask(TomcatPlugin.getResource("%updatingConfigurationTask"), 100);
-
- Tomcat32Configuration config = new Tomcat32Configuration();
- config.load(path, ProgressUtil.getSubMonitorFor(monitor, 30));
-
- if (monitor.isCanceled())
- return;
-
- if (serverType.isTestEnvironment()) {
- config.server.getContextManager().setHome(runtime.getLocation().toOSString());
- config.isServerDirty = true;
- } else {
- IServerConfigurationWorkingCopy scwc = config.getServerConfiguration().getWorkingCopy();
- ((Tomcat32ConfigurationWorkingCopy) scwc.getDelegate()).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("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 int
- * @param newExtension java.lang.String
- */
- public void modifyMimeMapping(int index, IMimeMapping map) {
- webAppDocument.modifyMimeMapping(index, map);
- firePropertyChangeEvent(MODIFY_MAPPING_PROPERTY, new Integer(index), map);
- }
-
- /**
- * Modify the port with the given id.
- *
- * @param id java.lang.String
- * @param port int
- */
- public void modifyServerPort(String id, int port) {
- try {
- int con = Integer.parseInt(id);
- Connector connector = server.getContextManager().getConnector(con);
-
- int size = connector.getParameterCount();
- for (int i = 0; i < size; i++) {
- Parameter p = connector.getParameter(i);
- if ("port".equals(p.getName())) {
- p.setValue(port + "");
- isServerDirty = true;
- firePropertyChangeEvent(MODIFY_PORT_PROPERTY, id, new Integer(port));
- return;
- }
- }
- } catch (Exception e) {
- Trace.trace("Error modifying server port " + id, e);
- }
- }
-
- /**
- * Change a web module.
- * @param index int
- * @param docBase java.lang.String
- * @param path java.lang.String
- * @param reloadable boolean
- */
- public void modifyWebModule(int index, String docBase, String path, boolean reloadable) {
- try {
- ContextManager contextManager = server.getContextManager();
- Context context = contextManager.getContext(index);
- context.setPath(path);
- context.setDocBase(docBase);
- context.setReloadable(reloadable ? "true" : "false");
- isServerDirty = true;
- WebModule module = new WebModule(path, docBase, null, reloadable);
- firePropertyChangeEvent(MODIFY_WEB_MODULE_PROPERTY, new Integer(index), module);
- } catch (Exception e) {
- Trace.trace("Error modifying web module " + index, e);
- }
- }
-
- /**
- * Removes a mime mapping.
- * @param index int
- */
- public void removeMimeMapping(int index) {
- webAppDocument.removeMimeMapping(index);
- firePropertyChangeEvent(REMOVE_MAPPING_PROPERTY, null, new Integer(index));
- }
-
- /**
- * Removes a web module.
- * @param index int
- */
- public void removeWebModule(int index) {
- try {
- ContextManager contextManager = server.getContextManager();
- contextManager.removeElement("Context", index);
- isServerDirty = true;
- firePropertyChangeEvent(REMOVE_WEB_MODULE_PROPERTY, null, new Integer(index));
- } catch (Exception e) {
- Trace.trace("Error removing web module " + index, e);
- }
- }
-
- public void importFromPath(IPath path, IProgressMonitor monitor) throws CoreException {
- load(path, monitor);
- }
-
- public void importFromRuntime(IRuntime runtime, IProgressMonitor monitor) throws CoreException {
- load(runtime.getLocation().append("conf"), monitor);
- }
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat32Handler.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat32Handler.java
index a2d63f8..656136c 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat32Handler.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat32Handler.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,6 +8,8 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal;
+
import java.io.File;
import java.util.ArrayList;
import java.util.List;
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat32RuntimeTargetHandler.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat32RuntimeTargetHandler.java
deleted file mode 100644
index 8559ee0..0000000
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat32RuntimeTargetHandler.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.eclipse.jst.server.tomcat.core.internal;
-/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- **********************************************************************/
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jdt.core.IClasspathEntry;
-
-import org.eclipse.wst.server.core.IRuntime;
-/**
- *
- */
-public class Tomcat32RuntimeTargetHandler extends TomcatRuntimeTargetHandler {
- public String getId() {
- return "org.eclipse.jst.server.tomcat.runtimeTarget.v32";
- }
-
- public String getLabel() {
- return TomcatPlugin.getResource("%target32runtime");
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.target.IServerTargetDelegate#getClasspathEntries()
- */
- public IClasspathEntry[] resolveClasspathContainer(IRuntime runtime) {
- IPath installPath = runtime.getLocation();
-
- if (installPath == null)
- return new IClasspathEntry[0];
-
- IPath path = installPath.append("lib");
- List list = new ArrayList();
- addLibraryEntries(list, path.toFile(), true);
-
- return resolveList(list);
- }
-}
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 2072415..3dc4210 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
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,6 +8,8 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal;
+
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.ByteArrayInputStream;
@@ -22,26 +23,18 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.*;
+import org.eclipse.jst.server.tomcat.core.IMimeMapping;
+import org.eclipse.jst.server.tomcat.core.ITomcatWebModule;
import org.eclipse.jst.server.tomcat.core.WebModule;
import org.eclipse.jst.server.tomcat.core.internal.xml.Factory;
import org.eclipse.jst.server.tomcat.core.internal.xml.XMLUtil;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Connector;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Context;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Engine;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Host;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Server;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Service;
+import org.eclipse.jst.server.tomcat.core.internal.xml.server40.*;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.InputSource;
-import org.eclipse.wst.server.core.model.IServerPort;
-import org.eclipse.wst.server.core.util.ProgressUtil;
+import org.eclipse.wst.server.core.IServerPort;
import org.eclipse.wst.server.core.util.ServerPort;
/**
* Tomcat v4.0 server configuration.
@@ -67,8 +60,8 @@
/**
* Tomcat40Configuration constructor comment.
*/
- public Tomcat40Configuration() {
- super();
+ public Tomcat40Configuration(IFolder path) {
+ super(path);
}
/**
@@ -133,7 +126,9 @@
try {
int port = Integer.parseInt(server.getPort());
ports.add(new ServerPort("server", "Server port", port, "TCPIP"));
- } catch (Exception e) { }
+ } catch (Exception e) {
+ // ignore
+ }
// add connectors
try {
@@ -151,7 +146,9 @@
int port = -1;
try {
port = Integer.parseInt(connector.getPort());
- } catch (Exception e) { }
+ } catch (Exception e) {
+ // ignore
+ }
if (HTTP_CONNECTOR.equals(className)) {
name = "HTTP Connector";
protocol = "HTTP";
@@ -163,7 +160,9 @@
name = "SSL Connector";
protocol = "SSL";
}
- } catch (Exception e) { }
+ } catch (Exception e) {
+ // ignore
+ }
if ("HTTP".equals(protocol))
advanced = false;
} else if (APACHE_CONNECTOR.equals(className))
@@ -440,4 +439,200 @@
throw new CoreException(new Status(IStatus.ERROR, TomcatPlugin.PLUGIN_ID, 0, TomcatPlugin.getResource("%errorCouldNotSaveConfiguration", new String[] {e.getLocalizedMessage()}), e));
}
}
-}
+
+ /**
+ * Adds a mime mapping.
+ * @param extension java.lang.String
+ * @param mimeType java.lang.String
+ */
+ public void addMimeMapping(int index, IMimeMapping map) {
+ webAppDocument.addMimeMapping(index, map);
+ firePropertyChangeEvent(ADD_MAPPING_PROPERTY, new Integer(index), map);
+ }
+
+ /**
+ * Add a web module.
+ * @param module org.eclipse.jst.server.tomcat.WebModule
+ */
+ public void addWebModule(int index, ITomcatWebModule module) {
+ try {
+ int size = server.getServiceCount();
+ for (int i = 0; i < size; i++) {
+ Service service = server.getService(i);
+ if (service.getName().equalsIgnoreCase(DEFAULT_SERVICE)) {
+ Engine engine = service.getEngine();
+ Host host = engine.getHost();
+ Context context = (Context) host.createElement(index, "Context");
+ context.setDocBase(module.getDocumentBase());
+ context.setPath(module.getPath());
+ context.setReloadable(module.isReloadable() ? "true" : "false");
+ if (module.getMemento() != null && module.getMemento().length() > 0)
+ context.setSource(module.getMemento());
+ isServerDirty = true;
+ firePropertyChangeEvent(ADD_WEB_MODULE_PROPERTY, null, module);
+ return;
+ }
+ }
+ } catch (Exception e) {
+ Trace.trace("Error adding web module " + module.getPath(), e);
+ }
+ }
+
+ /**
+ * Localize the web projects in this configuration.
+ *
+ * @param file java.io.File
+ * @param monitor org.eclipse.core.runtime.IProgressMonitor
+ */
+ public void localizeConfiguration(IPath path, TomcatServer server2, IProgressMonitor monitor) {
+ try {
+ monitor = ProgressUtil.getMonitorFor(monitor);
+ monitor.beginTask(TomcatPlugin.getResource("%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("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 int
+ * @param newExtension java.lang.String
+ */
+ public void modifyMimeMapping(int index, IMimeMapping map) {
+ webAppDocument.modifyMimeMapping(index, map);
+ firePropertyChangeEvent(MODIFY_MAPPING_PROPERTY, new Integer(index), map);
+ }
+
+ /**
+ * Modify the port with the given id.
+ *
+ * @param id java.lang.String
+ * @param port int
+ */
+ public void modifyServerPort(String id, int port) {
+ try {
+ if ("server".equals(id)) {
+ server.setPort(port + "");
+ isServerDirty = true;
+ firePropertyChangeEvent(MODIFY_PORT_PROPERTY, id, new Integer(port));
+ return;
+ }
+
+ int i = id.indexOf("/");
+ int servNum = Integer.parseInt(id.substring(0, i));
+ int connNum = Integer.parseInt(id.substring(i + 1));
+
+ Service service = server.getService(servNum);
+ Connector connector = service.getConnector(connNum);
+ connector.setPort(port + "");
+ isServerDirty = true;
+ firePropertyChangeEvent(MODIFY_PORT_PROPERTY, id, new Integer(port));
+ } catch (Exception e) {
+ Trace.trace("Error modifying server port " + id, e);
+ }
+ }
+ /**
+ * Change a web module.
+ * @param index int
+ * @param docBase java.lang.String
+ * @param path java.lang.String
+ * @param reloadable boolean
+ */
+ public void modifyWebModule(int index, String docBase, String path, boolean reloadable) {
+ try {
+ int size = server.getServiceCount();
+ for (int i = 0; i < size; i++) {
+ Service service = server.getService(i);
+ if (service.getName().equalsIgnoreCase(DEFAULT_SERVICE)) {
+ Engine engine = service.getEngine();
+ Host host = engine.getHost();
+ Context context = host.getContext(index);
+ context.setPath(path);
+ context.setDocBase(docBase);
+ context.setReloadable(reloadable ? "true" : "false");
+ isServerDirty = true;
+ WebModule module = new WebModule(path, docBase, null, reloadable);
+ firePropertyChangeEvent(MODIFY_WEB_MODULE_PROPERTY, new Integer(index), module);
+ return;
+ }
+ }
+ } catch (Exception e) {
+ Trace.trace("Error modifying web module " + index, e);
+ }
+ }
+
+ /**
+ * Removes a mime mapping.
+ * @param index int
+ */
+ public void removeMimeMapping(int index) {
+ webAppDocument.removeMimeMapping(index);
+ firePropertyChangeEvent(REMOVE_MAPPING_PROPERTY, null, new Integer(index));
+ }
+
+ /**
+ * Removes a web module.
+ * @param index int
+ */
+ public void removeWebModule(int index) {
+ try {
+ int size = server.getServiceCount();
+ for (int i = 0; i < size; i++) {
+ Service service = server.getService(i);
+ if (service.getName().equalsIgnoreCase(DEFAULT_SERVICE)) {
+ Engine engine = service.getEngine();
+ Host host = engine.getHost();
+ host.removeElement("Context", index);
+ isServerDirty = true;
+ firePropertyChangeEvent(REMOVE_WEB_MODULE_PROPERTY, null, new Integer(index));
+ return;
+ }
+ }
+ } catch (Exception e) {
+ Trace.trace("Error removing module ref " + index, e);
+ }
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat40ConfigurationWorkingCopy.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat40ConfigurationWorkingCopy.java
deleted file mode 100644
index 999948a..0000000
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat40ConfigurationWorkingCopy.java
+++ /dev/null
@@ -1,253 +0,0 @@
-package org.eclipse.jst.server.tomcat.core.internal;
-/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- **********************************************************************/
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jst.server.tomcat.core.IMimeMapping;
-import org.eclipse.jst.server.tomcat.core.ITomcatConfigurationWorkingCopy;
-import org.eclipse.jst.server.tomcat.core.ITomcatWebModule;
-import org.eclipse.jst.server.tomcat.core.WebModule;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Connector;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Context;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Engine;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Host;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Service;
-
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.IServerConfigurationWorkingCopy;
-import org.eclipse.wst.server.core.util.ProgressUtil;
-/**
- * Tomcat v4.0 server configuration.
- */
-public class Tomcat40ConfigurationWorkingCopy extends Tomcat40Configuration implements ITomcatConfigurationWorkingCopy {
- protected IServerConfigurationWorkingCopy wc;
-
- /**
- * Tomcat40Configuration constructor comment.
- */
- public Tomcat40ConfigurationWorkingCopy() {
- super();
- }
-
- public void initialize(IServerConfigurationWorkingCopy wc2) {
- this.wc = wc2;
- }
-
- public void setDefaults() { }
-
- public void handleSave(byte id, IProgressMonitor monitor) { }
-
- /**
- * Adds a mime mapping.
- * @param extension java.lang.String
- * @param mimeType java.lang.String
- */
- public void addMimeMapping(int index, IMimeMapping map) {
- webAppDocument.addMimeMapping(index, map);
- firePropertyChangeEvent(ADD_MAPPING_PROPERTY, new Integer(index), map);
- }
-
- /**
- * Add a web module.
- * @param module org.eclipse.jst.server.tomcat.WebModule
- */
- public void addWebModule(int index, ITomcatWebModule module) {
- try {
- int size = server.getServiceCount();
- for (int i = 0; i < size; i++) {
- Service service = server.getService(i);
- if (service.getName().equalsIgnoreCase(DEFAULT_SERVICE)) {
- Engine engine = service.getEngine();
- Host host = engine.getHost();
- Context context = (Context) host.createElement(index, "Context");
- context.setDocBase(module.getDocumentBase());
- context.setPath(module.getPath());
- context.setReloadable(module.isReloadable() ? "true" : "false");
- if (module.getMemento() != null && module.getMemento().length() > 0)
- context.setSource(module.getMemento());
- isServerDirty = true;
- firePropertyChangeEvent(ADD_WEB_MODULE_PROPERTY, null, module);
- return;
- }
- }
- } catch (Exception e) {
- Trace.trace("Error adding web module " + module.getPath(), e);
- }
- }
-
- /**
- * Localize the web projects in this configuration.
- *
- * @param file java.io.File
- * @param monitor org.eclipse.core.runtime.IProgressMonitor
- */
- public void localizeConfiguration(IPath path, TomcatServer server2, IProgressMonitor monitor) {
- try {
- monitor = ProgressUtil.getMonitorFor(monitor);
- monitor.beginTask(TomcatPlugin.getResource("%updatingConfigurationTask"), 100);
-
- Tomcat40Configuration config = new Tomcat40Configuration();
- config.load(path, ProgressUtil.getSubMonitorFor(monitor, 40));
-
- if (monitor.isCanceled())
- return;
-
- if (!server2.isTestEnvironment()) {
- IServerConfigurationWorkingCopy scwc = config.getServerConfiguration().getWorkingCopy();
- ((Tomcat40ConfigurationWorkingCopy) scwc.getDelegate()).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("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 int
- * @param newExtension java.lang.String
- */
- public void modifyMimeMapping(int index, IMimeMapping map) {
- webAppDocument.modifyMimeMapping(index, map);
- firePropertyChangeEvent(MODIFY_MAPPING_PROPERTY, new Integer(index), map);
- }
-
- /**
- * Modify the port with the given id.
- *
- * @param id java.lang.String
- * @param port int
- */
- public void modifyServerPort(String id, int port) {
- try {
- if ("server".equals(id)) {
- server.setPort(port + "");
- isServerDirty = true;
- firePropertyChangeEvent(MODIFY_PORT_PROPERTY, id, new Integer(port));
- return;
- }
-
- int i = id.indexOf("/");
- int servNum = Integer.parseInt(id.substring(0, i));
- int connNum = Integer.parseInt(id.substring(i + 1));
-
- Service service = server.getService(servNum);
- Connector connector = service.getConnector(connNum);
- connector.setPort(port + "");
- isServerDirty = true;
- firePropertyChangeEvent(MODIFY_PORT_PROPERTY, id, new Integer(port));
- } catch (Exception e) {
- Trace.trace("Error modifying server port " + id, e);
- }
- }
- /**
- * Change a web module.
- * @param index int
- * @param docBase java.lang.String
- * @param path java.lang.String
- * @param reloadable boolean
- */
- public void modifyWebModule(int index, String docBase, String path, boolean reloadable) {
- try {
- int size = server.getServiceCount();
- for (int i = 0; i < size; i++) {
- Service service = server.getService(i);
- if (service.getName().equalsIgnoreCase(DEFAULT_SERVICE)) {
- Engine engine = service.getEngine();
- Host host = engine.getHost();
- Context context = host.getContext(index);
- context.setPath(path);
- context.setDocBase(docBase);
- context.setReloadable(reloadable ? "true" : "false");
- isServerDirty = true;
- WebModule module = new WebModule(path, docBase, null, reloadable);
- firePropertyChangeEvent(MODIFY_WEB_MODULE_PROPERTY, new Integer(index), module);
- return;
- }
- }
- } catch (Exception e) {
- Trace.trace("Error modifying web module " + index, e);
- }
- }
-
- /**
- * Removes a mime mapping.
- * @param index int
- */
- public void removeMimeMapping(int index) {
- webAppDocument.removeMimeMapping(index);
- firePropertyChangeEvent(REMOVE_MAPPING_PROPERTY, null, new Integer(index));
- }
-
- /**
- * Removes a web module.
- * @param index int
- */
- public void removeWebModule(int index) {
- try {
- int size = server.getServiceCount();
- for (int i = 0; i < size; i++) {
- Service service = server.getService(i);
- if (service.getName().equalsIgnoreCase(DEFAULT_SERVICE)) {
- Engine engine = service.getEngine();
- Host host = engine.getHost();
- host.removeElement("Context", index);
- isServerDirty = true;
- firePropertyChangeEvent(REMOVE_WEB_MODULE_PROPERTY, null, new Integer(index));
- return;
- }
- }
- } catch (Exception e) {
- Trace.trace("Error removing module ref " + index, e);
- }
- }
-
- public void importFromPath(IPath path, IProgressMonitor monitor) throws CoreException {
- load(path, monitor);
- }
-
- public void importFromRuntime(IRuntime runtime, IProgressMonitor monitor) throws CoreException {
- load(runtime.getLocation().append("conf"), monitor);
- }
-}
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat40Handler.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat40Handler.java
index b69a5b4..0452222 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat40Handler.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat40Handler.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,6 +8,8 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal;
+
import java.util.ArrayList;
import java.util.List;
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat40RuntimeTargetHandler.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat40RuntimeTargetHandler.java
deleted file mode 100644
index 5adf0e6..0000000
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat40RuntimeTargetHandler.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.eclipse.jst.server.tomcat.core.internal;
-/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- **********************************************************************/
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jdt.core.IClasspathEntry;
-
-import org.eclipse.wst.server.core.IRuntime;
-/**
- *
- */
-public class Tomcat40RuntimeTargetHandler extends TomcatRuntimeTargetHandler {
- public String getId() {
- return "org.eclipse.jst.server.tomcat.runtimeTarget.v40";
- }
-
- public String getLabel() {
- return TomcatPlugin.getResource("%target40runtime");
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.target.IServerTargetDelegate#getClasspathEntries()
- */
- public IClasspathEntry[] resolveClasspathContainer(IRuntime runtime) {
- IPath installPath = runtime.getLocation();
-
- if (installPath == null)
- return new IClasspathEntry[0];
-
- IPath path = installPath.append("common");
- List list = new ArrayList();
- addLibraryEntries(list, path.append("lib").toFile(), true);
- addLibraryEntries(list, path.append("endorsed").toFile(), true);
- //addLibraryEntry(list, path.append("classes").toFile()); // no longer supported by eclipse
- return resolveList(list);
- }
-}
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 5d26f99..1ff47c1 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
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,6 +8,8 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal;
+
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.ByteArrayInputStream;
@@ -22,27 +23,18 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.*;
+import org.eclipse.jst.server.tomcat.core.IMimeMapping;
+import org.eclipse.jst.server.tomcat.core.ITomcatWebModule;
import org.eclipse.jst.server.tomcat.core.WebModule;
import org.eclipse.jst.server.tomcat.core.internal.xml.Factory;
import org.eclipse.jst.server.tomcat.core.internal.xml.XMLUtil;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Connector;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Context;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Engine;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Host;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Listener;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Server;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Service;
+import org.eclipse.jst.server.tomcat.core.internal.xml.server40.*;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.InputSource;
-import org.eclipse.wst.server.core.model.IServerPort;
-import org.eclipse.wst.server.core.util.ProgressUtil;
+import org.eclipse.wst.server.core.IServerPort;
import org.eclipse.wst.server.core.util.ServerPort;
/**
* Tomcat v4.1 server configuration.
@@ -69,8 +61,8 @@
/**
* Tomcat41Configuration constructor comment.
*/
- public Tomcat41Configuration() {
- super();
+ public Tomcat41Configuration(IFolder path) {
+ super(path);
}
/**
@@ -135,7 +127,9 @@
try {
int port = Integer.parseInt(server.getPort());
ports.add(new ServerPort("server", "Server port", port, "TCPIP"));
- } catch (Exception e) { }
+ } catch (Exception e) {
+ // ignore
+ }
// add connectors
try {
@@ -153,7 +147,9 @@
int port = -1;
try {
port = Integer.parseInt(connector.getPort());
- } catch (Exception e) { }
+ } catch (Exception e) {
+ // ignore
+ }
if (HTTP_CONNECTOR.equals(className)) {
name = "HTTP Connector";
protocol = "HTTP";
@@ -165,7 +161,9 @@
name = "SSL Connector";
protocol = "SSL";
}
- } catch (Exception e) { }
+ } catch (Exception e) {
+ // ignore
+ }
if ("HTTP".equals(protocol))
advanced = false;
} else if (APACHE_CONNECTOR.equals(className))
@@ -458,4 +456,199 @@
}
return false;
}
-}
+
+ /**
+ * Adds a mime mapping.
+ * @param extension java.lang.String
+ * @param mimeType java.lang.String
+ */
+ public void addMimeMapping(int index, IMimeMapping map) {
+ webAppDocument.addMimeMapping(index, map);
+ firePropertyChangeEvent(ADD_MAPPING_PROPERTY, new Integer(index), map);
+ }
+
+ /**
+ * Add a web module.
+ * @param module org.eclipse.jst.server.tomcat.WebModule
+ */
+ public void addWebModule(int index, ITomcatWebModule module) {
+ try {
+ int size = server.getServiceCount();
+ for (int i = 0; i < size; i++) {
+ Service service = server.getService(i);
+ if (service.getName().equalsIgnoreCase(DEFAULT_SERVICE)) {
+ Engine engine = service.getEngine();
+ Host host = engine.getHost();
+ Context context = (Context) host.createElement(index, "Context");
+ context.setDocBase(module.getDocumentBase());
+ context.setPath(module.getPath());
+ context.setReloadable(module.isReloadable() ? "true" : "false");
+ if (module.getMemento() != null && module.getMemento().length() > 0)
+ context.setSource(module.getMemento());
+ isServerDirty = true;
+ firePropertyChangeEvent(ADD_WEB_MODULE_PROPERTY, null, module);
+ return;
+ }
+ }
+ } catch (Exception e) {
+ Trace.trace("Error adding web module " + module.getPath(), e);
+ }
+ }
+
+ /**
+ * Localize the web projects in this configuration.
+ *
+ * @param file java.io.File
+ * @param monitor org.eclipse.core.runtime.IProgressMonitor
+ */
+ public void localizeConfiguration(IPath path, TomcatServer server2, TomcatRuntime runtime, IProgressMonitor monitor) {
+ try {
+ monitor = ProgressUtil.getMonitorFor(monitor);
+ monitor.beginTask(TomcatPlugin.getResource("%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("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 int
+ * @param newExtension java.lang.String
+ */
+ public void modifyMimeMapping(int index, IMimeMapping map) {
+ webAppDocument.modifyMimeMapping(index, map);
+ firePropertyChangeEvent(MODIFY_MAPPING_PROPERTY, new Integer(index), map);
+ }
+
+ /**
+ * Modify the port with the given id.
+ *
+ * @param id java.lang.String
+ * @param port int
+ */
+ public void modifyServerPort(String id, int port) {
+ try {
+ if ("server".equals(id)) {
+ server.setPort(port + "");
+ isServerDirty = true;
+ firePropertyChangeEvent(MODIFY_PORT_PROPERTY, id, new Integer(port));
+ return;
+ }
+
+ int i = id.indexOf("/");
+ int servNum = Integer.parseInt(id.substring(0, i));
+ int connNum = Integer.parseInt(id.substring(i + 1));
+
+ Service service = server.getService(servNum);
+ Connector connector = service.getConnector(connNum);
+ connector.setPort(port + "");
+ isServerDirty = true;
+ firePropertyChangeEvent(MODIFY_PORT_PROPERTY, id, new Integer(port));
+ } catch (Exception e) {
+ Trace.trace("Error modifying server port " + id, e);
+ }
+ }
+ /**
+ * Change a web module.
+ * @param index int
+ * @param docBase java.lang.String
+ * @param path java.lang.String
+ * @param reloadable boolean
+ */
+ public void modifyWebModule(int index, String docBase, String path, boolean reloadable) {
+ try {
+ int size = server.getServiceCount();
+ for (int i = 0; i < size; i++) {
+ Service service = server.getService(i);
+ if (service.getName().equalsIgnoreCase(DEFAULT_SERVICE)) {
+ Engine engine = service.getEngine();
+ Host host = engine.getHost();
+ Context context = host.getContext(index);
+ context.setPath(path);
+ context.setDocBase(docBase);
+ context.setReloadable(reloadable ? "true" : "false");
+ isServerDirty = true;
+ WebModule module = new WebModule(path, docBase, null, reloadable);
+ firePropertyChangeEvent(MODIFY_WEB_MODULE_PROPERTY, new Integer(index), module);
+ return;
+ }
+ }
+ } catch (Exception e) {
+ Trace.trace("Error modifying web module " + index, e);
+ }
+ }
+
+ /**
+ * Removes a mime mapping.
+ * @param index int
+ */
+ public void removeMimeMapping(int index) {
+ webAppDocument.removeMimeMapping(index);
+ firePropertyChangeEvent(REMOVE_MAPPING_PROPERTY, null, new Integer(index));
+ }
+
+ /**
+ * Removes a web module.
+ * @param index int
+ */
+ public void removeWebModule(int index) {
+ try {
+ int size = server.getServiceCount();
+ for (int i = 0; i < size; i++) {
+ Service service = server.getService(i);
+ if (service.getName().equalsIgnoreCase(DEFAULT_SERVICE)) {
+ Engine engine = service.getEngine();
+ Host host = engine.getHost();
+ host.removeElement("Context", index);
+ isServerDirty = true;
+ firePropertyChangeEvent(REMOVE_WEB_MODULE_PROPERTY, null, new Integer(index));
+ return;
+ }
+ }
+ } catch (Exception e) {
+ Trace.trace("Error removing module ref " + index, e);
+ }
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat41ConfigurationWorkingCopy.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat41ConfigurationWorkingCopy.java
deleted file mode 100644
index 0c1abd6..0000000
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat41ConfigurationWorkingCopy.java
+++ /dev/null
@@ -1,252 +0,0 @@
-package org.eclipse.jst.server.tomcat.core.internal;
-/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- **********************************************************************/
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jst.server.tomcat.core.IMimeMapping;
-import org.eclipse.jst.server.tomcat.core.ITomcatConfigurationWorkingCopy;
-import org.eclipse.jst.server.tomcat.core.ITomcatWebModule;
-import org.eclipse.jst.server.tomcat.core.WebModule;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Connector;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Context;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Engine;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Host;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Service;
-
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.IServerConfigurationWorkingCopy;
-import org.eclipse.wst.server.core.util.ProgressUtil;
-/**
- * Tomcat v4.1 server configuration.
- */
-public class Tomcat41ConfigurationWorkingCopy extends Tomcat41Configuration implements ITomcatConfigurationWorkingCopy {
- protected IServerConfigurationWorkingCopy wc;
-
- /**
- * Tomcat41Configuration constructor comment.
- */
- public Tomcat41ConfigurationWorkingCopy() {
- super();
- }
-
- public void initialize(IServerConfigurationWorkingCopy wc2) {
- this.wc = wc2;
- }
-
- public void setDefaults() { }
-
- public void handleSave(byte id, IProgressMonitor monitor) { }
-
- /**
- * Adds a mime mapping.
- * @param extension java.lang.String
- * @param mimeType java.lang.String
- */
- public void addMimeMapping(int index, IMimeMapping map) {
- webAppDocument.addMimeMapping(index, map);
- firePropertyChangeEvent(ADD_MAPPING_PROPERTY, new Integer(index), map);
- }
-
- /**
- * Add a web module.
- * @param module org.eclipse.jst.server.tomcat.WebModule
- */
- public void addWebModule(int index, ITomcatWebModule module) {
- try {
- int size = server.getServiceCount();
- for (int i = 0; i < size; i++) {
- Service service = server.getService(i);
- if (service.getName().equalsIgnoreCase(DEFAULT_SERVICE)) {
- Engine engine = service.getEngine();
- Host host = engine.getHost();
- Context context = (Context) host.createElement(index, "Context");
- context.setDocBase(module.getDocumentBase());
- context.setPath(module.getPath());
- context.setReloadable(module.isReloadable() ? "true" : "false");
- if (module.getMemento() != null && module.getMemento().length() > 0)
- context.setSource(module.getMemento());
- isServerDirty = true;
- firePropertyChangeEvent(ADD_WEB_MODULE_PROPERTY, null, module);
- return;
- }
- }
- } catch (Exception e) {
- Trace.trace("Error adding web module " + module.getPath(), e);
- }
- }
-
- /**
- * Localize the web projects in this configuration.
- *
- * @param file java.io.File
- * @param monitor org.eclipse.core.runtime.IProgressMonitor
- */
- public void localizeConfiguration(IPath path, TomcatServer server2, TomcatRuntime runtime, IProgressMonitor monitor) {
- try {
- monitor = ProgressUtil.getMonitorFor(monitor);
- monitor.beginTask(TomcatPlugin.getResource("%updatingConfigurationTask"), 100);
-
- Tomcat41Configuration config = new Tomcat41Configuration();
- config.load(path, ProgressUtil.getSubMonitorFor(monitor, 40));
-
- if (monitor.isCanceled())
- return;
-
- if (!server2.isTestEnvironment()) {
- IServerConfigurationWorkingCopy scwc = config.getServerConfiguration().getWorkingCopy();
- ((Tomcat41ConfigurationWorkingCopy) scwc.getDelegate()).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("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 int
- * @param newExtension java.lang.String
- */
- public void modifyMimeMapping(int index, IMimeMapping map) {
- webAppDocument.modifyMimeMapping(index, map);
- firePropertyChangeEvent(MODIFY_MAPPING_PROPERTY, new Integer(index), map);
- }
-
- /**
- * Modify the port with the given id.
- *
- * @param id java.lang.String
- * @param port int
- */
- public void modifyServerPort(String id, int port) {
- try {
- if ("server".equals(id)) {
- server.setPort(port + "");
- isServerDirty = true;
- firePropertyChangeEvent(MODIFY_PORT_PROPERTY, id, new Integer(port));
- return;
- }
-
- int i = id.indexOf("/");
- int servNum = Integer.parseInt(id.substring(0, i));
- int connNum = Integer.parseInt(id.substring(i + 1));
-
- Service service = server.getService(servNum);
- Connector connector = service.getConnector(connNum);
- connector.setPort(port + "");
- isServerDirty = true;
- firePropertyChangeEvent(MODIFY_PORT_PROPERTY, id, new Integer(port));
- } catch (Exception e) {
- Trace.trace("Error modifying server port " + id, e);
- }
- }
- /**
- * Change a web module.
- * @param index int
- * @param docBase java.lang.String
- * @param path java.lang.String
- * @param reloadable boolean
- */
- public void modifyWebModule(int index, String docBase, String path, boolean reloadable) {
- try {
- int size = server.getServiceCount();
- for (int i = 0; i < size; i++) {
- Service service = server.getService(i);
- if (service.getName().equalsIgnoreCase(DEFAULT_SERVICE)) {
- Engine engine = service.getEngine();
- Host host = engine.getHost();
- Context context = host.getContext(index);
- context.setPath(path);
- context.setDocBase(docBase);
- context.setReloadable(reloadable ? "true" : "false");
- isServerDirty = true;
- WebModule module = new WebModule(path, docBase, null, reloadable);
- firePropertyChangeEvent(MODIFY_WEB_MODULE_PROPERTY, new Integer(index), module);
- return;
- }
- }
- } catch (Exception e) {
- Trace.trace("Error modifying web module " + index, e);
- }
- }
-
- /**
- * Removes a mime mapping.
- * @param index int
- */
- public void removeMimeMapping(int index) {
- webAppDocument.removeMimeMapping(index);
- firePropertyChangeEvent(REMOVE_MAPPING_PROPERTY, null, new Integer(index));
- }
-
- /**
- * Removes a web module.
- * @param index int
- */
- public void removeWebModule(int index) {
- try {
- int size = server.getServiceCount();
- for (int i = 0; i < size; i++) {
- Service service = server.getService(i);
- if (service.getName().equalsIgnoreCase(DEFAULT_SERVICE)) {
- Engine engine = service.getEngine();
- Host host = engine.getHost();
- host.removeElement("Context", index);
- isServerDirty = true;
- firePropertyChangeEvent(REMOVE_WEB_MODULE_PROPERTY, null, new Integer(index));
- return;
- }
- }
- } catch (Exception e) {
- Trace.trace("Error removing module ref " + index, e);
- }
- }
-
- public void importFromPath(IPath path, IProgressMonitor monitor) throws CoreException {
- load(path, monitor);
- }
-
- public void importFromRuntime(IRuntime runtime, IProgressMonitor monitor) throws CoreException {
- load(runtime.getLocation().append("conf"), monitor);
- }
-}
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat41Handler.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat41Handler.java
index 6efc9bf..599ba88 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat41Handler.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat41Handler.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,6 +8,8 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal;
+
import java.util.ArrayList;
import java.util.List;
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat41RuntimeTargetHandler.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat41RuntimeTargetHandler.java
deleted file mode 100644
index d96cb51..0000000
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat41RuntimeTargetHandler.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.eclipse.jst.server.tomcat.core.internal;
-/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- **********************************************************************/
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jdt.core.IClasspathEntry;
-
-import org.eclipse.wst.server.core.IRuntime;
-/**
- *
- */
-public class Tomcat41RuntimeTargetHandler extends TomcatRuntimeTargetHandler {
- public String getId() {
- return "org.eclipse.jst.server.tomcat.runtimeTarget.v41";
- }
-
- public String getLabel() {
- return TomcatPlugin.getResource("%target41runtime");
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.target.IServerTargetDelegate#getClasspathEntries()
- */
- public IClasspathEntry[] resolveClasspathContainer(IRuntime runtime) {
- IPath installPath = runtime.getLocation();
-
- if (installPath == null)
- return new IClasspathEntry[0];
-
- IPath path = installPath.append("common");
- List list = new ArrayList();
- addLibraryEntries(list, path.append("lib").toFile(), true);
- addLibraryEntries(list, path.append("endorsed").toFile(), true);
- //addLibraryEntry(list, path.append("classes").toFile()); // no longer supported by eclipse
- return resolveList(list);
- }
-}
\ No newline at end of file
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 0f0103b..bbe71a9 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
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,6 +8,8 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal;
+
import java.io.*;
import java.util.ArrayList;
import java.util.Iterator;
@@ -17,6 +18,8 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.*;
+import org.eclipse.jst.server.tomcat.core.IMimeMapping;
+import org.eclipse.jst.server.tomcat.core.ITomcatWebModule;
import org.eclipse.jst.server.tomcat.core.WebModule;
import org.eclipse.jst.server.tomcat.core.internal.xml.Factory;
import org.eclipse.jst.server.tomcat.core.internal.xml.XMLUtil;
@@ -24,8 +27,7 @@
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
-import org.eclipse.wst.server.core.model.IServerPort;
-import org.eclipse.wst.server.core.util.ProgressUtil;
+import org.eclipse.wst.server.core.IServerPort;
import org.eclipse.wst.server.core.util.ServerPort;
/**
* Tomcat v5.0 server configuration.
@@ -46,8 +48,8 @@
/**
* Tomcat50Configuration constructor comment.
*/
- public Tomcat50Configuration() {
- super();
+ public Tomcat50Configuration(IFolder path) {
+ super(path);
}
/**
@@ -112,7 +114,9 @@
try {
int port = Integer.parseInt(server.getPort());
ports.add(new ServerPort("server", "Server port", port, "TCPIP"));
- } catch (Exception e) { }
+ } catch (Exception e) {
+ // ignore
+ }
// add connectors
try {
@@ -129,7 +133,9 @@
int port = -1;
try {
port = Integer.parseInt(connector.getPort());
- } catch (Exception e) { }
+ } catch (Exception e) {
+ // ignore
+ }
String protocol = connector.getProtocol();
if (protocol != null && protocol.length() > 0) {
name = protocol;
@@ -430,4 +436,199 @@
}
return false;
}
-}
+
+ /**
+ * Adds a mime mapping.
+ * @param extension java.lang.String
+ * @param mimeType java.lang.String
+ */
+ public void addMimeMapping(int index, IMimeMapping map) {
+ webAppDocument.addMimeMapping(index, map);
+ firePropertyChangeEvent(ADD_MAPPING_PROPERTY, new Integer(index), map);
+ }
+
+ /**
+ * Add a web module.
+ * @param module org.eclipse.jst.server.tomcat.WebModule
+ */
+ public void addWebModule(int index, ITomcatWebModule module) {
+ try {
+ int size = server.getServiceCount();
+ for (int i = 0; i < size; i++) {
+ Service service = server.getService(i);
+ if (service.getName().equalsIgnoreCase(DEFAULT_SERVICE)) {
+ Engine engine = service.getEngine();
+ Host host = engine.getHost();
+ Context context = (Context) host.createElement(index, "Context");
+ context.setDocBase(module.getDocumentBase());
+ context.setPath(module.getPath());
+ context.setReloadable(module.isReloadable() ? "true" : "false");
+ if (module.getMemento() != null && module.getMemento().length() > 0)
+ context.setSource(module.getMemento());
+ isServerDirty = true;
+ firePropertyChangeEvent(ADD_WEB_MODULE_PROPERTY, null, module);
+ return;
+ }
+ }
+ } catch (Exception e) {
+ Trace.trace("Error adding web module " + module.getPath(), e);
+ }
+ }
+
+ /**
+ * Localize the web projects in this configuration.
+ *
+ * @param file java.io.File
+ * @param monitor org.eclipse.core.runtime.IProgressMonitor
+ */
+ public void localizeConfiguration(IPath path, TomcatServer server2, TomcatRuntime runtime, IProgressMonitor monitor) {
+ try {
+ monitor = ProgressUtil.getMonitorFor(monitor);
+ monitor.beginTask(TomcatPlugin.getResource("%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("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 int
+ * @param newExtension java.lang.String
+ */
+ public void modifyMimeMapping(int index, IMimeMapping map) {
+ webAppDocument.modifyMimeMapping(index, map);
+ firePropertyChangeEvent(MODIFY_MAPPING_PROPERTY, new Integer(index), map);
+ }
+
+ /**
+ * Modify the port with the given id.
+ *
+ * @param id java.lang.String
+ * @param port int
+ */
+ public void modifyServerPort(String id, int port) {
+ try {
+ if ("server".equals(id)) {
+ server.setPort(port + "");
+ isServerDirty = true;
+ firePropertyChangeEvent(MODIFY_PORT_PROPERTY, id, new Integer(port));
+ return;
+ }
+
+ int i = id.indexOf("/");
+ int servNum = Integer.parseInt(id.substring(0, i));
+ int connNum = Integer.parseInt(id.substring(i + 1));
+
+ Service service = server.getService(servNum);
+ Connector connector = service.getConnector(connNum);
+ connector.setPort(port + "");
+ isServerDirty = true;
+ firePropertyChangeEvent(MODIFY_PORT_PROPERTY, id, new Integer(port));
+ } catch (Exception e) {
+ Trace.trace("Error modifying server port " + id, e);
+ }
+ }
+ /**
+ * Change a web module.
+ * @param index int
+ * @param docBase java.lang.String
+ * @param path java.lang.String
+ * @param reloadable boolean
+ */
+ public void modifyWebModule(int index, String docBase, String path, boolean reloadable) {
+ try {
+ int size = server.getServiceCount();
+ for (int i = 0; i < size; i++) {
+ Service service = server.getService(i);
+ if (service.getName().equalsIgnoreCase(DEFAULT_SERVICE)) {
+ Engine engine = service.getEngine();
+ Host host = engine.getHost();
+ Context context = host.getContext(index);
+ context.setPath(path);
+ context.setDocBase(docBase);
+ context.setReloadable(reloadable ? "true" : "false");
+ isServerDirty = true;
+ WebModule module = new WebModule(path, docBase, null, reloadable);
+ firePropertyChangeEvent(MODIFY_WEB_MODULE_PROPERTY, new Integer(index), module);
+ return;
+ }
+ }
+ } catch (Exception e) {
+ Trace.trace("Error modifying web module " + index, e);
+ }
+ }
+
+ /**
+ * Removes a mime mapping.
+ * @param index int
+ */
+ public void removeMimeMapping(int index) {
+ webAppDocument.removeMimeMapping(index);
+ firePropertyChangeEvent(REMOVE_MAPPING_PROPERTY, null, new Integer(index));
+ }
+
+ /**
+ * Removes a web module.
+ * @param index int
+ */
+ public void removeWebModule(int index) {
+ try {
+ int size = server.getServiceCount();
+ for (int i = 0; i < size; i++) {
+ Service service = server.getService(i);
+ if (service.getName().equalsIgnoreCase(DEFAULT_SERVICE)) {
+ Engine engine = service.getEngine();
+ Host host = engine.getHost();
+ host.removeElement("Context", index);
+ isServerDirty = true;
+ firePropertyChangeEvent(REMOVE_WEB_MODULE_PROPERTY, null, new Integer(index));
+ return;
+ }
+ }
+ } catch (Exception e) {
+ Trace.trace("Error removing module ref " + index, e);
+ }
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat50ConfigurationWorkingCopy.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat50ConfigurationWorkingCopy.java
deleted file mode 100644
index cc50521..0000000
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat50ConfigurationWorkingCopy.java
+++ /dev/null
@@ -1,252 +0,0 @@
-package org.eclipse.jst.server.tomcat.core.internal;
-/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- **********************************************************************/
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jst.server.tomcat.core.IMimeMapping;
-import org.eclipse.jst.server.tomcat.core.ITomcatConfigurationWorkingCopy;
-import org.eclipse.jst.server.tomcat.core.ITomcatWebModule;
-import org.eclipse.jst.server.tomcat.core.WebModule;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Connector;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Context;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Engine;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Host;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Service;
-
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.IServerConfigurationWorkingCopy;
-import org.eclipse.wst.server.core.util.ProgressUtil;
-/**
- * Tomcat v4.1 server configuration.
- */
-public class Tomcat50ConfigurationWorkingCopy extends Tomcat50Configuration implements ITomcatConfigurationWorkingCopy {
- protected IServerConfigurationWorkingCopy wc;
-
- /**
- * Tomcat50Configuration constructor comment.
- */
- public Tomcat50ConfigurationWorkingCopy() {
- super();
- }
-
- public void initialize(IServerConfigurationWorkingCopy wc2) {
- this.wc = wc2;
- }
-
- public void setDefaults() { }
-
- public void handleSave(byte id, IProgressMonitor monitor) { }
-
- /**
- * Adds a mime mapping.
- * @param extension java.lang.String
- * @param mimeType java.lang.String
- */
- public void addMimeMapping(int index, IMimeMapping map) {
- webAppDocument.addMimeMapping(index, map);
- firePropertyChangeEvent(ADD_MAPPING_PROPERTY, new Integer(index), map);
- }
-
- /**
- * Add a web module.
- * @param module org.eclipse.jst.server.tomcat.WebModule
- */
- public void addWebModule(int index, ITomcatWebModule module) {
- try {
- int size = server.getServiceCount();
- for (int i = 0; i < size; i++) {
- Service service = server.getService(i);
- if (service.getName().equalsIgnoreCase(DEFAULT_SERVICE)) {
- Engine engine = service.getEngine();
- Host host = engine.getHost();
- Context context = (Context) host.createElement(index, "Context");
- context.setDocBase(module.getDocumentBase());
- context.setPath(module.getPath());
- context.setReloadable(module.isReloadable() ? "true" : "false");
- if (module.getMemento() != null && module.getMemento().length() > 0)
- context.setSource(module.getMemento());
- isServerDirty = true;
- firePropertyChangeEvent(ADD_WEB_MODULE_PROPERTY, null, module);
- return;
- }
- }
- } catch (Exception e) {
- Trace.trace("Error adding web module " + module.getPath(), e);
- }
- }
-
- /**
- * Localize the web projects in this configuration.
- *
- * @param file java.io.File
- * @param monitor org.eclipse.core.runtime.IProgressMonitor
- */
- public void localizeConfiguration(IPath path, TomcatServer server2, TomcatRuntime runtime, IProgressMonitor monitor) {
- try {
- monitor = ProgressUtil.getMonitorFor(monitor);
- monitor.beginTask(TomcatPlugin.getResource("%updatingConfigurationTask"), 100);
-
- Tomcat50Configuration config = new Tomcat50Configuration();
- config.load(path, ProgressUtil.getSubMonitorFor(monitor, 40));
-
- if (monitor.isCanceled())
- return;
-
- if (!server2.isTestEnvironment()) {
- IServerConfigurationWorkingCopy scwc = config.getServerConfiguration().getWorkingCopy();
- ((Tomcat50ConfigurationWorkingCopy) scwc.getDelegate()).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("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 int
- * @param newExtension java.lang.String
- */
- public void modifyMimeMapping(int index, IMimeMapping map) {
- webAppDocument.modifyMimeMapping(index, map);
- firePropertyChangeEvent(MODIFY_MAPPING_PROPERTY, new Integer(index), map);
- }
-
- /**
- * Modify the port with the given id.
- *
- * @param id java.lang.String
- * @param port int
- */
- public void modifyServerPort(String id, int port) {
- try {
- if ("server".equals(id)) {
- server.setPort(port + "");
- isServerDirty = true;
- firePropertyChangeEvent(MODIFY_PORT_PROPERTY, id, new Integer(port));
- return;
- }
-
- int i = id.indexOf("/");
- int servNum = Integer.parseInt(id.substring(0, i));
- int connNum = Integer.parseInt(id.substring(i + 1));
-
- Service service = server.getService(servNum);
- Connector connector = service.getConnector(connNum);
- connector.setPort(port + "");
- isServerDirty = true;
- firePropertyChangeEvent(MODIFY_PORT_PROPERTY, id, new Integer(port));
- } catch (Exception e) {
- Trace.trace("Error modifying server port " + id, e);
- }
- }
- /**
- * Change a web module.
- * @param index int
- * @param docBase java.lang.String
- * @param path java.lang.String
- * @param reloadable boolean
- */
- public void modifyWebModule(int index, String docBase, String path, boolean reloadable) {
- try {
- int size = server.getServiceCount();
- for (int i = 0; i < size; i++) {
- Service service = server.getService(i);
- if (service.getName().equalsIgnoreCase(DEFAULT_SERVICE)) {
- Engine engine = service.getEngine();
- Host host = engine.getHost();
- Context context = host.getContext(index);
- context.setPath(path);
- context.setDocBase(docBase);
- context.setReloadable(reloadable ? "true" : "false");
- isServerDirty = true;
- WebModule module = new WebModule(path, docBase, null, reloadable);
- firePropertyChangeEvent(MODIFY_WEB_MODULE_PROPERTY, new Integer(index), module);
- return;
- }
- }
- } catch (Exception e) {
- Trace.trace("Error modifying web module " + index, e);
- }
- }
-
- /**
- * Removes a mime mapping.
- * @param index int
- */
- public void removeMimeMapping(int index) {
- webAppDocument.removeMimeMapping(index);
- firePropertyChangeEvent(REMOVE_MAPPING_PROPERTY, null, new Integer(index));
- }
-
- /**
- * Removes a web module.
- * @param index int
- */
- public void removeWebModule(int index) {
- try {
- int size = server.getServiceCount();
- for (int i = 0; i < size; i++) {
- Service service = server.getService(i);
- if (service.getName().equalsIgnoreCase(DEFAULT_SERVICE)) {
- Engine engine = service.getEngine();
- Host host = engine.getHost();
- host.removeElement("Context", index);
- isServerDirty = true;
- firePropertyChangeEvent(REMOVE_WEB_MODULE_PROPERTY, null, new Integer(index));
- return;
- }
- }
- } catch (Exception e) {
- Trace.trace("Error removing module ref " + index, e);
- }
- }
-
- public void importFromPath(IPath path, IProgressMonitor monitor) throws CoreException {
- load(path, monitor);
- }
-
- public void importFromRuntime(IRuntime runtime, IProgressMonitor monitor) throws CoreException {
- load(runtime.getLocation().append("conf"), monitor);
- }
-}
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat50Handler.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat50Handler.java
index 9371e9a..c1d8f30 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat50Handler.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat50Handler.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,6 +8,8 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal;
+
import java.util.ArrayList;
import java.util.List;
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat50RuntimeTargetHandler.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat50RuntimeTargetHandler.java
deleted file mode 100644
index c514873..0000000
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat50RuntimeTargetHandler.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.eclipse.jst.server.tomcat.core.internal;
-/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- **********************************************************************/
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jdt.core.IClasspathEntry;
-
-import org.eclipse.wst.server.core.IRuntime;
-/**
- *
- */
-public class Tomcat50RuntimeTargetHandler extends TomcatRuntimeTargetHandler {
- public String getId() {
- return "org.eclipse.jst.server.tomcat.runtimeTarget.v50";
- }
-
- public String getLabel() {
- return TomcatPlugin.getResource("%target50runtime");
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.target.IServerTargetDelegate#getClasspathEntries()
- */
- public IClasspathEntry[] resolveClasspathContainer(IRuntime runtime) {
- IPath installPath = runtime.getLocation();
-
- if (installPath == null)
- return new IClasspathEntry[0];
-
- IPath path = installPath.append("common");
- List list = new ArrayList();
- addLibraryEntries(list, path.append("lib").toFile(), true);
- addLibraryEntries(list, path.append("endorsed").toFile(), true);
- // addLibraryEntry(list, path.append("classes").toFile()); // no longer supported by eclipse
- return resolveList(list);
- }
-}
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 2c3d2c0..15be680 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
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,39 +8,26 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.ByteArrayInputStream;
-import java.io.FileInputStream;
-import java.io.FileWriter;
-import java.io.InputStream;
-import java.io.InputStreamReader;
+package org.eclipse.jst.server.tomcat.core.internal;
+
+import java.io.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.*;
+import org.eclipse.jst.server.tomcat.core.IMimeMapping;
+import org.eclipse.jst.server.tomcat.core.ITomcatWebModule;
import org.eclipse.jst.server.tomcat.core.WebModule;
import org.eclipse.jst.server.tomcat.core.internal.xml.Factory;
import org.eclipse.jst.server.tomcat.core.internal.xml.XMLUtil;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Connector;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Context;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Engine;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Host;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Listener;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Server;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Service;
+import org.eclipse.jst.server.tomcat.core.internal.xml.server40.*;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
-import org.eclipse.wst.server.core.model.IServerPort;
-import org.eclipse.wst.server.core.util.ProgressUtil;
+import org.eclipse.wst.server.core.IServerPort;
import org.eclipse.wst.server.core.util.ServerPort;
/**
* Tomcat v5.5 server configuration.
@@ -62,8 +48,8 @@
/**
* Tomcat55Configuration constructor comment.
*/
- public Tomcat55Configuration() {
- super();
+ public Tomcat55Configuration(IFolder path) {
+ super(path);
}
/**
@@ -128,7 +114,9 @@
try {
int port = Integer.parseInt(server.getPort());
ports.add(new ServerPort("server", "Server port", port, "TCPIP"));
- } catch (Exception e) { }
+ } catch (Exception e) {
+ // ignore
+ }
// add connectors
try {
@@ -145,7 +133,9 @@
int port = -1;
try {
port = Integer.parseInt(connector.getPort());
- } catch (Exception e) { }
+ } catch (Exception e) {
+ // ignore
+ }
String protocol = connector.getProtocol();
if (protocol != null && protocol.length() > 0) {
name = protocol;
@@ -446,4 +436,199 @@
}
return false;
}
-}
+
+ /**
+ * Adds a mime mapping.
+ * @param extension java.lang.String
+ * @param mimeType java.lang.String
+ */
+ public void addMimeMapping(int index, IMimeMapping map) {
+ webAppDocument.addMimeMapping(index, map);
+ firePropertyChangeEvent(ADD_MAPPING_PROPERTY, new Integer(index), map);
+ }
+
+ /**
+ * Add a web module.
+ * @param module org.eclipse.jst.server.tomcat.WebModule
+ */
+ public void addWebModule(int index, ITomcatWebModule module) {
+ try {
+ int size = server.getServiceCount();
+ for (int i = 0; i < size; i++) {
+ Service service = server.getService(i);
+ if (service.getName().equalsIgnoreCase(DEFAULT_SERVICE)) {
+ Engine engine = service.getEngine();
+ Host host = engine.getHost();
+ Context context = (Context) host.createElement(index, "Context");
+ context.setDocBase(module.getDocumentBase());
+ context.setPath(module.getPath());
+ context.setReloadable(module.isReloadable() ? "true" : "false");
+ if (module.getMemento() != null && module.getMemento().length() > 0)
+ context.setSource(module.getMemento());
+ isServerDirty = true;
+ firePropertyChangeEvent(ADD_WEB_MODULE_PROPERTY, null, module);
+ return;
+ }
+ }
+ } catch (Exception e) {
+ Trace.trace("Error adding web module " + module.getPath(), e);
+ }
+ }
+
+ /**
+ * Localize the web projects in this configuration.
+ *
+ * @param file java.io.File
+ * @param monitor org.eclipse.core.runtime.IProgressMonitor
+ */
+ public void localizeConfiguration(IPath path, TomcatServer server2, TomcatRuntime runtime, IProgressMonitor monitor) {
+ try {
+ monitor = ProgressUtil.getMonitorFor(monitor);
+ monitor.beginTask(TomcatPlugin.getResource("%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("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 int
+ * @param newExtension java.lang.String
+ */
+ public void modifyMimeMapping(int index, IMimeMapping map) {
+ webAppDocument.modifyMimeMapping(index, map);
+ firePropertyChangeEvent(MODIFY_MAPPING_PROPERTY, new Integer(index), map);
+ }
+
+ /**
+ * Modify the port with the given id.
+ *
+ * @param id java.lang.String
+ * @param port int
+ */
+ public void modifyServerPort(String id, int port) {
+ try {
+ if ("server".equals(id)) {
+ server.setPort(port + "");
+ isServerDirty = true;
+ firePropertyChangeEvent(MODIFY_PORT_PROPERTY, id, new Integer(port));
+ return;
+ }
+
+ int i = id.indexOf("/");
+ int servNum = Integer.parseInt(id.substring(0, i));
+ int connNum = Integer.parseInt(id.substring(i + 1));
+
+ Service service = server.getService(servNum);
+ Connector connector = service.getConnector(connNum);
+ connector.setPort(port + "");
+ isServerDirty = true;
+ firePropertyChangeEvent(MODIFY_PORT_PROPERTY, id, new Integer(port));
+ } catch (Exception e) {
+ Trace.trace("Error modifying server port " + id, e);
+ }
+ }
+ /**
+ * Change a web module.
+ * @param index int
+ * @param docBase java.lang.String
+ * @param path java.lang.String
+ * @param reloadable boolean
+ */
+ public void modifyWebModule(int index, String docBase, String path, boolean reloadable) {
+ try {
+ int size = server.getServiceCount();
+ for (int i = 0; i < size; i++) {
+ Service service = server.getService(i);
+ if (service.getName().equalsIgnoreCase(DEFAULT_SERVICE)) {
+ Engine engine = service.getEngine();
+ Host host = engine.getHost();
+ Context context = host.getContext(index);
+ context.setPath(path);
+ context.setDocBase(docBase);
+ context.setReloadable(reloadable ? "true" : "false");
+ isServerDirty = true;
+ WebModule module = new WebModule(path, docBase, null, reloadable);
+ firePropertyChangeEvent(MODIFY_WEB_MODULE_PROPERTY, new Integer(index), module);
+ return;
+ }
+ }
+ } catch (Exception e) {
+ Trace.trace("Error modifying web module " + index, e);
+ }
+ }
+
+ /**
+ * Removes a mime mapping.
+ * @param index int
+ */
+ public void removeMimeMapping(int index) {
+ webAppDocument.removeMimeMapping(index);
+ firePropertyChangeEvent(REMOVE_MAPPING_PROPERTY, null, new Integer(index));
+ }
+
+ /**
+ * Removes a web module.
+ * @param index int
+ */
+ public void removeWebModule(int index) {
+ try {
+ int size = server.getServiceCount();
+ for (int i = 0; i < size; i++) {
+ Service service = server.getService(i);
+ if (service.getName().equalsIgnoreCase(DEFAULT_SERVICE)) {
+ Engine engine = service.getEngine();
+ Host host = engine.getHost();
+ host.removeElement("Context", index);
+ isServerDirty = true;
+ firePropertyChangeEvent(REMOVE_WEB_MODULE_PROPERTY, null, new Integer(index));
+ return;
+ }
+ }
+ } catch (Exception e) {
+ Trace.trace("Error removing module ref " + index, e);
+ }
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat55ConfigurationWorkingCopy.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat55ConfigurationWorkingCopy.java
deleted file mode 100644
index df1c811..0000000
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat55ConfigurationWorkingCopy.java
+++ /dev/null
@@ -1,252 +0,0 @@
-package org.eclipse.jst.server.tomcat.core.internal;
-/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- **********************************************************************/
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jst.server.tomcat.core.IMimeMapping;
-import org.eclipse.jst.server.tomcat.core.ITomcatConfigurationWorkingCopy;
-import org.eclipse.jst.server.tomcat.core.ITomcatWebModule;
-import org.eclipse.jst.server.tomcat.core.WebModule;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Connector;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Context;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Engine;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Host;
-import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Service;
-
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.IServerConfigurationWorkingCopy;
-import org.eclipse.wst.server.core.util.ProgressUtil;
-/**
- * Tomcat v5.5 server configuration.
- */
-public class Tomcat55ConfigurationWorkingCopy extends Tomcat55Configuration implements ITomcatConfigurationWorkingCopy {
- protected IServerConfigurationWorkingCopy wc;
-
- /**
- * Tomcat55Configuration constructor comment.
- */
- public Tomcat55ConfigurationWorkingCopy() {
- super();
- }
-
- public void initialize(IServerConfigurationWorkingCopy wc2) {
- this.wc = wc2;
- }
-
- public void setDefaults() { }
-
- public void handleSave(byte id, IProgressMonitor monitor) { }
-
- /**
- * Adds a mime mapping.
- * @param extension java.lang.String
- * @param mimeType java.lang.String
- */
- public void addMimeMapping(int index, IMimeMapping map) {
- webAppDocument.addMimeMapping(index, map);
- firePropertyChangeEvent(ADD_MAPPING_PROPERTY, new Integer(index), map);
- }
-
- /**
- * Add a web module.
- * @param module org.eclipse.jst.server.tomcat.WebModule
- */
- public void addWebModule(int index, ITomcatWebModule module) {
- try {
- int size = server.getServiceCount();
- for (int i = 0; i < size; i++) {
- Service service = server.getService(i);
- if (service.getName().equalsIgnoreCase(DEFAULT_SERVICE)) {
- Engine engine = service.getEngine();
- Host host = engine.getHost();
- Context context = (Context) host.createElement(index, "Context");
- context.setDocBase(module.getDocumentBase());
- context.setPath(module.getPath());
- context.setReloadable(module.isReloadable() ? "true" : "false");
- if (module.getMemento() != null && module.getMemento().length() > 0)
- context.setSource(module.getMemento());
- isServerDirty = true;
- firePropertyChangeEvent(ADD_WEB_MODULE_PROPERTY, null, module);
- return;
- }
- }
- } catch (Exception e) {
- Trace.trace("Error adding web module " + module.getPath(), e);
- }
- }
-
- /**
- * Localize the web projects in this configuration.
- *
- * @param file java.io.File
- * @param monitor org.eclipse.core.runtime.IProgressMonitor
- */
- public void localizeConfiguration(IPath path, TomcatServer server2, TomcatRuntime runtime, IProgressMonitor monitor) {
- try {
- monitor = ProgressUtil.getMonitorFor(monitor);
- monitor.beginTask(TomcatPlugin.getResource("%updatingConfigurationTask"), 100);
-
- Tomcat55Configuration config = new Tomcat55Configuration();
- config.load(path, ProgressUtil.getSubMonitorFor(monitor, 40));
-
- if (monitor.isCanceled())
- return;
-
- if (!server2.isTestEnvironment()) {
- IServerConfigurationWorkingCopy scwc = config.getServerConfiguration().getWorkingCopy();
- ((Tomcat55ConfigurationWorkingCopy) scwc.getDelegate()).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("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 int
- * @param newExtension java.lang.String
- */
- public void modifyMimeMapping(int index, IMimeMapping map) {
- webAppDocument.modifyMimeMapping(index, map);
- firePropertyChangeEvent(MODIFY_MAPPING_PROPERTY, new Integer(index), map);
- }
-
- /**
- * Modify the port with the given id.
- *
- * @param id java.lang.String
- * @param port int
- */
- public void modifyServerPort(String id, int port) {
- try {
- if ("server".equals(id)) {
- server.setPort(port + "");
- isServerDirty = true;
- firePropertyChangeEvent(MODIFY_PORT_PROPERTY, id, new Integer(port));
- return;
- }
-
- int i = id.indexOf("/");
- int servNum = Integer.parseInt(id.substring(0, i));
- int connNum = Integer.parseInt(id.substring(i + 1));
-
- Service service = server.getService(servNum);
- Connector connector = service.getConnector(connNum);
- connector.setPort(port + "");
- isServerDirty = true;
- firePropertyChangeEvent(MODIFY_PORT_PROPERTY, id, new Integer(port));
- } catch (Exception e) {
- Trace.trace("Error modifying server port " + id, e);
- }
- }
- /**
- * Change a web module.
- * @param index int
- * @param docBase java.lang.String
- * @param path java.lang.String
- * @param reloadable boolean
- */
- public void modifyWebModule(int index, String docBase, String path, boolean reloadable) {
- try {
- int size = server.getServiceCount();
- for (int i = 0; i < size; i++) {
- Service service = server.getService(i);
- if (service.getName().equalsIgnoreCase(DEFAULT_SERVICE)) {
- Engine engine = service.getEngine();
- Host host = engine.getHost();
- Context context = host.getContext(index);
- context.setPath(path);
- context.setDocBase(docBase);
- context.setReloadable(reloadable ? "true" : "false");
- isServerDirty = true;
- WebModule module = new WebModule(path, docBase, null, reloadable);
- firePropertyChangeEvent(MODIFY_WEB_MODULE_PROPERTY, new Integer(index), module);
- return;
- }
- }
- } catch (Exception e) {
- Trace.trace("Error modifying web module " + index, e);
- }
- }
-
- /**
- * Removes a mime mapping.
- * @param index int
- */
- public void removeMimeMapping(int index) {
- webAppDocument.removeMimeMapping(index);
- firePropertyChangeEvent(REMOVE_MAPPING_PROPERTY, null, new Integer(index));
- }
-
- /**
- * Removes a web module.
- * @param index int
- */
- public void removeWebModule(int index) {
- try {
- int size = server.getServiceCount();
- for (int i = 0; i < size; i++) {
- Service service = server.getService(i);
- if (service.getName().equalsIgnoreCase(DEFAULT_SERVICE)) {
- Engine engine = service.getEngine();
- Host host = engine.getHost();
- host.removeElement("Context", index);
- isServerDirty = true;
- firePropertyChangeEvent(REMOVE_WEB_MODULE_PROPERTY, null, new Integer(index));
- return;
- }
- }
- } catch (Exception e) {
- Trace.trace("Error removing module ref " + index, e);
- }
- }
-
- public void importFromPath(IPath path, IProgressMonitor monitor) throws CoreException {
- load(path, monitor);
- }
-
- public void importFromRuntime(IRuntime runtime, IProgressMonitor monitor) throws CoreException {
- load(runtime.getLocation().append("conf"), monitor);
- }
-}
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat55Handler.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat55Handler.java
index 891f976..bfcba2a 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat55Handler.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat55Handler.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,6 +8,8 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal;
+
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -40,4 +41,4 @@
return new Status(IStatus.ERROR, TomcatPlugin.PLUGIN_ID, 0, TomcatPlugin.getResource("%errorSpec55"), null);
}
-}
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat55RuntimeTargetHandler.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat55RuntimeTargetHandler.java
deleted file mode 100644
index cae2d19..0000000
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat55RuntimeTargetHandler.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.eclipse.jst.server.tomcat.core.internal;
-/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- **********************************************************************/
-/**
- *
- */
-public class Tomcat55RuntimeTargetHandler extends Tomcat50RuntimeTargetHandler {
- public String getId() {
- return "org.eclipse.jst.server.tomcat.runtimeTarget.v55";
- }
-
- public String getLabel() {
- return TomcatPlugin.getResource("%target55runtime");
- }
-}
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 4a18a1d..32fd827 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
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,31 +8,34 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import java.io.File;
import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.*;
import org.eclipse.jst.server.j2ee.IWebModule;
import org.eclipse.jst.server.tomcat.core.ITomcatConfiguration;
+import org.eclipse.jst.server.tomcat.core.ITomcatConfigurationWorkingCopy;
+import org.eclipse.jst.server.tomcat.core.ITomcatWebModule;
import org.eclipse.jst.server.tomcat.core.WebModule;
-import org.eclipse.wst.server.core.model.IServerPort;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServerPort;
+import org.eclipse.wst.server.core.internal.Trace;
import org.eclipse.wst.server.core.util.FileUtil;
-import org.eclipse.wst.server.core.util.ProgressUtil;
-import org.eclipse.wst.server.core.util.ServerConfigurationDelegate;
/**
* Generic Tomcat server configuration.
*/
-public abstract class TomcatConfiguration extends ServerConfigurationDelegate implements ITomcatConfiguration {
+public abstract class TomcatConfiguration implements ITomcatConfiguration, ITomcatConfigurationWorkingCopy {
public static final String NAME_PROPERTY = "name";
public static final String PORT_PROPERTY = "port";
public static final String MODIFY_PORT_PROPERTY = "modifyPort";
@@ -44,12 +46,27 @@
public static final String MODIFY_WEB_MODULE_PROPERTY = "modifyWebModule";
public static final String ADD_WEB_MODULE_PROPERTY = "addWebModule";
public static final String REMOVE_WEB_MODULE_PROPERTY = "removeWebModule";
+
+ protected IFolder configPath;
+
+ // property change listeners
+ private transient List propertyListeners;
/**
* TomcatConfiguration constructor comment.
*/
- public TomcatConfiguration() {
+ public TomcatConfiguration(IFolder path) {
super();
+ this.configPath = path;
+ /*try {
+ load(configPath, new NullProgressMonitor());
+ } catch (Exception e) {
+ // ignore
+ }*/
+ }
+
+ protected IFolder getFolder() {
+ return configPath;
}
/**
@@ -76,14 +93,15 @@
confDir = confDir.append("conf");
- IFolder folder = configuration.getConfigurationDataFolder();
+ /*IServerConfiguration config = getServerConfiguration();
+ IFolder folder = config.getConfigurationDataFolder();
if (folder != null)
backupFolder(folder, confDir, backup, ms, monitor);
else {
- IPath path = configuration.getConfigurationDataPath();
- backupPath(path, confDir, backup, ms, monitor);
- }
-
+ IPath path = config.getConfigurationDataPath();
+ backupPath(configPath, confDir, backup, ms, monitor);*/
+ backupFolder(getFolder(), confDir, backup, ms, monitor);
+ //}
} catch (Exception e) {
Trace.trace("backupAndPublish() error", e);
IStatus s = new Status(IStatus.ERROR, TomcatPlugin.PLUGIN_ID, 0, TomcatPlugin.getResource("%errorPublishConfiguration", new String[] {e.getLocalizedMessage()}), e);
@@ -190,12 +208,13 @@
* @return java.lang.String
* @param module IWebModule
*/
- protected String getWebModuleURL(IWebModule webModule) {
+ protected String getWebModuleURL(IModule webModule) {
WebModule module = getWebModule(webModule);
if (module != null)
return module.getPath();
- return webModule.getContextRoot();
+ IWebModule webModule2 = (IWebModule) webModule.getAdapter(IWebModule.class);
+ return webModule2.getContextRoot();
}
/**
@@ -204,11 +223,11 @@
* @return java.lang.String
* @param project org.eclipse.core.resources.IProject
*/
- protected WebModule getWebModule(IWebModule webModule) {
+ protected WebModule getWebModule(IModule webModule) {
if (webModule == null)
return null;
- String memento = webModule.getFactoryId() + ":" + webModule.getId();
+ String memento = webModule.getId();
List modules = getWebModules();
int size = modules.size();
@@ -234,13 +253,68 @@
* @param forceSave boolean
* @exception java.io.IOException
*/
- protected abstract void save(IPath path, boolean forceSave, IProgressMonitor monitor) throws CoreException;
+ //protected abstract void save(IPath path, boolean forceSave, IProgressMonitor monitor) throws CoreException;
+
+ protected abstract void save(IFolder folder, IProgressMonitor monitor) throws CoreException;
protected void firePropertyChangeEvent(String propertyName, Object oldValue, Object newValue) {
- configuration.getWorkingCopy().firePropertyChangeEvent(propertyName, oldValue, newValue);
+ if (propertyListeners == null)
+ return;
+
+ PropertyChangeEvent event = new PropertyChangeEvent(this, propertyName, oldValue, newValue);
+ try {
+ Iterator iterator = propertyListeners.iterator();
+ while (iterator.hasNext()) {
+ try {
+ PropertyChangeListener listener = (PropertyChangeListener) iterator.next();
+ listener.propertyChange(event);
+ } catch (Exception e) {
+ Trace.trace("Error firing property change event", e);
+ }
+ }
+ } catch (Exception e) {
+ Trace.trace("Error in property event", e);
+ }
}
/**
+ * Adds a property change listener to this server.
+ *
+ * @param listener java.beans.PropertyChangeListener
+ */
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ if (propertyListeners == null)
+ propertyListeners = new ArrayList();
+ propertyListeners.add(listener);
+ }
+
+ /**
+ * Removes a property change listener from this server.
+ *
+ * @param listener java.beans.PropertyChangeListener
+ */
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ if (propertyListeners != null)
+ propertyListeners.remove(listener);
+ }
+
+ /*public void importFromPath(IPath path, IProgressMonitor monitor) throws CoreException {
+ load(path, monitor);
+ }
+
+ public void importFromRuntime(IRuntime runtime, IProgressMonitor monitor) throws CoreException {
+ load(runtime.getLocation().append("conf"), monitor);
+ }*/
+
+ protected abstract void load(IPath path, IProgressMonitor monitor) throws CoreException;
+
+ protected abstract void load(IFolder folder, IProgressMonitor monitor) throws CoreException;
+
+ public abstract void addWebModule(int index, ITomcatWebModule module);
+
+ public abstract void removeWebModule(int index);
+
+ /**
* Return a string representation of this object.
* @return java.lang.String
*/
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatConfigurationUtil.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatConfigurationUtil.java
index d0b81dd..1f0f7f3 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatConfigurationUtil.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatConfigurationUtil.java
@@ -1,6 +1,6 @@
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatLaunchConfigurationDelegate.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatLaunchConfigurationDelegate.java
index aa25486..2044ff2 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatLaunchConfigurationDelegate.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatLaunchConfigurationDelegate.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,6 +8,8 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal;
+
import java.io.File;
import java.util.Map;
@@ -32,14 +33,14 @@
public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
String serverId = configuration.getAttribute(IServer.ATTR_SERVER_ID, (String) null);
- IServer server = ServerCore.getResourceManager().getServer(serverId);
+ IServer server = ServerCore.findServer(serverId);
if (server == null) {
Trace.trace(Trace.FINEST, "Launch configuration could not find server");
// throw CoreException();
return;
}
- TomcatServer tomcatServer = (TomcatServer) server.getDelegate();
+ TomcatServerBehaviour tomcatServer = (TomcatServerBehaviour) server.getAdapter(TomcatServerBehaviour.class);
tomcatServer.setupLaunch(launch, mode, monitor);
String mainTypeName = tomcatServer.getRuntimeClass();
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatLaunchableAdapterDelegate.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatLaunchableAdapterDelegate.java
index 3407b18..4d6edf5 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatLaunchableAdapterDelegate.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatLaunchableAdapterDelegate.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,37 +8,37 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal;
+
import java.net.URL;
import org.eclipse.jst.server.j2ee.IWebModule;
import org.eclipse.jst.server.j2ee.Servlet;
import org.eclipse.jst.server.j2ee.WebResource;
+import org.eclipse.wst.server.core.ILaunchable;
+import org.eclipse.wst.server.core.IModuleArtifact;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.model.*;
import org.eclipse.wst.server.core.util.HttpLaunchable;
-import org.eclipse.wst.server.core.util.NullLaunchable;
-import org.eclipse.wst.server.core.util.NullModuleObject;
/**
* Launchable adapter delegate for Web resources in Tomcat.
*/
-public class TomcatLaunchableAdapterDelegate implements ILaunchableAdapterDelegate {
+public class TomcatLaunchableAdapterDelegate extends LaunchableAdapterDelegate {
/*
- * @see ILaunchableAdapterDelegate#getLaunchable(IServer, IModuleObject)
+ * @see LaunchableAdapterDelegate#getLaunchable(IServer, IModuleArtifact)
*/
- public ILaunchable getLaunchable(IServer server, IModuleObject moduleObject) {
+ public ILaunchable getLaunchable(IServer server, IModuleArtifact moduleObject) {
Trace.trace("TomcatLaunchableAdapter " + server + "-" + moduleObject);
- IServerDelegate delegate = server.getDelegate();
- if (!(delegate instanceof TomcatServer))
+ if (server.getAdapter(TomcatServer.class) == null)
return null;
if (!(moduleObject instanceof Servlet) &&
- !(moduleObject instanceof WebResource) &&
- !(moduleObject instanceof NullModuleObject))
+ !(moduleObject instanceof WebResource))
return null;
- if (!(moduleObject.getModule() instanceof IWebModule))
+ if (moduleObject.getModule().getAdapter(IWebModule.class) == null)
return null;
try {
- URL url = ((IURLProvider) delegate).getModuleRootURL(moduleObject.getModule());
+ URL url = ((IURLProvider) server.getAdapter(IURLProvider.class)).getModuleRootURL(moduleObject.getModule());
Trace.trace("root: " + url);
@@ -60,8 +59,6 @@
path = path.substring(1);
if (path != null && path.length() > 0)
url = new URL(url, path);
- } else { // null
- return new NullLaunchable();
}
return new HttpLaunchable(url);
} catch (Exception e) {
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatPlugin.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatPlugin.java
index 7f179b6..ab7094d 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatPlugin.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatPlugin.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,6 +8,8 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal;
+
import java.io.File;
import java.net.URL;
import java.text.MessageFormat;
@@ -151,7 +152,9 @@
}
public static ITomcatVersionHandler getTomcatVersionHandler(String id) {
- id = id.substring(0, id.length() - 8);
+ if (id.indexOf("runtime") > 0)
+ id = id.substring(0, 30) + id.substring(38);
+ //id = id.substring(0, id.length() - 8);
if (TOMCAT_32.equals(id))
return new Tomcat32Handler();
else if (TOMCAT_40.equals(id))
@@ -176,6 +179,13 @@
if (verify32 != null)
return;
+ // backup (empty) values
+ verify32 = new String[0];
+ verify40 = new String[0];
+ verify41 = new String[0];
+ verify50 = new String[0];
+ verify55 = new String[0];
+
try {
URL url = getInstance().getBundle().getEntry(VERIFY_INSTALL_FILE);
url = Platform.resolve(url);
@@ -242,11 +252,6 @@
list.toArray(verify55);
} catch (Exception e) {
Trace.trace(Trace.SEVERE, "Could not load installation verification properties", e);
- verify32 = new String[0];
- verify40 = new String[0];
- verify41 = new String[0];
- verify50 = new String[0];
- verify55 = new String[0];
}
}
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatRuntime.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatRuntime.java
index 2f18b9c..fbece93 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatRuntime.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatRuntime.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,48 +8,46 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal;
+
import java.util.List;
-import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.launching.IVMInstall;
import org.eclipse.jdt.launching.IVMInstallType;
import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.jst.server.tomcat.core.ITomcatRuntime;
+import org.eclipse.jst.server.tomcat.core.ITomcatRuntimeWorkingCopy;
-import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.IRuntimeType;
-import org.eclipse.wst.server.core.ServerUtil;
+import org.eclipse.wst.server.core.model.RuntimeDelegate;
/**
*
*/
-public class TomcatRuntime implements ITomcatRuntime {
+public class TomcatRuntime extends RuntimeDelegate implements ITomcatRuntime, ITomcatRuntimeWorkingCopy {
protected static final String PROP_VM_INSTALL_TYPE_ID = "vm-install-type-id";
protected static final String PROP_VM_INSTALL_ID = "vm-install-id";
- protected IRuntime runtime;
-
- public TomcatRuntime() { }
-
- public void initialize(IRuntime newRuntime) {
- this.runtime = newRuntime;
+ public TomcatRuntime() {
+ // do nothing
}
/* (non-Javadoc)
* @see org.eclipse.wst.server.core.model.IRuntime#getLocation()
*/
public ITomcatVersionHandler getVersionHandler() {
- IRuntimeType type = runtime.getRuntimeType();
+ IRuntimeType type = getRuntime().getRuntimeType();
return TomcatPlugin.getTomcatVersionHandler(type.getId());
}
- public String getVMInstallTypeId() {
- return runtime.getAttribute(PROP_VM_INSTALL_TYPE_ID, (String)null);
+ protected String getVMInstallTypeId() {
+ return getAttribute(PROP_VM_INSTALL_TYPE_ID, (String)null);
}
- public String getVMInstallId() {
- return runtime.getAttribute(PROP_VM_INSTALL_ID, (String)null);
+ protected String getVMInstallId() {
+ return getAttribute(PROP_VM_INSTALL_ID, (String)null);
}
public IVMInstall getVMInstall() {
@@ -63,12 +60,14 @@
if (id.equals(vmInstalls[i].getId()))
return vmInstalls[i];
}
- } catch (Exception e) { }
+ } catch (Exception e) {
+ // ignore
+ }
return null;
}
public List getRuntimeClasspath() {
- return getVersionHandler().getRuntimeClasspath(runtime.getLocation());
+ return getVersionHandler().getRuntimeClasspath(getRuntime().getLocation());
}
/**
@@ -78,26 +77,46 @@
* @return boolean
*/
public boolean verifyLocation() {
- return getVersionHandler().verifyInstallPath(runtime.getLocation());
+ return getVersionHandler().verifyInstallPath(getRuntime().getLocation());
}
public IStatus validate() {
- if (runtime.getName() == null || runtime.getName().length() == 0)
- return new Status(IStatus.ERROR, TomcatPlugin.PLUGIN_ID, 0, TomcatPlugin.getResource("%errorRuntimeName"), null);
-
- if (runtime.isWorkingCopy() && ServerUtil.isNameInUse(runtime))
- return new Status(IStatus.ERROR, TomcatPlugin.PLUGIN_ID, 0, TomcatPlugin.getResource("%errorDuplicateRuntimeName"), null);
+ IStatus status = super.validate();
+ if (!status.isOK())
+ return status;
- IPath path = runtime.getLocation();
- if (path == null || path.isEmpty())
- return new Status(IStatus.ERROR, TomcatPlugin.PLUGIN_ID, 0, "", null);
- else if (!verifyLocation())
+ if (!verifyLocation())
return new Status(IStatus.ERROR, TomcatPlugin.PLUGIN_ID, 0, TomcatPlugin.getResource("%errorInstallDir"), null);
- else if (getVMInstall() == null) {
+ else if (getVMInstall() == null)
return new Status(IStatus.ERROR, TomcatPlugin.PLUGIN_ID, 0, TomcatPlugin.getResource("%errorJRE"), null);
+
+ return new Status(IStatus.OK, TomcatPlugin.PLUGIN_ID, 0, "", null);
+ }
+
+ public void setDefaults() {
+ IVMInstall vmInstall = JavaRuntime.getDefaultVMInstall();
+ setVMInstall(vmInstall.getVMInstallType().getId(), vmInstall.getId());
+
+ IRuntimeType type = getRuntimeWorkingCopy().getRuntimeType();
+ getRuntimeWorkingCopy().setLocation(new Path(TomcatPlugin.getPreference("location" + type.getId())));
+ }
+
+ public void setVMInstall(IVMInstall vmInstall) {
+ if (vmInstall == null) {
+ setVMInstall(null, null);
} else
- return new Status(IStatus.OK, TomcatPlugin.PLUGIN_ID, 0, "", null);
+ setVMInstall(vmInstall.getVMInstallType().getId(), vmInstall.getId());
}
- public void dispose() { }
+ protected void setVMInstall(String typeId, String id) {
+ if (typeId == null)
+ setAttribute(PROP_VM_INSTALL_TYPE_ID, (String)null);
+ else
+ setAttribute(PROP_VM_INSTALL_TYPE_ID, typeId);
+
+ if (id == null)
+ setAttribute(PROP_VM_INSTALL_ID, (String)null);
+ else
+ setAttribute(PROP_VM_INSTALL_ID, id);
+ }
}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatRuntimeLocator.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatRuntimeLocator.java
index 8a3d9f5..969fa73 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatRuntimeLocator.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatRuntimeLocator.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,38 +8,49 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal;
+
import java.io.File;
import java.io.FileFilter;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.launching.IVMInstall;
import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.jst.server.tomcat.core.ITomcatRuntimeWorkingCopy;
-import org.eclipse.wst.server.core.IRuntimeType;
-import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
-import org.eclipse.wst.server.core.ServerCore;
-import org.eclipse.wst.server.core.model.IRuntimeLocatorDelegate;
-import org.eclipse.wst.server.core.model.IRuntimeLocatorListener;
-import org.eclipse.wst.server.core.model.IRuntimeWorkingCopyDelegate;
+import org.eclipse.wst.server.core.*;
+import org.eclipse.wst.server.core.model.RuntimeLocatorDelegate;
/**
*
*/
-public class TomcatRuntimeLocator implements IRuntimeLocatorDelegate {
+public class TomcatRuntimeLocator extends RuntimeLocatorDelegate {
protected static final String[] runtimeTypes = new String[] {
- "org.eclipse.jst.server.tomcat.32.runtime",
- "org.eclipse.jst.server.tomcat.40.runtime",
- "org.eclipse.jst.server.tomcat.41.runtime",
- "org.eclipse.jst.server.tomcat.50.runtime",
- "org.eclipse.jst.server.tomcat.55.runtime"};
+ "org.eclipse.jst.server.tomcat.runtime.32",
+ "org.eclipse.jst.server.tomcat.runtime.40",
+ "org.eclipse.jst.server.tomcat.runtime.41",
+ "org.eclipse.jst.server.tomcat.runtime.50",
+ "org.eclipse.jst.server.tomcat.runtime.55"};
/* (non-Javadoc)
* @see org.eclipse.wst.server.core.model.IRuntimeFactoryDelegate#getKnownRuntimes()
*/
- public void searchForRuntimes(IRuntimeLocatorListener listener, IProgressMonitor monitor) {
- File[] files = File.listRoots();
+ public void searchForRuntimes(IPath path, IRuntimeLocator.RuntimeSearchListener listener, IProgressMonitor monitor) {
+ searchForRuntimes2(path, listener, monitor);
+ }
+
+ protected static void searchForRuntimes2(IPath path, IRuntimeLocator.RuntimeSearchListener listener, IProgressMonitor monitor) {
+ File[] files = null;
+ if (path != null) {
+ File f = path.toFile();
+ if (f.exists())
+ files = f.listFiles();
+ else
+ return;
+ } else
+ files = File.listRoots();
+
if (files != null) {
int size = files.length;
int work = 100 / size;
@@ -57,9 +67,9 @@
monitor.worked(100);
}
- protected void searchDir(IRuntimeLocatorListener listener, File dir, int depth, IProgressMonitor monitor) {
+ protected static void searchDir(IRuntimeLocator.RuntimeSearchListener listener, File dir, int depth, IProgressMonitor monitor) {
if ("conf".equals(dir.getName())) {
- IRuntimeWorkingCopy runtime = getRuntimeFromDir(dir.getParentFile());
+ IRuntimeWorkingCopy runtime = getRuntimeFromDir(dir.getParentFile(), monitor);
if (runtime != null) {
listener.runtimeFound(runtime);
return;
@@ -84,18 +94,16 @@
}
}
- protected IRuntimeWorkingCopy getRuntimeFromDir(File dir) {
+ protected static IRuntimeWorkingCopy getRuntimeFromDir(File dir, IProgressMonitor monitor) {
for (int i = 0; i < runtimeTypes.length; i++) {
try {
- IRuntimeType runtimeType = ServerCore.getRuntimeType(runtimeTypes[i]);
- IRuntimeWorkingCopy runtime = runtimeType.createRuntime(dir.getAbsolutePath());
+ IRuntimeType runtimeType = ServerCore.findRuntimeType(runtimeTypes[i]);
+ IRuntimeWorkingCopy runtime = runtimeType.createRuntime(dir.getAbsolutePath(), monitor);
runtime.setName(dir.getName());
runtime.setLocation(new Path(dir.getAbsolutePath()));
- IRuntimeWorkingCopyDelegate delegate = runtime.getWorkingCopyDelegate();
- ITomcatRuntimeWorkingCopy wc = (ITomcatRuntimeWorkingCopy) delegate;
- IVMInstall vmInstall = JavaRuntime.getDefaultVMInstall();
- wc.setVMInstall(vmInstall.getVMInstallType().getId(), vmInstall.getId());
- IStatus status = wc.validate();
+ ITomcatRuntimeWorkingCopy wc = (ITomcatRuntimeWorkingCopy) runtime.getAdapter(ITomcatRuntimeWorkingCopy.class);
+ wc.setVMInstall(JavaRuntime.getDefaultVMInstall());
+ IStatus status = runtime.validate(monitor);
if (status == null || status.isOK())
return runtime;
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatRuntimeTargetHandler.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatRuntimeTargetHandler.java
index 90b9d93..f384cbd 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatRuntimeTargetHandler.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatRuntimeTargetHandler.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,6 +8,13 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.JavaCore;
@@ -21,9 +27,9 @@
/**
*
*/
-public abstract class TomcatRuntimeTargetHandler extends ClasspathRuntimeTargetHandler {
- public IClasspathEntry[] getDelegateClasspathEntries(IRuntime runtime) {
- ITomcatRuntime tomcatRuntime = (ITomcatRuntime) runtime.getDelegate();
+public class TomcatRuntimeTargetHandler extends ClasspathRuntimeTargetHandler {
+ public IClasspathEntry[] getDelegateClasspathEntries(IRuntime runtime, IProgressMonitor monitor) {
+ ITomcatRuntime tomcatRuntime = (ITomcatRuntime) runtime.getAdapter(ITomcatRuntime.class);
IVMInstall vmInstall = tomcatRuntime.getVMInstall();
if (vmInstall != null) {
String name = vmInstall.getName();
@@ -31,23 +37,55 @@
}
return null;
}
-
+
public String[] getClasspathEntryIds(IRuntime runtime) {
return new String[1];
}
+ /**
+ * Return a label for the classpath container.
+ *
+ * @return
+ */
public String getClasspathContainerLabel(IRuntime runtime, String id) {
- return getLabel();
+ String id2 = runtime.getId();
+ if (id2.indexOf("32") > 0)
+ return TomcatPlugin.getResource("%target32runtime");
+ else if (id2.indexOf("40") > 0)
+ return TomcatPlugin.getResource("%target40runtime");
+ else if (id2.indexOf("41") > 0)
+ return TomcatPlugin.getResource("%target41runtime");
+ else if (id2.indexOf("50") > 0)
+ return TomcatPlugin.getResource("%target50runtime");
+
+ return TomcatPlugin.getResource("%target55runtime");
}
/* (non-Javadoc)
- * @see org.eclipse.wst.server.target.IServerTargetDelegate#getClasspathEntries()
+ * @see org.eclipse.jst.server
*/
public IClasspathEntry[] resolveClasspathContainer(IRuntime runtime, String id) {
return resolveClasspathContainer(runtime);
}
- public abstract String getLabel();
-
- public abstract IClasspathEntry[] resolveClasspathContainer(IRuntime runtime);
-}
+ /**
+ * Resolve the classpath entries.
+ */
+ public IClasspathEntry[] resolveClasspathContainer(IRuntime runtime) {
+ IPath installPath = runtime.getLocation();
+
+ if (installPath == null)
+ return new IClasspathEntry[0];
+
+ List list = new ArrayList();
+ if (runtime.getId().indexOf("32") > 0) {
+ IPath path = installPath.append("lib");
+ addLibraryEntries(list, path.toFile(), true);
+ } else {
+ IPath path = installPath.append("common");
+ addLibraryEntries(list, path.append("lib").toFile(), true);
+ addLibraryEntries(list, path.append("endorsed").toFile(), true);
+ }
+ return resolveList(list);
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatRuntimeWorkingCopy.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatRuntimeWorkingCopy.java
deleted file mode 100644
index 70616fd..0000000
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatRuntimeWorkingCopy.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.eclipse.jst.server.tomcat.core.internal;
-/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- **********************************************************************/
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.launching.IVMInstall;
-import org.eclipse.jdt.launching.JavaRuntime;
-import org.eclipse.jst.server.tomcat.core.ITomcatRuntimeWorkingCopy;
-
-import org.eclipse.wst.server.core.IRuntimeType;
-import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
-/**
- *
- */
-public class TomcatRuntimeWorkingCopy extends TomcatRuntime implements ITomcatRuntimeWorkingCopy {
- protected IRuntimeWorkingCopy wc;
-
- public void initialize(IRuntimeWorkingCopy runtime2) {
- wc = runtime2;
- }
-
- public void setDefaults() {
- IVMInstall vmInstall = JavaRuntime.getDefaultVMInstall();
- setVMInstall(vmInstall.getVMInstallType().getId(), vmInstall.getId());
-
- IRuntimeType type = wc.getRuntimeType();
- wc.setLocation(new Path(TomcatPlugin.getPreference("location" + type.getId())));
- }
-
- public void setVMInstall(String typeId, String id) {
- if (typeId == null)
- wc.setAttribute(PROP_VM_INSTALL_TYPE_ID, (String)null);
- else
- wc.setAttribute(PROP_VM_INSTALL_TYPE_ID, typeId);
-
- if (id == null)
- wc.setAttribute(PROP_VM_INSTALL_ID, (String)null);
- else
- wc.setAttribute(PROP_VM_INSTALL_ID, id);
- }
-
- public void handleSave(byte id, IProgressMonitor monitor) { }
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServer.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServer.java
index 93b6f45..79514ae 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
@@ -1,6 +1,6 @@
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -10,12 +10,12 @@
**********************************************************************/
package org.eclipse.jst.server.tomcat.core.internal;
-import java.io.File;
import java.net.URL;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.*;
import org.eclipse.debug.core.*;
import org.eclipse.debug.core.model.IProcess;
@@ -27,28 +27,24 @@
import org.eclipse.jst.server.tomcat.core.ITomcatConfiguration;
import org.eclipse.jst.server.tomcat.core.ITomcatRuntime;
import org.eclipse.jst.server.tomcat.core.ITomcatServer;
+import org.eclipse.jst.server.tomcat.core.ITomcatServerWorkingCopy;
import org.eclipse.jst.server.tomcat.core.WebModule;
-import org.eclipse.jst.server.tomcat.core.internal.command.RemoveWebModuleTask;
-import org.eclipse.jst.server.tomcat.core.internal.command.SetWebModulePathTask;
import org.eclipse.wst.server.core.*;
import org.eclipse.wst.server.core.model.*;
-import org.eclipse.wst.server.core.resources.IModuleResourceDelta;
-import org.eclipse.wst.server.core.util.SocketUtil;
+import org.eclipse.wst.server.core.util.PingThread;
/**
* Generic Tomcat server.
*/
-public class TomcatServer implements ITomcatServer, IStartableServer, IMonitorableServer {
- private static final String ATTR_STOP = "stop-server";
-
+public class TomcatServer extends ServerDelegate implements ITomcatServer, ITomcatServerWorkingCopy {
protected transient IPath tempDirectory;
-
- protected IServerState server;
// the thread used to ping the server to check for startup
protected transient PingThread ping = null;
protected transient IProcess process;
protected transient IDebugEventSetListener processListener;
+
+ protected transient TomcatConfiguration configuration;
/**
* TomcatServer.
@@ -57,47 +53,79 @@
super();
}
- public void initialize(IServerState server2) {
- this.server = server2;
- }
-
- public void dispose() { }
-
public TomcatRuntime getTomcatRuntime() {
- if (server.getRuntime() == null)
+ if (getServer().getRuntime() == null)
return null;
- return (TomcatRuntime) server.getRuntime().getDelegate();
+ return (TomcatRuntime) getServer().getAdapter(TomcatRuntime.class);
}
-
+
public ITomcatVersionHandler getTomcatVersionHandler() {
- if (server.getRuntime() == null)
+ if (getServer().getRuntime() == null)
return null;
- TomcatRuntime runtime = (TomcatRuntime) server.getRuntime().getDelegate();
- return runtime.getVersionHandler();
+ return getTomcatRuntime().getVersionHandler();
}
-
+
+ public ITomcatConfiguration getServerConfiguration() {
+ return getTomcatConfiguration();
+ }
+
public TomcatConfiguration getTomcatConfiguration() {
- IServerConfiguration configuration = server.getServerConfiguration();
- if (configuration == null)
- return null;
-
- return (TomcatConfiguration) configuration.getDelegate();
+ if (configuration == null) {
+ IFolder folder = getServer().getServerConfiguration();
+ /*IPath path = null;
+ if (getServerWC() != null && getServerWC().getRuntime() != null)
+ path = getServerWC().getRuntime().getLocation().append("conf");
+ else if (getServer() != null && getServer().getRuntime() != null)
+ path = getServer().getRuntime().getLocation().append("conf");
+ else
+ return null;*/
+
+ String id = getServer().getServerType().getId();
+ if (id.indexOf("32") > 0)
+ configuration = new Tomcat32Configuration(folder);
+ else if (id.indexOf("40") > 0)
+ configuration = new Tomcat40Configuration(folder);
+ else if (id.indexOf("41") > 0)
+ configuration = new Tomcat41Configuration(folder);
+ else if (id.indexOf("50") > 0)
+ configuration = new Tomcat50Configuration(folder);
+ else if (id.indexOf("55") > 0)
+ configuration = new Tomcat55Configuration(folder);
+ try {
+ configuration.load(folder, null);
+ } catch (CoreException ce) {
+ // ignore
+ }
+ }
+ return configuration;
}
- /**
- * Returns the project publisher that can be used to
- * publish the given project.
- *
- * @param project org.eclipse.core.resources.IProject
- * @return org.eclipse.wst.server.core.model.IProjectPublisher
- */
- public IPublisher getPublisher(List parents, IModule module) {
- if (isTestEnvironment())
- return null;
+ public void importConfiguration(IRuntime runtime, IProgressMonitor monitor) {
+ IPath path = runtime.getLocation().append("conf");
- return new TomcatWebModulePublisher((IWebModule) module, server.getRuntime().getLocation());
+ String id = getServer().getServerType().getId();
+ if (id.indexOf("32") > 0)
+ configuration = new Tomcat32Configuration(null);
+ else if (id.indexOf("40") > 0)
+ configuration = new Tomcat40Configuration(null);
+ else if (id.indexOf("41") > 0)
+ configuration = new Tomcat41Configuration(null);
+ else if (id.indexOf("50") > 0)
+ configuration = new Tomcat50Configuration(null);
+ else if (id.indexOf("55") > 0)
+ configuration = new Tomcat55Configuration(null);
+ try {
+ configuration.load(path, monitor);
+ } catch (CoreException ce) {
+ // ignore
+ }
+ }
+
+ public void saveConfiguration(IProgressMonitor monitor) throws CoreException {
+ TomcatConfiguration config = getTomcatConfiguration();
+ config.save(getServer().getServerConfiguration(), monitor);
}
/**
@@ -110,22 +138,21 @@
if (module == null || !(module instanceof IWebModule))
return null;
- IServerConfiguration serverConfig = server.getServerConfiguration();
+ IFolder serverConfig = getServer().getServerConfiguration();
if (serverConfig == null)
return null;
- TomcatConfiguration config = (TomcatConfiguration) serverConfig.getDelegate();
+ TomcatConfiguration config = getTomcatConfiguration();
if (config == null)
return null;
String url = "http://localhost";
int port = config.getMainPort().getPort();
- port = ServerCore.getServerMonitorManager().getMonitoredPort(server, port, "web");
+ port = ServerCore.getServerMonitorManager().getMonitoredPort(getServer(), port, "web");
if (port != 80)
url += ":" + port;
- IWebModule module2 = (IWebModule) module;
- url += config.getWebModuleURL(module2);
+ url += config.getWebModuleURL(module);
if (!url.endsWith("/"))
url += "/";
@@ -168,7 +195,7 @@
IPath configPath = null;
if (isTestEnvironment())
configPath = getTempDirectory();
- return getTomcatVersionHandler().getRuntimeVMArguments(server.getRuntime().getLocation(), configPath, isSecure());
+ return getTomcatVersionHandler().getRuntimeVMArguments(getServer().getRuntime().getLocation(), configPath, isSecure());
}
/**
@@ -178,7 +205,7 @@
*/
public IPath getTempDirectory() {
if (tempDirectory == null)
- tempDirectory = server.getTempDirectory();
+ tempDirectory = getServer().getTempDirectory();
return tempDirectory;
}
@@ -189,7 +216,7 @@
* @return boolean
*/
public boolean isDebug() {
- return server.getAttribute(PROPERTY_DEBUG, false);
+ return getAttribute(PROPERTY_DEBUG, false);
}
/**
@@ -198,7 +225,7 @@
* @return boolean
*/
public boolean isTestEnvironment() {
- return server.getAttribute(PROPERTY_TEST_ENVIRONMENT, false);
+ return getAttribute(PROPERTY_TEST_ENVIRONMENT, false);
}
/**
@@ -207,7 +234,7 @@
* @return boolean
*/
public boolean isSecure() {
- return server.getAttribute(PROPERTY_SECURE, false);
+ return getAttribute(PROPERTY_SECURE, false);
}
protected static String renderCommandLine(String[] commandLine, String separator) {
@@ -221,183 +248,6 @@
return buf.toString();
}
- public void setProcess(final IProcess newProcess) {
- if (process != null)
- return;
-
- process = newProcess;
- processListener = new IDebugEventSetListener() {
- public void handleDebugEvents(DebugEvent[] events) {
- if (events != null) {
- int size = events.length;
- for (int i = 0; i < size; i++) {
- if (process.equals(events[i].getSource()) && events[i].getKind() == DebugEvent.TERMINATE) {
- DebugPlugin.getDefault().removeDebugEventListener(this);
- stopImpl();
- }
- }
- }
- }
- };
- DebugPlugin.getDefault().addDebugEventListener(processListener);
- }
-
- protected void stopImpl() {
- if (ping != null) {
- ping.stopPinging();
- ping = null;
- }
- if (process != null) {
- process = null;
- DebugPlugin.getDefault().removeDebugEventListener(processListener);
- processListener = null;
- }
- server.setServerState(IServer.SERVER_STOPPED);
- }
-
- /**
- * Methods called to notify that publishing is about to begin.
- * This allows the server to open a connection to the server
- * or get any global information ready.
- *
- * @param monitor org.eclipse.core.runtime.IProgressMonitor
- */
- public IStatus publishStart(IProgressMonitor monitor) {
- return new Status(IStatus.OK, TomcatPlugin.PLUGIN_ID, 0, TomcatPlugin.getResource("%publishingStarted"), null);
- }
-
- public IStatus publishConfiguration(IProgressMonitor monitor) {
- IPath confDir = null;
- if (isTestEnvironment()) {
- confDir = getTempDirectory();
- File temp = confDir.append("conf").toFile();
- if (!temp.exists())
- temp.mkdirs();
- } else
- confDir = server.getRuntime().getLocation();
- return getTomcatConfiguration().backupAndPublish(confDir, !isTestEnvironment(), monitor);
- }
-
- /**
- * Methods called to notify that publishing has finished.
- * The server can close any open connections to the server
- * and do any cleanup operations.
- *
- * @param monitor org.eclipse.core.runtime.IProgressMonitor
- */
- public IStatus publishStop(IProgressMonitor monitor) {
- server.setConfigurationSyncState(IServer.SYNC_STATE_IN_SYNC);
- return new Status(IStatus.OK, TomcatPlugin.PLUGIN_ID, 0, TomcatPlugin.getResource("%publishingStopped"), null);
- }
-
- /**
- * Return true if the server should be terminated before the workbench
- * shutdown and false if not. If the server is not terminated when
- * workbench shutdown, then the server should get reconnected
- * in the server load when the workbench startsup.
- *
- * @return boolean
- **/
- public boolean isTerminateOnShutdown() {
- return true;
- }
-
- /**
- * Setup for starting the server.
- *
- * @param launch ILaunch
- * @param launchMode String
- * @param monitor IProgressMonitor
- */
- public void setupLaunch(ILaunch launch, String launchMode, IProgressMonitor monitor) throws CoreException {
- if ("true".equals(launch.getLaunchConfiguration().getAttribute(ATTR_STOP, "false")))
- return;
- IStatus status = getTomcatRuntime().validate();
- if (status != null && !status.isOK())
- throw new CoreException(status);
-
- //setRestartNeeded(false);
- TomcatConfiguration configuration = getTomcatConfiguration();
-
- // check that ports are free
- Iterator iterator = configuration.getServerPorts().iterator();
- while (iterator.hasNext()) {
- IServerPort sp = (IServerPort) iterator.next();
- if (SocketUtil.isPortInUse(sp.getPort(), 5))
- throw new CoreException(new Status(IStatus.ERROR, TomcatPlugin.PLUGIN_ID, 0, TomcatPlugin.getResource("%errorPortInUse", new String[] {sp.getPort() + "", sp.getName()}), null));
- }
-
- server.setServerState(IServer.SERVER_STARTING);
-
- // ping server to check for startup
- try {
- String url = "http://localhost";
- int port = configuration.getMainPort().getPort();
- if (port != 80)
- url += ":" + port;
- ping = new PingThread(this, server, url, launchMode);
- ping.start();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Can't ping for Tomcat startup.");
- }
- }
-
- /**
- * Cleanly shuts down and terminates the server.
- */
- public void stop() {
- byte state = server.getServerState();
- if (state == IServer.SERVER_STOPPED)
- return;
- else if (state == IServer.SERVER_STARTING || state == IServer.SERVER_STOPPING) {
- terminate();
- return;
- }
-
- try {
- Trace.trace(Trace.FINER, "Stopping Tomcat");
- if (state != IServer.SERVER_STOPPED)
- server.setServerState(IServer.SERVER_STOPPING);
-
- ILaunchConfiguration launchConfig = server.getLaunchConfiguration(true);
- ILaunchConfigurationWorkingCopy wc = launchConfig.getWorkingCopy();
-
- String args = renderCommandLine(getRuntimeProgramArguments(false), " ");
- wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, args);
- wc.setAttribute(ATTR_STOP, "true");
- wc.launch(ILaunchManager.RUN_MODE, new NullProgressMonitor());
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error stopping Tomcat", e);
- }
- }
-
- /**
- * Terminates the server.
- */
- public void terminate() {
- if (server.getServerState() == IServer.SERVER_STOPPED)
- return;
-
- try {
- server.setServerState(IServer.SERVER_STOPPING);
- Trace.trace(Trace.FINER, "Killing the Tomcat process");
- if (process != null && !process.isTerminated()) {
- process.terminate();
- stopImpl();
- }
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error killing the process", e);
- }
- }
-
- public int getStartTimeout() {
- return 45000;
- }
-
- public int getStopTimeout() {
- return 10000;
- }
-
/**
* Return a string representation of this object.
* @return java.lang.String
@@ -411,21 +261,24 @@
* (i.e. publish any changes to the server, and restart if necessary)
* @param config org.eclipse.wst.server.core.model.IServerConfiguration
*/
- public void updateConfiguration() {
+ /*public void updateConfiguration() {
Trace.trace(Trace.FINEST, "Configuration updated " + this);
//setConfigurationSyncState(SYNC_STATE_DIRTY);
//setRestartNeeded(true);
- }
+ }*/
/**
* Respond to updates within the project tree.
*/
- public void updateModule(final IModule module, IModuleResourceDelta delta) { }
+ //public void updateModule(final IModule module, IModuleResourceDelta delta) { }
public void setLaunchDefaults(ILaunchConfigurationWorkingCopy workingCopy) {
ITomcatRuntime runtime = getTomcatRuntime();
- workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_INSTALL_TYPE, runtime.getVMInstallTypeId());
- workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_INSTALL_NAME, runtime.getVMInstall().getName());
+ IVMInstall vmInstall = runtime.getVMInstall();
+ if (vmInstall != null) {
+ workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_INSTALL_TYPE, vmInstall.getVMInstallType().getId());
+ workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_INSTALL_NAME, vmInstall.getName());
+ }
String[] args = getRuntimeProgramArguments(true);
String args2 = renderCommandLine(args, " ");
@@ -438,11 +291,12 @@
List cp = runtime.getRuntimeClasspath();
// add tools.jar to the path
- IVMInstall vmInstall = runtime.getVMInstall();
if (vmInstall != null) {
try {
cp.add(JavaRuntime.newRuntimeContainerClasspathEntry(new Path(JavaRuntime.JRE_CONTAINER).append("org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType").append(vmInstall.getName()), IRuntimeClasspathEntry.BOOTSTRAP_CLASSES));
- } catch (Exception e) { }
+ } catch (Exception e) {
+ // ignore
+ }
IPath jrePath = new Path(vmInstall.getInstallLocation().getAbsolutePath());
if (jrePath != null) {
@@ -475,8 +329,8 @@
* @param project org.eclipse.core.resources.IProject
* @return java.util.List
*/
- public List getChildModules(IModule project) {
- return new ArrayList(0);
+ public IModule[] getChildModules(IModule project) {
+ return new IModule[0];
}
/**
@@ -494,19 +348,16 @@
* @param project org.eclipse.core.resources.IProject
* @return java.util.List
*/
- public List getParentModules(IModule module) throws CoreException {
- if (module instanceof IWebModule) {
- IWebModule webModule = (IWebModule) module;
+ public IModule[] getParentModules(IModule module) throws CoreException {
+ if (module.getAdapter(IWebModule.class) != null) {
IStatus status = canModifyModules(new IModule[] { module }, null);
if (status == null || !status.isOK())
throw new CoreException(status);
- ArrayList l = new ArrayList();
- l.add(webModule);
- return l;
+ return new IModule[] { module };
}
return null;
}
-
+
/**
* Returns the project references for projects that are in
* this configuration.
@@ -525,14 +376,9 @@
String memento = module.getMemento();
if (memento != null) {
- int index = memento.indexOf(":");
- if (index > 0) {
- String factoryId = memento.substring(0, index);
- String mem = memento.substring(index + 1);
- IModule module2 = ServerUtil.getModule(factoryId, mem);
- if (module2 != null)
- list.add(module2);
- }
+ IModule module2 = ServerUtil.getModule(memento);
+ if (module2 != null)
+ list.add(module2);
}
}
}
@@ -544,7 +390,7 @@
}
public byte getModuleState(IModule module) {
- return IServer.MODULE_STATE_STARTED;
+ return IServer.STATE_STARTED;
}
/**
@@ -571,91 +417,89 @@
return new Status(IStatus.OK, TomcatPlugin.PLUGIN_ID, 0, "%canModifyModules", null);
}
+ public IServerPort[] getServerPorts() {
+ if (getServer().getServerConfiguration() == null)
+ return new IServerPort[0];
+
+ List list = getTomcatConfiguration().getServerPorts();
+ IServerPort[] sp = new IServerPort[list.size()];
+ list.toArray(sp);
+ return sp;
+ }
+
+ public void setDefaults() {
+ setTestEnvironment(true);
+ }
+
/**
- * Method called when changes to the modules or module factories
- * within this configuration occur. Return any necessary commands to repair
- * or modify the server configuration in response to these changes.
- *
- * @param org.eclipse.wst.server.core.model.IModuleFactoryEvent[]
- * @param org.eclipse.wst.server.core.model.IModuleEvent[]
- * @return org.eclipse.wst.server.core.model.ITask[]
+ * Sets this process to debug mode. This feature only works
+ * with Tomcat v4.0.
+ *
+ * @param b boolean
*/
- public ITask[] getRepairCommands(IModuleFactoryEvent[] factoryEvent, IModuleEvent[] moduleEvent) {
- List list = new ArrayList();
- // check for Web modules being removed
- if (factoryEvent != null) {
- List modules = getTomcatConfiguration().getWebModules();
- int size = modules.size();
+ public void setDebug(boolean b) {
+ setAttribute(PROPERTY_DEBUG, b);
+ }
+
+ /**
+ * Sets this process to secure mode.
+ * @param b boolean
+ */
+ public void setSecure(boolean b) {
+ setAttribute(PROPERTY_SECURE, b);
+ }
+
+ /**
+ * Sets this server to test environment mode.
+ *
+ * @param b boolean
+ */
+ public void setTestEnvironment(boolean b) {
+ setAttribute(PROPERTY_TEST_ENVIRONMENT, b);
+ }
+
+ /**
+ * Add the given project to this configuration. The project
+ * has already been verified using isSupportedProject() and
+ * does not already exist in the configuration.
+ *
+ * @param ref java.lang.String
+ */
+ public void modifyModules(IModule[] add, IModule[] remove, IProgressMonitor monitor) throws CoreException {
+ IStatus status = canModifyModules(add, remove);
+ if (status == null || !status.isOK())
+ throw new CoreException(status);
+
+ TomcatConfiguration config = getTomcatConfiguration();
+
+ if (add != null) {
+ int size = add.length;
for (int i = 0; i < size; i++) {
- WebModule module = (WebModule) modules.get(i);
-
- String memento = module.getMemento();
- if (memento != null) {
- boolean found = false;
- int index = memento.indexOf(":");
- String factoryId = memento.substring(0, index);
- String mem = memento.substring(index + 1);
-
- int size2 = factoryEvent.length;
- for (int j = 0; !found && j < size2; j++) {
- IModule[] removed = factoryEvent[j].getRemovedModules();
- if (removed != null) {
- int size3 = removed.length;
- for (int k = 0; !found && k < size3; k++) {
- if (removed[k] != null && removed[k].getFactoryId().equals(factoryId) &&
- removed[k].getId().equals(mem)) {
- list.add(new RemoveWebModuleTask(i));
- found = true;
- }
- }
- }
- }
- }
+ IModule module3 = add[i];
+ IWebModule module = (IWebModule) module3.getAdapter(IWebModule.class);
+ String contextRoot = module.getContextRoot();
+ if (contextRoot != null && !contextRoot.startsWith("/"))
+ contextRoot = "/" + contextRoot;
+ WebModule module2 = new WebModule(contextRoot,
+ module.getLocation().toOSString(), module3.getId(), true);
+ config.addWebModule(-1, module2);
}
}
- // check for changing context roots
- if (moduleEvent != null) {
- int size2 = moduleEvent.length;
+ if (remove != null) {
+ int size2 = remove.length;
for (int j = 0; j < size2; j++) {
- if (moduleEvent[j].getModule() instanceof IWebModule && moduleEvent[j].isChanged()) {
- IWebModule webModule = (IWebModule) moduleEvent[j].getModule();
-
- String contextRoot = webModule.getContextRoot();
- if (contextRoot != null && !contextRoot.startsWith("/"))
- contextRoot = "/" + contextRoot;
-
- List modules = getTomcatConfiguration().getWebModules();
- int size = modules.size();
- boolean found = false;
- for (int i = 0; !found && i < size; i++) {
- WebModule module = (WebModule) modules.get(i);
-
- String memento = module.getMemento();
- if (memento != null) {
- int index = memento.indexOf(":");
- String factoryId = memento.substring(0, index);
- String mem = memento.substring(index + 1);
- if (webModule.getFactoryId().equals(factoryId) && webModule.getId().equals(mem)) {
- if (!module.getPath().equals(contextRoot)) {
- list.add(new SetWebModulePathTask(i, contextRoot));
- found = true;
- }
- }
- }
- }
+ IModule module3 = remove[j];
+ String memento = module3.getId();
+ List modules = getTomcatConfiguration().getWebModules();
+ int size = modules.size();
+ for (int i = 0; i < size; i++) {
+ WebModule module = (WebModule) modules.get(i);
+ if (memento.equals(module.getMemento()))
+ config.removeWebModule(i);
}
}
}
-
- ITask[] commands = new ITask[list.size()];
- list.toArray(commands);
- return commands;
+ config.save(config.getFolder(), monitor);
}
-
- public List getServerPorts() {
- if (server.getServerConfiguration() == null)
- return new ArrayList();
- return getTomcatConfiguration().getServerPorts();
- }
-}
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServerBehaviour.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServerBehaviour.java
new file mode 100644
index 0000000..88aaec5
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServerBehaviour.java
@@ -0,0 +1,365 @@
+/**********************************************************************
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.debug.core.*;
+import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
+import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.jst.server.j2ee.IWebModule;
+import org.eclipse.jst.server.tomcat.core.ITomcatRuntime;
+import org.eclipse.jst.server.tomcat.core.ITomcatServerBehaviour;
+
+import org.eclipse.wst.server.core.*;
+import org.eclipse.wst.server.core.model.*;
+import org.eclipse.wst.server.core.util.FileUtil;
+import org.eclipse.wst.server.core.util.PingThread;
+import org.eclipse.wst.server.core.util.SocketUtil;
+/**
+ * Generic Tomcat server.
+ */
+public class TomcatServerBehaviour extends ServerBehaviourDelegate implements ITomcatServerBehaviour {
+ private static final String ATTR_STOP = "stop-server";
+
+ protected transient IPath tempDirectory;
+
+ // the thread used to ping the server to check for startup
+ protected transient PingThread ping = null;
+ protected transient IProcess process;
+ protected transient IDebugEventSetListener processListener;
+
+ /**
+ * TomcatServer.
+ */
+ public TomcatServerBehaviour() {
+ super();
+ }
+
+ public void initialize() {
+ setMode(ILaunchManager.RUN_MODE);
+ }
+
+ public TomcatRuntime getTomcatRuntime() {
+ if (getServer().getRuntime() == null)
+ return null;
+
+ return (TomcatRuntime) getServer().getRuntime().getAdapter(TomcatRuntime.class);
+ }
+
+ public ITomcatVersionHandler getTomcatVersionHandler() {
+ if (getServer().getRuntime() == null)
+ return null;
+
+ return getTomcatRuntime().getVersionHandler();
+ }
+
+ public TomcatConfiguration getTomcatConfiguration() {
+ return getTomcatServer().getTomcatConfiguration();
+ }
+
+ public TomcatServer getTomcatServer() {
+ return (TomcatServer) getServer().getAdapter(TomcatServer.class);
+ }
+
+ /**
+ * Return the runtime class name.
+ *
+ * @return java.lang.String
+ */
+ public String getRuntimeClass() {
+ return getTomcatVersionHandler().getRuntimeClass();
+ }
+
+ /**
+ * Return the program's runtime arguments to start or stop.
+ *
+ * @param boolean starting
+ * @return java.lang.String
+ */
+ protected String[] getRuntimeProgramArguments(boolean starting) {
+ IPath configPath = null;
+ if (getTomcatServer().isTestEnvironment())
+ configPath = getTempDirectory();
+ return getTomcatVersionHandler().getRuntimeProgramArguments(configPath, getTomcatServer().isDebug(), starting);
+ }
+
+ /**
+ * Return the runtime (VM) arguments.
+ *
+ * @return java.lang.String
+ */
+ protected String[] getRuntimeVMArguments() {
+ IPath configPath = null;
+ if (getTomcatServer().isTestEnvironment())
+ configPath = getTempDirectory();
+ return getTomcatVersionHandler().getRuntimeVMArguments(getServer().getRuntime().getLocation(), configPath, getTomcatServer().isSecure());
+ }
+
+ /**
+ * Obtain a temporary directory if this server doesn't
+ * already have one. Otherwise, return the existing one.
+ * @return java.io.File
+ */
+ public IPath getTempDirectory() {
+ if (tempDirectory == null)
+ tempDirectory = getServer().getTempDirectory();
+ return tempDirectory;
+ }
+
+ protected static String renderCommandLine(String[] commandLine, String separator) {
+ if (commandLine == null || commandLine.length < 1)
+ return "";
+ StringBuffer buf= new StringBuffer(commandLine[0]);
+ for (int i = 1; i < commandLine.length; i++) {
+ buf.append(separator);
+ buf.append(commandLine[i]);
+ }
+ return buf.toString();
+ }
+
+ public void setProcess(final IProcess newProcess) {
+ if (process != null)
+ return;
+
+ process = newProcess;
+ processListener = new IDebugEventSetListener() {
+ public void handleDebugEvents(DebugEvent[] events) {
+ if (events != null) {
+ int size = events.length;
+ for (int i = 0; i < size; i++) {
+ if (process.equals(events[i].getSource()) && events[i].getKind() == DebugEvent.TERMINATE) {
+ DebugPlugin.getDefault().removeDebugEventListener(this);
+ stopImpl();
+ }
+ }
+ }
+ }
+ };
+ DebugPlugin.getDefault().addDebugEventListener(processListener);
+ }
+
+ protected void stopImpl() {
+ if (ping != null) {
+ ping.stopPinging();
+ ping = null;
+ }
+ if (process != null) {
+ process = null;
+ DebugPlugin.getDefault().removeDebugEventListener(processListener);
+ processListener = null;
+ }
+ setServerState(IServer.STATE_STOPPED);
+ }
+
+ public void publishServer(IProgressMonitor monitor) throws CoreException {
+ IPath confDir = null;
+ if (getTomcatServer().isTestEnvironment()) {
+ confDir = getTempDirectory();
+ File temp = confDir.append("conf").toFile();
+ if (!temp.exists())
+ temp.mkdirs();
+ } else
+ confDir = getServer().getRuntime().getLocation();
+ IStatus status = getTomcatConfiguration().backupAndPublish(confDir, !getTomcatServer().isTestEnvironment(), monitor);
+ if (status != null && !status.isOK())
+ throw new CoreException(status);
+
+ setServerPublishState(IServer.PUBLISH_STATE_NONE);
+ }
+
+ /**
+ * Returns the project publisher that can be used to
+ * publish the given project.
+ */
+ public void publishModule(IModule[] parents, IModule module, IProgressMonitor monitor) {
+ if (getTomcatServer().isTestEnvironment())
+ return;
+
+ IWebModule webModule = (IWebModule) module;
+ IPath from = webModule.getLocation();
+ IPath to = getServer().getRuntime().getLocation().append("webapps").append(webModule.getContextRoot());
+ FileUtil.smartCopyDirectory(from.toOSString(), to.toOSString(), monitor);
+
+ setModulePublishState(module, IServer.PUBLISH_STATE_NONE);
+ }
+
+ /**
+ * Setup for starting the server.
+ *
+ * @param launch ILaunch
+ * @param launchMode String
+ * @param monitor IProgressMonitor
+ */
+ public void setupLaunch(ILaunch launch, String launchMode, IProgressMonitor monitor) throws CoreException {
+ if ("true".equals(launch.getLaunchConfiguration().getAttribute(ATTR_STOP, "false")))
+ return;
+ IStatus status = getTomcatRuntime().validate();
+ if (status != null && !status.isOK())
+ throw new CoreException(status);
+
+ //setRestartNeeded(false);
+ TomcatConfiguration configuration = getTomcatConfiguration();
+
+ // check that ports are free
+ Iterator iterator = configuration.getServerPorts().iterator();
+ while (iterator.hasNext()) {
+ IServerPort sp = (IServerPort) iterator.next();
+ if (SocketUtil.isPortInUse(sp.getPort(), 5))
+ throw new CoreException(new Status(IStatus.ERROR, TomcatPlugin.PLUGIN_ID, 0, TomcatPlugin.getResource("%errorPortInUse", new String[] {sp.getPort() + "", sp.getName()}), null));
+ }
+
+ setServerState(IServer.STATE_STARTING);
+
+ // ping server to check for startup
+ try {
+ String url = "http://localhost";
+ int port = configuration.getMainPort().getPort();
+ if (port != 80)
+ url += ":" + port;
+ ping = new PingThread(getServer(), this, url, 50);
+ } catch (Exception e) {
+ Trace.trace(Trace.SEVERE, "Can't ping for Tomcat startup.");
+ }
+ }
+
+ /**
+ * Cleanly shuts down and terminates the server.
+ */
+ public void stop(boolean force) {
+ if (force) {
+ terminate();
+ return;
+ }
+ int state = getServer().getServerState();
+ if (state == IServer.STATE_STOPPED)
+ return;
+ else if (state == IServer.STATE_STARTING || state == IServer.STATE_STOPPING) {
+ terminate();
+ return;
+ }
+
+ try {
+ Trace.trace(Trace.FINER, "Stopping Tomcat");
+ if (state != IServer.STATE_STOPPED)
+ setServerState(IServer.STATE_STOPPING);
+
+ ILaunchConfiguration launchConfig = getServer().getLaunchConfiguration(true, null);
+ ILaunchConfigurationWorkingCopy wc = launchConfig.getWorkingCopy();
+
+ String args = renderCommandLine(getRuntimeProgramArguments(false), " ");
+ wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, args);
+ wc.setAttribute(ATTR_STOP, "true");
+ wc.launch(ILaunchManager.RUN_MODE, new NullProgressMonitor());
+ } catch (Exception e) {
+ Trace.trace(Trace.SEVERE, "Error stopping Tomcat", e);
+ }
+ }
+
+ /**
+ * Terminates the server.
+ */
+ protected void terminate() {
+ if (getServer().getServerState() == IServer.STATE_STOPPED)
+ return;
+
+ try {
+ setServerState(IServer.STATE_STOPPING);
+ Trace.trace(Trace.FINER, "Killing the Tomcat process");
+ if (process != null && !process.isTerminated()) {
+ process.terminate();
+ stopImpl();
+ }
+ } catch (Exception e) {
+ Trace.trace(Trace.SEVERE, "Error killing the process", e);
+ }
+ }
+
+ /**
+ * Return a string representation of this object.
+ * @return java.lang.String
+ */
+ public String toString() {
+ return "TomcatServer";
+ }
+
+ /**
+ * Update the given configuration in the server.
+ * (i.e. publish any changes to the server, and restart if necessary)
+ * @param config org.eclipse.wst.server.core.model.IServerConfiguration
+ */
+ /*public void updateConfiguration() {
+ Trace.trace(Trace.FINEST, "Configuration updated " + this);
+ //setConfigurationSyncState(SYNC_STATE_DIRTY);
+ //setRestartNeeded(true);
+ }*/
+
+ /**
+ * Respond to updates within the project tree.
+ */
+ //public void updateModule(final IModule module, IModuleResourceDelta delta) { }
+
+ public void setLaunchDefaults(ILaunchConfigurationWorkingCopy workingCopy) {
+ ITomcatRuntime runtime = getTomcatRuntime();
+ IVMInstall vmInstall = runtime.getVMInstall();
+ if (vmInstall != null) {
+ workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_INSTALL_TYPE, vmInstall.getVMInstallType().getId());
+ workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_INSTALL_NAME, vmInstall.getName());
+ }
+
+ String[] args = getRuntimeProgramArguments(true);
+ String args2 = renderCommandLine(args, " ");
+ workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, args2);
+
+ args = getRuntimeVMArguments();
+ args2 = renderCommandLine(args, " ");
+ workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, args2);
+
+ List cp = runtime.getRuntimeClasspath();
+
+ // add tools.jar to the path
+ if (vmInstall != null) {
+ try {
+ cp.add(JavaRuntime.newRuntimeContainerClasspathEntry(new Path(JavaRuntime.JRE_CONTAINER).append("org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType").append(vmInstall.getName()), IRuntimeClasspathEntry.BOOTSTRAP_CLASSES));
+ } catch (Exception e) {
+ // ignore
+ }
+
+ IPath jrePath = new Path(vmInstall.getInstallLocation().getAbsolutePath());
+ if (jrePath != null) {
+ IPath toolsPath = jrePath.append("lib").append("tools.jar");
+ if (toolsPath.toFile().exists()) {
+ cp.add(JavaRuntime.newArchiveRuntimeClasspathEntry(toolsPath));
+ }
+ }
+ }
+
+ Iterator cpi = cp.iterator();
+ List list = new ArrayList();
+ while (cpi.hasNext()) {
+ IRuntimeClasspathEntry entry = (IRuntimeClasspathEntry) cpi.next();
+ try {
+ list.add(entry.getMemento());
+ } catch (Exception e) {
+ Trace.trace(Trace.SEVERE, "Could not resolve classpath entry: " + entry, e);
+ }
+ }
+ workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, list);
+ workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, false);
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServerLocator.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServerLocator.java
index 6f2388f..da7571d 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServerLocator.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServerLocator.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,36 +8,30 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal;
+
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.core.model.IRuntimeLocatorListener;
-import org.eclipse.wst.server.core.model.IServerLocatorDelegate;
-import org.eclipse.wst.server.core.model.IServerLocatorListener;
+import org.eclipse.wst.server.core.model.ServerLocatorDelegate;
/**
*
*/
-public class TomcatServerLocator extends TomcatRuntimeLocator implements IServerLocatorDelegate {
- /*protected static final String[] serverTypes = new String[] {
- "org.eclipse.jst.server.tomcat.32",
- "org.eclipse.jst.server.tomcat.40",
- "org.eclipse.jst.server.tomcat.41",
- "org.eclipse.jst.server.tomcat.50"};*/
-
- public void searchForServers(final IServerLocatorListener listener, IProgressMonitor monitor) {
- IRuntimeLocatorListener listener2 = new IRuntimeLocatorListener() {
- public void runtimeFound(IRuntime runtime) {
+public class TomcatServerLocator extends ServerLocatorDelegate {
+ public void searchForServers(String host, final IServerLocator.Listener listener, final IProgressMonitor monitor) {
+ IRuntimeLocator.RuntimeSearchListener listener2 = new IRuntimeLocator.RuntimeSearchListener() {
+ public void runtimeFound(IRuntimeWorkingCopy runtime) {
String runtimeTypeId = runtime.getRuntimeType().getId();
String serverTypeId = runtimeTypeId.substring(0, runtimeTypeId.length() - 8);
- IServerType serverType = ServerCore.getServerType(serverTypeId);
+ IServerType serverType = ServerCore.findServerType(serverTypeId);
try {
- IServer server = serverType.createServer(serverTypeId, null, runtime);
+ IServerWorkingCopy server = serverType.createServer(serverTypeId, null, runtime, monitor);
listener.serverFound(server);
} catch (Exception e) {
Trace.trace(Trace.WARNING, "Could not create Tomcat server", e);
}
}
};
- searchForRuntimes(listener2, monitor);
+ TomcatRuntimeLocator.searchForRuntimes2(null, listener2, monitor);
}
}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServerUtil.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServerUtil.java
index 5e0f98b..787ca39 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServerUtil.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServerUtil.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,6 +8,8 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal;
+
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.JavaCore;
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServerWorkingCopy.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServerWorkingCopy.java
deleted file mode 100644
index 6a2f595..0000000
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServerWorkingCopy.java
+++ /dev/null
@@ -1,131 +0,0 @@
-package org.eclipse.jst.server.tomcat.core.internal;
-/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- **********************************************************************/
-import java.util.List;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jst.server.j2ee.IWebModule;
-import org.eclipse.jst.server.tomcat.core.ITomcatConfigurationWorkingCopy;
-import org.eclipse.jst.server.tomcat.core.ITomcatServerWorkingCopy;
-import org.eclipse.jst.server.tomcat.core.WebModule;
-
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.IServerConfigurationWorkingCopy;
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-import org.eclipse.wst.server.core.model.IModule;
-/**
- *
- */
-public class TomcatServerWorkingCopy extends TomcatServer implements ITomcatServerWorkingCopy {
- protected IServerWorkingCopy workingCopy;
-
- public TomcatServerWorkingCopy() {
- super();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.core.model.IServerWorkingCopyDelegate#initializeWorkingCopy(org.eclipse.wst.server.core.IServerWorkingCopy)
- */
- public void initialize(IServerWorkingCopy workingCopy2) {
- this.workingCopy = workingCopy2;
- }
-
- public void setDefaults() {
- setTestEnvironment(true);
- }
-
- /**
- * Sets this process to debug mode. This feature only works
- * with Tomcat v4.0.
- *
- * @param b boolean
- */
- public void setDebug(boolean b) {
- workingCopy.setAttribute(PROPERTY_DEBUG, b);
- }
-
- /**
- * Sets this process to secure mode.
- * @param b boolean
- */
- public void setSecure(boolean b) {
- workingCopy.setAttribute(PROPERTY_SECURE, b);
- }
-
- /**
- * Sets this server to test environment mode.
- *
- * @param b boolean
- */
- public void setTestEnvironment(boolean b) {
- workingCopy.setAttribute(PROPERTY_TEST_ENVIRONMENT, b);
- }
-
- /**
- * Add the given project to this configuration. The project
- * has already been verified using isSupportedProject() and
- * does not already exist in the configuration.
- *
- * @param ref java.lang.String
- */
- public void modifyModules(IModule[] add, IModule[] remove, IProgressMonitor monitor) throws CoreException {
- IStatus status = canModifyModules(add, remove);
- if (status == null || !status.isOK())
- throw new CoreException(status);
-
- IServerConfigurationWorkingCopy scwc = server.getServerConfiguration().getWorkingCopy();
- // TODO
- ITomcatConfigurationWorkingCopy wc = (ITomcatConfigurationWorkingCopy) scwc.getWorkingCopyDelegate();
- boolean change = false;
-
- if (add != null) {
- int size = add.length;
- for (int i = 0; i < size; i++) {
- IModule module3 = add[i];
- IWebModule module = (IWebModule) module3;
- String contextRoot = module.getContextRoot();
- if (contextRoot != null && !contextRoot.startsWith("/"))
- contextRoot = "/" + contextRoot;
- WebModule module2 = new WebModule(contextRoot,
- module.getLocation().toOSString(), module.getFactoryId() + ":" + module.getId(), true);
- wc.addWebModule(-1, module2);
- change = true;
- }
- }
-
- if (remove != null) {
- int size2 = remove.length;
- for (int j = 0; j < size2; j++) {
- IModule module3 = remove[j];
- String memento = module3.getFactoryId() + ":" + module3.getId();
- List modules = getTomcatConfiguration().getWebModules();
- int size = modules.size();
- for (int i = 0; i < size; i++) {
- WebModule module = (WebModule) modules.get(i);
- if (memento.equals(module.getMemento())) {
- wc.removeWebModule(i);
- change = true;
- }
- }
- }
- }
- if (!change)
- scwc.release();
- else
- scwc.save(new NullProgressMonitor());
- server.setConfigurationSyncState(IServer.SYNC_STATE_DIRTY);
- }
-
- public void handleSave(byte id, IProgressMonitor monitor) { }
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatSourcePathComputerDelegate.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatSourcePathComputerDelegate.java
index a299b6e..0f4ff3c 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatSourcePathComputerDelegate.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatSourcePathComputerDelegate.java
@@ -1,6 +1,6 @@
/**********************************************************************
* Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -24,10 +24,9 @@
import org.eclipse.jdt.internal.launching.JavaSourceLookupUtil;
import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.ServerCore;
-import org.eclipse.wst.server.core.model.IModule;
-import org.eclipse.wst.server.core.model.IProjectModule;
/**
*
*/
@@ -40,21 +39,22 @@
String serverId = configuration.getAttribute(IServer.ATTR_SERVER_ID, (String) null);
- IServer server = ServerCore.getResourceManager().getServer(serverId);
+ IServer server = ServerCore.findServer(serverId);
if (server != null) {
List list = new ArrayList();
List pathList = new ArrayList();
- IModule[] modules = server.getModules();
+ IModule[] modules = server.getModules(monitor);
for (int i = 0; i < modules.length; i++) {
- if (modules[i] instanceof IProjectModule) {
- IProjectModule dp = (IProjectModule) modules[i];
- IProject project = dp.getProject();
+ IProject project = modules[i].getProject();
+ if (project != null) {
try {
if (project.hasNature(JavaCore.NATURE_ID)) {
IJavaProject javaProject = (IJavaProject) project.getNature(JavaCore.NATURE_ID);
list.add(javaProject);
}
- } catch (Exception e) { }
+ } catch (Exception e) {
+ // ignore
+ }
IPath path = server.getRuntime().getLocation().append("work").append("Catalina").append("localhost").append(modules[i].getName());
pathList.add(path);
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatWebModulePublisher.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatWebModulePublisher.java
deleted file mode 100644
index 705f24f..0000000
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatWebModulePublisher.java
+++ /dev/null
@@ -1,260 +0,0 @@
-package org.eclipse.jst.server.tomcat.core.internal;
-/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- **********************************************************************/
-import java.io.File;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jst.server.j2ee.IWebModule;
-
-import org.eclipse.wst.server.core.model.IPublisher;
-import org.eclipse.wst.server.core.resources.IModuleFile;
-import org.eclipse.wst.server.core.resources.IModuleFolder;
-import org.eclipse.wst.server.core.resources.IModuleResource;
-import org.eclipse.wst.server.core.resources.IRemoteResource;
-import org.eclipse.wst.server.core.resources.RemoteFolder;
-import org.eclipse.wst.server.core.resources.RemoteResource;
-import org.eclipse.wst.server.core.util.FileUtil;
-import org.eclipse.wst.server.core.util.ProgressUtil;
-/**
- * The Tomcat publisher for local (out of the workbench) resources.
- */
-public class TomcatWebModulePublisher implements IPublisher {
- protected IWebModule module;
- protected IPath installDir;
-
- protected static final Status publishStatus = new Status(IStatus.OK, TomcatPlugin.PLUGIN_ID, 0, "Published successfully", null);
- protected static final Status deleteStatus = new Status(IStatus.OK, TomcatPlugin.PLUGIN_ID, 0, "Deleted successfully", null);
-
- /**
- * TomcatWebModulePublisher constructor comment.
- */
- public TomcatWebModulePublisher(IWebModule module, IPath installDir) {
- super();
- this.module = module;
- this.installDir = installDir;
- }
-
- /**
- * Delete the following files from the remote machine.
- *
- * @param file java.lang.String[]
- * @return org.eclipse.core.runtime.IStatus[]
- */
- public IStatus[] delete(IRemoteResource[] resource, IProgressMonitor monitor) {
- if (resource == null)
- return null;
-
- monitor = ProgressUtil.getMonitorFor(monitor);
- monitor.beginTask(TomcatPlugin.getResource("%publishTask"), resource.length);
-
- IPath root = getRemoteRoot().append(module.getContextRoot());
-
- int size = resource.length;
- IStatus[] status = new Status[size];
- for (int i = 0; i < size; i++) {
- if (monitor.isCanceled())
- return status;
-
- IPath path = resource[i].getPath();
- IPath realPath = root.append(path);
- File file = new File(realPath.toOSString());
-
- monitor.subTask(TomcatPlugin.getResource("%publisherDeleteTask", new String[] {path.toString()}));
- Trace.trace("Deleting " + realPath);
- boolean b = file.delete();
- if (b)
- status[i] = new Status(IStatus.OK, TomcatPlugin.PLUGIN_ID, 0, "Delete " + realPath.toOSString() + " successfully", null);
- else
- status[i] = new Status(IStatus.ERROR, TomcatPlugin.PLUGIN_ID, 0, "Could not delete " + realPath.toOSString(), null);
-
- monitor.worked(1);
- }
- monitor.done();
- return status;
- }
-
- /**
- * Returns the mapping of this file on the remote
- * system. Return null if this file should not be
- * copied to the remote server.
- *
- * @param resource org.eclipse.core.resources.IResource
- * @return org.eclipse.core.resources.IPath
- */
- public IPath getMappedLocation(IModuleResource resource) {
- return resource.getPath();
- }
-
- /**
- * Recursively builds a directory tree of the remote resources.
- *
- * @param path org.eclipse.core.runtime.IPath
- * @return java.util.List
- */
- protected IRemoteResource[] getRemoteResources(RemoteFolder parent, File dir) {
- List list = new ArrayList();
-
- if (!dir.exists())
- return null;
-
- if (!dir.isDirectory())
- return null;
-
- File[] files = dir.listFiles();
- if (files == null)
- return null;
-
- int size = files.length;
- for (int i = 0; i < size; i++) {
- File file = files[i];
- if (file.isDirectory()) {
- RemoteFolder folder = new RemoteFolder(parent, file.getName(), file.lastModified());
- if (parent != null)
- parent.addChild(folder);
- getRemoteResources(folder, file);
- list.add(folder);
- } else {
- IRemoteResource remote = new RemoteResource(parent, file.getName(), file.lastModified());
- if (parent != null)
- parent.addChild(remote);
- list.add(remote);
- }
- }
-
- IRemoteResource[] resources = new IRemoteResource[list.size()];
- list.toArray(resources);
- return resources;
- }
-
- /**
- * Returns a list of the remote resources at the root level.
- * These may be folders or resources. This method should not
- * return cached data.
- *
- * @return java.util.List
- */
- public IRemoteResource[] getRemoteResources(IProgressMonitor monitor) {
- File rootFile = getRemoteRoot().append(module.getContextRoot()).toFile();
- if (rootFile.exists()) {
- return getRemoteResources(null, rootFile);
- }
- return new IRemoteResource[0];
- }
-
- /**
- * Returns the root of the remote publishing location.
- *
- * @return org.eclipse.core.runtime.IPath
- */
- protected IPath getRemoteRoot() {
- return installDir.append("webapps");
- }
-
- /**
- * Returns true if there may be any files or folders within
- * this container that should be mapped to the remote system.
- * Returns false if files within this folder are never copied
- * to the remote system.
- *
- * @param container org.eclipse.core.resources.IContainer
- * @return boolean
- */
- public boolean shouldMapMembers(IModuleFolder folder) {
- return true;
- }
-
- /**
- * Publish the given files to the given location on the
- * remote machine.
- *
- * @param file java.lang.String[]
- * @return org.eclipse.core.runtime.IStatus[]
- */
- public IStatus[] publish(IModuleResource[] resource, IProgressMonitor monitor) {
- if (resource == null)
- return null;
-
- monitor = ProgressUtil.getMonitorFor(monitor);
- monitor.beginTask(TomcatPlugin.getResource("%publishTask"), resource.length);
-
- IPath root = getRemoteRoot().append(module.getContextRoot());
-
- // create context root directory if necessary
- File temp = root.toFile();
- if (!temp.exists())
- temp.mkdirs();
-
- int size = resource.length;
- IStatus[] status = new Status[size];
- for (int i = 0; i < size; i++) {
- if (monitor.isCanceled())
- return status;
-
- //IPath fromPath = resource[i].getLocation();
- IPath toPath = getMappedLocation(resource[i]);
- IPath realToPath = root.append(toPath);
-
- // copy file
- monitor.subTask(TomcatPlugin.getResource("%publisherPublishTask", new String[] {toPath.toString()}));
- Trace.trace("Publishing " + resource[i] + " -> " + realToPath);
- if (resource[i] instanceof IModuleFolder) {
- File f = new File(realToPath.toOSString());
- if (f.exists() && f.isDirectory()) {
- status[i] = new Status(IStatus.OK, TomcatPlugin.PLUGIN_ID, 0, "Directory " + realToPath.toOSString() + " already exists", null);
- } else {
- boolean b = f.mkdir();
-
- if (b)
- status[i] = new Status(IStatus.OK, TomcatPlugin.PLUGIN_ID, 0, "Created " + realToPath.toOSString() + " successfully", null);
- else
- status[i] = new Status(IStatus.ERROR, TomcatPlugin.PLUGIN_ID, 0, "Could not create directory " + realToPath.toOSString(), null);
- }
- } else if (resource[i] instanceof IModuleFile) {
- IModuleFile file = (IModuleFile) resource[i];
- InputStream in = null;
- try {
- in = file.getContents();
- status[i] = FileUtil.copyFile(in, realToPath.toOSString());
- } catch (Exception e) {
- // FIX-ME
- } finally {
- if (in != null)
- try {
- in.close();
- } catch (Exception e) { }
- }
- }
- monitor.worked(1);
- }
-
- monitor.done();
- return status;
- }
-
- /**
- * Delete the entire module from the remote location.
- *
- * @param monitor org.eclipse.core.runtime.IProgressMonitor
- * @return org.eclipse.core.runtime.IStatus
- */
- public IStatus deleteAll(IProgressMonitor monitor) {
- IPath path = getRemoteRoot().append(module.getContextRoot());
-
- FileUtil.deleteDirectory(path.toFile(), monitor);
- return new Status(IStatus.OK, TomcatPlugin.PLUGIN_ID, 0, TomcatPlugin.getResource("%projectCleanupSuccess", module.getContextRoot()), null);
- }
-}
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Trace.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Trace.java
index 338cbf5..3f2d51a 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Trace.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Trace.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,6 +8,7 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal;
/**
* Helper class to route trace output.
*/
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/WebAppDocument.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/WebAppDocument.java
index 4b59012..8f51978 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/WebAppDocument.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/WebAppDocument.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,6 +8,8 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal;
+
import java.io.ByteArrayInputStream;
import java.io.FileInputStream;
import java.io.IOException;
@@ -27,8 +28,6 @@
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
-
-import org.eclipse.wst.server.core.util.ProgressUtil;
/**
* Helper class to access a web.xml file.
*/
@@ -122,16 +121,6 @@
element.removeChild(node);
isWebAppDirty = true;
}
-
- /**
- * Saves the Web app document.
- *
- * @param filename java.lang.String
- */
- /*public void save(String dirPath, boolean forceDirty) throws IOException {
- if (forceDirty || isWebAppDirty)
- XMLUtil.save(dirPath + "web.xml", webAppDocument);
- }*/
/**
* Saves the Web app document.
@@ -158,11 +147,13 @@
else
file.create(in, true, ProgressUtil.getSubMonitorFor(monitor, 200));
} catch (Exception e) {
+ // ignore
} finally {
try {
in.close();
- } catch (Exception e) { }
+ } catch (Exception e) {
+ // 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/command/AddMimeMappingCommand.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/AddMimeMappingCommand.java
index 857b4ab..cabf6e6 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/AddMimeMappingCommand.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/AddMimeMappingCommand.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal.command;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,6 +8,8 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal.command;
+
import org.eclipse.jst.server.tomcat.core.*;
import org.eclipse.jst.server.tomcat.core.internal.*;
/**
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/AddWebModuleCommand.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/AddWebModuleCommand.java
index 8ba4c8f..a070d93 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/AddWebModuleCommand.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/AddWebModuleCommand.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal.command;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,6 +8,8 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal.command;
+
import org.eclipse.jst.server.tomcat.core.*;
import org.eclipse.jst.server.tomcat.core.internal.TomcatPlugin;
/**
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/ConfigurationCommand.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/ConfigurationCommand.java
index 517c134..fb1854e 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/ConfigurationCommand.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/ConfigurationCommand.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal.command;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,6 +8,8 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal.command;
+
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jst.server.tomcat.core.ITomcatConfigurationWorkingCopy;
import org.eclipse.wst.server.core.util.Task;
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/ModifyMimeMappingCommand.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/ModifyMimeMappingCommand.java
index 549494d..e255537 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/ModifyMimeMappingCommand.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/ModifyMimeMappingCommand.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal.command;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,6 +8,8 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal.command;
+
import org.eclipse.jst.server.tomcat.core.ITomcatConfigurationWorkingCopy;
import org.eclipse.jst.server.tomcat.core.internal.MimeMapping;
import org.eclipse.jst.server.tomcat.core.internal.TomcatPlugin;
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/ModifyPortCommand.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/ModifyPortCommand.java
index 4915720..6664d07 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/ModifyPortCommand.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/ModifyPortCommand.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal.command;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,11 +8,13 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal.command;
+
import java.util.Iterator;
import org.eclipse.jst.server.tomcat.core.ITomcatConfigurationWorkingCopy;
import org.eclipse.jst.server.tomcat.core.internal.TomcatPlugin;
-import org.eclipse.wst.server.core.model.IServerPort;
+import org.eclipse.wst.server.core.IServerPort;
/**
* Command to change the configuration port.
*/
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/ModifyWebModuleCommand.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/ModifyWebModuleCommand.java
index 4f470f7..d06341d 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/ModifyWebModuleCommand.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/ModifyWebModuleCommand.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal.command;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,6 +8,8 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal.command;
+
import org.eclipse.jst.server.tomcat.core.ITomcatConfigurationWorkingCopy;
import org.eclipse.jst.server.tomcat.core.WebModule;
import org.eclipse.jst.server.tomcat.core.internal.TomcatPlugin;
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/RemoveMimeMappingCommand.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/RemoveMimeMappingCommand.java
index 49ac07b..3e561ec 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/RemoveMimeMappingCommand.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/RemoveMimeMappingCommand.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal.command;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,6 +8,8 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal.command;
+
import org.eclipse.jst.server.tomcat.core.ITomcatConfigurationWorkingCopy;
import org.eclipse.jst.server.tomcat.core.internal.MimeMapping;
import org.eclipse.jst.server.tomcat.core.internal.TomcatPlugin;
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/RemoveWebModuleCommand.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/RemoveWebModuleCommand.java
index fca5d86..19156e7 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/RemoveWebModuleCommand.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/RemoveWebModuleCommand.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal.command;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,6 +8,8 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal.command;
+
import org.eclipse.jst.server.tomcat.core.ITomcatConfigurationWorkingCopy;
import org.eclipse.jst.server.tomcat.core.WebModule;
import org.eclipse.jst.server.tomcat.core.internal.TomcatPlugin;
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/RemoveWebModuleTask.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/RemoveWebModuleTask.java
index 4f70202..ae93c8d 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/RemoveWebModuleTask.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/RemoveWebModuleTask.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal.command;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,15 +8,16 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal.command;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jst.server.tomcat.core.ITomcatConfiguration;
-import org.eclipse.jst.server.tomcat.core.ITomcatConfigurationWorkingCopy;
import org.eclipse.jst.server.tomcat.core.WebModule;
+import org.eclipse.jst.server.tomcat.core.internal.TomcatConfiguration;
import org.eclipse.jst.server.tomcat.core.internal.TomcatPlugin;
+import org.eclipse.jst.server.tomcat.core.internal.TomcatServer;
-import org.eclipse.wst.server.core.IServerConfiguration;
-import org.eclipse.wst.server.core.IServerConfigurationWorkingCopy;
+import org.eclipse.wst.server.core.IServerWorkingCopy;
import org.eclipse.wst.server.core.ITaskModel;
import org.eclipse.wst.server.core.util.Task;
/**
@@ -40,8 +40,9 @@
* @return boolean
*/
public void execute(IProgressMonitor monitor) throws CoreException {
- IServerConfigurationWorkingCopy wc = (IServerConfigurationWorkingCopy) getTaskModel().getObject(ITaskModel.TASK_SERVER_CONFIGURATION);
- ITomcatConfigurationWorkingCopy configuration = (ITomcatConfigurationWorkingCopy) wc.getWorkingCopyDelegate();
+ IServerWorkingCopy wc = (IServerWorkingCopy) getTaskModel().getObject(ITaskModel.TASK_SERVER);
+ TomcatServer server = (TomcatServer) wc.getAdapter(TomcatServer.class);
+ TomcatConfiguration configuration = server.getTomcatConfiguration();
module = (WebModule) configuration.getWebModules().get(index);
configuration.removeWebModule(index);
}
@@ -52,8 +53,9 @@
*/
public String getDescription() {
if (module == null) {
- IServerConfiguration config = (IServerConfiguration) getTaskModel().getObject(ITaskModel.TASK_SERVER_CONFIGURATION);
- ITomcatConfiguration configuration = (ITomcatConfiguration) config.getDelegate();
+ IServerWorkingCopy wc = (IServerWorkingCopy) getTaskModel().getObject(ITaskModel.TASK_SERVER);
+ TomcatServer server = (TomcatServer) wc.getAdapter(TomcatServer.class);
+ TomcatConfiguration configuration = server.getTomcatConfiguration();
module = (WebModule) configuration.getWebModules().get(index);
}
return TomcatPlugin.getResource("%configurationEditorActionRemoveWebModuleDescription", module.getPath());
@@ -72,9 +74,12 @@
*/
public void undo() {
try {
- IServerConfigurationWorkingCopy wc = (IServerConfigurationWorkingCopy) getTaskModel().getObject(ITaskModel.TASK_SERVER_CONFIGURATION);
- ITomcatConfigurationWorkingCopy configuration = (ITomcatConfigurationWorkingCopy) wc.getWorkingCopyDelegate();
+ IServerWorkingCopy wc = (IServerWorkingCopy) getTaskModel().getObject(ITaskModel.TASK_SERVER);
+ TomcatServer server = (TomcatServer) wc.getAdapter(TomcatServer.class);
+ TomcatConfiguration configuration = server.getTomcatConfiguration();
configuration.addWebModule(index, module);
- } catch (Exception e) { }
+ } catch (Exception e) {
+ // 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/command/ServerCommand.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/ServerCommand.java
index 38eed7b..8bf10e6 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/ServerCommand.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/ServerCommand.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal.command;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,6 +8,8 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal.command;
+
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jst.server.tomcat.core.ITomcatServerWorkingCopy;
import org.eclipse.wst.server.core.util.Task;
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/SetDebugModeCommand.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/SetDebugModeCommand.java
index 944bb0e..35dabc2 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/SetDebugModeCommand.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/SetDebugModeCommand.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal.command;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,6 +8,8 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal.command;
+
import org.eclipse.jst.server.tomcat.core.ITomcatServerWorkingCopy;
import org.eclipse.jst.server.tomcat.core.internal.TomcatPlugin;
/**
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/SetSecureCommand.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/SetSecureCommand.java
index 2e381bf..2386ed4 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/SetSecureCommand.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/SetSecureCommand.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal.command;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,6 +8,8 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal.command;
+
import org.eclipse.jst.server.tomcat.core.ITomcatServerWorkingCopy;
import org.eclipse.jst.server.tomcat.core.internal.TomcatPlugin;
/**
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/SetTestEnvironmentCommand.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/SetTestEnvironmentCommand.java
index 365effb..faae3a0 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/SetTestEnvironmentCommand.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/SetTestEnvironmentCommand.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal.command;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,6 +8,8 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal.command;
+
import org.eclipse.jst.server.tomcat.core.ITomcatServerWorkingCopy;
import org.eclipse.jst.server.tomcat.core.internal.TomcatPlugin;
/**
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/SetWebModulePathCommand.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/SetWebModulePathCommand.java
index ab778f7..b056932 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/SetWebModulePathCommand.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/SetWebModulePathCommand.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal.command;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,6 +8,8 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal.command;
+
import org.eclipse.jst.server.tomcat.core.ITomcatConfigurationWorkingCopy;
import org.eclipse.jst.server.tomcat.core.WebModule;
import org.eclipse.jst.server.tomcat.core.internal.TomcatPlugin;
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/SetWebModulePathTask.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/SetWebModulePathTask.java
index 332112d..0ac8c1b 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/SetWebModulePathTask.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/command/SetWebModulePathTask.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal.command;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,15 +8,16 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal.command;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jst.server.tomcat.core.ITomcatConfiguration;
-import org.eclipse.jst.server.tomcat.core.ITomcatConfigurationWorkingCopy;
import org.eclipse.jst.server.tomcat.core.WebModule;
+import org.eclipse.jst.server.tomcat.core.internal.TomcatConfiguration;
import org.eclipse.jst.server.tomcat.core.internal.TomcatPlugin;
+import org.eclipse.jst.server.tomcat.core.internal.TomcatServer;
-import org.eclipse.wst.server.core.IServerConfiguration;
-import org.eclipse.wst.server.core.IServerConfigurationWorkingCopy;
+import org.eclipse.wst.server.core.IServerWorkingCopy;
import org.eclipse.wst.server.core.ITaskModel;
import org.eclipse.wst.server.core.util.Task;
/**
@@ -36,14 +36,15 @@
this.index = index;
this.path = contextRoot;
}
-
+
/**
* Execute the command.
* @return boolean
*/
public void execute(IProgressMonitor monitor) throws CoreException {
- IServerConfigurationWorkingCopy wc = (IServerConfigurationWorkingCopy) getTaskModel().getObject(ITaskModel.TASK_SERVER_CONFIGURATION);
- ITomcatConfigurationWorkingCopy configuration = (ITomcatConfigurationWorkingCopy) wc.getWorkingCopyDelegate();
+ IServerWorkingCopy wc = (IServerWorkingCopy) getTaskModel().getObject(ITaskModel.TASK_SERVER);
+ TomcatServer server = (TomcatServer) wc.getAdapter(TomcatServer.class);
+ TomcatConfiguration configuration = server.getTomcatConfiguration();
oldModule = (WebModule) configuration.getWebModules().get(index);
configuration.removeWebModule(index);
@@ -57,8 +58,9 @@
*/
public String getDescription() {
if (oldModule == null) {
- IServerConfiguration config = (IServerConfiguration) getTaskModel().getObject(ITaskModel.TASK_SERVER_CONFIGURATION);
- ITomcatConfiguration configuration = (ITomcatConfiguration) config.getDelegate();
+ IServerWorkingCopy wc = (IServerWorkingCopy) getTaskModel().getObject(ITaskModel.TASK_SERVER);
+ TomcatServer server = (TomcatServer) wc.getAdapter(TomcatServer.class);
+ TomcatConfiguration configuration = server.getTomcatConfiguration();
oldModule = (WebModule) configuration.getWebModules().get(index);
}
@@ -78,10 +80,13 @@
*/
public void undo() {
try {
- IServerConfigurationWorkingCopy wc = (IServerConfigurationWorkingCopy) getTaskModel().getObject(ITaskModel.TASK_SERVER_CONFIGURATION);
- ITomcatConfigurationWorkingCopy configuration = (ITomcatConfigurationWorkingCopy) wc.getWorkingCopyDelegate();
+ IServerWorkingCopy wc = (IServerWorkingCopy) getTaskModel().getObject(ITaskModel.TASK_SERVER);
+ TomcatServer server = (TomcatServer) wc.getAdapter(TomcatServer.class);
+ TomcatConfiguration configuration = server.getTomcatConfiguration();
configuration.removeWebModule(index);
configuration.addWebModule(index, oldModule);
- } catch (Exception e) { }
+ } catch (Exception e) {
+ // 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/xml/Factory.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/Factory.java
index 9c82af9..b3be98d 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/Factory.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/Factory.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal.xml;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,6 +8,8 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal.xml;
+
import java.io.*;
import org.w3c.dom.*;
@@ -18,15 +19,13 @@
/**
* Factory for reading and writing from XML files.
*/
-public class Factory implements Serializable {
-
-
- private static final long serialVersionUID = 1L;
-
+public class Factory {
protected String packageName;
protected Document document;
- public Factory() { }
+ public Factory() {
+ // do nothing
+ }
protected Attr createAttribute(String s, Element element) {
Attr attr = document.createAttribute(s);
@@ -106,11 +105,13 @@
s = packageName + "." + s;
Class class1 = Class.forName(s);
- XMLElement ibmxmlelement = (XMLElement) class1.newInstance();
- ibmxmlelement.setElement(element);
- ibmxmlelement.setFactory(this);
- return ibmxmlelement;
- } catch (Exception exception) { }
+ XMLElement xmlElement = (XMLElement) class1.newInstance();
+ xmlElement.setElement(element);
+ xmlElement.setFactory(this);
+ return xmlElement;
+ } catch (Exception exception) {
+ // ignore
+ }
return null;
}
@@ -125,4 +126,4 @@
public void setPackageName(String s) {
packageName = s;
}
-}
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/XMLElement.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/XMLElement.java
index 2e9ee79..76b4821 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/XMLElement.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/XMLElement.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal.xml;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,18 +8,19 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
-import java.io.Serializable;
+package org.eclipse.jst.server.tomcat.core.internal.xml;
+
import org.w3c.dom.*;
/**
* An XML element.
*/
-public class XMLElement implements Serializable {
-
- private static final long serialVersionUID = 1L;
+public class XMLElement {
private Element xmlElement;
protected Factory factory;
- public XMLElement() { }
+ public XMLElement() {
+ // do nothing
+ }
public Attr addAttribute(String s, String s1) {
Attr attr = factory.createAttribute(s, xmlElement);
@@ -36,9 +36,6 @@
return factory.createElement(s, xmlElement);
}
- public void createEmptyBody() {
- }
-
public XMLElement findElement(String s) {
NodeList nodelist = xmlElement.getElementsByTagName(s);
int i = nodelist == null ? 0 : nodelist.getLength();
@@ -208,4 +205,4 @@
}
}
}
-}
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/XMLUtil.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/XMLUtil.java
index 421b297..d1b41a1 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/XMLUtil.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/XMLUtil.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal.xml;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,6 +8,8 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal.xml;
+
import java.io.*;
import java.util.*;
@@ -112,7 +113,9 @@
if (out != null)
try {
out.close();
- } catch (Exception e) { }
+ } catch (Exception e) {
+ // ignore
+ }
}
}
@@ -331,7 +334,9 @@
if (out != null)
try {
out.close();
- } catch (Exception e) { }
+ } catch (Exception e) {
+ // ignore
+ }
}
}
@@ -367,11 +372,14 @@
print(out, document);
return new String(baos.toByteArray());
} catch (Exception ex) {
+ // ignore
} finally {
if (out != null)
try {
out.close();
- } catch (Exception e) { }
+ } catch (Exception e) {
+ // ignore
+ }
}
return null;
}
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server32/Connector.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server32/Connector.java
index e014b9d..43d980b 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server32/Connector.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server32/Connector.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal.xml.server32;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,12 +8,16 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal.xml.server32;
+
import org.eclipse.jst.server.tomcat.core.internal.xml.*;
/**
*
*/
public class Connector extends XMLElement {
- public Connector() { }
+ public Connector() {
+ // do nothing
+ }
public String getClassName() {
return getAttributeValue("className");
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server32/Context.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server32/Context.java
index 7157981..a371fa6 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server32/Context.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server32/Context.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal.xml.server32;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,12 +8,16 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal.xml.server32;
+
import org.eclipse.jst.server.tomcat.core.internal.xml.*;
/**
*
*/
public class Context extends XMLElement {
- public Context() { }
+ public Context() {
+ // do nothing
+ }
public String getCrossContext() {
return getAttributeValue("crossContext");
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server32/ContextManager.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server32/ContextManager.java
index 0913c3a..7a910a6 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server32/ContextManager.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server32/ContextManager.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal.xml.server32;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,12 +8,16 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal.xml.server32;
+
import org.eclipse.jst.server.tomcat.core.internal.xml.*;
/**
*
*/
public class ContextManager extends XMLElement {
- public ContextManager() { }
+ public ContextManager() {
+ // do nothing
+ }
public Connector getConnector(int index) {
return (Connector) findElement("Connector", index);
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server32/Parameter.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server32/Parameter.java
index ca73ec8..56ca74d 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server32/Parameter.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server32/Parameter.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal.xml.server32;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,12 +8,16 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal.xml.server32;
+
import org.eclipse.jst.server.tomcat.core.internal.xml.*;
/**
*
*/
public class Parameter extends XMLElement {
- public Parameter() { }
+ public Parameter() {
+ // do nothing
+ }
public String getName() {
return getAttributeValue("name");
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server32/Server.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server32/Server.java
index 2011fa4..1c173ca 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server32/Server.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server32/Server.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal.xml.server32;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,12 +8,16 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal.xml.server32;
+
import org.eclipse.jst.server.tomcat.core.internal.xml.*;
/**
*
*/
public class Server extends XMLElement {
- public Server() { }
+ public Server() {
+ // do nothing
+ }
public ContextManager getContextManager() {
return (ContextManager) findElement("ContextManager");
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server40/Connector.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server40/Connector.java
index f89e0f5..8ba1949 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server40/Connector.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server40/Connector.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal.xml.server40;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,12 +8,16 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal.xml.server40;
+
import org.eclipse.jst.server.tomcat.core.internal.xml.*;
/**
*
*/
public class Connector extends XMLElement {
- public Connector() { }
+ public Connector() {
+ // do nothing
+ }
public String getAcceptCount() {
return getAttributeValue("acceptCount");
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server40/Context.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server40/Context.java
index ffbb584..95abb58 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server40/Context.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server40/Context.java
@@ -1,6 +1,5 @@
-package org.eclipse.jst.server.tomcat.core.internal.xml.server40;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
@@ -9,12 +8,16 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal.xml.server40;
+
import org.eclipse.jst.server.tomcat.core.internal.xml.*;
/**
*
*/
public class Context extends XMLElement {
- public Context() { }
+ public Context() {
+ // do nothing
+ }
public String getDebug() {
return getAttributeValue("debug");
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server40/Engine.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server40/Engine.java
index ed7acd6..bd3903d 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server40/Engine.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server40/Engine.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal.xml.server40;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,12 +8,16 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal.xml.server40;
+
import org.eclipse.jst.server.tomcat.core.internal.xml.*;
/**
*
*/
public class Engine extends XMLElement {
- public Engine() { }
+ public Engine() {
+ // do nothing
+ }
public String getAppBase() {
return getAttributeValue("appBase");
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server40/Host.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server40/Host.java
index b3996df..b993d33 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server40/Host.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server40/Host.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal.xml.server40;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,12 +8,16 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal.xml.server40;
+
import org.eclipse.jst.server.tomcat.core.internal.xml.*;
/**
*
*/
public class Host extends XMLElement {
- public Host() { }
+ public Host() {
+ // do nothing
+ }
public String getAppBase() {
return getAttributeValue("appBase");
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server40/Listener.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server40/Listener.java
index a8f9061..c2fa008 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server40/Listener.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server40/Listener.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal.xml.server40;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,12 +8,16 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal.xml.server40;
+
import org.eclipse.jst.server.tomcat.core.internal.xml.*;
/**
*
*/
public class Listener extends XMLElement {
- public Listener() { }
+ public Listener() {
+ // do nothing
+ }
public String getClassName() {
return getAttributeValue("className");
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server40/Server.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server40/Server.java
index cc73793..2573f16 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server40/Server.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server40/Server.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal.xml.server40;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,12 +8,16 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal.xml.server40;
+
import org.eclipse.jst.server.tomcat.core.internal.xml.*;
/**
*
*/
public class Server extends XMLElement {
- public Server() { }
+ public Server() {
+ // do nothing
+ }
public String getDebug() {
return getAttributeValue("debug");
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server40/Service.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server40/Service.java
index 99499ed..728b949 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server40/Service.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/server40/Service.java
@@ -1,7 +1,6 @@
-package org.eclipse.jst.server.tomcat.core.internal.xml.server40;
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
@@ -9,12 +8,16 @@
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.jst.server.tomcat.core.internal.xml.server40;
+
import org.eclipse.jst.server.tomcat.core.internal.xml.*;
/**
*
*/
public class Service extends XMLElement {
- public Service() { }
+ public Service() {
+ // do nothing
+ }
public Connector getConnector(int index) {
return (Connector) findElement("Connector", index);
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/verifyInstall.properties b/plugins/org.eclipse.jst.server.tomcat.core/verifyInstall.properties
index 9434b15..ebbd84c 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/verifyInstall.properties
+++ b/plugins/org.eclipse.jst.server.tomcat.core/verifyInstall.properties
@@ -1,4 +1,5 @@
verify32install=lib/jasper.jar,lib/servlet.jar,bin,conf,webapps
verify40install=bin/bootstrap.jar,conf,webapps
verify41install=bin/bootstrap.jar,conf,webapps
-verify50install=bin/bootstrap.jar,conf,webapps
\ No newline at end of file
+verify50install=bin/bootstrap.jar,conf,webapps
+verify55install=bin/bootstrap.jar,conf,webapps
\ No newline at end of file