Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core')
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IModule.java129
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IModuleArtifact.java31
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IModuleType.java63
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IProjectProperties.java54
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IRuntime.java218
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IRuntimeLifecycleListener.java48
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IRuntimeTargetHandler.java52
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IRuntimeType.java150
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IRuntimeWorkingCopy.java178
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServer.java651
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerAttributes.java348
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerLifecycleListener.java48
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerListener.java34
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerType.java226
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerWorkingCopy.java283
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/ServerCore.java563
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/ServerEvent.java224
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/ServerPort.java139
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/ServerUtil.java760
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/TaskModel.java95
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Base.java387
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ChainedJob.java93
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Client.java129
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/DeletedModule.java84
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IClient.java74
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IInstallableRuntime.java43
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IInstallableServer.java83
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ILaunchableAdapter.java42
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IMemento.java189
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IModuleListener.java22
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IModuleResourceDeltaVisitor.java56
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IModuleVisitor.java27
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IMonitoredServerPort.java56
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IOrdered.java33
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IPublishListener.java45
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IPublishTask.java59
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IRuntimeLocator.java72
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IServerLocator.java79
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IServerMonitor.java55
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IServerMonitorManager.java74
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IStartup.java23
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/InstallableRuntime.java156
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/InstallableServer.java136
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/LaunchableAdapter.java75
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Messages.java71
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Messages.properties75
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Module.java225
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleArtifactAdapter.java196
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleEvent.java100
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleFactory.java161
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleFactoryEvent.java49
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleFile.java74
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleFolder.java79
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleKind.java44
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleProperties.java133
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModulePublishInfo.java162
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleResourceDelta.java75
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleType.java123
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ProgressUtil.java69
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ProjectProperties.java227
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/PublishAdapter.java29
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/PublishInfo.java153
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/PublishServerJob.java147
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/PublishTask.java113
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ResourceManager.java1042
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/RestartServerJob.java58
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Runtime.java212
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/RuntimeLocator.java89
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/RuntimeTargetHandler.java178
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/RuntimeType.java147
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/RuntimeWorkingCopy.java363
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Server.java2113
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerListener.java72
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerMonitor.java118
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerMonitorDelegate.java41
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerMonitorManager.java371
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerNotificationManager.java153
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerPlugin.java1050
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerPreferences.java314
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerPublishInfo.java322
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerSchedulingRule.java44
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerType.java359
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerWorkingCopy.java441
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/StartServerJob.java40
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Trace.java100
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/UpdateServerJob.java37
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/WorkingCopyHelper.java170
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/XMLMemento.java412
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/provisional/ServerLocatorDelegate.java49
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/ClientDelegate.java50
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/IModuleFile.java25
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/IModuleFolder.java24
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/IModuleResource.java34
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/IModuleResourceDelta.java160
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/IURLProvider.java44
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/InternalInitializer.java65
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/LaunchableAdapterDelegate.java39
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/ModuleArtifactAdapterDelegate.java37
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/ModuleDelegate.java112
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/ModuleFactoryDelegate.java115
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/PublishOperation.java164
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/PublishTaskDelegate.java51
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/RuntimeDelegate.java311
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/RuntimeLocatorDelegate.java52
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/RuntimeTargetHandlerDelegate.java77
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/ServerBehaviourDelegate.java766
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/ServerDelegate.java392
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/package.html30
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/package.xml25
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/package.html58
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/package.xml38
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/HttpLaunchable.java45
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/IStaticWeb.java25
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/NullModuleArtifact.java44
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/ProjectModule.java296
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/ProjectModuleFactoryDelegate.java406
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/RuntimeLifecycleAdapter.java43
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/ServerLifecycleAdapter.java43
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/SocketUtil.java179
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/WebResource.java58
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/package.html45
-rw-r--r--plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/package.xml30
122 files changed, 0 insertions, 20869 deletions
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IModule.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IModule.java
deleted file mode 100644
index 6e80ccd24..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IModule.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-/**
- * A module is a unit of "content" that can be published to a
- * server.
- * <p>
- * All modules have a module type, which is fixed for the
- * lifetime of the module. The set of module types (or
- * "kinds") is open-ended.
- * </p>
- * <p>
- * All modules are created by module factories using the moduleFactories
- * extension point.
- * </p>
- * <p>
- * The content of a module is a collection of file and folder
- * resources in the workspace.
- * </p>
- * <p>
- * In principle, a module exists independent of any
- * particular server. The same module instance can be associated
- * with multiple server instances at the same time. That is
- * why you cannot ask the module which server it's associated
- * with.
- * </p>
- * <p>
- * [issue: Equality/identify for modules?]
- * </p>
- * <p>This interface is not intended to be implemented by clients.</p>
- * <p>
- * <b>Provisional API:</b> This class/interface is part of an interim API that is still under development and expected to
- * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
- * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
- * (repeatedly) as the API evolves.
- * </p>
- *
- * @plannedfor 1.0
- */
-public interface IModule extends IAdaptable {
- /**
- * Returns the id of this module.
- * Each module has a distinct id, used to distinguish this
- * module from all other modules in the workspace (and
- * within a server). Ids are intended to be used internally
- * as keys; they are not intended to be shown to end users.
- *
- * @return the module id
- */
- public String getId();
-
- /**
- * Returns the displayable name for this module.
- * <p>
- * Note that this name is appropriate for the current locale.
- * </p>
- *
- * @return a displayable name for this module
- */
- public String getName();
-
- /**
- * Returns the type of this module.
- *
- * @return the module type
- */
- public IModuleType getModuleType();
-
- /**
- * Returns the workbench project that this module is contained in,
- * or null if the module is outside of the workspace.
- *
- * @return a project
- */
- public IProject getProject();
-
- /**
- * Returns an object which is an instance of the given class
- * associated with this object. Returns <code>null</code> if
- * no such object can be found, or if the delegate is not
- * loaded.
- * <p>
- * This method will not check the delegate classes for adapting
- * unless they are already loaded. No plugin loading will occur
- * when calling this method. It is suitable for popup menus and
- * other UI artifacts where performance is a concern.
- * </p>
- *
- * @param adapter the adapter class to look up
- * @return a object castable to the given class,
- * or <code>null</code> if this object does not
- * have an adapter for the given class
- * @see IAdaptable#getAdapter(Class)
- * @see #loadAdapter(Class, IProgressMonitor)
- */
- public Object getAdapter(Class adapter);
-
- /**
- * Returns an object which is an instance of the given class
- * associated with this object. Returns <code>null</code> only if
- * no such object can be found after loading and initializing
- * delegates.
- * <p>
- * This method will force a load and initialization of all delegate
- * classes and check them for adapting.
- * </p>
- *
- * @param adapter the adapter class to look up
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @return a object castable to the given class,
- * or <code>null</code> if this object does not
- * have an adapter for the given class
- * @see #getAdapter(Class)
- */
- public Object loadAdapter(Class adapter, IProgressMonitor monitor);
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IModuleArtifact.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IModuleArtifact.java
deleted file mode 100644
index ce88bee97..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IModuleArtifact.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core;
-/**
- * A module artifact is a resource within a module, which can be launched
- * on the server. Examples of module artifacts are servlets, HTML pages,
- * or EJB beans.
- * <p>
- * Objects that provide an adapter of this type will be considered by the
- * contextual Run on Server launch support.
- * </p>
- *
- * @see org.eclipse.wst.server.core.model.ModuleArtifactAdapterDelegate
- * @plannedfor 1.0
- */
-public interface IModuleArtifact {
- /**
- * Returns the module that this artifact is a part of.
- *
- * @return the module that this artifact is contained in
- */
- public IModule getModule();
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IModuleType.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IModuleType.java
deleted file mode 100644
index 5b44bd6c7..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IModuleType.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core;
-/**
- * Represents the type of a module.
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- * <p>
- * <b>Provisional API:</b> This class/interface is part of an interim API that is still under development and expected to
- * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
- * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
- * (repeatedly) as the API evolves.
- * </p>
- *
- * @plannedfor 1.0
- */
-public interface IModuleType {
- /**
- * Returns the module type id.
- * <p>
- * The module type id is a "." separated string uniquely identifying the
- * type of module. Like a java package name, it should scope the type from
- * most general to specific. For instance, "jst.web".
- * </p>
- *
- * @return the module type id
- */
- public String getId();
-
- /**
- * Returns the displayable name for this module type.
- * <p>
- * Note that this name is appropriate for the current locale.
- * </p>
- *
- * @return a displayable name for this module type
- */
- public String getName();
-
- /**
- * Returns the version (specification level) of this module type,
- * e.g. "1.0" or "1.3.2a".
- * <p>
- * The version will normally be a series of numbers separated by
- * ".", but it could be different depending on the type of module.
- * For module types where a version does not make sense (e.g.
- * a static Web module), <code>null</code> is returned.
- * </p>
- *
- * @return the specification version of this module type, or
- * <code>null</code> if there is no version
- */
- public String getVersion();
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IProjectProperties.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IProjectProperties.java
deleted file mode 100644
index a62e995fa..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IProjectProperties.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-/**
- * This interface holds information on the properties of a given project.
- *
- * <p>This interface is not intended to be implemented by clients.</p>
- * <p>
- * <b>Provisional API:</b> This class/interface is part of an interim API that is still under development and expected to
- * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
- * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
- * (repeatedly) as the API evolves.
- * </p>
- *
- * @deprecated Project facet support should now be used instead of this API. @see
- * org.eclipse.wst.common.project.facet.core.IFacetedProject#getRuntime()
- *
- * @plannedfor 1.0
- */
-public interface IProjectProperties {
- /**
- * Returns the current runtime target for this project.
- *
- * @return the current runtime target, or <code>null</code> if the project has
- * no runtime target
- * @deprecated Project facet support should now be used instead of this API. @see
- * org.eclipse.wst.common.project.facet.core.IFacetedProject#getRuntime()
- */
- public IRuntime getRuntimeTarget();
-
- /**
- * Sets the runtime target for the project.
- *
- * @param runtime the runtime to use as the target, or <code>null</code> to
- * unset the target
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @throws CoreException if there is a problem setting the runtime target
- * @deprecated Project facet support should now be used instead of this API. @see
- * org.eclipse.wst.common.project.facet.core.IFacetedProject#setRuntime()
- */
- public void setRuntimeTarget(IRuntime runtime, IProgressMonitor monitor) throws CoreException;
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IRuntime.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IRuntime.java
deleted file mode 100644
index 02fb367ff..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IRuntime.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core;
-
-import org.eclipse.core.runtime.*;
-/**
- * Represents a runtime instance. Every runtime is an instance of a
- * particular, fixed runtime type.
- * <p>
- * Servers have a runtime. The server runtime corresponds to the
- * installed code base for the server. The main role played by the server
- * runtime is in identifying code libraries to compile or build against.
- * In the case of local servers, the server runtime may play a secondary role
- * of being used to launch the server for testing. Having the server runtimes
- * identified as an entity separate from the server itself facilitates sharing
- * server runtimes between several servers.
- * </p>
- * <p>
- * IRuntime implements IAdaptable to allow users to obtain a runtime-type-specific
- * class. By casting the runtime extension to the type prescribed in the API
- * documentation for that particular runtime type, the client can access
- * runtime-type-specific properties and methods. getAdapter() may involve plugin
- * loading, and should not be called from popup menus, etc.
- * </p>
- * <p>
- * The server framework maintains a global list of all known runtime instances
- * ({@link ServerCore#getRuntimes()}).
- * </p>
- * <p>
- * All runtimes have a unique id. Two runtimes (or more likely a runtime and it's
- * working copy) with the same id are equal, and two runtimes with different ids
- * are never equal.
- * </p>
- * <p>
- * Two runtimes are identical if and only if they have the same id.
- * </p>
- * <p>This interface is not intended to be implemented by clients.</p>
- * <p>
- * <b>Provisional API:</b> This class/interface is part of an interim API that is still under development and expected to
- * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
- * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
- * (repeatedly) as the API evolves.
- * </p>
- *
- * @see IRuntimeWorkingCopy
- * @plannedfor 1.0
- */
-public interface IRuntime extends IAdaptable {
- /**
- * Returns the displayable name for this runtime.
- * <p>
- * Note that this name is appropriate for the current locale.
- * </p>
- *
- * @return a displayable name
- */
- public String getName();
-
- /**
- * Returns the id of this runtime instance.
- * Each runtime (of a given type) has a distinct id, fixed for
- * its lifetime. Ids are intended to be used internally as keys;
- * they are not intended to be shown to end users.
- * <p>
- * For the id of the runtime type, use {@link IRuntimeType#getId()}
- * </p>
- *
- * @return the runtime id
- */
- public String getId();
-
- /**
- * Deletes the persistent representation of this runtime.
- *
- * @throws CoreException if there was any error received while deleting the runtime
- * or if this method is called on a working copy
- */
- public void delete() throws CoreException;
-
- /**
- * Returns whether this runtime is marked read only.
- * When a runtime is read only, working copies can be created but
- * they cannot be saved.
- *
- * @return <code>true</code> if this runtime is marked as read only,
- * and <code>false</code> otherwise
- */
- public boolean isReadOnly();
-
- /**
- * Returns true if this is a working copy.
- *
- * @return <code>true</code> if this runtime is a working copy
- * (can be cast to IRuntimeWorkingCopy), and
- * <code>false</code> otherwise
- */
- public boolean isWorkingCopy();
-
- /**
- * Returns an object which is an instance of the given class
- * associated with this object. Returns <code>null</code> if
- * no such object can be found, or if the delegate is not
- * loaded.
- * <p>
- * This method will not check the delegate classes for adapting
- * unless they are already loaded. No plugin loading will occur
- * when calling this method. It is suitable for popup menus and
- * other UI artifacts where performance is a concern.
- * </p>
- *
- * @param adapter the adapter class to look up
- * @return a object castable to the given class,
- * or <code>null</code> if this object does not
- * have an adapter for the given class
- * @see IAdaptable#getAdapter(Class)
- * @see #loadAdapter(Class, IProgressMonitor)
- */
- public Object getAdapter(Class adapter);
-
- /**
- * Returns an object which is an instance of the given class
- * associated with this object. Returns <code>null</code> only if
- * no such object can be found after loading and initializing
- * delegates.
- * <p>
- * This method will force a load and initialization of all delegate
- * classes and check them for adapting.
- * </p>
- *
- * @param adapter the adapter class to look up
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @return a object castable to the given class,
- * or <code>null</code> if this object does not
- * have an adapter for the given class
- * @see #getAdapter(Class)
- */
- public Object loadAdapter(Class adapter, IProgressMonitor monitor);
-
- /**
- * Returns the type of this runtime instance.
- *
- * @return the runtime type
- */
- public IRuntimeType getRuntimeType();
-
- /**
- * Returns a runtime working copy for modifying this runtime instance.
- * If this instance is already a working copy, it is returned.
- * If this instance is not a working copy, a new runtime working copy
- * is created with the same id and attributes.
- * Clients are responsible for saving or releasing the working copy when
- * they are done with it.
- * <p>
- * The runtime working copy is related to this runtime instance
- * in the following ways:
- * <pre>
- * this.getWorkingCopy().getId() == this.getId()
- * this.getWorkingCopy().getOriginal() == this
- * </pre>
- * </p>
- * <p>
- * [issue: IRuntimeWorkingCopy extends IRuntime.
- * Runtime.getWorkingCopy() create a new working copy;
- * RuntimeWorkingCopy.getWorkingCopy() returns this.
- * This may be convenient in code that is ignorant of
- * whether they are dealing with a working copy or not.
- * However, it is hard for clients to manage working copies
- * with this design.
- * </p>
- *
- * @return a new working copy
- */
- public IRuntimeWorkingCopy createWorkingCopy();
-
- /**
- * Returns the absolute path in the local file system to the root of the runtime,
- * typically the installation directory.
- *
- * @return the location of this runtime, or <code>null</code> if none
- */
- public IPath getLocation();
-
- /**
- * Returns whether this runtime is a stub (used for compilation only)
- * or a full runtime.
- *
- * @return <code>true</code> if this runtime is a stub, and
- * <code>false</code> otherwise
- */
- public boolean isStub();
-
- /**
- * Validates this runtime instance. This method returns an error if the runtime
- * is pointing to a null or invalid location (e.g. not pointing to the correct
- * installation directory), or if the runtime-type-specific properties are missing
- * or invalid.
- * <p>
- * This method is not on the working copy so that the runtime can be validated at
- * any time.
- * </p>
- *
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @return a status object with code <code>IStatus.OK</code> if this
- * runtime is valid, otherwise a status object indicating what is
- * wrong with it
- */
- public IStatus validate(IProgressMonitor monitor);
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IRuntimeLifecycleListener.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IRuntimeLifecycleListener.java
deleted file mode 100644
index 14a620297..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IRuntimeLifecycleListener.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core;
-/**
- * Listener interface for changes to runtimes.
- * <p>
- * This interface is fired whenever a runtime is added, modified, or removed.
- * All events are fired post-change, so that all server tools API called as a
- * result of the event will return the updated results. (for example, on
- * runtimeAdded the new server will be in the global list of runtimes
- * ({@link ServerCore#getRuntimes()}), and on runtimeRemoved the runtime will
- * not be in the list.
- * </p>
- *
- * @see ServerCore
- * @see IRuntime
- * @plannedfor 1.0
- */
-public interface IRuntimeLifecycleListener {
- /**
- * A new runtime has been created.
- *
- * @param runtime the new runtime
- */
- public void runtimeAdded(IRuntime runtime);
-
- /**
- * An existing runtime has been updated or modified.
- *
- * @param runtime the modified runtime
- */
- public void runtimeChanged(IRuntime runtime);
-
- /**
- * A existing runtime has been removed.
- *
- * @param runtime the removed runtime
- */
- public void runtimeRemoved(IRuntime runtime);
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IRuntimeTargetHandler.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IRuntimeTargetHandler.java
deleted file mode 100644
index 25dfee1e2..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IRuntimeTargetHandler.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core;
-
-import org.eclipse.core.runtime.IAdaptable;
-/**
- * A runtime target handler is used to apply some properties to a project
- * this is being targeted to a given runtime. For instance, the handler
- * might update the classpath of a Java project to include the runtime's
- * classes, add validation for the given runtime, or restrict the type of
- * resources that can be created.
- *
- * <p>This interface is not intended to be implemented by clients.</p>
- * <p>
- * <b>Provisional API:</b> This class/interface is part of an interim API that is still under development and expected to
- * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
- * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
- * (repeatedly) as the API evolves.
- * </p>
- *
- * @deprecated use project facets instead of runtime targets
- * @plannedfor 1.0
- */
-public interface IRuntimeTargetHandler extends IAdaptable {
- /**
- * Returns the id of this runtime target handler.
- * Each known runtime target handler has a distinct id.
- * Ids are intended to be used internally as keys; they are not
- * intended to be shown to end users.
- *
- * @return the runtime target handler id
- */
- public String getId();
-
- /**
- * Returns <code>true</code> if this runtime target handler supports
- * (can work with) the given runtime.
- *
- * @param runtimeType a runtime type
- * @return <code>true</code> if the handler can accept the given runtime type,
- * and <code>false</code> otherwise
- */
- public boolean supportsRuntimeType(IRuntimeType runtimeType);
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IRuntimeType.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IRuntimeType.java
deleted file mode 100644
index aba5d0212..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IRuntimeType.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-/**
- * Represents a (server) runtime type from which runtime instances can be
- * created.
- * <p>
- * The server core framework supports
- * an open-ended set of runtime types, which are contributed via
- * the <code>runtimeTypes</code> extension point in the server core
- * plug-in. Runtime type objects carry no state (all information is
- * read-only and is supplied by the server runtime type declaration).
- * The global list of known runtime types is available via
- * {@link ServerCore#getRuntimeTypes()}.
- * </p>
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- * <p>
- * [issue: What value do runtimes add?
- * It's main role is for setting up the Java build classpath
- * for projects holding modules that must be Java compiled.
- * If the notion of module is to transcend the vagaries of particular
- * types of server, and, indeed, be published to multiple servers
- * simultaneously, then matters of build classpath had better not
- * be tied to the particular servers involved.]
- * </p>
- * <p>
- * Two runtime types are identical if and only if they have the same id.
- * </p>
- * <p>
- * <b>Provisional API:</b> This class/interface is part of an interim API that is still under development and expected to
- * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
- * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
- * (repeatedly) as the API evolves.
- * </p>
- *
- * @plannedfor 1.0
- */
-public interface IRuntimeType {
- /**
- * Returns the id of this runtime type.
- * Each known server runtime type has a distinct id.
- * Ids are intended to be used internally as keys; they are not
- * intended to be shown to end users.
- *
- * @return the runtime type id
- */
- public String getId();
-
- /**
- * Returns the displayable name for this runtime type.
- * <p>
- * Note that this name is appropriate for the current locale.
- * </p>
- *
- * @return a displayable name for this runtime type
- */
- public String getName();
-
- /**
- * Returns the displayable description for this runtime type.
- * <p>
- * Note that this description is appropriate for the current locale.
- * </p>
- *
- * @return a displayable description for this runtime type
- */
- public String getDescription();
-
- /**
- * Returns the displayable vendor name for this runtime type. If the
- * runtime type did not specific a vendor, an empty string is returned.
- * <p>
- * Note that this description is appropriate for the current locale.
- * </p>
- *
- * @return a displayable vendor name for this runtime type
- */
- public String getVendor();
-
- /**
- * Returns the displayable version name for this runtime type. If the
- * runtime type did not specific a vendor, an empty string is returned.
- * <p>
- * Note that this description is appropriate for the current locale.
- * </p>
- *
- * @return a displayable version name for this runtime type
- */
- public String getVersion();
-
- /**
- * Returns an array of module types that this runtime type can support.
- * <p>
- * A new array is returned on each call, so clients may store or modify the result.
- * </p>
- *
- * @return the array of module types {@link IModuleType}
- */
- public IModuleType[] getModuleTypes();
-
- /**
- * Returns whether this runtime type can be instantiated.
- * <p>
- * [issue: It's unclear what this method is for.
- * The implementation checks whether the "class"
- * and "workingCopyClass" attributes (both optional) were specified.
- * What would be the point of a runtime type that didn't
- * have both of these attributes and could not be "created"?]
- * </p>
- *
- * @return <code>true</code> if this type of runtime can be
- * instantiated, and <code>false</code> if it cannot
- * @see #createRuntime(String, IProgressMonitor)
- */
- public boolean canCreate();
-
- /**
- * Creates a working copy instance of this runtime type.
- * After setting various properties of the working copy,
- * the client should call {@link IRuntimeWorkingCopy#save(boolean, IProgressMonitor)}
- * to bring the runtime instance into existence.
- * <p>
- * Default values are set by calling the instance's delegate.
- * Clients should assume that the location and other properties are
- * not set and must be explicitly set by the client.
- * </p>
- *
- * @param id the id to assign to the runtime instance; a generated
- * id is used if id is <code>null</code> or an empty string
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @return a new runtime working copy with the given id
- * @throws CoreException if an exception occurs while creating this runtime
- * or setting it's default values
- */
- public IRuntimeWorkingCopy createRuntime(String id, IProgressMonitor monitor) throws CoreException;
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IRuntimeWorkingCopy.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IRuntimeWorkingCopy.java
deleted file mode 100644
index 5f79bd5a4..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IRuntimeWorkingCopy.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core;
-
-import java.beans.PropertyChangeListener;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-/**
- * A working copy runtime object used for formulating changes
- * to a runtime instance ({@link IRuntime}). Changes made on a
- * working copy do not occur (and are not persisted) until a
- * save() is performed.
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- * <p>
- * <b>Provisional API:</b> This class/interface is part of an interim API that is still under development and expected to
- * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
- * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
- * (repeatedly) as the API evolves.
- * </p>
- *
- * @see IRuntime
- * @plannedfor 1.0
- */
-public interface IRuntimeWorkingCopy extends IRuntime {
- /**
- * Status code (value 1) returned from the save() method when the save
- * failed with force set to <code>false</code> because the runtime has
- * been modified and saved since this working copy was created.
- *
- * @see #save(boolean, IProgressMonitor)
- */
- public static final int SAVE_CONFLICT = 1;
-
- /**
- * Property change name (value "name") used when the name of the runtime
- * changes.
- *
- * @see #addPropertyChangeListener(PropertyChangeListener)
- * @see #removePropertyChangeListener(PropertyChangeListener)
- */
- public static final String PROPERTY_NAME = "name";
-
- /**
- * Property change name (value "location") used when the location of the
- * runtime changes.
- *
- * @see #addPropertyChangeListener(PropertyChangeListener)
- * @see #removePropertyChangeListener(PropertyChangeListener)
- */
- public static final String PROPERTY_LOCATION = "location";
-
- /**
- * Sets the displayable name for this runtime.
- * <p>
- * The name should be appropriate for the current locale.
- * </p>
- *
- * @param name a displayable name
- * @see IRuntime#getName()
- */
- public void setName(String name);
-
- /**
- * Sets or unsets whether this runtime is marked as read only.
- * When a runtime is read only, working copies can be created but
- * they cannot be saved.
- *
- * @param readOnly <code>true</code> to set this runtime to be marked
- * read only, and <code>false</code> to unset
- */
- public void setReadOnly(boolean readOnly);
-
- /**
- * Returns whether this working copy has unsaved changes.
- *
- * @return <code>true</code> if this working copy has unsaved
- * changes, and <code>false</code> otherwise
- */
- public boolean isDirty();
-
- /**
- * Adds a property change listener to this runtime.
- * <p>
- * Once registered, a listener starts receiving notification of
- * property changes to this runtime. The listener continues to receive
- * notifications until it is removed.
- * Has no effect if an identical listener is already registered.
- * </p>
- *
- * @param listener a property change listener
- * @see #removePropertyChangeListener(PropertyChangeListener)
- */
- public void addPropertyChangeListener(PropertyChangeListener listener);
-
- /**
- * Removes a property change listener from this runtime.
- * Has no effect if the listener is not registered.
- *
- * @param listener a property change listener
- * @see #addPropertyChangeListener(PropertyChangeListener)
- */
- public void removePropertyChangeListener(PropertyChangeListener listener);
-
- /**
- * Returns the runtime instance that this working copy is
- * associated with.
- * <p>
- * For a runtime working copy created by a call to
- * {@link IRuntime#createWorkingCopy()},
- * <code>this.getOriginal()</code> returns the original
- * runtime object. For a runtime working copy just created by
- * a call to {@link IRuntimeType#createRuntime(String, IProgressMonitor)},
- * <code>this.getOriginal()</code> returns <code>null</code>.
- * </p>
- *
- * @return the associated runtime instance, or <code>null</code> if none
- */
- public IRuntime getOriginal();
-
- /**
- * Sets the absolute path in the local file system to the root of the runtime,
- * typically the installation directory.
- *
- * @param path the location of this runtime, or <code>null</code> if none
- * @see IRuntime#getLocation()
- */
- public void setLocation(IPath path);
-
- /**
- * Returns whether this runtime is a stub (used for compilation only)
- * or a full runtime.
- *
- * @param stub <code>true</code> if this runtime is a stub, and
- * <code>false</code> otherwise
- */
- public void setStub(boolean stub);
-
- /**
- * Commits the changes made in this working copy. If there is
- * no extant runtime instance with a matching id and runtime
- * type, this will create a runtime instance with attributes
- * taken from this working copy, and return that object.
- * <p>
- * If there an existing runtime instance with a matching id and
- * runtime type, this will change the runtime instance accordingly.
- * The returned runtime will be the same runtime this is returned
- * from getOriginal(), after the changes have been applied.
- * Otherwise, this method will return a newly created runtime.
- * </p>
- * Runtimes can be saved even when they have invalid properties. It
- * is the clients responsibility to call validate() or check the
- * properties before saving.
- * <p>
- * [issue: What is lifecycle for RuntimeWorkingCopyDelegate
- * associated with this working copy?]
- * </p>
- *
- * @param force <code>true</code> to force the save, or <code>false</code>
- * otherwise
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @return a new runtime instance
- * @throws CoreException if the save could not be completed
- * @see #SAVE_CONFLICT
- */
- public IRuntime save(boolean force, IProgressMonitor monitor) throws CoreException;
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServer.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServer.java
deleted file mode 100644
index 1280be81b..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServer.java
+++ /dev/null
@@ -1,651 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core;
-
-import org.eclipse.core.runtime.*;
-/**
- * Represents a server instance. Every server is an instance of a
- * particular, fixed server type.
- * <p>
- * Not surprisingly, the notion of <b>server</b> is central in the web tools
- * server infrastructure. In this context, understand that a server is
- * a web server of some ilk. It could be a simple web server lacking Java
- * support, or an J2EE based server, or perhaps even some kind of database
- * server. A more exact definition is not required for the purposes of this API.
- * From a tool-centric point of view, a server
- * is something that the developer is writing "content" for.
- * The unit of content is termed a module.
- * In a sense, the server exists, but lacks useful content. The
- * development task is to provide that content. The content can include
- * anything from simple, static HTML web pages to complex, highly dynamic
- * web applications.
- * In the course of writing and debugging this content,
- * the developer will want to test their content on a web server, to see how it
- * gets served up. For this they will need to launch a server process running on
- * some host machine (often the local host on which the IDE is running), or
- * attach to a server that's already running on a remote (or local) host.
- * The newly developed content sitting in the developer's workspace needs to
- * end up in a location and format that the running server can use for its
- * serving purposes.
- * </p>
- * <p>
- * In this picture, an <code>IServer</code> object is a proxy for the real web
- * server. Through this proxy, a client can configure the server, and start,
- * stop, and restart it.
- * </p>
- * <p>
- * The server framework maintains a global list of all known server instances
- * ({@link ServerCore#getServers()}).
- * </p>
- * <p>
- * [rough notes:
- * Server has a state.
- * Server can be started, stopped, and restarted.
- * To modify server attributes, get a working copy, modify it, and then save it
- * to commit the changes.
- * Server attributes. Serialization.
- * Chained working copies for runtime, server configuration.
- * Server has a set of root modules.
- * Modules have state wrt a server.
- * Restarting modules.
- * ]
- * </p>
- * <p>
- * Two servers are identical if and only if they have the same id.
- * </p>
- *
- * <p>This interface is not intended to be implemented by clients.</p>
- *
- * @plannedfor 1.0
- */
-public interface IServer extends IServerAttributes {
- /**
- * An operation listener is used to receive notification back about a
- * specific server operation, such as starting or stopping a server.
- *
- * <b>Provisional API:</b> This class/interface is part of an interim API
- * that is still under development and expected to change significantly
- * before reaching stability. It is being made available at this early
- * stage to solicit feedback from pioneering adopters on the understanding
- * that any code that uses this API will almost certainly be broken
- * (repeatedly) as the API evolves.
- */
- public interface IOperationListener {
- /**
- * Called once when the operation is complete.
- *
- * @param result a status object with code <code>IStatus.OK</code> if
- * the operation completed successfully, otherwise a status object
- * indicating why it didn't
- */
- public void done(IStatus result);
- }
-
- /**
- * Server state constant (value 0) indicating that the
- * server is in an unknown state.
- *
- * @see #getServerState()
- * @see #getModuleState(IModule[])
- */
- public static final int STATE_UNKNOWN = 0;
-
- /**
- * Server state constant (value 1) indicating that the
- * server is starting, but not yet ready to serve content.
- *
- * @see #getServerState()
- * @see #getModuleState(IModule[])
- */
- public static final int STATE_STARTING = 1;
-
- /**
- * Server state constant (value 2) indicating that the
- * server is ready to serve content.
- *
- * @see #getServerState()
- * @see #getModuleState(IModule[])
- */
- public static final int STATE_STARTED = 2;
-
- /**
- * Server state constant (value 3) indicating that the
- * server is shutting down.
- *
- * @see #getServerState()
- * @see #getModuleState(IModule[])
- */
- public static final int STATE_STOPPING = 3;
-
- /**
- * Server state constant (value 4) indicating that the
- * server is stopped.
- *
- * @see #getServerState()
- * @see #getModuleState(IModule[])
- */
- public static final int STATE_STOPPED = 4;
-
- /**
- * Publish state constant (value 0) indicating that it's
- * in an unknown state.
- *
- * @see #getServerPublishState()
- * @see #getModulePublishState(IModule[])
- */
- public static final int PUBLISH_STATE_UNKNOWN = 0;
-
- /**
- * Publish state constant (value 1) indicating that there
- * is no publish required.
- *
- * @see #getServerPublishState()
- * @see #getModulePublishState(IModule[])
- */
- public static final int PUBLISH_STATE_NONE = 1;
-
- /**
- * Publish state constant (value 2) indicating that an
- * incremental publish is required.
- *
- * @see #getServerPublishState()
- * @see #getModulePublishState(IModule[])
- */
- public static final int PUBLISH_STATE_INCREMENTAL = 2;
-
- /**
- * Publish state constant (value 3) indicating that a
- * full publish is required.
- *
- * @see #getServerPublishState()
- * @see #getModulePublishState(IModule[])
- */
- public static final int PUBLISH_STATE_FULL = 3;
-
- /**
- * Publish kind constant (value 1) indicating an incremental publish request.
- *
- * @see #publish(int, IProgressMonitor)
- */
- public static final int PUBLISH_INCREMENTAL = 1;
-
- /**
- * Publish kind constant (value 2) indicating a full publish request.
- *
- * @see #publish(int, IProgressMonitor)
- */
- public static final int PUBLISH_FULL = 2;
-
- /**
- * Publish kind constant (value 3) indicating an automatic publish request.
- *
- * @see #publish(int, IProgressMonitor)
- */
- public static final int PUBLISH_AUTO = 3;
-
- /**
- * Publish kind constant (value 4) indicating a publish clean request
- *
- * @see #publish(int, IProgressMonitor)
- */
- public static final int PUBLISH_CLEAN = 4;
-
- /**
- * Returns the current state of this server.
- * <p>
- * Note that this operation is guaranteed to be fast
- * (it does not actually communicate with any actual
- * server).
- * </p>
- *
- * @return one of the server state (<code>STATE_XXX</code>)
- * constants declared on {@link IServer}
- */
- public int getServerState();
-
- /**
- * Returns the ILaunchManager mode that the server is in. This method will
- * return null if the server is not running.
- *
- * @return the mode in which a server is running, one of the mode constants
- * defined by {@link org.eclipse.debug.core.ILaunchManager}, or
- * <code>null</code> if the server is stopped.
- */
- public String getMode();
-
- /**
- * Returns the server's sync state.
- *
- * @return one of the PUBLISH_XXX state flags
- */
- public int getServerPublishState();
-
- /**
- * Adds the given server state listener to this server.
- * Once registered, a listener starts receiving notification of
- * state changes to this server. The listener continues to receive
- * notifications until it is removed.
- * Has no effect if an identical listener is already registered.
- *
- * @param listener the server listener
- * @see #removeServerListener(IServerListener)
- */
- public void addServerListener(IServerListener listener);
-
- /**
- * Adds the given server state listener to this server.
- * Once registered, a listener starts receiving notification of
- * state changes to this server. The listener continues to receive
- * notifications until it is removed.
- * Has no effect if an identical listener is already registered.
- *
- * @param listener the server listener
- * @param eventMask the bit-wise OR of all event types of interest to the
- * listener
- * @see #removeServerListener(IServerListener)
- */
- public void addServerListener(IServerListener listener, int eventMask);
-
- /**
- * Removes the given server state listener from this server. Has no
- * effect if the listener is not registered.
- *
- * @param listener the listener
- * @see #addServerListener(IServerListener)
- */
- public void removeServerListener(IServerListener listener);
-
- /**
- * Returns whether this server is in a state that it can
- * be published to.
- *
- * @return a status object with code <code>IStatus.OK</code> if the server can
- * be published to, otherwise a status object indicating what is wrong
- */
- public IStatus canPublish();
-
- /**
- * Publish to the server using the progress monitor. The result of the
- * publish operation is returned as an IStatus.
- * <p>
- * This method should not be called from the UI thread. Publishing is long-
- * running and may trigger resource change events or builds. Although this
- * framework is safe, there is no guarantee that other bundles are UI-safe
- * and the risk of UI deadlock is high.
- * </p>
- *
- * @param kind the kind of publish being requested. Valid values are
- * <ul>
- * <li><code>PUBLSIH_FULL</code>- indicates a full publish.</li>
- * <li><code>PUBLISH_INCREMENTAL</code>- indicates a incremental publish.
- * <li><code>PUBLISH_CLEAN</code>- indicates a clean request. Clean throws
- * out all state and cleans up the module on the server before doing a
- * full publish.
- * </ul>
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @return status indicating what (if anything) went wrong
- */
- public IStatus publish(int kind, IProgressMonitor monitor);
-
- /**
- * Returns whether this server is in a state that it can
- * be started in the given mode.
- *
- * @param launchMode a mode in which a server can be launched,
- * one of the mode constants defined by
- * {@link org.eclipse.debug.core.ILaunchManager}
- * @return a status object with code <code>IStatus.OK</code> if the server can
- * be started, otherwise a status object indicating why it can't
- */
- public IStatus canStart(String launchMode);
-
- /**
- * Asynchronously starts this server in the given launch mode.
- * <p>
- * If canStart(launchMode) is false, this method will throw an
- * exception.
- * </p>
- * <p>
- * If the caller wants to listen for failure or success of the
- * server starting, it can add a server listener or use the
- * version of this method that takes a status listener as a
- * parameter.
- * </p>
- *
- * @param launchMode a mode in which a server can be launched,
- * one of the mode constants defined by
- * {@link org.eclipse.debug.core.ILaunchManager}
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @exception CoreException if an error occurs while trying to start the server
- */
- public void start(String launchMode, IProgressMonitor monitor) throws CoreException;
-
- /**
- * Asynchronously starts this server in the given launch mode.
- * <p>
- * If canStart(launchMode) is false, this method will throw an
- * exception.
- * </p>
- * <p>
- * The operation listener can be used to add a listener for notification
- * of this specific server launch. The listener will be called with a
- * single successful status (severity OK) when the server has
- * finished starting, or a single failure (severity ERROR) if
- * there was an error starting the server.
- * </p>
- *
- * @param launchMode a mode in which a server can be launched,
- * one of the mode constants defined by
- * {@link org.eclipse.debug.core.ILaunchManager}
- * @param listener an operation listener to receive notification when this
- * operation is done, or <code>null</code> if notification is not
- * required
- */
- public void start(String launchMode, IOperationListener listener);
-
- /**
- * Starts this server in the given launch mode and waits until the server
- * has finished starting.
- * <p>
- * This convenience method uses {@link #start(String, IProgressMonitor)}
- * to start the server, and an internal thread and listener to detect
- * when the server has finished starting.
- * </p>
- *
- * @param launchMode a mode in which a server can be launched,
- * one of the mode constants defined by
- * {@link org.eclipse.debug.core.ILaunchManager}
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @deprecated this method is deprecated. use start(String,
- * IProgressMonitor, IOperationListener) instead
- * @exception CoreException if an error occurs while trying to start the server
- */
- public void synchronousStart(String launchMode, IProgressMonitor monitor) throws CoreException;
-
- /**
- * Returns whether this server is in a state that it can
- * be restarted in the given mode. Note that only servers
- * that are currently running can be restarted.
- *
- * @param mode a mode in which a server can be launched,
- * one of the mode constants defined by
- * {@link org.eclipse.debug.core.ILaunchManager}
- * @return a status object with code <code>IStatus.OK</code> if the server can
- * be restarted, otherwise a status object indicating why it can't
- */
- public IStatus canRestart(String mode);
-
- /**
- * Returns whether this server is out of sync and needs to be
- * restarted. This method will return false when the
- * server is not running.
- * <p>
- * [issue: Need to explain what is it that can get out of
- * "out of sync" here, and how this can happen.]
- * </p>
- *
- * @return <code>true</code> if this server is out of sync and needs to be
- * restarted, and <code>false</code> otherwise (e.g., if the contents have
- * not been modified and the server process is still in sync); the
- * result is unspecified if the server is not currently running
- */
- public boolean getServerRestartState();
-
- /**
- * Asynchronously restarts this server. This operation does
- * nothing if this server cannot be stopped ({@link #canRestart(String)}
- * returns <code>false</code>.
- * This method cannot be used to start the server from a stopped state.
- * <p>
- * If the caller wants to listen for failure or success of the
- * server restarting, it can add a server listener or use the
- * version of this method that takes a status listener as a
- * parameter.
- * </p>
- *
- * @param launchMode a mode in which a server can be launched,
- * one of the mode constants defined by
- * {@link org.eclipse.debug.core.ILaunchManager}
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- */
- public void restart(String launchMode, IProgressMonitor monitor);
-
- /**
- * Asynchronously restarts this server. This operation does
- * nothing if this server cannot be stopped ({@link #canRestart(String)}
- * returns <code>false</code>.
- * This method cannot be used to start the server from a stopped state.
- * <p>
- * The operation listener can be used to add a listener for notification
- * of this specific server restart. The listener will be called with a
- * single successful status (severity OK) when the server has
- * finished restarting, or a single failure (severity ERROR) if
- * there was an error restarting the server.
- * </p>
- *
- * @param launchMode a mode in which a server can be launched,
- * one of the mode constants defined by
- * {@link org.eclipse.debug.core.ILaunchManager}
- * @param listener an operation listener to receive notification when this
- * operation is done, or <code>null</code> if notification is not
- * required
- */
- public void restart(String launchMode, IOperationListener listener);
-
- /**
- * Synchronously restarts this server. This operation does
- * nothing if this server cannot be stopped ({@link #canRestart(String)}
- * returns <code>false</code>.
- * <p>
- * [issue: There is no way to communicate failure to the
- * client. Given that this operation can go awry, there probably
- * should be a mechanism that allows failing asynch operations
- * to be diagnosed.]
- * </p>
- *
- * @param launchMode a mode in which a server can be launched,
- * one of the mode constants defined by
- * {@link org.eclipse.debug.core.ILaunchManager}
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @throws CoreException if there was an error
- * @deprecated this method is deprecated. use restart(String,
- * IProgressMonitor, IOperationListener) instead
- */
- public void synchronousRestart(String launchMode, IProgressMonitor monitor) throws CoreException;
-
- /**
- * Returns whether this server is in a state that it can
- * be stopped.
- * Servers can be stopped if they are not already stopped and if
- * they belong to a state-set that can be stopped.
- *
- * @return a status object with code <code>IStatus.OK</code> if the server can
- * be stopped, otherwise a status object indicating why it can't
- */
- public IStatus canStop();
-
- /**
- * Asynchronously stops this server. This operation does
- * nothing if this server cannot be stopped ({@link #canStop()}
- * returns <code>false</code>.
- * <p>
- * If force is <code>false</code>, it will attempt to stop the server
- * normally/gracefully. If force is <code>true</code>, then the server
- * process will be terminated any way that it can.
- * </p>
- * <p>
- * If the caller wants to listen for success or failure of the
- * server stopping, it can add a server listener or use the
- * version of this method that takes a status listener as a
- * parameter.
- * </p>
- *
- * @param force <code>true</code> to kill the server, or <code>false</code>
- * to stop normally
- */
- public void stop(boolean force);
-
- /**
- * Asynchronously stops this server. This operation does
- * nothing if this server cannot be stopped ({@link #canStop()}
- * returns <code>false</code>.
- * <p>
- * If force is <code>false</code>, it will attempt to stop the server
- * normally/gracefully. If force is <code>true</code>, then the server
- * process will be terminated any way that it can.
- * </p>
- * <p>
- * The operation listener can be used to add a listener for notification
- * of this specific server stop. The listener will be called with a
- * single successful status (severity OK) when the server has
- * finished stopping, or a single failure (severity ERROR) if
- * there was an error stopping the server.
- * </p>
- *
- * @param force <code>true</code> to kill the server, or <code>false</code>
- * to stop normally
- * @param listener an operation listener to receive notification when this
- * operation is done, or <code>null</code> if notification is not
- * required
- */
- public void stop(boolean force, IOperationListener listener);
-
- /**
- * Stops this server and waits until the server has completely stopped.
- * <p>
- * This convenience method uses {@link #stop(boolean)}
- * to stop the server, and an internal thread and listener to detect
- * when the server has complied.
- * </p>
- *
- * @param force <code>true</code> to kill the server, or <code>false</code>
- * to stop normally
- * @deprecated this method is deprecated. use stop(boolean,
- * IOperationListener) instead
- */
- public void synchronousStop(boolean force);
-
- /**
- * Returns the current state of the given module on this server.
- * Returns <code>STATE_UNKNOWN</code> if the module
- * is not among the ones associated with this server.
- *
- * @param module the module
- * @return one of the state (<code>STATE_XXX</code>) constants declared
- * on {@link IServer}
- */
- public int getModuleState(IModule[] module);
-
- /**
- * Returns the module's sync state.
- *
- * @param module the module
- * @return one of the PUBLISH_XXX state flags
- */
- public int getModulePublishState(IModule[] module);
-
- /**
- * Check if the given module is in sync on the server. It should
- * return true if the module should be restarted (is out of
- * sync) or false if the module does not need to be restarted.
- *
- * @param module the module
- * @return boolean
- */
- public boolean getModuleRestartState(IModule[] module);
-
- /**
- * Returns whether the given module can be restarted.
- * <p>
- * This method has a progress monitor because it may involve plugin
- * and class loading. No communication to the server will occur.
- * </p>
- *
- * @param module the module
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @return a status object with code <code>IStatus.OK</code> if the module can
- * be restarted, otherwise a status object indicating why it can't
- */
- public IStatus canControlModule(IModule[] module, IProgressMonitor monitor);
-
- /**
- * Asynchronously starts this server in the given launch mode.
- * <p>
- * If canStart(launchMode) is false, this method will throw an
- * exception.
- * </p>
- * <p>
- * The operation listener can be used to add a listener for notification
- * of this specific module start. The listener will be called with a
- * single successful status (severity OK) when the module has
- * finished starting, or a single failure (severity ERROR) if
- * there was an error starting the module.
- * </p>
- *
- *@param module the module to be started
- * @param listener an operation listener to receive notification when this
- * operation is done, or <code>null</code> if notification is not
- * required
- */
- public void startModule(IModule[] module, IOperationListener listener);
-
- /**
- * Asynchronously stops the given module. This operation does
- * nothing if this module cannot be stopped.
- * <p>
- * The operation listener can be used to add a listener for notification
- * of this specific module stop. The listener will be called with a
- * single successful status (severity OK) when the module has
- * finished stopping, or a single failure (severity ERROR) if
- * there was an error stopping the module.
- * </p>
- *
- * @param module the module to be stopped
- * @param listener an operation listener to receive notification when this
- * operation is done, or <code>null</code> if notification is not
- * required
- */
- public void stopModule(IModule[] module, IOperationListener listener);
-
- /**
- * Asynchronously restarts the given module on the server.
- * <p>
- * The implementation should update the module sync state and fire
- * an event for the module. If the module does not exist on the server,
- * an exception will be thrown.
- * </p>
- * <p>
- * [issue: Since this method is ascynchronous, is there
- * any need for the progress monitor?]
- * </p>
- * <p>
- * [issue: IServer.synchronousModuleRestart throws CoreException
- * if anything goes wrong.]
- * </p>
- * <p>
- * [issue: If the module was just published to the server
- * and had never been started, would is be ok to "start"
- * the module using this method?]
- * </p>
- *
- * @param module the module to be started
- * @param listener an operation listener to receive notification when this
- * operation is done, or <code>null</code> if notification is not
- * required
- */
- public void restartModule(IModule[] module, IOperationListener listener);
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerAttributes.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerAttributes.java
deleted file mode 100644
index 0b10a588a..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerAttributes.java
+++ /dev/null
@@ -1,348 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core;
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.runtime.*;
-/**
- * Represents a server instance. Every server is an instance of a
- * particular, fixed server type.
- * <p>
- * Not surprisingly, the notion of <b>server</b> is central in the web tools
- * server infrastructure. In this context, understand that a server is
- * a web server of some ilk. It could be a simple web server lacking Java
- * support, or an J2EE based server, or perhaps even some kind of database
- * server. A more exact definition is not required for the purposes of this API.
- * From a tool-centric point of view, a server
- * is something that the developer is writing "content" for.
- * The unit of content is termed a module.
- * In a sense, the server exists, but lacks useful content. The
- * development task is to provide that content. The content can include
- * anything from simple, static HTML web pages to complex, highly dynamic
- * web applications.
- * In the course of writing and debugging this content,
- * the developer will want to test their content on a web server, to see how it
- * gets served up. For this they will need to launch a server process running on
- * some host machine (often the local host on which the IDE is running), or
- * attach to a server that's already running on a remote (or local) host.
- * The newly developed content sitting in the developer's workspace needs to
- * end up in a location and format that the running server can use for its
- * serving purposes.
- * </p>
- * <p>
- * In this picture, an <code>IServer</code> object is a proxy for the real web
- * server. Through this proxy, a client can configure the server, and start,
- * stop, and restart it.
- * </p>
- * <p>
- * IServerAttributes implements IAdaptable to allow users to obtain a
- * server-type-specific class. By casting the runtime extension to the type
- * prescribed in the API documentation for that particular server type, the
- * client can access server-type-specific properties and methods.
- * getAdapter() may involve plugin loading, and should not be called from
- * popup menus, etc.
- * </p>
- * <p>
- * The server framework maintains a global list of all known server instances
- * ({@link ServerCore#getServers()}).
- * </p>
- * <p>
- * [rough notes:
- * Server has a state.
- * Server can be started, stopped, and restarted.
- * To modify server attributes, get a working copy, modify it, and then save it
- * to commit the changes.
- * Server attributes. Serialization.
- * Chained working copies for runtime, server configuration.
- * Server has a set of root modules.
- * Modules have state wrt a server.
- * Restarting modules.]
- * </p>
- * <p>
- * Two servers are identical if and only if they have the same id.
- * </p>
- *
- * <p>This interface is not intended to be implemented by clients.</p>
- *
- * @plannedfor 1.0
- */
-public interface IServerAttributes extends IAdaptable {
- /**
- * Returns the displayable name for this server.
- * <p>
- * Note that this name is appropriate for the current locale.
- * </p>
- *
- * @return a displayable name
- */
- public String getName();
-
- /**
- * Returns the id of this server.
- * Each server (of a given type) has a distinct id, fixed for
- * its lifetime. Ids are intended to be used internally as keys;
- * they are not intended to be shown to end users.
- *
- * @return the server id
- */
- public String getId();
-
- /**
- * Deletes the persistent representation of this server.
- *
- * @throws CoreException if there was any error received while deleting the server
- * or if this method is called on a working copy
- */
- public void delete() throws CoreException;
-
- /**
- * Returns whether this server is marked read only.
- * When a server is read only, working copies can be created but
- * they cannot be saved.
- *
- * @return <code>true</code> if this server is marked as read only,
- * and <code>false</code> otherwise
- */
- public boolean isReadOnly();
-
- /**
- * Returns true if this is a working copy.
- *
- * @return <code>true</code> if this server is a working copy,
- * and <code>false</code> otherwise
- */
- public boolean isWorkingCopy();
-
- /**
- * Returns an object which is an instance of the given class
- * associated with this object. Returns <code>null</code> if
- * no such object can be found, or if the delegate is not
- * loaded.
- * <p>
- * This method will not check the delegate classes for adapting
- * unless they are already loaded. No plugin loading will occur
- * when calling this method. It is suitable for popup menus and
- * other UI artifacts where performance is a concern.
- * </p>
- *
- * @param adapter the adapter class to look up
- * @return a object castable to the given class,
- * or <code>null</code> if this object does not
- * have an adapter for the given class
- * @see IAdaptable#getAdapter(Class)
- * @see #loadAdapter(Class, IProgressMonitor)
- */
- public Object getAdapter(Class adapter);
-
- /**
- * Returns an object which is an instance of the given class
- * associated with this object. Returns <code>null</code> only if
- * no such object can be found after loading and initializing
- * delegates.
- * <p>
- * This method will force a load and initialization of all delegate
- * classes and check them for adapting.
- * </p>
- *
- * @param adapter the adapter class to look up
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @return a object castable to the given class,
- * or <code>null</code> if this object does not
- * have an adapter for the given class
- * @see #getAdapter(Class)
- */
- public Object loadAdapter(Class adapter, IProgressMonitor monitor);
-
- /**
- * Returns the host for the server.
- * The format of the host can be either a qualified or unqualified hostname,
- * or an IP address and must conform to RFC 2732.
- *
- * @return a host string conforming to RFC 2732
- * @see java.net.URL#getHost()
- */
- public String getHost();
-
- /**
- * Returns the runtime associated with this server.
- * <p>
- * Note: The runtime of a server working copy may or may not
- * be a working copy. For a server instance that is not a
- * working copy, the runtime instance is not a working copy
- * either.
- * </p>
- * <p>
- * [issue: According to serverType extension point,
- * runtimeTypeId is a mandatory attribute. It seems odd
- * then to have server runtime instance being an
- * optional property of server instance. What does it mean
- * for a server to not have a runtime?]
- * </p>
- *
- * @return the runtime, or <code>null</code> if none
- */
- public IRuntime getRuntime();
-
- /**
- * Returns the type of this server.
- *
- * @return the server type
- * @see IServerType
- */
- public IServerType getServerType();
-
- /**
- * Returns the server configuration associated with this server.
- * <p>
- * Note: The server configuration of a server working copy may
- * or may not be a working copy. For a server instance that is
- * not a working copy, the server configuration instance is not
- * a working copy either.
- * </p>
- * <p>
- * [issue: According to serverType extension point,
- * configurationTypeId is an optional attribute. If a server type
- * has no server configuration type, then it seems reasonable to
- * expect this method to return null for all instances of that server
- * type. But what about a server type that explicitly specifies
- * a server configuration type. Does that mean that all server
- * instances of that server type must have a server configuration
- * instance of that server configuration type, and that this method
- * never returns null in those cases?]
- * </p>
- *
- * @return the server configuration, or <code>null</code> if none
- */
- public IFolder getServerConfiguration();
-
- /**
- * Returns a server working copy for modifying this server instance.
- * If this instance is already a working copy, it is returned.
- * If this instance is not a working copy, a new server working copy
- * is created with the same id and attributes.
- * Clients are responsible for saving or releasing the working copy when
- * they are done with it.
- * <p>
- * The server working copy is related to this server instance
- * in the following ways:
- * <pre>
- * this.getWorkingCopy().getId() == this.getId()
- * this.getWorkingCopy().getFile() == this.getFile()
- * this.getWorkingCopy().getOriginal() == this
- * this.getWorkingCopy().getRuntime() == this.getRuntime()
- * this.getWorkingCopy().getServerConfiguration() == this.getServerConfiguration()
- * </pre>
- * </p>
- * <p>
- * [issue: IServerWorkingCopy extends IServer.
- * Server.getWorkingCopy() create a new working copy;
- * ServerWorkingCopy.getWorkingCopy() returns this.
- * This may be convenient in code that is ignorant of
- * whether they are dealing with a working copy or not.
- * However, it is hard for clients to manage working copies
- * with this design.]
- * </p>
- *
- * @return a new working copy
- */
- public IServerWorkingCopy createWorkingCopy();
-
- /**
- * Returns an array of user modules that are currently configured on
- * the server. When the server is published, these are the projects
- * that will be configured on the server. This method may not return
- * the list of projects that are currently on the server if a module
- * has been added since the last publish.
- * <p>
- * This method returns the root modules, which are not parented within
- * another modules. Each of these may contain child modules, which are
- * also deployed to this server.
- * </p>
- *
- * @return a possibly-empty array of modules
- */
- public IModule[] getModules();
-
- /**
- * Returns whether the specified module modifications could be made to this
- * server at this time.
- * <p>
- * This method may decide based on the type of module
- * or refuse simply due to reaching a maximum number of
- * modules or other criteria.
- * </p>
- * <p>
- * [issue: This seems odd to have a pre-flight method.
- * I should expect that the client can propose making
- * any set of module changes they desire (via a server
- * working copy). If the server doesn't like it, the operation
- * should fail.]
- * </p>
- *
- * @param add a possibly-empty list of modules to add
- * @param remove a possibly-empty list of modules to remove
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @return <code>true</code> if the proposed modifications
- * look feasible, and <code>false</code> otherwise
- */
- public IStatus canModifyModules(IModule[] add, IModule[] remove, IProgressMonitor monitor);
-
- /**
- * Returns the child module(s) of this module. If this
- * module contains other modules, it should list those
- * modules. If not, it should return an empty list.
- *
- * <p>This method should only return the direct children.
- * To obtain the full module tree, this method may be
- * recursively called on the children.</p>
- *
- * @param module a module
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @return an array of direct module children
- */
- public IModule[] getChildModules(IModule module[], IProgressMonitor monitor);
-
- /**
- * Returns the parent module(s) of this module. When determining if a given
- * project can run on a server, this method will be used to find the actual
- * module(s) that may be run on the server. For instance, a Web module may
- * return a list of EAR modules that it is contained in if the server only
- * supports configuring EAR modules.
- *
- * <p>If the module type is not supported, this method will return null.
- * If the type is normally supported but there is a configuration
- * problem or missing parent, etc., this method will fire a CoreException
- * that may then be presented to the user.</p>
- *
- * <p>If it does return valid parent(s), this method will always return
- * the topmost parent module(s), even if there are a few levels
- * (a heirarchy) of modules.</p>
- *
- * @param module a module
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @return an array of possible root modules
- * @throws CoreException if there is a problem
- */
- public IModule[] getRootModules(IModule module, IProgressMonitor monitor) throws CoreException;
-
- /**
- * Returns an array of ServerPorts that this server has.
- *
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @return a possibly empty array of servers ports
- */
- public ServerPort[] getServerPorts(IProgressMonitor monitor);
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerLifecycleListener.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerLifecycleListener.java
deleted file mode 100644
index b093dc487..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerLifecycleListener.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core;
-/**
- * Listener interface for changes to servers.
- * <p>
- * This interface is fired whenever a server is added, modified, or removed.
- * All events are fired post-change, so that all server tools API called as a
- * result of the event will return the updated results. (for example, on
- * serverAdded the new server will be in the global list of servers
- * ({@link ServerCore#getServers()}), and on serverRemoved the server will
- * not be in the list.
- * </p>
- *
- * @see ServerCore
- * @see IServer
- * @plannedfor 1.0
- */
-public interface IServerLifecycleListener {
- /**
- * A new server has been created.
- *
- * @param server the new server
- */
- public void serverAdded(IServer server);
-
- /**
- * An existing server has been updated or modified.
- *
- * @param server the modified server
- */
- public void serverChanged(IServer server);
-
- /**
- * A existing server has been removed.
- *
- * @param server the removed server
- */
- public void serverRemoved(IServer server);
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerListener.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerListener.java
deleted file mode 100644
index 8ca2958c6..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerListener.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core;
-/**
- * This interface is used by the server to broadcast a change of state.
- * Usually, the change of state will be caused by some user action,
- * (e.g. requesting to start a server) however, it is equally fine for
- * a server to broadcast a change of state through no direct user action.
- * (e.g. stopping because the server crashed) This information can be
- * used to inform the user of the change or update the UI.
- *
- * <p>Note: The server listener event MUST NOT directly be used to modify
- * the server's or module's state via one of the server's method. For example,
- * a server stopped event cannot directly trigger a start(). Doing this may
- * cause the thread to hang.</p>
- *
- * @plannedfor 1.0
- */
-public interface IServerListener {
- /**
- * A server or module has been changed as specified in the event.
- *
- * @param event a server event that contains information on the change
- */
- public void serverChanged(ServerEvent event);
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerType.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerType.java
deleted file mode 100644
index 97b538aac..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerType.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-/**
- * Represents a server type from which server instances can be created.
- * <p>
- * The server core framework supports
- * an open-ended set of server types, which are contributed via
- * the <code>serverTypes</code> extension point in the server core
- * plug-in. Server type objects carry no state (all information is
- * read-only and is supplied by the server type declaration).
- * The global list of known server types is available via
- * {@link ServerCore#getServerTypes()}.
- * </p>
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- * <p>
- * Two server types are identical if and only if they have the same id.
- * </p>
- *
- * @plannedfor 1.0
- */
-public interface IServerType {
- /**
- * Returns the id of this server type.
- * Each known server type has a distinct id.
- * Ids are intended to be used internally as keys; they are not
- * intended to be shown to end users.
- *
- * @return the server type id
- */
- public String getId();
-
- /**
- * Returns the displayable name for this server type.
- * <p>
- * Note that this name is appropriate for the current locale.
- * </p>
- *
- * @return a displayable name for this server type
- */
- public String getName();
-
- /**
- * Returns the displayable description for this server type.
- * <p>
- * Note that this description is appropriate for the current locale.
- * </p>
- *
- * @return a displayable description for this server type
- */
- public String getDescription();
-
- /**
- * Returns the type of server runtime that this type
- * of server requires.
- * <p>
- * [issue: "runtimeTypeId" is mandatory according the
- * serverTypes schema. This suggests that all types
- * of servers have a server runtime. But there is also
- * a boolean "runtime" attribute indicating whether the
- * server requires a runtime. I supect that server type
- * has an optional server runtime, in which case you
- * can make "runtimeTypeId" optional and dispense with
- * "runtime".]
- * </p>
- * <p>
- * [issue: Does it really make sense for
- * runtimeTypes and serverTypes be separate extension
- * points? Would it not be sufficient to have the party declaring
- * the server type also declare the server runtime type?
- * Having runtimeType as a separate extension point
- * only makes sense if it would be possible in principle to
- * declare a server runtime type that could actually be
- * used on serveral server types. If server runtimes
- * always end up being server-type specific, it would be better
- * to combine them.]
- * </p>
- * <p>
- * [issue: What should happen when a server type mentions
- * the id of a server runtime type that is not known
- * to the system?]
- * </p>
- *
- * @return a server runtime type
- */
- public IRuntimeType getRuntimeType();
-
- /**
- * Returns whether this type of server requires a server
- * runtime.
- * <p>
- * [issue: See issues on getRuntimeType(). I suspect this
- * method is unnecessary, and that
- * this.getRuntimeType() != null will do.]
- * </p>
- *
- * @return <code>true</code> if this type of server requires
- * a server runtime, and <code>false</code> if it does not
- * @see #getRuntimeType()
- */
- public boolean hasRuntime();
-
- /**
- * Returns whether this type of server supports the given launch mode.
- * <p>
- * [issue: It also seems odd that this is part of the server type
- * declaration. This means that any server type has to commit
- * so early on which modes it supports.]
- * </p>
- *
- * @param launchMode a mode in which a server can be launched,
- * one of the mode constants defined by
- * {@link org.eclipse.debug.core.ILaunchManager}
- * @return whether this type of server supports the given mode
- */
- public boolean supportsLaunchMode(String launchMode);
-
- /**
- * Returns whether this type of server requires a server
- * configuration.
- * <p>
- * [issue: It's not clear how this method differs from
- * this.getServerConfigurationType() != null]
- * </p>
- *
- * @return <code>true</code> if this type of server requires
- * a server configuration, and <code>false</code> if it does not
- */
- public boolean hasServerConfiguration();
-
- /**
- * Returns <code>true</code> if this type of server can run on a remote host.
- * Returns <code>false</code> if the server type can only be run on "localhost"
- * (the local machine).
- *
- * @return <code>true</code> if this type of server can run on
- * a remote host, and <code>false</code> if it cannot
- */
- public boolean supportsRemoteHosts();
-
- /**
- * Creates an working copy instance of this server type.
- * After setting various properties of the working copy,
- * the client should call {@link IServerWorkingCopy#save(boolean, IProgressMonitor)}
- * to bring the server instance into existence.
- * <p>
- * [issue: Why is a runtime passed in?
- * IServerWorkingCopy.setRuntime(runtime) could be called on
- * the result to accomplish the same thing.]
- * </p>
- * <p>
- * [issue: The implementation of this method never creates a server
- * config working copy, whereas the other one does!?]
- * Consider combining the method with the other.]
- * </p>
- * <p>
- * The server returned from this method will have it's host set to
- * "localhost". Other defaults will be set by calling the server
- * delegate's setDefaults() method.
- * </p>
- *
- * @param id the id to assign to the server instance; a generated
- * id is used if id is <code>null</code> or an empty string
- * @param file the file in the workspace where the server instance
- * is to be serialized, or <code>null</code> if the information is
- * instead to be persisted with the workspace but not with any
- * particular workspace resource
- * @param runtime the runtime to associate with the server instance,
- * or <code>null</code> if none
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @return a new server working copy with the given id
- * @throws CoreException if an exception occurs while creating this runtime
- * or setting it's default values
- */
- public IServerWorkingCopy createServer(String id, IFile file, IRuntime runtime, IProgressMonitor monitor) throws CoreException;
-
- /**
- * Creates a working copy instance of this server type.
- * After setting various properties of the working copy,
- * the client should call {@link IServerWorkingCopy#save(boolean, IProgressMonitor)}
- * to bring the server instance into existence.
- * <p>
- * [issue: Since this method just creates a working copy,
- * it's not clear the operation is long-running and in need
- * of a progress monitor.]
- * </p>
- * <p>
- * The server returned from this method will have it's host set to
- * "localhost". Other defaults will be set by calling the server
- * delegate's setDefaults() method.
- * </p>
- * <p>
- * [issue: The implementation of this method creates a server
- * config working copy, whereas the other one does not!?
- * Consider combining the method with the other.]
- * </p>
- *
- * @param id the id to assign to the server instance; a generated
- * id is used if id is <code>null</code> or an empty string
- * @param file the file in the workspace where the server instance
- * is to be serialized, or <code>null</code> if the information is
- * instead to be persisted with the workspace but not with any
- * particular workspace resource
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @return a new server working copy with the given id
- * @throws CoreException if an exception occurs while creating this runtime
- * or setting it's default values
- */
- public IServerWorkingCopy createServer(String id, IFile file, IProgressMonitor monitor) throws CoreException;
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerWorkingCopy.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerWorkingCopy.java
deleted file mode 100644
index ae21ecba9..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerWorkingCopy.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core;
-
-import java.beans.PropertyChangeListener;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-/**
- * A working copy server object used for formulating changes
- * to a server instance ({@link IServer}).
- *
- * <p>This interface is not intended to be implemented by clients.</p>
- *
- * @plannedfor 1.0
- */
-public interface IServerWorkingCopy extends IServerAttributes {
- /**
- * Status code (value 1) returned from the save() method when the save
- * failed with force set to <code>false</code> because the runtime has
- * been modified and saved since this working copy was created.
- *
- * @see #save(boolean, IProgressMonitor)
- */
- public static final int SAVE_CONFLICT = 1;
-
- /**
- * Sets the displayable name for this server.
- * <p>
- * The name should be appropriate for the current locale.
- * </p>
- *
- * @param name a displayable name
- * @see IServerAttributes#getName()
- */
- public void setName(String name);
-
- /**
- * Sets or unsets whether this server is marked as read only.
- * When a server is read only, working copies can be created but
- * they cannot be saved.
- *
- * @param readOnly <code>true</code> to set this server to be marked
- * read only, and <code>false</code> to unset
- */
- public void setReadOnly(boolean readOnly);
-
- /**
- * Returns whether this working copy has unsaved changes.
- *
- * @return <code>true</code> if this working copy has unsaved
- * changes, and <code>false</code> otherwise
- */
- public boolean isDirty();
-
- /**
- * Adds a property change listener to this server.
- * <p>
- * Once registered, a listener starts receiving notification of
- * property changes to this server. The listener continues to receive
- * notifications until it is removed.
- * Has no effect if an identical listener is already registered.
- * </p>
- *
- * @param listener a property change listener
- * @see #removePropertyChangeListener(PropertyChangeListener)
- */
- public void addPropertyChangeListener(PropertyChangeListener listener);
-
- /**
- * Removes a property change listener from this server.
- * Has no effect if the listener is not registered.
- *
- * @param listener a property change listener
- * @see #addPropertyChangeListener(PropertyChangeListener)
- */
- public void removePropertyChangeListener(PropertyChangeListener listener);
-
- /**
- * Sets the server configuration associated with this server working copy.
- * <p>
- * Note: The server configuration of a server working copy may
- * or may not be a working copy.
- * </p>
- * <p>
- * [issue: According to serverType extension point,
- * configurationTypeId is an optional attribute. What happens if the
- * server configuration passed is null but the server must have a
- * server configuration? What happens of the server configuration
- * has the wrong type? Do the errors get detected and reported now, or
- * upon save()?]
- * </p>
- *
- * @param configuration the server configuration, or <code>null</code> if none
- */
- public void setServerConfiguration(IFolder configuration);
-
- /**
- * Returns the server instance that this working copy is
- * associated with.
- * <p>
- * For a server working copy created by a call to
- * {@link IServer#createWorkingCopy()},
- * <code>this.getOriginal()</code> returns the original
- * server object. For a server working copy just created by
- * a call to {@link IServerType#createServer(String, org.eclipse.core.resources.IFile, IProgressMonitor)},
- * <code>this.getOriginal()</code> returns <code>null</code>.
- * </p>
- *
- * @return the associated server instance, or <code>null</code> if none
- */
- public IServer getOriginal();
-
- /**
- * Commits the changes made in this working copy. If there is
- * no extant server instance with a matching id and server
- * type, this will create a server instance with attributes
- * taken from this working copy. If there an existing server
- * instance with a matching id and server type, this will
- * change the server instance accordingly.
- * <p>
- * If there an existing server instance with a matching id and
- * server type, this will change the server instance accordingly.
- * The returned server will be the same server this is returned
- * from getOriginal(), after the changes have been applied.
- * Otherwise, this method will return a newly created server.
- * </p>
- * <p>
- * Servers can be saved even when they have invalid properties. It
- * is the clients responsibility to validate or check the
- * properties before saving.
- * </p>
- * <p>
- * This method does not apply changes to the server. A publish()
- * must be completed to push out after the save to push out any
- * changes to the server.
- * </p>
- * <p>
- * [issue: What is lifecycle for ServerWorkingCopyDelegate
- * associated with this working copy?]
- * </p>
- * <p>
- * [issue: Since it does not make sense to commit a server
- * working copy without first committing any associated
- * runtime and server config working copies, the semantics
- * of saveAll should be part and parcel of the
- * normal save, and the saveAll method eliminated.]
- * </p>
- *
- * @param force <code>true</code> to force the save, or <code>false</code>
- * otherwise
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @return a new server instance
- * @throws CoreException [missing]
- * @see #SAVE_CONFLICT
- */
- public IServer save(boolean force, IProgressMonitor monitor) throws CoreException;
-
- /**
- * Commits the changes made in this server working copy after
- * first committing any associated server configuration or
- * server runtime working copies.
- * <p>
- * This convenience method is equivalent to:
- * <pre>
- * IRuntime rt = this.getRuntime();
- * if (rt != null && rt.isWorkingCopy()) {
- * ((IRuntimeWorkingCopy) rt).save(monitor);
- * }
- * IServerConfiguration cf = this.getServerConfiguration();
- * if (cf != null && cf.isWorkingCopy()) {
- * ((IServerConfigurationWorkingCopy) cf).save(monitor);
- * }
- * return save(monitor);
- * </pre>
- * </p>
- * <p>
- * [issue: Since it does not make sense to commit a server
- * working copy without first committing any associated
- * runtime and server config working copies, the semantics
- * of this operation should be part and parcel of the
- * normal save, and the saveAll method eliminated.]
- * </p>
- *
- * @param force <code>true</code> to force the save, or <code>false</code>
- * otherwise
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @return a new server instance
- * @throws CoreException [missing]
- * @see #SAVE_CONFLICT
- */
- public IServer saveAll(boolean force, IProgressMonitor monitor) throws CoreException;
-
- /**
- * Sets the runtime associated with this server working copy.
- * <p>
- * Note: The runtime of a server working copy may
- * or may not be a working copy.
- * </p>
- * <p>
- * [issue: According to serverType extension point,
- * runtimeTypeId is a mandatory attribute. But IServer.getRuntime()
- * is allowed to return null, suggesting that it is optional for instances.
- * What happens if the runtime passed is null but the server must
- * have a runtime? What happens if the runtime has the wrong
- * type? Do the errors get detected and reported now, or upon save()?]
- * </p>
- *
- * @param runtime the runtime, or <code>null</code> if none
- */
- public void setRuntime(IRuntime runtime);
-
- /**
- * Changes the host for the server.
- * The format of the host can be either a qualified or unqualified hostname,
- * or an IP address and must conform to RFC 2732.
- *
- * <p>
- * [issue: This is a questionable operation if there is a running
- * server associated with the original. When a host name
- * change is committed, the server instance loses contact with
- * the running server because of the host name change.]
- * </p>
- *
- * @param host a host string conforming to RFC 2732
- * @see IServer#getHost()
- * @see java.net.URL#getHost()
- */
- public void setHost(String host);
-
- /**
- * Modifies the list of modules associated with the server.
- * The modules included in the <code>add</code> list
- * must exist in the workspace and must not already be associated
- * with the server.
- * The modules included in the <code>remove</code> list
- * must be associated with the server, but may or may not exist
- * in the workspace.
- * <p>
- * This method will not communicate with the server. After saving,
- * publish() can be used to sync up with the server.
- * </p>
- * <p>
- * [issue: How to formulate what it means
- * to say "the module must exist in the workspace"?]
- * </p>
- * <p>
- * [issue: The spec should be more lax. Attempting to add
- * a module that's already include should be quietly ignore;
- * ditto removing a module that's not on this list. This
- * simplifies the handling of various other wacko cases
- * such as duplication within and between the add and remove
- * lists.]
- * </p>
- * <p>
- * [issue: The spec had also said: "...canModifyModules()
- * should have returned true. The configuration must assume
- * any default settings and add the module without any UI."]
- * </p>
- * <p>
- * [issue: What error checking should be performed by this
- * operation, and what needs to be performed by save() if
- * the client tries to commit these hypothetisized changes?]
- * </p>
- *
- * @param add a possibly-empty list of modules to add
- * @param remove a possibly-empty list of modules to remove
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @throws CoreException [missing]
- */
- public void modifyModules(IModule[] add, IModule[] remove, IProgressMonitor monitor) throws CoreException;
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/ServerCore.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/ServerCore.java
deleted file mode 100644
index b0fc5613f..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/ServerCore.java
+++ /dev/null
@@ -1,563 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core;
-
-import java.util.*;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.wst.server.core.internal.*;
-/**
- * Main class for server core API.
- * <p>
- * This class provides API to access most of the types in the server
- * framework, including server runtimes and servers. Methods **
- * The methods on this class are thread safe.
- * </p>
- * <p>
- * This class provides all its functionality through static members.
- * It is not intended to be subclassed or instantiated.
- * </p>
- *
- * @plannedfor 1.0
- */
-public class ServerCore {
- private static final String EXTENSION_SERVER_TYPE = "serverTypes";
- private static final String EXTENSION_RUNTIME_TYPE = "runtimeTypes";
-
- // cached copy of all runtime types
- private static List runtimeTypes;
-
- // cached copy of all runtime target handlers
- private static List runtimeTargetHandlers;
-
- // cached copy of all server and configuration types
- private static List serverTypes;
-
- private static IRegistryChangeListener registryListener;
-
- static {
- executeStartups();
- }
-
- private static class RegistryChangeListener implements IRegistryChangeListener {
- public void registryChanged(IRegistryChangeEvent event) {
- IExtensionDelta[] deltas = event.getExtensionDeltas(ServerPlugin.PLUGIN_ID, EXTENSION_RUNTIME_TYPE);
- if (deltas != null) {
- for (int i = 0; i < deltas.length; i++) {
- handleRuntimeTypeDelta(deltas[i]);
- }
- }
-
- deltas = event.getExtensionDeltas(ServerPlugin.PLUGIN_ID, EXTENSION_SERVER_TYPE);
- if (deltas != null) {
- for (int i = 0; i < deltas.length; i++) {
- handleServerTypeDelta(deltas[i]);
- }
- }
- }
- }
-
- /**
- * Cannot create ServerCore - use static methods.
- */
- private ServerCore() {
- // can't create
- }
-
- /**
- * Returns the resource manager.
- *
- * @return org.eclipse.wst.server.core.internal.ResourceManager
- */
- private static ResourceManager getResourceManager() {
- return ResourceManager.getInstance();
- }
-
- /**
- * Returns the preference information for the project. The project may not
- * be null.
- *
- * @param project a project
- * @return the properties of the project
- * @deprecated Project facet support should now be used instead of this API. @see
- * org.eclipse.wst.common.project.facet.core.IFacetedProject#getRuntime()
- */
- public static IProjectProperties getProjectProperties(IProject project) {
- if (project == null)
- throw new IllegalArgumentException();
- return new ProjectProperties(project);
- }
-
- /**
- * Returns an array of all known runtime types.
- * <p>
- * A new array is returned on each call, so clients may store or modify the result.
- * </p>
- *
- * @return the array of runtime types {@link IRuntimeType}
- */
- public static IRuntimeType[] getRuntimeTypes() {
- if (runtimeTypes == null)
- loadRuntimeTypes();
-
- IRuntimeType[] rt = new IRuntimeType[runtimeTypes.size()];
- runtimeTypes.toArray(rt);
- return rt;
- }
-
- /**
- * Returns the runtime type with the given id, or <code>null</code>
- * if none. This convenience method searches the list of known
- * runtime types ({@link #getRuntimeTypes()}) for the one with a matching
- * runtime type id ({@link IRuntimeType#getId()}). The id may not be null.
- *
- * @param id the runtime type id
- * @return the runtime type, or <code>null</code> if there is no runtime type
- * with the given id
- */
- public static IRuntimeType findRuntimeType(String id) {
- if (id == null)
- throw new IllegalArgumentException();
-
- if (runtimeTypes == null)
- loadRuntimeTypes();
-
- Iterator iterator = runtimeTypes.iterator();
- while (iterator.hasNext()) {
- IRuntimeType runtimeType = (IRuntimeType) iterator.next();
- if (id.equals(runtimeType.getId()))
- return runtimeType;
- }
- return null;
- }
-
- /**
- * Returns an array of all known runtime target handler instances.
- * <p>
- * A new array is returned on each call, so clients may store or modify the result.
- * </p>
- *
- * @return a possibly-empty array of runtime target handler instances
- * {@link IRuntimeTargetHandler}
- */
- public static IRuntimeTargetHandler[] getRuntimeTargetHandlers() {
- if (runtimeTargetHandlers == null)
- loadRuntimeTargetHandlers();
-
- IRuntimeTargetHandler[] rth = new IRuntimeTargetHandler[runtimeTargetHandlers.size()];
- runtimeTargetHandlers.toArray(rth);
- return rth;
- }
-
- /**
- * Returns the runtime target handler with the given id, or <code>null</code>
- * if none. This convenience method searches the list of known runtime
- * target handlers ({@link #getRuntimeTargetHandlers()}) for the one with
- * a matching runtime target handler id ({@link IRuntimeTargetHandler#getId()}).
- * The id may not be null.
- *
- * @param id the runtime target handler id
- * @return the runtime target handler instance, or <code>null</code> if
- * there is no runtime target handler with the given id
- */
- public static IRuntimeTargetHandler findRuntimeTargetHandler(String id) {
- if (id == null)
- throw new IllegalArgumentException();
-
- if (runtimeTargetHandlers == null)
- loadRuntimeTargetHandlers();
-
- Iterator iterator = runtimeTargetHandlers.iterator();
- while (iterator.hasNext()) {
- IRuntimeTargetHandler runtimeTargetListener = (IRuntimeTargetHandler) iterator.next();
- if (id.equals(runtimeTargetListener.getId()))
- return runtimeTargetListener;
- }
- return null;
- }
-
- /**
- * Returns an array of all known server types.
- * <p>
- * A new array is returned on each call, so clients may store or modify the result.
- * </p>
- *
- * @return the array of server types {@link IServerType}
- */
- public static IServerType[] getServerTypes() {
- if (serverTypes == null)
- loadServerTypes();
-
- IServerType[] st = new IServerType[serverTypes.size()];
- serverTypes.toArray(st);
- return st;
- }
-
- /**
- * Returns the server type with the given id, or <code>null</code>
- * if none. This convenience method searches the list of known
- * server types ({@link #getServerTypes()}) for the one with a matching
- * server type id ({@link IServerType#getId()}). The id may not be null.
- *
- * @param id the server type id
- * @return the server type, or <code>null</code> if there is no server type
- * with the given id
- */
- public static IServerType findServerType(String id) {
- if (id == null)
- throw new IllegalArgumentException();
-
- if (serverTypes == null)
- loadServerTypes();
-
- Iterator iterator = serverTypes.iterator();
- while (iterator.hasNext()) {
- IServerType serverType = (IServerType) iterator.next();
- if (id.equals(serverType.getId()))
- return serverType;
- }
- return null;
- }
-
- /**
- * Execute the server startup extension points.
- */
- private static synchronized void executeStartups() {
- Trace.trace(Trace.EXTENSION_POINT, "->- Loading .startup extension point ->-");
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IConfigurationElement[] cf = registry.getConfigurationElementsFor(ServerPlugin.PLUGIN_ID, "internalStartup");
-
- int size = cf.length;
- for (int i = 0; i < size; i++) {
- try {
- IStartup startup = (IStartup) cf[i].createExecutableExtension("class");
- try {
- startup.startup();
- } catch (Exception ex) {
- Trace.trace(Trace.SEVERE, "Startup failed" + startup.toString(), ex);
- }
- Trace.trace(Trace.EXTENSION_POINT, " Loaded startup: " + cf[i].getAttribute("id"));
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, " Could not load startup: " + cf[i].getAttribute("id"), t);
- }
- }
-
- Trace.trace(Trace.EXTENSION_POINT, "-<- Done loading .startup extension point -<-");
- }
-
- /**
- * Load the runtime types.
- */
- private static synchronized void loadRuntimeTypes() {
- if (runtimeTypes != null)
- return;
- Trace.trace(Trace.EXTENSION_POINT, "->- Loading .runtimeTypes extension point ->-");
-
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IConfigurationElement[] cf = registry.getConfigurationElementsFor(ServerPlugin.PLUGIN_ID, EXTENSION_RUNTIME_TYPE);
- runtimeTypes = new ArrayList(cf.length);
- addRuntimeTypes(cf);
- addRegistryListener();
-
- Trace.trace(Trace.EXTENSION_POINT, "-<- Done loading .runtimeTypes extension point -<-");
- }
-
- /**
- * Load the runtime types.
- */
- private static synchronized void addRuntimeTypes(IConfigurationElement[] cf) {
- for (int i = 0; i < cf.length; i++) {
- try {
- RuntimeType runtimeType = new RuntimeType(cf[i]);
- runtimeTypes.add(runtimeType);
- Trace.trace(Trace.EXTENSION_POINT, " Loaded runtimeType: " + cf[i].getAttribute("id"));
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, " Could not load runtimeType: " + cf[i].getAttribute("id"), t);
- }
- }
- }
-
- /**
- * Load the runtime target handlers.
- */
- private static synchronized void loadRuntimeTargetHandlers() {
- if (runtimeTargetHandlers != null)
- return;
- Trace.trace(Trace.EXTENSION_POINT, "->- Loading .runtimeTargetHandlers extension point ->-");
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IConfigurationElement[] cf = registry.getConfigurationElementsFor(ServerPlugin.PLUGIN_ID, "runtimeTargetHandlers");
-
- int size = cf.length;
- runtimeTargetHandlers = new ArrayList(size);
- for (int i = 0; i < size; i++) {
- try {
- RuntimeTargetHandler runtimeTargetListener = new RuntimeTargetHandler(cf[i]);
- runtimeTargetHandlers.add(runtimeTargetListener);
- Trace.trace(Trace.EXTENSION_POINT, " Loaded runtimeTargetHandler: " + cf[i].getAttribute("id"));
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, " Could not load runtimeTargetHandler: " + cf[i].getAttribute("id"), t);
- }
- }
- sortOrderedList(runtimeTargetHandlers);
-
- Trace.trace(Trace.EXTENSION_POINT, "-<- Done loading .runtimeTargetHandlers extension point -<-");
- }
-
- /**
- * Load the server types.
- */
- private static synchronized void loadServerTypes() {
- if (serverTypes != null)
- return;
-
- Trace.trace(Trace.EXTENSION_POINT, "->- Loading .serverTypes extension point ->-");
-
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IConfigurationElement[] cf = registry.getConfigurationElementsFor(ServerPlugin.PLUGIN_ID, EXTENSION_SERVER_TYPE);
- serverTypes = new ArrayList(cf.length);
- addServerTypes(cf);
- addRegistryListener();
-
- Trace.trace(Trace.EXTENSION_POINT, "-<- Done loading .serverTypes extension point -<-");
- }
-
- /**
- * Load the server types.
- */
- private static synchronized void addServerTypes(IConfigurationElement[] cf) {
- for (int i = 0; i < cf.length; i++) {
- try {
- ServerType serverType = new ServerType(cf[i]);
- serverTypes.add(serverType);
- Trace.trace(Trace.EXTENSION_POINT, " Loaded serverType: " + cf[i].getAttribute("id"));
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, " Could not load serverType: " + cf[i].getAttribute("id"), t);
- }
- }
- }
-
- /**
- * Returns the runtime with the given id, or <code>null</code>
- * if none. This convenience method searches the list of known
- * runtimes ({@link #getRuntimes()}) for the one with a matching
- * runtime id ({@link IRuntime#getId()}). The id may not be null.
- *
- * @param id the runtime id
- * @return the runtime instance, or <code>null</code> if there is no runtime
- * with the given id
- */
- public static IRuntime findRuntime(String id) {
- return getResourceManager().getRuntime(id);
- }
-
- /**
- * Returns an array of all known runtime instances. The list will not contain any
- * working copies.
- * <p>
- * A new array is returned on each call, so clients may store or modify the result.
- * </p>
- *
- * @return a possibly-empty array of runtime instances {@link IRuntime}
- */
- public static IRuntime[] getRuntimes() {
- return getResourceManager().getRuntimes();
- }
-
- /**
- * Returns the server with the given id, or <code>null</code>
- * if none. This convenience method searches the list of known
- * servers ({@link #getServers()}) for the one with a matching
- * server id ({@link IServer#getId()}). The id must not be null.
- *
- * @param id the server id
- * @return the server instance, or <code>null</code> if there is no server
- * with the given id
- */
- public static IServer findServer(String id) {
- return getResourceManager().getServer(id);
- }
-
- /**
- * Returns an array of all known server instances. The array will not include any
- * working copies.
- * <p>
- * A new array is returned on each call, so clients may store or modify the result.
- * </p>
- *
- * @return a possibly-empty array of server instances {@link IServer}
- */
- public static IServer[] getServers() {
- return getResourceManager().getServers();
- }
-
- /**
- * Adds a new runtime lifecycle listener.
- * Has no effect if an identical listener is already registered.
- *
- * @param listener a runtime lifecycle listener
- * @see #removeRuntimeLifecycleListener(IRuntimeLifecycleListener)
- */
- public static void addRuntimeLifecycleListener(IRuntimeLifecycleListener listener) {
- getResourceManager().addRuntimeLifecycleListener(listener);
- }
-
- /**
- * Removes a runtime lifecycle listener.
- * Has no effect if the listener is not registered.
- *
- * @param listener a runtime lifecycle listener
- * @see #addRuntimeLifecycleListener(IRuntimeLifecycleListener)
- */
- public static void removeRuntimeLifecycleListener(IRuntimeLifecycleListener listener) {
- getResourceManager().removeRuntimeLifecycleListener(listener);
- }
-
- /**
- * Adds a new server lifecycle listener.
- * Has no effect if an identical listener is already registered.
- *
- * @param listener a server lifecycle listener
- * @see #removeServerLifecycleListener(IServerLifecycleListener)
- */
- public static void addServerLifecycleListener(IServerLifecycleListener listener) {
- getResourceManager().addServerLifecycleListener(listener);
- }
-
- /**
- * Removes a server lifecycle listener.
- * Has no effect if the listener is not registered.
- *
- * @param listener a server lifecycle listener
- * #addServerLifecycleListener(IServerLifecycleListener)
- */
- public static void removeServerLifecycleListener(IServerLifecycleListener listener) {
- getResourceManager().removeServerLifecycleListener(listener);
- }
-
- /**
- * Sort the given list of IOrdered items into indexed order.
- *
- * @param list java.util.List
- * @return java.util.List
- */
- private static List sortOrderedList(List list) {
- if (list == null)
- return null;
-
- int size = list.size();
- for (int i = 0; i < size - 1; i++) {
- for (int j = i + 1; j < size; j++) {
- IOrdered a = (IOrdered) list.get(i);
- IOrdered b = (IOrdered) list.get(j);
- if (a.getOrder() > b.getOrder()) {
- Object temp = a;
- list.set(i, b);
- list.set(j, temp);
- }
- }
- }
- return list;
- }
-
- /**
- * Returns the preferred runtime server for the given module. This method
- * returns null if the server was never chosen or does not currently exist. (if the
- * server is recreated or was in a closed project, etc. this method will return
- * the original value if it becomes available again)
- *
- * @param module a module
- * @return the current default server, or <code>null</code> if there is no
- * default server
- */
- public static IServer getDefaultServer(IModule module) {
- return ModuleProperties.getInstance().getDefaultServer(module);
- }
-
- /**
- * Sets the preferred runtime server for the given module. Set the server to
- * null to clear the setting. If there is a problem saving the file, a CoreException
- * will be thrown.
- *
- * @param module the module to set the default for
- * @param server the server to set the default server, or <code>null</code>
- * to unset the default
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @throws CoreException if there is a problem setting the default server
- */
- public static void setDefaultServer(IModule module, IServer server, IProgressMonitor monitor) throws CoreException {
- ModuleProperties.getInstance().setDefaultServer(module, server, monitor);
- }
-
- protected static void handleServerTypeDelta(IExtensionDelta delta) {
- if (serverTypes == null) // not loaded yet
- return;
-
- IConfigurationElement[] cf = delta.getExtension().getConfigurationElements();
-
- if (delta.getKind() == IExtensionDelta.ADDED) {
- addServerTypes(cf);
- } else {
- int size = serverTypes.size();
- ServerType[] st = new ServerType[size];
- serverTypes.toArray(st);
- int size2 = cf.length;
-
- for (int i = 0; i < size; i++) {
- for (int j = 0; j < size2; j++) {
- if (st[i].getId().equals(cf[j].getAttribute("id"))) {
- st[i].dispose();
- serverTypes.remove(st[i]);
- }
- }
- }
- }
- getResourceManager().resolveServers();
- }
-
- protected static void handleRuntimeTypeDelta(IExtensionDelta delta) {
- if (runtimeTypes == null) // not loaded yet
- return;
-
- IConfigurationElement[] cf = delta.getExtension().getConfigurationElements();
-
- if (delta.getKind() == IExtensionDelta.ADDED) {
- addRuntimeTypes(cf);
- } else {
- int size = runtimeTypes.size();
- RuntimeType[] rt = new RuntimeType[size];
- runtimeTypes.toArray(rt);
- int size2 = cf.length;
-
- for (int i = 0; i < size; i++) {
- for (int j = 0; j < size2; j++) {
- if (rt[i].getId().equals(cf[j].getAttribute("id"))) {
- rt[i].dispose();
- runtimeTypes.remove(rt[i]);
- }
- }
- }
- }
- getResourceManager().resolveRuntimes();
- getResourceManager().resolveServers();
- }
-
- private static void addRegistryListener() {
- if (registryListener != null)
- return;
-
- registryListener = new RegistryChangeListener();
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- registry.addRegistryChangeListener(registryListener, ServerPlugin.PLUGIN_ID);
- ServerPlugin.setRegistryListener(registryListener);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/ServerEvent.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/ServerEvent.java
deleted file mode 100644
index cea36bdf9..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/ServerEvent.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core;
-
-/**
- * An event fired when a server change or module changes.
- *
- * @plannedfor 1.0
- */
-public class ServerEvent {
- private IServer server;
- private int kind;
- private IModule[] moduleTree;
- private int state;
- private int publishState;
- private boolean restartState;
-
- /**
- * For notification when the state has changed.
- * <p>
- * This kind is mutually exclusive with <code>PUBLISH_STATE_CHANGE</code> and
- * <code>RESTART_STATE_CHANGE</code>.
- * </p>
- *
- * @see #getKind()
- */
- public static final int STATE_CHANGE = 0x0001;
-
- /**
- * Fired when published is needed or no longer needs to be published,
- * or it's state has changed.
- * <p>
- * This kind is mutually exclusive with <code>STATE_CHANGE</code> and
- * <code>RESTART_STATE_CHANGE</code>.
- * </p>
- *
- * @see #getKind()
- */
- public static final int PUBLISH_STATE_CHANGE = 0x0002;
-
- /**
- * For notification when the server isRestartNeeded() property changes.
- * <p>
- * This kind is mutually exclusive with <code>STATE_CHANGE</code> and
- * <code>PUBLISH_STATE_CHANGE</code>.
- * </p>
- *
- * @see #getKind()
- */
- public static final int RESTART_STATE_CHANGE = 0x0004;
-
- /**
- * For event on server changes. This kind is mutually exclusive with <code>MODULE_CHANGE</code>.
- *
- * @see #getKind()
- */
- public static final int SERVER_CHANGE = 0x0010;
-
- /**
- * For event on module changes. This kind is mutually exclusive with <code>SERVER_CHANGE</code>.
- *
- * @see #getKind()
- */
- public static final int MODULE_CHANGE = 0x0020;
-
- /**
- * Create a new server event for server change events.
- *
- * @param kind the kind of the change. (<code>XXX_CHANGE</code>). If the kind does not
- * include the <code>SERVER_CHANGE</code> kind, the SERVER_CHANGE will be added automatically.
- * constants declared on {@link ServerEvent}
- * @param server the server that the server event takes place
- * @param state the server state after the change (<code>STATE_XXX</code>)
- * constants declared on {@link IServer}
- * @param publishingState the server publishing state after the
- * change (<code>PUBLISH_STATE_XXX</code>)
- * constants declared on {@link IServer}
- * @param restartState get the server restart state after the server is restart
- * needed property change event
- */
- public ServerEvent(int kind, IServer server, int state, int publishingState, boolean restartState) {
- this.kind = kind |= SERVER_CHANGE;
- this.server = server;
- this.state = state;
- this.publishState = publishingState;
- this.restartState = restartState;
-
- if (server == null)
- throw new IllegalArgumentException("Server parameter must not be null");
- if ((kind & MODULE_CHANGE) != 0)
- throw new IllegalArgumentException("Kind parameter invalid");
-
- checkKind();
- }
-
- /**
- * Create a new ServerEvent for module change events.
- *
- * @param kind the kind of the change. (<code>XXX_CHANGE</code>). If the kind does not
- * include the <code>MODULE_CHANGE</code> kind, the MODULE_CHANGE will be added automatically.
- * constants declared on {@link ServerEvent}
- * @param server the server that the module event takes place
- * @param module the module that has changed
- * @param state the module state after the change (<code>STATE_XXX</code>)
- * constants declared on {@link IServer}
- * @param publishingState the module publishing state after the
- * change (<code>PUBLISH_STATE_XXX</code>)
- * constants declared on {@link IServer}
- * @param restartState get the module restart state after the module is restart
- * needed property change event.
- */
- public ServerEvent(int kind, IServer server, IModule[] module, int state, int publishingState, boolean restartState) {
- this.kind = kind |= MODULE_CHANGE;
- this.server = server;
- this.moduleTree = module;
- this.state = state;
- this.publishState = publishingState;
- this.restartState = restartState;
-
- if (moduleTree == null || moduleTree.length == 0)
- throw new IllegalArgumentException("Module parameter invalid");
- if ((kind & SERVER_CHANGE) != 0)
- throw new IllegalArgumentException("Kind parameter invalid");
-
- checkKind();
- }
-
- private void checkKind() {
- int i = 0;
- if ((kind & STATE_CHANGE) != 0)
- i++;
- if ((kind & RESTART_STATE_CHANGE) != 0)
- i++;
- if ((kind & PUBLISH_STATE_CHANGE) != 0)
- i++;
-
- if (i != 1)
- throw new IllegalArgumentException("Kind parameter invalid");
- }
-
- /**
- * Returns the kind of the server event.
- * <p>
- * This kind can be used to test whether this event is a server event or module event by using
- * the following code (the example is checking for the server event):
- * ((getKind() | SERVER_CHANGE) != 0)
- * the following code (the example is checking for the module event):
- * ((getKind() | MODULE_CHANGE) != 0)
- *
- * @return the kind of the change (<code>XXX_CHANGE</code>
- * constants declared on {@link ServerEvent}
- */
- public int getKind() {
- return kind;
- }
-
- /**
- * Returns the module tree of the module involved in the module change event,
- * or <code>null</code> if the event is not a module event, i.e. isModuleEvent() is false.
- *
- * @return the module tree of the module involved in the module change event,
- * or <code>null</code> if the event is not a module event, i.e.
- * isModuleEvent() is false.
- */
- public IModule[] getModule() {
- return moduleTree;
- }
-
- /**
- * Get the publish state after the change that triggers this server event. If this event
- * is of the SERVER_CHANGE kind, then the publishing state is the server publishing state.
- * If this event is of the MODULE_CHANGE kind, then the publishing state is the module
- * publishing state.
- *
- * @return the publishing state after the change (<code>PUBLISH_STATE_XXX</code>)
- * constants declared on {@link IServer}
- */
- public int getPublishState() {
- return publishState;
- }
-
- /**
- * Get the restart state after isRestartNeeded() property change event.
- * If this event is of the SERVER_CHANGE kind, then the restart state is the server
- * restart state. If this event is of the MODULE_CHANGE kind, then the restart state
- * is the module restart state.
- *
- * @return <code>true</code> if restart is needed, and
- * <code>false</code> otherwise
- */
- public boolean getRestartState() {
- return restartState;
- }
-
- /**
- * Get the state after the change that triggers this server event. If this event
- * is of the SERVER_CHANGE kind, then the state is the server state.
- * If this event is of the MODULE_CHANGE kind, then the state is the module
- * state.
- *
- * @return the server state after the change (<code>STATE_XXX</code>)
- * constants declared on {@link IServer}
- */
- public int getState() {
- return state;
- }
-
- /**
- * Returns the server involved in the change event.
- *
- * @return the server involved in the change event.
- */
- public IServer getServer() {
- return server;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/ServerPort.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/ServerPort.java
deleted file mode 100644
index f271e6307..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/ServerPort.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core;
-/**
- * This class represents a port on a server.
- *
- * @plannedfor 1.0
- */
-public class ServerPort {
- private String id;
- private String name;
- private int port;
- private String protocol;
- private String[] contentTypes;
- private boolean advanced;
-
- /**
- * Create a new server port.
- *
- * @param id a server-specific port id
- * @param name a human-readable name for the port
- * @param port the number number
- * @param protocol the port's protocol
- */
- public ServerPort(String id, String name, int port, String protocol) {
- this(id, name, port, protocol, null, true);
- }
-
- /**
- * Create a new server port.
- *
- * @param id a server-specific port id
- * @param name a human-readable name for the port
- * @param port the number number
- * @param protocol the port's protocol
- * @param contentTypes the content types that the port supports
- * @param advanced <code>true</code> if the port is "advanced" and should only
- * be shown to advanced users, <code>false</code> otherwise
- */
- public ServerPort(String id, String name, int port, String protocol, String[] contentTypes, boolean advanced) {
- super();
- this.id = id;
- this.name = name;
- this.port = port;
- this.protocol = protocol;
- this.contentTypes = contentTypes;
- this.advanced = advanced;
- }
-
- /**
- * Return an optional internal id used to identify this port.
- *
- * @return an internal id
- */
- public String getId() {
- return id;
- }
-
- /**
- * Return the name of the port.
- *
- * @return the name of the port
- */
- public String getName() {
- return name;
- }
-
- /**
- * Return the actual port number.
- *
- * @return the port number
- */
- public int getPort() {
- return port;
- }
-
- /**
- * Returns the protocol, e.g. HTTP of this port. Returns null
- * if the protocol is unknown.
- *
- * @return the procotol
- */
- public String getProtocol() {
- return protocol;
- }
-
- /**
- * Returns the content types that this port would normally serve, or null
- * if the content is unknown.
- *
- * @return a possibly empty array of content types
- */
- public String[] getContentTypes() {
- return contentTypes;
- }
-
- /**
- * Returns true if this port is an "advanced" port and should not be shown
- * to novice users.
- *
- * @return <code>true</code> if the port is advanced, or <code>false</code>
- * otherwise
- */
- public boolean isAdvanced() {
- return advanced;
- }
-
- /**
- * @see Object#equals(Object)
- */
- public boolean equals(Object obj) {
- if (!(obj instanceof ServerPort))
- return false;
- ServerPort sp = (ServerPort) obj;
- return (sp.port == port);
- }
-
- /**
- * @see Object#hashCode()
- */
- public int hashCode() {
- return port;
- }
-
- /**
- * @see Object#toString()
- */
- public String toString() {
- return "ServerPort [" + getName() + ", " + getId() + ", " + getPort() + ", " + getProtocol() + "]";
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/ServerUtil.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/ServerUtil.java
deleted file mode 100644
index 366b543f3..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/ServerUtil.java
+++ /dev/null
@@ -1,760 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core;
-
-import java.util.*;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.debug.core.ILaunchConfiguration;
-
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.server.core.internal.*;
-/**
- * Server utility methods. These static methods can be used to perform
- * common operations on server artifacts.
- *
- * @plannedfor 1.0
- */
-public class ServerUtil {
- /**
- * Static utility class - cannot create an instance.
- */
- private ServerUtil() {
- // do nothing
- }
-
- /**
- * Returns the project modules attached to a project.
- *
- * @param project a project
- * @return a possibly empty array of modules
- */
- public static IModule getModule(IProject project) {
- if (project == null)
- throw new IllegalArgumentException();
-
- IModule[] modules = getModules();
- if (modules != null) {
- int size = modules.length;
- for (int i = 0; i < size; i++) {
- if (modules[i] != null && project.equals(modules[i].getProject()))
- return modules[i];
- }
- }
- return null;
- }
-
- /**
- * Returns a module from the given moduleId. The moduleId must not be null.
- *
- * @param moduleId a module id
- * @return the module, or <code>null</code> if the module could not be found
- */
- public static IModule getModule(String moduleId) {
- if (moduleId == null)
- throw new IllegalArgumentException();
-
- int index = moduleId.indexOf(":");
- if (index <= 0)
- return null;
-
- String factoryId = moduleId.substring(0, index);
- ModuleFactory moduleFactory = ServerPlugin.findModuleFactory(factoryId);
- if (moduleFactory == null)
- return null;
-
- String moduleSubId = moduleId.substring(index+1);
- IModule module = moduleFactory.getModule(moduleSubId);
- if (module != null)
- return module;
- return null;
- }
-
- /**
- * Return all the available modules from all factories whose
- * type matches the given module types.
- *
- * @param moduleTypes an array of module types
- * @return a possibly empty array of modules
- */
- public static IModule[] getModules(IModuleType[] moduleTypes) {
- List list = new ArrayList();
-
- ModuleFactory[] factories = ServerPlugin.getModuleFactories();
- if (factories != null) {
- int size = factories.length;
- for (int i = 0; i < size; i++) {
- if (isSupportedModule(factories[i].getModuleTypes(), moduleTypes)) {
- IModule[] modules = factories[i].getModules();
- if (modules != null) {
- int size2 = modules.length;
- for (int j = 0; j < size2; j++)
- list.add(modules[j]);
- }
- }
- }
- }
- IModule[] modules = new IModule[list.size()];
- list.toArray(modules);
- return modules;
- }
-
- /**
- * Return all the available modules from all factories whose
- * type matches the given module type id.
- *
- * @param type a module type
- * @return a possibly empty array of modules
- */
- public static IModule[] getModules(String type) {
- List list = new ArrayList();
-
- ModuleFactory[] factories = ServerPlugin.getModuleFactories();
- if (factories != null) {
- int size = factories.length;
- for (int i = 0; i < size; i++) {
- if (isSupportedModule(factories[i].getModuleTypes(), type, null)) {
- IModule[] modules = factories[i].getModules();
- if (modules != null) {
- int size2 = modules.length;
- for (int j = 0; j < size2; j++)
- if(type.equals(modules[j].getModuleType().getId()))
- list.add(modules[j]);
- }
- }
- }
- }
- IModule[] modules = new IModule[list.size()];
- list.toArray(modules);
- return modules;
- }
-
- /**
- * Returns <code>true</code> if any of the given moduleTypes have the given
- * module type id and version id.
- *
- * @param moduleTypes an array of module types
- * @param typeId a module type
- * @param versionId a module version
- * @return <code>true</code> if the module type is supported, and
- * <code>false</code> otherwise
- */
- public static boolean isSupportedModule(IModuleType[] moduleTypes, String typeId, String versionId) {
- if (moduleTypes != null) {
- int size = moduleTypes.length;
- for (int i = 0; i < size; i++) {
- if (isSupportedModule(moduleTypes[i], typeId, versionId))
- return true;
- }
- }
- return false;
- }
-
- private static boolean isSupportedModule(IModuleType[] moduleTypes, IModuleType[] mt) {
- if (mt != null) {
- int size = mt.length;
- for (int i = 0; i < size; i++) {
- if (isSupportedModule(moduleTypes, mt[i]))
- return true;
- }
- }
- return false;
- }
-
- /**
- * Returns <code>true</code> if any of the given moduleTypes match the given
- * module type.
- *
- * @param moduleTypes an array of modules types
- * @param mt a module type
- * @return <code>true</code> if the module type is supported, and
- * <code>false</code> otherwise
- */
- public static boolean isSupportedModule(IModuleType[] moduleTypes, IModuleType mt) {
- if (moduleTypes != null) {
- int size = moduleTypes.length;
- for (int i = 0; i < size; i++) {
- if (isSupportedModule(moduleTypes[i], mt))
- return true;
- }
- }
- return false;
- }
-
- private static boolean isSupportedModule(IModuleType moduleType, String type, String version) {
- String type2 = moduleType.getId();
- if (matches(type, type2)) {
- String version2 = moduleType.getVersion();
- if (matches(version, version2))
- return true;
- }
- return false;
- }
-
- /**
- * Returns true if the two given module types are compatible. The moduleTypes may not
- * be null.
- *
- * @param moduleType a module type
- * @param mt a module type
- * @return <code>true</code> if the module type is supported, and
- * <code>false</code> otherwise
- */
- public static boolean isSupportedModule(IModuleType moduleType, IModuleType mt) {
- if (moduleType == null || mt == null)
- throw new IllegalArgumentException();
-
- String type2 = moduleType.getId();
- if (matches(mt.getId(), type2)) {
- String version2 = moduleType.getVersion();
- if (matches(mt.getVersion(), version2))
- return true;
- }
- return false;
- }
-
- private static boolean matches(String a, String b) {
- if (a == null || b == null || "*".equals(a) || "*".equals(b) || a.startsWith(b) || b.startsWith(a)
- || (a.endsWith(".*") && b.startsWith(a.substring(0, a.length() - 1)))
- || (b.endsWith(".*") && a.startsWith(b.substring(0, b.length() - 1))))
- return true;
- return false;
- }
-
- /**
- * Return all the available modules from all factories.
- *
- * @return a possibly empty array of modules
- */
- private static IModule[] getModules() {
- List list = new ArrayList();
-
- ModuleFactory[] factories = ServerPlugin.getModuleFactories();
- if (factories != null) {
- int size = factories.length;
- for (int i = 0; i < size; i++) {
- IModule[] modules = factories[i].getModules();
- if (modules != null) {
- int size2 = modules.length;
- for (int j = 0; j < size2; j++) {
- if (!list.contains(modules[j]))
- list.add(modules[j]);
- }
- }
- }
- }
- IModule[] modules = new IModule[list.size()];
- list.toArray(modules);
- return modules;
- }
-
- /**
- * Adds or removes modules from a server. Will search for the first parent module
- * of each module and add it to the server instead. This method will handle multiple
- * modules having the same parent (the parent will only be added once), but may not
- * handle the case where the same module or parent is being both added and removed.
- *
- * @param server a server
- * @param add an array of modules to add, or <code>null</code> to not add any
- * @param remove an array of modules to remove, or <code>null</code> to not remove any
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @throws CoreException
- */
- public static void modifyModules(IServerWorkingCopy server, IModule[] add, IModule[] remove, IProgressMonitor monitor) throws CoreException {
- if (server == null)
- throw new IllegalArgumentException();
-
- if (add == null)
- add = new IModule[0];
- if (remove == null)
- remove = new IModule[0];
-
- int size = add.length;
- List addParentModules = new ArrayList();
- for (int i = 0; i < size; i++) {
- boolean found = false;
- try {
- IModule[] parents = server.getRootModules(add[i], monitor);
- if (parents != null) {
- found = true;
- if (parents.length > 0) {
- Object parent = parents[0];
- found = true;
- if (!addParentModules.contains(parent))
- addParentModules.add(parent);
- }
- }
- } catch (Exception e) {
- Trace.trace(Trace.WARNING, "Could not find parent module", e);
- }
-
- if (!found)
- addParentModules.add(add[i]);
- }
-
- size = remove.length;
- List removeParentModules = new ArrayList();
- for (int i = 0; i < size; i++) {
- boolean found = false;
- try {
- IModule[] parents = server.getRootModules(remove[i], monitor);
- if (parents != null) {
- found = true;
- if (parents.length > 0) {
- Object parent = parents[0];
- found = true;
- if (!removeParentModules.contains(parent))
- removeParentModules.add(parent);
- }
- }
- } catch (Exception e) {
- Trace.trace(Trace.WARNING, "Could not find parent module 2", e);
- }
-
- if (!found)
- removeParentModules.add(remove[i]);
- }
-
- IModule[] add2 = new IModule[addParentModules.size()];
- addParentModules.toArray(add2);
- IModule[] remove2 = new IModule[removeParentModules.size()];
- removeParentModules.toArray(remove2);
-
- server.modifyModules(add2, remove2, monitor);
- }
-
- /**
- * Sets a default name on the given runtime.
- *
- * @param runtime a runtime
- */
- public static void setRuntimeDefaultName(IRuntimeWorkingCopy runtime) {
- String typeName = runtime.getRuntimeType().getName();
-
- String name = NLS.bind(Messages.defaultRuntimeName, typeName);
- int i = 2;
- while (isNameInUse(name)) {
- name = NLS.bind(Messages.defaultRuntimeName2, new String[] {typeName, i + ""});
- i++;
- }
- runtime.setName(name);
- }
-
- /**
- * Sets a default name on the given server.
- *
- * @param server a server
- */
- public static void setServerDefaultName(IServerWorkingCopy server) {
- if (server == null)
- throw new IllegalArgumentException();
-
- String typeName = server.getServerType().getName();
- String host = server.getHost();
-
- String name = NLS.bind(Messages.defaultServerName, new String[] {typeName, host});
- int i = 2;
- while (isNameInUse(name)) {
- name = NLS.bind(Messages.defaultServerName2, new String[] {typeName, host, i + ""});
- i++;
- }
- server.setName(name);
- }
-
- private static boolean isValidFilename(String name) {
- IStatus status = ResourcesPlugin.getWorkspace().validateName(name, IResource.FILE);
- if (status != null && !status.isOK())
- return false;
-
- status = ResourcesPlugin.getWorkspace().validateName(name, IResource.FOLDER);
- if (status != null && !status.isOK())
- return false;
-
- return true;
- }
-
- private static String getValidFileName(String name) {
- if (isValidFilename(name))
- return name;
-
- // remove invalid characters
- String[] s = new String[] {".", "\\", "/", "?", ":", "*", "\"", "|", "<", ">"};
- int ind = 0;
- while (ind < s.length) {
- int index = name.indexOf(s[ind]);
- while (index >= 0) {
- name = name.substring(0, index) + name.substring(index+1);
- index = name.indexOf(s[ind]);
- }
- ind++;
- }
- return name;
- }
-
- /**
- * Returns an unused file in the given project.
- *
- * @param project a project
- * @param type a server type
- * @return an unused file within the given project
- */
- /*public static IFile getUnusedServerFile(IProject project, IServerType type) {
- if (project == null || type == null)
- throw new IllegalArgumentException();
-
- String typeName = getValidFileName(type.getName());
- String name = NLS.bind(Messages.defaultServerName3, typeName)+ "." + Server.FILE_EXTENSION;
- int i = 2;
- while (isFileNameInUse(project, name)) {
- name = NLS.bind(Messages.defaultServerName4, new String[] {typeName, i + ""}) + "." + Server.FILE_EXTENSION;
- i++;
- }
- return project.getFile(name);
- }*/
-
- /**
- * Returns an unused file in the given project.
- *
- * @param project a project
- * @param server a server
- * @return an unused file within the given project
- */
- public static IFile getUnusedServerFile(IProject project, IServer server) {
- if (project == null || server == null)
- throw new IllegalArgumentException();
-
- String typeName = getValidFileName(server.getName());
- String name = NLS.bind(Messages.defaultServerName3, typeName)+ "." + Server.FILE_EXTENSION;
- int i = 2;
- while (isFileNameInUse(project, name)) {
- name = NLS.bind(Messages.defaultServerName4, new String[] {typeName, i + ""}) + "." + Server.FILE_EXTENSION;
- i++;
- }
- return project.getFile(name);
- }
-
- /**
- * Returns true if a server or runtime exists with the given name.
- *
- * @param name a name
- * @return <code>true</code> if the name is in use, and <code>false</code>
- * otherwise
- */
- private static boolean isNameInUse(String name) {
- if (name == null)
- return true;
-
- List list = new ArrayList();
-
- addAll(list, ServerCore.getRuntimes());
- addAll(list, ServerCore.getServers());
-
- Iterator iterator = list.iterator();
- while (iterator.hasNext()) {
- Object obj = iterator.next();
- if (obj instanceof IServerAttributes && name.equalsIgnoreCase(((IServerAttributes)obj).getName()))
- return true;
- if (obj instanceof IRuntime && name.equalsIgnoreCase(((IRuntime)obj).getName()))
- return true;
- }
-
- return false;
- }
-
- private static void addAll(List list, Object[] obj) {
- if (obj == null)
- return;
-
- int size = obj.length;
- for (int i = 0; i < size; i++) {
- list.add(obj[i]);
- }
- }
-
- /**
- * Returns true if an element exists with the given name.
- *
- * @param project a project
- * @param name a file or folder name
- * @return boolean <code>true</code> if the file or folder name is being
- * used, and <code>false</code> otherwise
- */
- private static boolean isFileNameInUse(IProject project, String name) {
- if (name == null || project == null)
- return false;
-
- if (project.getFile(name).exists())
- return true;
- if (project.getFolder(name).exists())
- return true;
-
- return false;
- }
-
- /**
- * Return a list of all runtime targets that match the given type and version.
- * If type or version is null, it matches all of that type or version.
- *
- * @param type a module type
- * @param version a module version
- * @return a possibly-empty array of runtime instances {@link IRuntime}
- */
- public static IRuntime[] getRuntimes(String type, String version) {
- List list = new ArrayList();
- IRuntime[] runtimes = ServerCore.getRuntimes();
- if (runtimes != null) {
- int size = runtimes.length;
- for (int i = 0; i < size; i++) {
- IRuntimeType runtimeType = runtimes[i].getRuntimeType();
- if (runtimeType != null && isSupportedModule(runtimeType.getModuleTypes(), type, version)) {
- list.add(runtimes[i]);
- }
- }
- }
-
- IRuntime[] runtimes2 = new IRuntime[list.size()];
- list.toArray(runtimes2);
- return runtimes2;
- }
-
- /**
- * Return a list of all runtime types that match the given type and version.
- * If type or version is null, it matches all of that type or version.
- *
- * @param type a module type
- * @param version a module version
- * @return a possibly-empty array of runtime type instances {@link IRuntimeType}
- */
- public static IRuntimeType[] getRuntimeTypes(String type, String version) {
- List list = new ArrayList();
- IRuntimeType[] runtimeTypes = ServerCore.getRuntimeTypes();
- if (runtimeTypes != null) {
- int size = runtimeTypes.length;
- for (int i = 0; i < size; i++) {
- if (isSupportedModule(runtimeTypes[i].getModuleTypes(), type, version)) {
- list.add(runtimeTypes[i]);
- }
- }
- }
-
- IRuntimeType[] rt = new IRuntimeType[list.size()];
- list.toArray(rt);
- return rt;
- }
-
- /**
- * Return a list of all runtime types that match the given type, version,
- * and partial runtime type id. If type, version, or runtimeTypeId is null,
- * it matches all of that type or version.
- *
- * @param type a module type
- * @param version a module version
- * @param runtimeTypeId the id of a runtime type
- * @return a possibly-empty array of runtime type instances {@link IRuntimeType}
- */
- public static IRuntimeType[] getRuntimeTypes(String type, String version, String runtimeTypeId) {
- List list = new ArrayList();
- IRuntimeType[] runtimeTypes = ServerCore.getRuntimeTypes();
- if (runtimeTypes != null) {
- int size = runtimeTypes.length;
- for (int i = 0; i < size; i++) {
- if (isSupportedModule(runtimeTypes[i].getModuleTypes(), type, version)) {
- if (runtimeTypeId == null || runtimeTypes[i].getId().startsWith(runtimeTypeId))
- list.add(runtimeTypes[i]);
- }
- }
- }
-
- IRuntimeType[] rt = new IRuntimeType[list.size()];
- list.toArray(rt);
- return rt;
- }
-
- /**
- * Returns a list of all servers that this deployable is not currently
- * configured on, but could be added to. If includeErrors is true, this
- * method return servers where the parent deployable may throw errors. For
- * instance, this deployable may be the wrong spec level.
- *
- * @param module a module
- * @param includeErrors <code>true</code> to include servers that returned
- * errors when trying to add the module, and <code>false</code> otherwise
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @return a possibly empty array of servers
- */
- public static IServer[] getAvailableServersForModule(IModule module, boolean includeErrors, IProgressMonitor monitor) {
- if (module == null)
- return new IServer[0];
-
- // do it the slow way - go through all servers and
- // see if this deployable is not configured in it
- // but could be added
- List list = new ArrayList();
- IServer[] servers = ServerCore.getServers();
- if (servers != null) {
- int size = servers.length;
- for (int i = 0; i < size; i++) {
- if (!containsModule(servers[i], module, monitor)) {
- try {
- IModule[] parents = servers[i].getRootModules(module, monitor);
- if (parents != null && parents.length > 0) {
- boolean found = false;
- if (parents != null) {
- int size2 = parents.length;
- for (int j = 0; !found && j < size2; j++) {
- IModule parent = parents[j];
- IStatus status = servers[i].canModifyModules(new IModule[] { parent }, new IModule[0], monitor);
- if (status == null || status.isOK()){
- list.add(servers[i]);
- found = true;
- }
- }
- }
- }
- } catch (Exception se) {
- if (includeErrors)
- list.add(servers[i]);
- }
- }
- }
- }
-
- // make sure that the preferred server is the first one
- //IServer server = ServerCore.getServerPreferences().getDeployableServerPreference(deployable);
- //if (server != null && list.contains(server) && list.indexOf(server) != 0) {
- // list.remove(server);
- // list.add(0, server);
- //}
-
- IServer[] allServers = new IServer[list.size()];
- list.toArray(allServers);
- return allServers;
- }
-
- /**
- * Returns a list of all servers that this module is configured on.
- *
- * @param module a module
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @return a possibly-empty array of server instances {@link IServer}
- */
- public static IServer[] getServersByModule(IModule module, IProgressMonitor monitor) {
- if (module == null)
- return new IServer[0];
-
- // do it the slow way - go through all servers and
- // see if this module is configured in it
- List list = new ArrayList();
- IServer[] servers = ServerCore.getServers();
- if (servers != null) {
- int size = servers.length;
- for (int i = 0; i < size; i++) {
- if (containsModule(servers[i], module, monitor))
- list.add(servers[i]);
- }
- }
-
- IServer[] allServers = new IServer[list.size()];
- list.toArray(allServers);
- return allServers;
- }
-
- /**
- * Returns true if the given server currently contains the given module.
- *
- * @param server a server
- * @param module a module
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @return boolean <code>true</code> if the module is contained on the server,
- * or <code>false</code> otherwise
- */
- public static boolean containsModule(IServer server, final IModule module, IProgressMonitor monitor) {
- if (server == null)
- return false;
- Trace.trace(Trace.FINEST, "containsModule() " + server + " " + module);
-
- class Helper {
- boolean b;
- }
- final Helper h = new Helper();
-
- ((Server)server).visit(new IModuleVisitor() {
- public boolean visit(IModule[] modules) {
- int size = modules.length;
- if (modules[size - 1].equals(module)) {
- h.b = true;
- return false;
- }
- return true;
- }
- }, null);
- return h.b;
- }
-
- /**
- * Returns the server associated with the given launch configuration.
- *
- * @param configuration a launch configuration
- * @return the server associated with the launch configuration, or
- * <code>null</code> if no server could be found
- * @throws CoreException if there is a problem getting the attribute from
- * the launch configuration
- */
- public static IServer getServer(ILaunchConfiguration configuration) throws CoreException {
- String serverId = configuration.getAttribute(Server.ATTR_SERVER_ID, (String) null);
-
- if (serverId != null)
- return ServerCore.findServer(serverId);
- return null;
- }
-
- /**
- * Validates whether this server can be editted.
- *
- * @param context the context (Shell)
- * @param server the server
- * @return a status object with code <code>IStatus.OK</code> if the server
- * can be edited, otherwise a status object indicating what when wrong
- * with the checkout
- */
- public static IStatus validateEdit(Object context, IServer server) {
- return ((Server)server).validateEdit(context);
- }
-
- /**
- * Returns the port that is being used to monitor the given port on the server.
- * This method can be used whenever creating a 'client' for the server, and allows
- * the client to seamlessly use a monitored port instead of going directly to the
- * server.
- *
- * <b>Provisional API:</b> This class/interface is part of an interim API that is still under development and expected to
- * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
- * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
- * (repeatedly) as the API evolves.
- * </p>
- *
- * @param server a server
- * @param port a port on the server
- * @param contentType the content type, e.g. "web"
- * @return the monitored port, or the original port number if the port is not
- * currently being monitored
- */
- public static int getMonitoredPort(IServer server, int port, String contentType) {
- return ServerMonitorManager.getInstance().getMonitoredPort(server, port, contentType);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/TaskModel.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/TaskModel.java
deleted file mode 100644
index c445222c6..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/TaskModel.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core;
-
-import java.util.HashMap;
-import java.util.Map;
-/**
- * A task model represents a model that can be shared between multiple
- * tasks in a common workflow.
- * <p>
- * The task model contains information about the overall task flow and allows
- * tasks to store and retreive data. Its usage allows mutliple tasks to be
- * chained together and share data from the output of one task to the input
- * of another.
- * </p>
- *
- * @plannedfor 1.0
- */
-public class TaskModel {
- /**
- * Task model id for an IRuntime.
- *
- * @see #getObject(String)
- * @see #putObject(String, Object)
- */
- public static final String TASK_RUNTIME = "runtime";
-
- /**
- * Task model id for an IServer.
- *
- * @see #getObject(String)
- * @see #putObject(String, Object)
- */
- public static final String TASK_SERVER = "server";
-
- /**
- * Task model id for an array of modules.
- * The value is a List containing IModule[] arrays.
- *
- * @see #getObject(String)
- * @see TaskModel#putObject(String, Object)
- */
- public static final String TASK_MODULES = "modules";
-
- /**
- * Task model id for a launch mode.
- *
- * @see #getObject(String)
- * @see #putObject(String, Object)
- */
- public static final String TASK_LAUNCH_MODE = "launch-mode";
-
- private Map map = new HashMap();
-
- /**
- * Returns the object in the task model with the given id.
- * <p>
- * The id can be any of the predefined ids within TaskModel, or
- * any other key to retreive task-specific data.
- * </p>
- *
- * @param id an id for the object
- * @return the object with the given id, or <code>null</code>
- * if no object could be found with that id
- */
- public Object getObject(String id) {
- try {
- return map.get(id);
- } catch (Exception e) {
- return null;
- }
- }
-
- /**
- * Put an object into the task model with the given id.
- * <p>
- * The id can be any of the predefined ids within TaskModel, or
- * any other key to store task-specific data.
- * </p>
- *
- * @param id the id to associate the object with
- * @param obj an object, or <code>null</code> to reset (clear) the id
- */
- public void putObject(String id, Object obj) {
- map.put(id, obj);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Base.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Base.java
deleted file mode 100644
index d2c154c6b..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Base.java
+++ /dev/null
@@ -1,387 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.*;
-import org.eclipse.osgi.util.NLS;
-/**
- * Helper class for storing runtime and server attributes.
- */
-public abstract class Base {
- protected static final String PROP_LOCKED = "locked";
- protected static final String PROP_PRIVATE = "private";
- protected static final String PROP_NAME = "name";
- protected static final String PROP_ID = "id";
-
- protected Map map = new HashMap();
-
- // file loaded from, or null if it is saved in metadata
- protected IFile file;
-
- /**
- * Create a new object.
- *
- * @param file
- */
- public Base(IFile file) {
- this.file = file;
- }
-
- /**
- * Create a new object.
- *
- * @param file
- * @param id
- */
- public Base(IFile file, String id) {
- this.file = file;
- //this.map = map;
- map.put(PROP_ID, id);
- }
-
- /**
- * Returns the timestamp of this object.
- * Timestamps are monotonically increased each time the object is saved
- * and can be used to determine if any changes have been made on disk
- * since the object was loaded.
- *
- * @return the object's timestamp
- */
- public int getTimestamp() {
- return getAttribute("timestamp", -1);
- }
-
- /**
- * Returns the file where this server instance is serialized.
- *
- * @return the file in the workspace where the server instance
- * is serialized, or <code>null</code> if the information is
- * instead to be persisted with the workspace but not with any
- * particular workspace resource
- */
- public IFile getFile() {
- return file;
- }
-
- public String getAttribute(String attributeName, String defaultValue) {
- try {
- Object obj = map.get(attributeName);
- if (obj == null)
- return defaultValue;
- return (String) obj;
- } catch (Exception e) {
- // ignore
- }
- return defaultValue;
- }
-
- public int getAttribute(String attributeName, int defaultValue) {
- try {
- Object obj = map.get(attributeName);
- if (obj == null)
- return defaultValue;
- return Integer.parseInt((String) obj);
- } catch (Exception e) {
- // ignore
- }
- return defaultValue;
- }
-
- public boolean getAttribute(String attributeName, boolean defaultValue) {
- try {
- Object obj = map.get(attributeName);
- if (obj == null)
- return defaultValue;
- return Boolean.valueOf((String) obj).booleanValue();
- } catch (Exception e) {
- // ignore
- }
- return defaultValue;
- }
-
- public List getAttribute(String attributeName, List defaultValue) {
- try {
- Object obj = map.get(attributeName);
- if (obj == null)
- return defaultValue;
- List list = (List) obj;
- if (list != null)
- return list;
- } catch (Exception e) {
- // ignore
- }
- return defaultValue;
- }
-
- public Map getAttribute(String attributeName, Map defaultValue) {
- try {
- Object obj = map.get(attributeName);
- if (obj == null)
- return defaultValue;
- Map map2 = (Map) obj;
- if (map2 != null)
- return map2;
- } catch (Exception e) {
- // ignore
- }
- return defaultValue;
- }
-
- public String getId() {
- return getAttribute(PROP_ID, "");
- }
-
- public String getName() {
- return getAttribute(PROP_NAME, "");
- }
-
- public boolean isReadOnly() {
- return getAttribute(PROP_LOCKED, false);
- }
-
- /**
- * Returns <code>true</code> if this runtime is private (not shown
- * in the UI to the users), and <code>false</code> otherwise.
- *
- * @return <code>true</code> if this runtime is private,
- * and <code>false</code> otherwise
- */
- public boolean isPrivate() {
- return getAttribute(PROP_PRIVATE, false);
- }
-
- public boolean isWorkingCopy() {
- return false;
- }
-
- protected abstract String getXMLRoot();
-
- protected void save(IMemento memento) {
- //IMemento child = memento.createChild("properties");
- IMemento child = memento;
- Iterator iterator = map.keySet().iterator();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
- Object obj = map.get(key);
- if (obj instanceof String)
- child.putString(key, (String) obj);
- else if (obj instanceof Integer) {
- Integer in = (Integer) obj;
- child.putInteger(key, in.intValue());
- } else if (obj instanceof Boolean) {
- Boolean bool = (Boolean) obj;
- child.putBoolean(key, bool.booleanValue());
- } else if (obj instanceof List) {
- List list = (List) obj;
- saveList(child, key, list);
- } else if (obj instanceof Map) {
- Map map2 = (Map) obj;
- saveMap(child, key, map2);
-
- }
- }
- saveState(child);
- }
- protected void saveMap(IMemento memento, String key, Map map2) {
- IMemento child = memento.createChild("map");
- child.putString("key", key);
- Iterator iterator = map2.keySet().iterator();
- while (iterator.hasNext()) {
- String s = (String) iterator.next();
- child.putString(s, (String)map2.get(s));
- }
- }
-
- protected void saveList(IMemento memento, String key, List list) {
- IMemento child = memento.createChild("list");
- child.putString("key", key);
- int i = 0;
- Iterator iterator = list.iterator();
- while (iterator.hasNext()) {
- String s = (String) iterator.next();
- child.putString("value" + (i++), s);
- }
- }
-
- protected void saveToFile(IProgressMonitor monitor) throws CoreException {
- try {
- XMLMemento memento = XMLMemento.createWriteRoot(getXMLRoot());
- save(memento);
-
- InputStream in = memento.getInputStream();
- if (file.exists())
- file.setContents(in, true, true, ProgressUtil.getSubMonitorFor(monitor, 1000));
- else
- file.create(in, true, ProgressUtil.getSubMonitorFor(monitor, 1000));
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not save " + getXMLRoot(), e);
- throw new CoreException(new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, NLS.bind(Messages.errorSaving, getFile().toString()), e));
- }
- }
-
- protected void doSave(IProgressMonitor monitor) throws CoreException {
- if (file != null)
- saveToFile(monitor);
- else
- saveToMetadata(monitor);
- ResourceManager.getInstance().resolveServers();
- }
-
- protected void saveToMetadata(IProgressMonitor monitor) {
- // do nothing
- }
-
- protected abstract void saveState(IMemento memento);
-
- protected void load(IMemento memento) {
- map = new HashMap();
-
- Iterator iterator = memento.getNames().iterator();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
- map.put(key, memento.getString(key));
- }
- IMemento[] children = memento.getChildren("list");
- if (children != null) {
- int size = children.length;
- for (int i = 0; i < size; i++) {
- loadList(children[i]);
- }
- }
- IMemento[] maps = memento.getChildren("map");
- if (maps != null) {
- for (int i = 0; i <maps.length ; i++) {
- loadMap(maps[i]);
- }
- }
-
- loadState(memento);
- }
-
-
- protected void loadMap(IMemento memento) {
- String key = memento.getString("key");
- Map vMap = new HashMap();
- List keys = memento.getNames();
- Iterator iterator = keys.iterator();
- while(iterator.hasNext()) {
- String s = (String)iterator.next();
- String v = memento.getString(s);
- vMap.put(s,v);
- }
- map.put(key, vMap);
- }
-
-
- protected void loadList(IMemento memento) {
- String key = memento.getString("key");
- List list = new ArrayList();
- int i = 0;
- String key2 = memento.getString("value" + (i++));
- while (key2 != null) {
- list.add(key2);
- key2 = memento.getString("value" + (i++));
- }
- map.put(key, list);
- }
-
- protected abstract void loadState(IMemento memento);
-
- protected void resolve() {
- // do nothing
- }
-
- public void delete() throws CoreException {
- if (isWorkingCopy())
- throw new CoreException(new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, "Cannot delete a working copy", null));
-
- if (file != null)
- file.delete(true, true, new NullProgressMonitor());
- else
- deleteFromMetadata();
- }
-
- protected void deleteFromMetadata() {
- // do nothing
- }
-
- public boolean equals(Object obj) {
- if (!(obj instanceof Base))
- return false;
-
- Base base = (Base) obj;
- if (getId() == null)
- return false;
- return getId().equals(base.getId());
- }
-
- /**
- *
- */
- protected void loadFromFile(IProgressMonitor monitor) throws CoreException {
- InputStream in = null;
- try {
- in = file.getContents();
- IMemento memento = XMLMemento.loadMemento(in);
- load(memento);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not load from file" + e.getMessage(), e);
- throw new CoreException(new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, NLS.bind(Messages.errorLoading, getFile().toString()), e));
- } finally {
- try {
- in.close();
- } catch (Exception e) {
- // ignore
- }
- }
- }
-
- protected void loadFromMemento(IMemento memento, IProgressMonitor monitor) {
- load(memento);
- }
-
- /**
- *
- */
- protected void loadFromPath(IPath path, IProgressMonitor monitor) throws CoreException {
- FileInputStream fin = null;
- try {
- fin = new FileInputStream(path.toFile());
- IMemento memento = XMLMemento.loadMemento(fin);
- load(memento);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not load from path: " + e.getMessage(), e);
- throw new CoreException(new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, NLS.bind(Messages.errorLoading, path.toString()), e));
- } finally {
- try {
- fin.close();
- } catch (Exception e) {
- // ignore
- }
- }
- }
-
- public IStatus validateEdit(Object context) {
- if (file == null)
- return null;
-
- return file.getWorkspace().validateEdit(new IFile[] { file }, context);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ChainedJob.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ChainedJob.java
deleted file mode 100644
index 88ed145c8..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ChainedJob.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.IJobChangeListener;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.runtime.jobs.JobChangeAdapter;
-import org.eclipse.wst.server.core.IServer;
-/**
- * A Job that can start another job upon successful completion.
- */
-public abstract class ChainedJob extends Job {
- private IServer server;
- private Job nextJob;
- private IJobChangeListener listener;
-
- /**
- * Create a new dependant job.
- *
- * @param name the name of the job
- * @param server the server to publish to
- */
- public ChainedJob(String name, IServer server) {
- super(name);
- this.server = server;
- }
-
- /**
- * Returns the server that this job was created with.
- *
- * @return a server
- */
- public IServer getServer() {
- return server;
- }
-
- /**
- * Create a listener for when this job finishes.
- */
- protected void createListener() {
- if (listener != null)
- return;
-
- listener = new JobChangeAdapter() {
- public void done(IJobChangeEvent event) {
- jobDone(event.getResult());
- }
- };
-
- addJobChangeListener(listener);
- }
-
- /**
- * Called when this job is complete.
- *
- * @param status the result of the current job
- */
- protected void jobDone(IStatus status) {
- if (listener == null)
- return;
-
- removeJobChangeListener(listener);
- listener = null;
-
- if (nextJob != null && status != null && status.getSeverity() != IStatus.ERROR
- && status.getSeverity() != IStatus.CANCEL)
- nextJob.schedule();
- }
-
- /**
- * Set the next job, which should be scheduled if and only if this job completes
- * successfully. The next job will be run as long as the result of this job is
- * not an ERROR or CANCEL status.
- * This method is not thread-safe. However, the next job can be changed anytime
- * up until the current job completes.
- *
- * @param job the next job that should be scheduled
- */
- public void setNextJob(Job job) {
- nextJob = job;
- createListener();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Client.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Client.java
deleted file mode 100644
index a648f737f..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Client.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.debug.core.ILaunch;
-
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.model.ClientDelegate;
-/**
- *
- */
-public class Client implements IClient {
- private IConfigurationElement element;
- private ClientDelegate delegate;
-
- /**
- * Create a new client.
- *
- * @param element a configuration element
- */
- public Client(IConfigurationElement element) {
- super();
- this.element = element;
- }
-
- /**
- * @see IClient#getId()
- */
- public String getId() {
- return element.getAttribute("id");
- }
-
- /**
- * Returns the relative priority of this adapter.
- *
- * @return a priority
- */
- public int getPriority() {
- try {
- return Integer.parseInt(element.getAttribute("priority"));
- } catch (Exception e) {
- return 0;
- }
- }
-
- /**
- * @see IClient#getDescription()
- */
- public String getDescription() {
- return element.getAttribute("description");
- }
-
- protected String getLaunchable() {
- return element.getAttribute("launchable");
- }
-
- /**
- * @see IClient#getName()
- */
- public String getName() {
- String label = element.getAttribute("name");
- if (label == null)
- return "n/a";
- return label;
- }
-
- /**
- * Return the delegate.
- *
- * @return the delegate, or <code>null</code> if it couldn't be loaded
- */
- public ClientDelegate getDelegate() {
- if (delegate == null) {
- try {
- delegate = (ClientDelegate) element.createExecutableExtension("class");
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not create delegate" + toString() + ": " + e.getMessage());
- }
- }
- return delegate;
- }
-
- /**
- * @see IClient#supports(IServer, Object, String)
- */
- public boolean supports(IServer server, Object launchable, String launchMode) {
- if (launchable == null)
- return false;
- //if (!launchable.getClass().getName().equals(getLaunchable()))
- // return false;
- try {
- return getDelegate().supports(server, launchable, launchMode);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate " + toString() + ": " + e.getMessage());
- return false;
- }
- }
-
- /**
- * @see IClient#launch(IServer, Object, String, ILaunch)
- */
- public IStatus launch(IServer server, Object launchable, String launchMode, ILaunch launch) {
- try {
- return getDelegate().launch(server, launchable, launchMode, launch);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate " + toString() + ": " + e.getMessage());
- }
- return null;
- }
-
- /**
- * Return a string representation of this object.
- *
- * @return String
- */
- public String toString() {
- return "Client[" + getId() + "]";
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/DeletedModule.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/DeletedModule.java
deleted file mode 100644
index b0e2325a9..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/DeletedModule.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2005 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 Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IModuleType;
-/**
- *
- */
-public class DeletedModule implements IModule {
- protected String id;
- protected String name;
-
- public DeletedModule(String id, String name) {
- this.id = id;
- this.name = name;
- }
-
- public String getId() {
- return id;
- }
-
- public IStatus validate(IProgressMonitor monitor) {
- return null;
- }
-
- public String getName() {
- return name;
- }
-
- public IModuleType getModuleType() {
- return null;
- }
-
- public IProject getProject() {
- return null;
- }
-
- public void addModuleListener(IModuleListener listener) {
- // ignore
- }
-
- public void removeModuleListener(IModuleListener listener) {
- // ignore
- }
-
- public IModule[] getChildModules(IProgressMonitor monitor) {
- return null;
- }
-
- public Object getAdapter(Class adapter) {
- return null;
- }
-
- public Object loadAdapter(Class adapter, IProgressMonitor monitor) {
- return null;
- }
-
- public boolean equals(Object obj) {
- if (!(obj instanceof IModule))
- return false;
-
- IModule m = (IModule) obj;
- if (!getId().equals(m.getId()))
- return false;
-
- return true;
- }
-
- public String toString() {
- return "DeletedModule[" + name + "," + id + "]";
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IClient.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IClient.java
deleted file mode 100644
index 2f9828a62..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IClient.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.wst.server.core.IServer;
-/**
- * A launchable client is a client side application or test
- * harness that can be launched (run) against a resource
- * running on a server.
- *
- * <p>This interface is not intended to be implemented by clients.</p>
- */
-public interface IClient {
- /**
- * Returns the id of this client. Each known client has a distinct id.
- * Ids are intended to be used internally as keys; they are not
- * intended to be shown to end users.
- *
- * @return the client id
- */
- public String getId();
-
- /**
- * Returns the displayable name for this client.
- * <p>
- * Note that this name is appropriate for the current locale.
- * </p>
- *
- * @return a displayable name for this client
- */
- public String getName();
-
- /**
- * Returns the displayable description for this client.
- * <p>
- * Note that this description is appropriate for the current locale.
- * </p>
- *
- * @return a displayable description for this client
- */
- public String getDescription();
-
- /**
- * Returns true if this launchable can be run by this client.
- *
- * @param server the server
- * @param launchable the launchable object
- * @param launchMode the mode
- * @return boolean
- */
- public boolean supports(IServer server, Object launchable, String launchMode);
-
- /**
- * Launches the client.
- *
- * @param server the server
- * @param launchable the launchable object
- * @param launchMode the mode
- * @param launch the launch
- * @return a status object with code <code>IStatus.OK</code> if the launch was
- * successful, otherwise a status object indicating what went wrong
- */
- public IStatus launch(IServer server, Object launchable, String launchMode, ILaunch launch);
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IInstallableRuntime.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IInstallableRuntime.java
deleted file mode 100644
index a71ce23da..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IInstallableRuntime.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-/**
- * Represents an installable runtime.
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- */
-public interface IInstallableRuntime {
- /**
- * Returns the id of this runtime type.
- * Each known server runtime type has a distinct id.
- * Ids are intended to be used internally as keys; they are not
- * intended to be shown to end users.
- *
- * @return the runtime type id
- */
- public String getId();
-
- /**
- * Install this runtime.
- *
- * @param path the path to install the runtime at
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @throws CoreException if an exception occurs while creating this runtime
- * or setting it's default values
- */
- public void install(IPath path, IProgressMonitor monitor) throws CoreException;
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IInstallableServer.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IInstallableServer.java
deleted file mode 100644
index 5180a2976..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IInstallableServer.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-/**
- * Represents an installable server adapter.
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- */
-public interface IInstallableServer {
- /**
- * Returns the id of this runtime type.
- * Each known server runtime type has a distinct id.
- * Ids are intended to be used internally as keys; they are not
- * intended to be shown to end users.
- *
- * @return the runtime type id
- */
- public String getId();
-
- /**
- * Returns the displayable name for this runtime type.
- * <p>
- * Note that this name is appropriate for the current locale.
- * </p>
- *
- * @return a displayable name for this runtime type
- */
- public String getName();
-
- /**
- * Returns the displayable description for this runtime type.
- * <p>
- * Note that this description is appropriate for the current locale.
- * </p>
- *
- * @return a displayable description for this runtime type
- */
- public String getDescription();
-
- /**
- * Returns the displayable vendor name for this runtime type. If the
- * runtime type did not specific a vendor, an empty string is returned.
- * <p>
- * Note that this description is appropriate for the current locale.
- * </p>
- *
- * @return a displayable vendor name for this runtime type
- */
- public String getVendor();
-
- /**
- * Returns the displayable version name for this runtime type. If the
- * runtime type did not specific a vendor, an empty string is returned.
- * <p>
- * Note that this description is appropriate for the current locale.
- * </p>
- *
- * @return a displayable version name for this runtime type
- */
- public String getVersion();
-
- /**
- * Install this server.
- *
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @throws CoreException if an exception occurs while creating this runtime
- * or setting it's default values
- */
- public void install(IProgressMonitor monitor) throws CoreException;
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ILaunchableAdapter.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ILaunchableAdapter.java
deleted file mode 100644
index 0d0e92dab..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ILaunchableAdapter.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.wst.server.core.IModuleArtifact;
-import org.eclipse.wst.server.core.IServer;
-/**
- * This interface, typically implemented by the server
- * code, converts from an IModuleArtifact to an
- * ILaunchable.
- *
- * <p>This interface is not intended to be implemented by clients.</p>
- */
-public interface ILaunchableAdapter {
- /**
- * Returns the id of this adapter. Each known adapter has a distinct id.
- * Ids are intended to be used internally as keys; they are not
- * intended to be shown to end users.
- *
- * @return the adapter id
- */
- public String getId();
-
- /**
- * Returns a launchable object from this module object.
- *
- * @param server the server
- * @param moduleArtifact an artifact in the module
- * @return a launchable object
- * @exception CoreException thrown if there is a problem returning the launchable
- */
- public Object getLaunchable(IServer server, IModuleArtifact moduleArtifact) throws CoreException;
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IMemento.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IMemento.java
deleted file mode 100644
index a082439c3..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IMemento.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import java.util.List;
-/**
- * Interface to a memento used for saving the important state of an object
- * in a form that can be persisted in the file system.
- * <p>
- * Mementos were designed with the following requirements in mind:
- * <ol>
- * <li>Certain objects need to be saved and restored across platform sessions.
- * </li>
- * <li>When an object is restored, an appropriate class for an object might not
- * be available. It must be possible to skip an object in this case.</li>
- * <li>When an object is restored, the appropriate class for the object may be
- * different from the one when the object was originally saved. If so, the
- * new class should still be able to read the old form of the data.</li>
- * </ol>
- * </p>
- * <p>
- * Mementos meet these requirements by providing support for storing a
- * mapping of arbitrary string keys to primitive values, and by allowing
- * mementos to have other mementos as children (arranged into a tree).
- * A robust external storage format based on XML is used.
- * </p><p>
- * The key for an attribute may be any alpha numeric value. However, the
- * value of <code>TAG_ID</code> is reserved for internal use.
- * </p><p>
- * This interface is not intended to be implemented by clients.
- * </p>
- */
-public interface IMemento {
- /**
- * Special reserved key used to store the memento id
- * (value <code>"org.eclipse.ui.id"</code>).
- *
- * @see #getId
- */
- public static final String TAG_ID = "IMemento.internal.id"; //$NON-NLS-1$
-
- /**
- * Creates a new child of this memento with the given type.
- * <p>
- * The <code>getChild</code> and <code>getChildren</code> methods
- * are used to retrieve children of a given type.
- * </p>
- *
- * @param type the type
- * @return a new child memento
- * @see #getChild
- * @see #getChildren
- */
- public IMemento createChild(String type);
-
- /**
- * Creates a new child of this memento with the given type and id.
- * The id is stored in the child memento (using a special reserved
- * key, <code>TAG_ID</code>) and can be retrieved using <code>getId</code>.
- * <p>
- * The <code>getChild</code> and <code>getChildren</code> methods
- * are used to retrieve children of a given type.
- * </p>
- *
- * @param type the type
- * @param id the child id
- * @return a new child memento with the given type and id
- * @see #getId
- */
- public IMemento createChild(String type, String id);
-
- /**
- * Returns the first child with the given type id.
- *
- * @param type the type id
- * @return the first child with the given type
- */
- public IMemento getChild(String type);
-
- /**
- * Returns all children with the given type id.
- *
- * @param type the type id
- * @return the list of children with the given type
- */
- public IMemento[] getChildren(String type);
-
- /**
- * Returns the floating point value of the given key.
- *
- * @param key the key
- * @return the value, or <code>null</code> if the key was not found or was found
- * but was not a floating point number
- */
- public Float getFloat(String key);
-
- /**
- * Returns the id for this memento.
- *
- * @return the memento id, or <code>null</code> if none
- * @see #createChild(java.lang.String,java.lang.String)
- */
- public String getId();
-
- /**
- * Returns the name for this memento.
- *
- * @return the memento name, or <code>null</code> if none
- * @see #createChild(java.lang.String,java.lang.String)
- */
- public String getName();
-
- /**
- * Returns the integer value of the given key.
- *
- * @param key the key
- * @return the value, or <code>null</code> if the key was not found or was found
- * but was not an integer
- */
- public Integer getInteger(String key);
-
- /**
- * Returns the string value of the given key.
- *
- * @param key the key
- * @return the value, or <code>null</code> if the key was not found or was found
- * but was not an integer
- */
- public String getString(String key);
-
- /**
- * Returns the boolean value of the given key.
- *
- * @param key the key
- * @return the value, or <code>null</code> if the key was not found or was found
- * but was not a boolean
- */
- public Boolean getBoolean(String key);
-
- public List getNames();
-
- /**
- * Sets the value of the given key to the given floating point number.
- *
- * @param key the key
- * @param value the value
- */
- public void putFloat(String key, float value);
-
- /**
- * Sets the value of the given key to the given integer.
- *
- * @param key the key
- * @param value the value
- */
- public void putInteger(String key, int value);
-
- /**
- * Sets the value of the given key to the given boolean value.
- *
- * @param key the key
- * @param value the value
- */
- public void putBoolean(String key, boolean value);
-
- /**
- * Copy the attributes and children from <code>memento</code>
- * to the receiver.
- *
- * @param memento the IMemento to be copied.
- */
- public void putMemento(IMemento memento);
-
- /**
- * Sets the value of the given key to the given string.
- *
- * @param key the key
- * @param value the value
- */
- public void putString(String key, String value);
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IModuleListener.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IModuleListener.java
deleted file mode 100644
index ad0329240..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IModuleListener.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.internal;
-/**
- *
- */
-public interface IModuleListener {
- /**
- * A module has been changed as specified in the event.
- *
- * @param event org.eclipse.wst.server.core.model.ModuleEvent
- */
- public void moduleChanged(ModuleEvent event);
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IModuleResourceDeltaVisitor.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IModuleResourceDeltaVisitor.java
deleted file mode 100644
index 45e73252b..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IModuleResourceDeltaVisitor.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.wst.server.core.model.IModuleResourceDelta;
-/**
- * An objects that visits module resource deltas.
- * <p>
- * Usage:
- * <pre>
- * class Visitor implements IModuleResourceDeltaVisitor {
- * public boolean visit(IModuleResourceDelta delta) {
- * switch (delta.getKind()) {
- * case IModuleResourceDelta.ADDED :
- * // handle added resource
- * break;
- * case IModuleResourceDelta.REMOVED :
- * // handle removed resource
- * break;
- * case IModuleResourceDelta.CHANGED :
- * // handle changed resource
- * break;
- * }
- * return true;
- * }
- * }
- * IModuleResourceDelta rootDelta = ...;
- * rootDelta.accept(new Visitor());
- * </pre>
- * </p>
- * <p>
- * Clients may implement this interface.
- * </p>
- *
- * [issue: @see IModuleResourceDelta#accept(IModuleResourceVisitor)]
- */
-public interface IModuleResourceDeltaVisitor {
- /**
- * Visits the given module resource delta.
- *
- * @param delta the resource delta
- * @return <code>true</code> if the resource delta's children should
- * be visited; <code>false</code> if they should be skipped.
- * @throws CoreException if the visit fails for some reason.
- */
- public boolean visit(IModuleResourceDelta delta) throws CoreException;
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IModuleVisitor.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IModuleVisitor.java
deleted file mode 100644
index 00e362b77..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IModuleVisitor.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import org.eclipse.wst.server.core.IModule;
-/**
- * A visitor on a server's modules.
- */
-public interface IModuleVisitor {
- /**
- * Visit a single module. Returns true to keep visiting, and
- * false if it should stop visiting the module.
- *
- * @param module a module on the server
- * @return boolean <code>true</code> to visit the next module, or
- * <code>false</code> to stop visiting
- */
- public boolean visit(IModule[] module);
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IMonitoredServerPort.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IMonitoredServerPort.java
deleted file mode 100644
index 69ae23b79..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IMonitoredServerPort.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.ServerPort;
-
-/**
- * An monitored port on a server.
- *
- * <p>This interface is not intended to be implemented by clients.</p>
- */
-public interface IMonitoredServerPort {
- /**
- * Returns the server that it being monitored.
- *
- * @return org.eclipse.wst.server.core.IServer
- */
- public IServer getServer();
-
- /**
- * Returns the server port.
- *
- * @return org.eclipse.wst.server.model.IServerPort
- */
- public ServerPort getServerPort();
-
- /**
- * Return the port that is being used to monitor.
- *
- * @return int
- */
- public int getMonitorPort();
-
- /**
- * Returns the content types that are being monitored, or null for all content.
- *
- * @return java.lang.String[]
- */
- public String[] getContentTypes();
-
- /**
- * Returns true if the monitor is currently running/active.
- *
- * @return boolean
- */
- public boolean isStarted();
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IOrdered.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IOrdered.java
deleted file mode 100644
index e0f30076e..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IOrdered.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.internal;
-/**
- * An object that has an absolute ordering, and can be ordered against other objects.
- *
- * <p>
- * [issue: It is notoriously difficult to place any kind of
- * useful order on objects that are contributed independently by
- * non-collaborating parties. The IOrdered mechanism is weak, and
- * can't really solve the problem. Issues of presentation are usually
- * best left to the UI, which can sort objects based on arbitrary
- * properties.]
- * </p>
- *
- * <p>This interface is not intended to be implemented by clients.</p>
- */
-public interface IOrdered {
- /**
- * Returns the order (index/priority).
- *
- * @return int
- */
- public int getOrder();
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IPublishListener.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IPublishListener.java
deleted file mode 100644
index d67e3958f..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IPublishListener.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.wst.server.core.IServer;
-/**
- * A publish listener is used to listen for publishing events from a server.
- * The events are typically received in the following order:
- *
- * publishStarted() - The publish operation is starting
- * publishModuleStarted() - This section is fired for each module in the server
- * publishModuleFinished() - This module is finished publishing
- * publishModuleStarted() - The next module is publishing
- * ...
- * publishFinished() - The publish operation is finished
- * <p>
- * Publish listeners are added to a server via IServer.addPublishListener().
- * </p>
- * @see IServer
- */
-public interface IPublishListener {
- /**
- * Fired to notify that publishing has begun.
- *
- * @param server
- */
- public void publishStarted(IServer server);
-
- /**
- * Publishing has finished. Returns the overall status.
- *
- * @param server
- * @param status
- */
- public void publishFinished(IServer server, IStatus status);
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IPublishTask.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IPublishTask.java
deleted file mode 100644
index 50915e3cf..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IPublishTask.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import java.util.List;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.model.PublishOperation;
-/**
- * A task for a server.
- *
- * <p>This interface is not intended to be implemented by clients.</p>
- */
-public interface IPublishTask {
- /**
- * Returns the id of the adapter.
- *
- * @return java.lang.String
- */
- public String getId();
-
- /**
- * Returns true if the given type (given by the id) can use this task. This
- * result is based on the result of the getTypeIds() method.
- *
- * @param id a server type id
- * @return boolean
- */
- public boolean supportsType(String id);
-
- /**
- * Lets the task know that it is about to be used. This method should
- * be used to clean out any previously cached information, or start to
- * create a new cache.
- *
- * @param server the server
- * @param modules a list containing IModule arrays
- * @return a possibly empty array of optional tasks
- */
- public PublishOperation[] getTasks(IServer server, List modules);
-
- /**
- * Returns the tasks that should be performed during publishing.
- *
- * @param server the server
- * @param modules a list containing IModule arrays
- * @param kind one of the IServer.PUBLISH_XX constants
- * @param kindList one of the IServer publish change constants
- * @return the tasks that should be performed on the server
- */
- public PublishOperation[] getTasks(IServer server, int kind, List modules, List kindList);
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IRuntimeLocator.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IRuntimeLocator.java
deleted file mode 100644
index d5bf9ecba..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IRuntimeLocator.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
-/**
- * A runtime locator provides the ability to locate or search for additional
- * runtimes of a particular type.
- * <p>
- * Runtime locators are found via ServerCore.getRuntimeLocators().
- * </p>
- *
- * <p>This interface is not intended to be implemented by clients.</p>
- */
-public interface IRuntimeLocator {
- /**
- * A callback listener interface.
- */
- public interface IRuntimeSearchListener {
- /**
- * Called when a new runtime is found by the locator.
- * The runtime must never be null.
- *
- * @param runtime the runtime that was found.
- */
- public void runtimeFound(IRuntimeWorkingCopy runtime);
- }
-
- /**
- * Returns the id of this runtime locator.
- * Each known runtime locator has a distinct id.
- * Ids are intended to be used internally as keys; they are not
- * intended to be shown to end users.
- *
- * @return the runtime locator id
- */
- public String getId();
-
- /**
- * Returns true if the runtime locator can find runtimes of the given type.
- * The id should never be null.
- *
- * @param runtimeTypeId the id of a runtime type
- * @return boolean
- */
- public boolean supportsType(String runtimeTypeId);
-
- /**
- * Searches for local runtimes.
- * It uses the callback listener to report runtimes that are found.
- * The path contains the absolute path of the folder to search in,
- * or <code>null</code> to search the entire machine.
- *
- * @param path the path to search for runtimes in
- * @param listener a listener to report status to
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @throws CoreException
- */
- public void searchForRuntimes(IPath path, IRuntimeSearchListener listener, IProgressMonitor monitor) throws CoreException;
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IServerLocator.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IServerLocator.java
deleted file mode 100644
index 242cafb97..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IServerLocator.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-/**
- * A server locator provides the ability to locate or search for additional
- * servers of a particular type, on a particular host.
- * <p>
- * Server locators are found via ServerCore.getServerLocators().
- * </p>
- *
- * <p>This interface is not intended to be implemented by clients.</p>
- */
-public interface IServerLocator {
- /**
- * A callback listener interface.
- */
- public interface IServerSearchListener {
- /**
- * Called when a new server is found by the locator.
- * The server must never be null.
- *
- * @param server the runtime that was found.
- */
- public void serverFound(IServerWorkingCopy server);
- }
-
- /**
- * Returns the id of this server locator.
- * Each known server locator has a distinct id.
- * Ids are intended to be used internally as keys; they are not
- * intended to be shown to end users.
- *
- * @return the server locator id
- */
- public String getId();
-
- /**
- * Returns true if the server locator can find servers of the given type.
- * The id should never be null.
- *
- * @param serverTypeId the id of a server type
- * @return boolean
- */
- public boolean supportsType(String serverTypeId);
-
- /**
- * Returns <code>true</code> if this type of server can run on a remote host.
- * Returns <code>false</code> if the server type can only be run on "localhost"
- * (the local machine).
- *
- * @return <code>true</code> if this type of server can run on
- * a remote host, and <code>false</code> if it cannot
- */
- public boolean supportsRemoteHosts();
-
- /**
- * Searches for servers.
- * It uses the callback listener to report servers that are found.
- *
- * @param host a host string conforming to RFC 2732
- * @param listener a listener to report status to
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @throws CoreException
- */
- public void searchForServers(String host, IServerSearchListener listener, IProgressMonitor monitor) throws CoreException;
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IServerMonitor.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IServerMonitor.java
deleted file mode 100644
index 780d186b0..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IServerMonitor.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.internal;
-/**
- * An interface to a TCP/IP monitor.
- *
- * <p>This interface is not intended to be implemented by clients.</p>
- */
-public interface IServerMonitor {
- /**
- * Returns the id of the monitor.
- *
- * @return java.lang.String
- */
- public String getId();
-
- /**
- * Returns the label (name) of this monitor.
- *
- * @return java.lang.String
- */
- public String getName();
-
- /**
- * Returns the description of this monitor.
- *
- * @return java.lang.String
- */
- public String getDescription();
-
- /**
- * Start monitoring the given port, and return the port number to
- * tunnel requests through. The monitorPort is the new port to use, or
- * -1 to pick a random port.
- *
- * @param port
- * @return
- */
- //public int startMonitoring(IServer server, ServerPort port, int monitorPort) throws CoreException;
-
- /**
- * Stop monitoring the given port.
- *
- * @param port
- */
- //public void stopMonitoring(IServer server, ServerPort port);
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IServerMonitorManager.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IServerMonitorManager.java
deleted file mode 100644
index 7d1faf750..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IServerMonitorManager.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.ServerPort;
-/**
- *
- * <p>This interface is not intended to be implemented by clients.</p>
- */
-public interface IServerMonitorManager {
- /**
- * Returns the array of ports that are currently being monitored.
- *
- * @param server a server
- * @return an array containing the monitored ports for this server
- */
- public IMonitoredServerPort[] getMonitoredPorts(IServer server);
-
- /**
- * Starts monitoring the given port, and returns the new port # to use that will
- * route to the monitored port.
- *
- * @param server
- * @param port
- * @param monitorPort - the new port number to use for monitoring, or -1 to pick a new port
- * @param content
- * @return monitor port number
- */
- public IMonitoredServerPort createMonitor(IServer server, ServerPort port, int monitorPort, String[] content);
-
- /**
- * Stop monitoring the given port. Throws a CoreException if there was a problem
- * stopping the monitoring
- *
- * @param msp the monitored port
- */
- public void removeMonitor(IMonitoredServerPort msp);
-
- /**
- * Start the monitor. If the msp port is -1, it will be updated to the port that is actually in use.
- *
- * @param msp the monitored port
- * @throws CoreException
- */
- public void startMonitor(IMonitoredServerPort msp) throws CoreException;
-
- /**
- * Stop monitoring.
- *
- * @param msp the monitored port
- */
- public void stopMonitor(IMonitoredServerPort msp);
-
- /**
- * Returns the monitored port to use when making requests to the given server, port number,
- * and content. Returns the existing port number if the port is not being monitored.
- *
- * @param server
- * @param port
- * @param contentType
- * @return the monitored port number
- */
- public int getMonitoredPort(IServer server, int port, String contentType);
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IStartup.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IStartup.java
deleted file mode 100644
index f8df3267f..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/IStartup.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core.internal;
-/**
- * An interface for the startup extension point.
- * Plug-ins that register a startup extension will be activated when the server
- * core plug-in initializes and have an opportunity to run code that can't be
- * implemented using the normal contribution mechanisms.
- */
-public interface IStartup {
- /**
- * Will be called on server core startup.
- */
- public void startup();
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/InstallableRuntime.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/InstallableRuntime.java
deleted file mode 100644
index 2c18430ac..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/InstallableRuntime.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import java.io.BufferedInputStream;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.update.standalone.InstallCommand;
-import org.osgi.framework.Bundle;
-/**
- *
- */
-public class InstallableRuntime implements IInstallableRuntime {
- private IConfigurationElement element;
-
- public InstallableRuntime(IConfigurationElement element) {
- super();
- this.element = element;
- }
-
- /**
- *
- * @return the id
- */
- public String getId() {
- try {
- return element.getAttribute("id");
- } catch (Exception e) {
- return null;
- }
- }
-
- public String getFeatureVersion() {
- try {
- return element.getAttribute("featureVersion");
- } catch (Exception e) {
- // ignore
- }
- return null;
- }
-
- public String getFeatureId() {
- try {
- return element.getAttribute("featureId");
- } catch (Exception e) {
- // ignore
- }
- return null;
- }
-
- public String getBundleId() {
- try {
- return element.getAttribute("bundleId");
- } catch (Exception e) {
- // ignore
- }
- return null;
- }
-
- public String getPath() {
- try {
- return element.getAttribute("path");
- } catch (Exception e) {
- // ignore
- }
- return null;
- }
-
- public String getFromSite() {
- try {
- return element.getAttribute("featureSite");
- } catch (Exception e) {
- // ignore
- }
- return null;
- }
-
- /*
- * @see IInstallableServer#install(IProgressMonitor)
- */
- public void install(IPath path, IProgressMonitor monitor) throws CoreException {
- String featureId = getFeatureId();
- String featureVersion = getFeatureVersion();
- String fromSite = getFromSite();
-
- if (featureId == null || featureVersion == null || fromSite == null)
- return;
-
- // download and install plugins
- Bundle bundle = Platform.getBundle(getBundleId());
- if (bundle == null) {
- try {
- monitor.setTaskName("Installing feature");
- InstallCommand command = new InstallCommand(featureId, featureVersion, fromSite, null, "false");
- command.run(monitor);
- command.applyChangesNow();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error installing feature", e);
- return;
- }
- }
-
- // unzip from bundle into path
- try {
- byte[] buf = new byte[8192];
- bundle = Platform.getBundle(getBundleId());
- URL url = bundle.getEntry(getPath());
- url = Platform.resolve(url);
- InputStream in = url.openStream();
- BufferedInputStream bin = new BufferedInputStream(in);
- ZipInputStream zin = new ZipInputStream(bin);
- ZipEntry entry = zin.getNextEntry();
- while (entry != null) {
- String name = entry.getName();
- monitor.setTaskName("Unzipping: " + name);
-
- if (entry.isDirectory()) {
- path.append(name).toFile().mkdirs();
- } else {
- FileOutputStream fout = new FileOutputStream(path.append(name).toFile());
- int r = zin.read(buf);
- while (r >= 0) {
- fout.write(buf, 0, r);
- r = zin.read(buf);
- }
- }
- zin.closeEntry();
- entry = zin.getNextEntry();
- }
- zin.close();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error installing feature", e);
- }
- }
-
- public String toString() {
- return "InstallableRuntime[" + getId() + "]";
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/InstallableServer.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/InstallableServer.java
deleted file mode 100644
index 69f2b4775..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/InstallableServer.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.update.standalone.InstallCommand;
-/**
- *
- */
-public class InstallableServer implements IInstallableServer {
- private IConfigurationElement element;
-
- public InstallableServer(IConfigurationElement element) {
- super();
- this.element = element;
- }
-
- /**
- *
- * @return the id
- */
- public String getId() {
- try {
- return element.getAttribute("id");
- } catch (Exception e) {
- return null;
- }
- }
-
- /**
- *
- * @return the name
- */
- public String getName() {
- try {
- return element.getAttribute("name");
- } catch (Exception e) {
- return null;
- }
- }
-
- /**
- *
- * @return the description
- */
- public String getDescription() {
- try {
- return element.getAttribute("description");
- } catch (Exception e) {
- return null;
- }
- }
-
- public String getVendor() {
- try {
- String vendor = element.getAttribute("vendor");
- if (vendor != null)
- return vendor;
- } catch (Exception e) {
- // ignore
- }
- return Messages.defaultVendor;
- }
-
- public String getVersion() {
- try {
- String version = element.getAttribute("version");
- if (version != null)
- return version;
- } catch (Exception e) {
- // ignore
- }
- return Messages.defaultVersion;
- }
-
- public String getFeatureVersion() {
- try {
- return element.getAttribute("featureVersion");
- } catch (Exception e) {
- // ignore
- }
- return null;
- }
-
- public String getFeatureId() {
- try {
- return element.getAttribute("featureId");
- } catch (Exception e) {
- // ignore
- }
- return null;
- }
-
- public String getFromSite() {
- try {
- return element.getAttribute("featureSite");
- } catch (Exception e) {
- // ignore
- }
- return null;
- }
-
- /*
- * @see IInstallableServer#install(IProgressMonitor)
- */
- public void install(IProgressMonitor monitor) throws CoreException {
- String featureId = getFeatureId();
- String featureVersion = getFeatureVersion();
- String fromSite = getFromSite();
-
- if (featureId == null || featureVersion == null || fromSite == null)
- return;
-
- try {
- InstallCommand command = new InstallCommand(featureId, featureVersion, fromSite, null, "false");
- command.run(monitor);
- command.applyChangesNow();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error installing feature", e);
- }
- }
-
- public String toString() {
- return "InstallableServer[" + getId() + ", " + getName() + "]";
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/LaunchableAdapter.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/LaunchableAdapter.java
deleted file mode 100644
index 87e4e5687..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/LaunchableAdapter.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-
-import org.eclipse.wst.server.core.IModuleArtifact;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.model.*;
-/**
- *
- */
-public class LaunchableAdapter implements ILaunchableAdapter {
- private IConfigurationElement element;
- private LaunchableAdapterDelegate delegate;
-
- /**
- * LaunchableAdapter constructor comment.
- *
- * @param element a configuration element
- */
- public LaunchableAdapter(IConfigurationElement element) {
- super();
- this.element = element;
- }
-
- /**
- * Returns the id of this LaunchableAdapter.
- *
- * @return java.lang.String
- */
- public String getId() {
- return element.getAttribute("id");
- }
-
- public LaunchableAdapterDelegate getDelegate() {
- if (delegate == null) {
- try {
- delegate = (LaunchableAdapterDelegate) element.createExecutableExtension("class");
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, "Could not create delegate" + toString() + ": " + t.getMessage());
- }
- }
- return delegate;
- }
-
- /**
- * @see ILaunchableAdapter#getLaunchable(IServer, IModuleArtifact)
- */
- public Object getLaunchable(IServer server, IModuleArtifact object) {
- try {
- return getDelegate().getLaunchable(server, object);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate " + toString() + ": " + e.getMessage());
- return null;
- }
- }
-
- /**
- * Return a string representation of this object.
- *
- * @return java.lang.String
- */
- public String toString() {
- return "LaunchableAdapter[" + getId() + "]";
- }
-}
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Messages.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Messages.java
deleted file mode 100644
index 7329ec272..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Messages.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import org.eclipse.osgi.util.NLS;
-/**
- * Translated messages.
- */
-public class Messages extends NLS {
- public static String publishing;
- public static String errorRuntimeName;
- public static String errorDuplicateRuntimeName;
- public static String errorSaving;
- public static String errorLoading;
- public static String errorCannotAddModule;
- public static String defaultVendor;
- public static String defaultVersion;
- public static String savingTask;
- public static String taskPerforming;
- public static String deletingTask;
- public static String defaultServerProjectName;
- public static String defaultRuntimeName;
- public static String defaultRuntimeName2;
- public static String defaultServerName;
- public static String defaultServerName2;
- public static String defaultServerName3;
- public static String defaultServerName4;
- public static String taskModifyModules;
- public static String errorWorkingCopyTimestamp;
- public static String errorPublishStarting;
- public static String errorPublishNoRuntime;
- public static String errorPublishNoConfiguration;
- public static String errorNoConfiguration;
- public static String canPublishOk;
- public static String publishingStatusOk;
- public static String publishingStatusInfo;
- public static String publishingStatusWarning;
- public static String publishingStatusError;
- public static String errorPublishing;
- public static String publishingStop;
- public static String publishingModule;
- public static String publishedModule;
- public static String errorStartTimeout;
- public static String errorStartFailed;
- public static String errorModuleRestartFailed;
- public static String canRestartModuleOk;
- public static String errorRestartModule;
- public static String canStartErrorState;
- public static String errorLaunchMode;
- public static String canStartOk;
- public static String canRestartOk;
- public static String errorRestartNotStarted;
- public static String errorStopAlreadyStopped;
- public static String canStopOk;
- public static String moduleTypeUnknown;
- public static String jobStartingServer;
- public static String jobRestartingServer;
- public static String jobUpdateServer;
-
- static {
- NLS.initializeMessages(ServerPlugin.PLUGIN_ID + ".internal.Messages", Messages.class);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Messages.properties b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Messages.properties
deleted file mode 100644
index 90cd03a00..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Messages.properties
+++ /dev/null
@@ -1,75 +0,0 @@
-###############################################################################
-# Copyright (c) 2004, 2005 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-# --------------- Tasks (progress monitors) ---------------
-savingTask=Saving {0}
-deletingTask=Deleting {0}
-
-taskPerforming=Performing Tasks
-taskModifyModules=Adding and/or removing projects.
-
-publishing=Publishing to {0}...
-publishingStatusOk=Publishing finished successfully
-publishingStatusInfo=Publishing completed with information
-publishingStatusWarning=Publishing completed with a warning
-publishingStatusError=Publishing failed
-publishingStop=Disconnecting from server
-
-publishingModule=Publishing: {0}
-publishedModule={0} published successfully
-
-jobStartingServer=Starting server - {0}
-jobRestartingServer=Restarting server - {0}
-jobUpdateServer=Updating status for {0}...
-
-# --------------- Misc UI ---------------
-
-# Error Messages
-errorPublishing=Could not publish to the server.
-errorNoConfiguration=The server has no configuration.
-errorLoading=Error loading from {0}.
-errorSaving=Could not save to {0}.
-errorModuleRestartFailed=Could not restart the module.
-errorWorkingCopyTimestamp=Could not save because the file has been modified since the start of editting.
-errorRuntimeName=Enter a name for the runtime.
-errorDuplicateRuntimeName=Name is already in use.
-errorStartTimeout=Timeout waiting for {0} to start. Server did not start after {1}s.
-errorStartFailed=Server {0} failed to start.
-errorCannotAddModule=The server does not support version {1} of the {0} specification.
-
-# Default server creation names
-# {0} will be replaced by a number if the given name is already being used
-defaultServerProjectName=Servers{0}
-defaultRuntimeName={0}
-defaultRuntimeName2={0} ({1})
-defaultServerName={0} @ {1}
-defaultServerName2={0} @ {1} ({2})
-defaultServerName3={0}
-defaultServerName4={0} ({1})
-
-# Used when a name can't be found
-defaultVendor=Basic
-defaultVersion=Basic
-moduleTypeUnknown=Unknown module
-
-canStartOk=The server can be started.
-canStopOk=The server can be stopped.
-canRestartOk=The server can be restarted.
-canPublishOk=The server can be published to.
-canRestartModuleOk=The module can be restarted.
-canStartErrorState=The server cannot be started because it is current starting or stopping.
-errorLaunchMode=The server does not support the given launch mode.
-errorRestartNotStarted=Cannot restart the server because it is not currently running.
-errorPublishStarting=Cannot publish to the server because it is currently starting or stopping.
-errorPublishNoRuntime=Cannot publish to the server because it is missing its runtime.
-errorPublishNoConfiguration=Cannot publish to the server because the configuration is missing.
-errorStopAlreadyStopped=The server cannot be stopped because it is already stopped.
-errorRestartModule=The module cannot be restarted.
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Module.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Module.java
deleted file mode 100644
index c6ff2c2a8..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Module.java
+++ /dev/null
@@ -1,225 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.core.model.ModuleDelegate;
-/**
- *
- */
-public class Module implements IModule {
- protected String id;
- protected String name;
- protected ModuleFactory factory;
- protected String type;
- protected String version;
- protected IProject project;
- protected ModuleDelegate delegate;
-
- /**
- * Module constructor.
- *
- * @param factory
- * @param id
- * @param name
- * @param type
- * @param version
- * @param project
- */
- public Module(ModuleFactory factory, String id, String name, String type, String version, IProject project) {
- super();
- this.factory = factory;
- this.project = project;
- this.type = type;
- this.version = version;
- this.id = id;
- this.name = name;
- }
-
- /**
- * Returns the id of this module.
- *
- * @return java.lang.String
- */
- public String getId() {
- return factory.getId() + ":" + id;
- }
-
- /**
- * Returns the internal (partial) id of this module.
- *
- * @return the id
- */
- public String getInternalId() {
- return id;
- }
-
- /**
- * Returns the type of this module.
- *
- * @return the module type
- */
- public IModuleType getModuleType() {
- return new ModuleType(type, version);
- }
-
- /**
- * Returns the workbench project that this module is contained in,
- * or null if the module is outside of the workspace.
- *
- * @return the project that the module is contained in
- */
- public IProject getProject() {
- return project;
- }
-
- /*
- * @see IModule#getName()
- */
- public String getName() {
- return name;
- }
-
- protected ModuleDelegate getDelegate(IProgressMonitor monitor) {
- if (delegate != null)
- return delegate;
-
- synchronized (this) {
- if (delegate == null) {
- try {
- long time = System.currentTimeMillis();
- delegate = factory.getDelegate(monitor).getModuleDelegate(this);
- delegate.initialize(this);
- Trace.trace(Trace.PERFORMANCE, "Module.getDelegate(): <" + (System.currentTimeMillis() - time) + " " + factory.getId());
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, "Could not create delegate " + toString(), t);
- }
- }
- }
- return delegate;
- }
-
- /**
- * Returns the child modules of this module.
- *
- * @param monitor a progress monitor
- * @return a possibly empty array of modules
- */
- public IModule[] getChildModules(IProgressMonitor monitor) {
- try {
- return getDelegate(monitor).getChildModules();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate getChildModules() " + toString(), e);
- return null;
- }
- }
-
- /**
- * Validates this module.
- * <p>
- * [issue: Conjecture: Each different type of module prescribes
- * legal arrangements of, and the significance of, the files within
- * it. This would be spelled out in the spec for the particular
- * module types.
- * This validate operation is suppose to check the actual
- * arrangement of files in this module to see whether they
- * meet expectations.
- * It's an open question as to how "strenuous" a check this
- * is.]
- * </p>
- * <p>
- * [issue: Old comment said: "If there is an error
- * that should block the server from starting (e.g. major errors)
- * it should be returned from this method. This method can also be used to
- * return warning for such things as an open (and dirty) editor."]
- * </p>
- * <p>
- * [issue: All existing implementations of this return null,
- * which is illegal.]
- * </p>
- * <p>
- * [issue: Old comment said: "Returns an IStatus that is used to determine if this object can
- * be published to the server." Since the same module can
- * be associated with any number of servers, "the server" is
- * ill-defined.]
- * </p>
- * <p>
- * [issue: Old comment said: "Should return an error if there
- * is a major problem with the resources, or can be used to
- * return warnings on unsaved files, etc." It is usually
- * difficult in principle for core-level infrastructure to
- * detect whether there are open editors with unsaved changes.]
- * </p>
- *
- * @param monitor a progress monitor, or <code>null</code> if no
- * progress reporting is required
- * @return a status object with code <code>IStatus.OK</code> if the given
- * module is valid, otherwise a status object indicating what is
- * wrong with it
- */
- public IStatus validate(IProgressMonitor monitor) {
- try {
- return getDelegate(monitor).validate();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate validate() " + toString(), e);
- return null;
- }
- }
-
- /**
- * @see IModule#getAdapter(Class)
- */
- public Object getAdapter(Class adapter) {
- if (delegate != null) {
- if (adapter.isInstance(delegate))
- return delegate;
- }
- return Platform.getAdapterManager().getAdapter(this, adapter);
- }
-
- /**
- * @see IModule#loadAdapter(Class, IProgressMonitor)
- */
- public Object loadAdapter(Class adapter, IProgressMonitor monitor) {
- getDelegate(monitor);
- if (adapter.isInstance(delegate))
- return delegate;
- return Platform.getAdapterManager().loadAdapter(this, adapter.getName());
- }
-
- public boolean equals(Object obj) {
- if (!(obj instanceof IModule))
- return false;
-
- IModule m = (IModule) obj;
- if (!getId().equals(m.getId()))
- return false;
- //if (!project.equals(m.getProject()))
- // return false;
- //if (!getModuleType().equals(m.getModuleType()))
- // return false;
-
- return true;
- }
-
- /**
- * Return a string representation of this object.
- *
- * @return java.lang.String
- */
- public String toString() {
- return "Module[" + name + "," + getId() + "]";
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleArtifactAdapter.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleArtifactAdapter.java
deleted file mode 100644
index dcc4d921a..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleArtifactAdapter.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import org.eclipse.core.expressions.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.wst.server.core.IModuleArtifact;
-import org.eclipse.wst.server.core.model.ModuleArtifactAdapterDelegate;
-import org.osgi.framework.Bundle;
-/**
- *
- */
-public class ModuleArtifactAdapter {
- private IConfigurationElement element;
- private Expression fContextualLaunchExpr = null;
- private ModuleArtifactAdapterDelegate delegate;
-
- /**
- * ModuleArtifactAdapter constructor comment.
- *
- * @param element a configuration element
- */
- public ModuleArtifactAdapter(IConfigurationElement element) {
- super();
- this.element = element;
- }
-
- /**
- * Returns the id of this ModuleArtifactAdapter.
- *
- * @return java.lang.String
- */
- public String getId() {
- return element.getAttribute("id");
- }
-
- /**
- * Returns the relative priority of this adapter.
- *
- * @return a priority
- */
- public int getPriority() {
- try {
- return Integer.parseInt(element.getAttribute("priority"));
- } catch (Exception e) {
- return 0;
- }
- }
-
- /**
- * Returns true if the plugin that loaded this class has been loaded.
- *
- * @return boolean
- */
- public boolean isPluginActivated() {
- String pluginId = element.getDeclaringExtension().getNamespace();
- return Platform.getBundle(pluginId).getState() == Bundle.ACTIVE;
- }
-
- /**
- * Returns an expression that represents the enablement logic for the
- * contextual launch element of this launch shortcut description or
- * <code>null</code> if none.
- * @return an evaluatable expression or <code>null</code>
- * @throws CoreException if the configuration element can't be
- * converted. Reasons include: (a) no handler is available to
- * cope with a certain configuration element or (b) the XML
- * expression tree is malformed.
- */
- public Expression getContextualLaunchEnablementExpression() throws CoreException {
- if (fContextualLaunchExpr == null) {
- IConfigurationElement[] elements = element.getChildren(ExpressionTagNames.ENABLEMENT);
- IConfigurationElement enablement = elements.length > 0 ? elements[0] : null;
-
- if (enablement != null)
- fContextualLaunchExpr = ExpressionConverter.getDefault().perform(enablement);
- }
- return fContextualLaunchExpr;
- }
-
- /**
- * Evaluate the given expression within the given context and return
- * the result. Returns <code>true</code> iff result is either TRUE or NOT_LOADED.
- * This allows optimistic inclusion of shortcuts before plugins are loaded.
- * Returns <code>false</code> if exp is <code>null</code>.
- *
- * @param exp the enablement expression to evaluate or <code>null</code>
- * @param context the context of the evaluation. Usually, the
- * user's selection.
- * @return the result of evaluating the expression
- * @throws CoreException
- */
- protected boolean evalEnablementExpression(IEvaluationContext context, Expression exp) throws CoreException {
- return (exp != null) ? ((exp.evaluate(context)) != EvaluationResult.FALSE) : false;
- }
-
- /**
- * @return an Evaluation context with default variable = selection
- */
- /*protected IEvaluationContext createContext(Object obj) {
- List list = null;
- IWorkbenchWindow window = DebugUIPlugin.getActiveWorkbenchWindow();
- if (window != null) {
- IWorkbenchPage page = window.getActivePage();
- if (page != null) {
- IWorkbenchPart activePart = page.getActivePart();
- if (activePart instanceof IEditorPart) {
- list = new ArrayList();
- list.add(((IEditorPart)activePart).getEditorInput());
- } else if (activePart != null) {
- IWorkbenchPartSite site = activePart.getSite();
- if (site != null) {
- ISelectionProvider selectionProvider = site.getSelectionProvider();
- if (selectionProvider != null) {
- ISelection selection = selectionProvider.getSelection();
- if (selection instanceof IStructuredSelection) {
- list = ((IStructuredSelection)selection).toList();
- }
- }
- }
- }
- }
- }
- // create a default evaluation context with default variable
- // of the user selection or editor input
- if (list == null) {
- list = Collections.EMPTY_LIST;
- }
- IEvaluationContext context = new EvaluationContext(null, list);
- context.addVariable("selection", list); //$NON-NLS-1$
-
- return context;
- }*/
-
- /**
- * Returns true if enabled for the given object.
- *
- * @param obj an object
- * @return <code>true</code> if enabled
- * @throws CoreException if anything goes wrong
- */
- public boolean isEnabled(Object obj) throws CoreException {
- IEvaluationContext context = new EvaluationContext(null, obj);
- context.addVariable("selection", obj);
- return evalEnablementExpression(context, getContextualLaunchEnablementExpression());
- }
-
- public ModuleArtifactAdapterDelegate getDelegate() {
- if (delegate == null) {
- try {
- delegate = (ModuleArtifactAdapterDelegate) element.createExecutableExtension("class");
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, "Could not create delegate" + toString() + ": " + t.getMessage());
- }
- }
- return delegate;
- }
-
- public boolean isDelegateLoaded() {
- return (delegate != null);
- }
-
- /**
- * Returns the module artifact.
- *
- * @param obj an object
- * @return the module artifact, or <code>null</code>
- */
- public IModuleArtifact getModuleArtifact(Object obj) {
- try {
- return getDelegate().getModuleArtifact(obj);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate " + toString() + ": " + e.getMessage());
- return null;
- }
- }
-
- /**
- * Return a string representation of this object.
- *
- * @return java.lang.String
- */
- public String toString() {
- return "ModuleArtifactAdapter[" + getId() + "]";
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleEvent.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleEvent.java
deleted file mode 100644
index 3a0e86911..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleEvent.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.wst.server.core.IModule;
-/**
- * An event fired when a module changes.
- */
-public class ModuleEvent {
- private IModule module;
- private boolean isChanged;
- private IModule[] added;
- private IModule[] changed;
- private IModule[] removed;
-
- class IModuleArtifact {
- IPath path;
- long timestamp;
- }
-
- /**
- * Create a new module event.
- *
- * @param module the module that has been changed
- * @param isChanged true if the module has changed
- * @param added added child modules
- * @param changed changed child modules
- * @param removed removed child modules
- */
- public ModuleEvent(IModule module, boolean isChanged, IModule[] added, IModule[] changed, IModule[] removed) {
- this.module = module;
- this.isChanged = isChanged;
- this.added = added;
- this.changed = changed;
- this.removed = removed;
- }
-
- /**
- * Returns the module that has been changed.
- *
- * @return the module
- */
- public IModule getModule() {
- return module;
- }
-
- /**
- * Returns true if this module's settings have changed.
- *
- * @return <code>true</code> if the contents have changed
- */
- public boolean isChanged() {
- return isChanged;
- }
-
- /**
- * Returns any child modules that have been added.
- *
- * @return the added child modules, or null if no modules have been added
- */
- public IModule[] getAddedChildModules() {
- return added;
- }
-
- /**
- * Returns any child modules that have been changed.
- *
- * @return the changed child modules, or null if no modules have been changed
- */
- public IModule[] getChangedChildModules() {
- return changed;
- }
-
- /**
- * Returns any child modules that have been removed.
- *
- * @return the removed child modules, or null if no modules have been removed
- */
- public IModule[] getRemovedChildModules() {
- return removed;
- }
-
- /**
- * Returns the module artifacts that have changed.
- *
- * @return the changed module artifacts
- */
- public IModuleArtifact[] getChangedArtifacts() {
- return null;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleFactory.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleFactory.java
deleted file mode 100644
index 32fcd704d..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleFactory.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IModuleType;
-import org.eclipse.wst.server.core.model.InternalInitializer;
-import org.eclipse.wst.server.core.model.ModuleFactoryDelegate;
-/**
- *
- */
-public class ModuleFactory implements IOrdered {
- private IConfigurationElement element;
- private ModuleFactoryDelegate delegate;
- private List moduleTypes;
-
- private List modules;
-
- /**
- * ModuleFactory constructor comment.
- *
- * @param element a configuration element
- */
- public ModuleFactory(IConfigurationElement element) {
- super();
- this.element = element;
- }
-
- /**
- * Returns the id of this factory.
- *
- * @return java.lang.String
- */
- public String getId() {
- return element.getAttribute("id");
- }
-
- /**
- * Returns the index (ordering) of this task.
- *
- * @return int
- */
- public int getOrder() {
- try {
- return Integer.parseInt(element.getAttribute("order"));
- } catch (NumberFormatException e) {
- return -1;
- }
- }
-
- /**
- * Return the supported module types.
- *
- * @return an array of module types
- */
- public IModuleType[] getModuleTypes() {
- if (moduleTypes == null)
- moduleTypes = ServerPlugin.getModuleTypes(element.getChildren("moduleType"));
-
- IModuleType[] mt = new IModuleType[moduleTypes.size()];
- moduleTypes.toArray(mt);
- return mt;
- }
-
- /**
- * Returns true if this modules factory produces project modules.
- *
- * @return boolean
- */
- public boolean isProjectModuleFactory() {
- return "true".equalsIgnoreCase(element.getAttribute("projects"));
- }
-
- /*
- * @see IModuleFactoryDelegate#getDelegate()
- */
- public ModuleFactoryDelegate getDelegate(IProgressMonitor monitor) {
- if (delegate == null) {
- try {
- delegate = (ModuleFactoryDelegate) element.createExecutableExtension("class");
- //delegate.initialize(this);
- InternalInitializer.initializeModuleFactoryDelegate(delegate, this, monitor);
- //ResourceManager.getInstance().addModuleFactoryListener(delegate);
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, "Could not create delegate " + toString() + ": " + t.getMessage());
- }
- }
- return delegate;
- }
-
- /*
- * @see
- */
- public IModule getModule(String id) {
- IModule[] modules2 = getModules();
- if (modules2 != null) {
- int size = modules2.length;
- for (int i = 0; i < size; i++) {
- Module module = (Module) modules2[i];
- if (id.equals(module.getInternalId()))
- return module;
- }
- }
- return null;
- }
-
- public void clearModuleCache() {
- modules = null;
- }
-
- /*
- * @see
- */
- public IModule[] getModules() {
- //Trace.trace(Trace.FINER, "getModules() > " + this);
- //modules = null;
- if (modules == null) {
- try {
- modules = new ArrayList();
- IModule[] modules2 = getDelegate(null).getModules();
- if (modules2 != null) {
- int size = modules2.length;
- for (int i = 0; i < size; i++)
- modules.add(modules2[i]);
- }
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, "Error calling delegate " + toString() + ": " + t.getMessage());
- return null;
- }
- }
-
- //Trace.trace(Trace.FINER, "getModules() < " + this);
-
- IModule[] m = new IModule[modules.size()];
- modules.toArray(m);
- return m;
- }
-
- /**
- * Return a string representation of this object.
- *
- * @return java.lang.String
- */
- public String toString() {
- return "ModuleFactory[" + getId() + "]";
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleFactoryEvent.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleFactoryEvent.java
deleted file mode 100644
index 2aaf57765..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleFactoryEvent.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import org.eclipse.wst.server.core.IModule;
-/**
- * An event fired when a module factory changes.
- */
-public class ModuleFactoryEvent {
- protected IModule[] added;
- protected IModule[] removed;
-
- /**
- * Create a new event.
- *
- * @param added added modules
- * @param removed removed modules
- */
- public ModuleFactoryEvent(IModule[] added, IModule[] removed) {
- this.added = added;
- this.removed = removed;
- }
-
- /**
- * Returns any modules that have been added.
- *
- * @return org.eclipse.wst.server.core.model.IModule[]
- */
- public IModule[] getAddedModules() {
- return added;
- }
-
- /**
- * Returns any modules that have been removed.
- *
- * @return org.eclipse.wst.server.core.model.IModule[]
- */
- public IModule[] getRemovedModules() {
- return removed;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleFile.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleFile.java
deleted file mode 100644
index bcf6b841d..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleFile.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.wst.server.core.model.IModuleFile;
-/**
- *
- */
-public class ModuleFile implements IModuleFile {
- protected IFile file;
- protected String name;
- protected IPath path;
- protected long stamp;
-
- public ModuleFile(IFile file, String name, IPath path, long stamp) {
- this.file = file;
- this.name = name;
- this.path = path;
- this.stamp = stamp;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.core.model.IModuleFile#getModificationStamp()
- */
- public long getModificationStamp() {
- return stamp;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.core.model.IModuleResource#getModuleRelativePath()
- */
- public IPath getModuleRelativePath() {
- return path;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.core.model.IModuleResource#getName()
- */
- public String getName() {
- return name;
- }
-
- public boolean equals(Object obj) {
- if (!(obj instanceof ModuleFile))
- return false;
-
- ModuleFile mf = (ModuleFile) obj;
- if (!name.equals(mf.name))
- return false;
- if (!path.equals(mf.path))
- return false;
- return true;
- }
-
- public Object getAdapter(Class cl) {
- if (IFile.class.equals(cl))
- return file;
- return null;
- }
-
- public String toString() {
- return "ModuleFile [" + name + ", " + path + ", " + stamp + "]";
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleFolder.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleFolder.java
deleted file mode 100644
index aa6e703bd..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleFolder.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.wst.server.core.model.IModuleFolder;
-import org.eclipse.wst.server.core.model.IModuleResource;
-/**
- *
- */
-public class ModuleFolder implements IModuleFolder {
- protected IContainer container;
- protected String name;
- protected IPath path;
- protected IModuleResource[] members;
-
- public ModuleFolder(IContainer container, String name, IPath path) {
- this.container = container;
- this.name = name;
- this.path = path;
- }
-
- public void setMembers(IModuleResource[] members) {
- this.members = members;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.core.model.IModuleResource#getModuleRelativePath()
- */
- public IPath getModuleRelativePath() {
- return path;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.core.model.IModuleResource#getName()
- */
- public String getName() {
- return name;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.core.model.IModuleFolder#members()
- */
- public IModuleResource[] members() {
- return members;
- }
-
- public boolean equals(Object obj) {
- if (!(obj instanceof ModuleFolder))
- return false;
-
- ModuleFolder mf = (ModuleFolder) obj;
- if (!name.equals(mf.name))
- return false;
- if (!path.equals(mf.path))
- return false;
- return true;
- }
-
- public Object getAdapter(Class cl) {
- if (IContainer.class.equals(cl) || IFolder.class.equals(cl))
- return container;
- return null;
- }
-
- public String toString() {
- return "ModuleFolder [" + name + ", " + path + "]";
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleKind.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleKind.java
deleted file mode 100644
index 7bd8184c8..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleKind.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-/**
- *
- */
-public class ModuleKind {
- protected String id;
- protected String name;
-
- public ModuleKind(IConfigurationElement ce) {
- super();
- this.id = ce.getAttribute("id");
- this.name = ce.getAttribute("name");
- }
-
- public ModuleKind(String id, String name) {
- super();
- this.id = id;
- this.name = name;
- }
-
- public String getId() {
- return id;
- }
-
- public String getName() {
- return name;
- }
-
- public String toString() {
- return "ModuleType[" + id + ", " + name + "]";
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleProperties.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleProperties.java
deleted file mode 100644
index 555563506..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleProperties.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.core.runtime.*;
-
-import org.eclipse.wst.server.core.*;
-/**
- * Helper class that stores preference information for the server tools.
- */
-public class ModuleProperties {
- private static final String MODULE_DATA_FILE = "modules.xml";
-
- protected static ModuleProperties instance;
- protected Map modules;
-
- /**
- * ModuleProperties constructor.
- */
- protected ModuleProperties() {
- super();
- load();
- instance = this;
- }
-
- /**
- * Return a static instance.
- *
- * @return a static instance
- */
- public static ModuleProperties getInstance() {
- if (instance == null)
- new ModuleProperties();
- return instance;
- }
-
- /**
- * Load the data.
- */
- private void load() {
- Trace.trace(Trace.FINEST, "Loading module info");
- String filename = ServerPlugin.getInstance().getStateLocation().append(MODULE_DATA_FILE).toOSString();
- modules = new HashMap();
-
- try {
- IMemento memento = XMLMemento.loadMemento(filename);
-
- IMemento[] children = memento.getChildren("module");
- int size = children.length;
-
- for (int i = 0; i < size; i++) {
- String moduleId = children[i].getString("moduleId");
- String serverId = children[i].getString("serverId");
- modules.put(moduleId, serverId);
- }
- } catch (Exception e) {
- Trace.trace(Trace.WARNING, "Could not load servers: " + e.getMessage());
- }
- }
-
- private void save(IProgressMonitor monitor) throws CoreException {
- String filename = ServerPlugin.getInstance().getStateLocation().append(MODULE_DATA_FILE).toOSString();
-
- try {
- XMLMemento memento = XMLMemento.createWriteRoot("modules");
-
- Iterator iterator = modules.keySet().iterator();
- while (iterator.hasNext()) {
- String moduleId = (String) iterator.next();
- String serverId = (String) modules.get(moduleId);
-
- IMemento child = memento.createChild("module");
- child.putString("moduleId", moduleId);
- child.putString("serverId", serverId);
- }
-
- memento.saveToFile(filename);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not save servers", e);
- }
- }
-
- /*
- * @see ServerCore#getDefaultServer(IModule)
- */
- public IServer getDefaultServer(IModule module) {
- if (module == null)
- throw new IllegalArgumentException();
-
- String serverId = (String) modules.get(module.getId());
- if (serverId == null || serverId.length() == 0)
- return null;
-
- return ServerCore.findServer(serverId);
- }
-
- /*
- * @see ServerCore#setDefaultServer(IModule, IServer, IProgressMonitor)
- */
- public void setDefaultServer(IModule module, IServer server, IProgressMonitor monitor) throws CoreException {
- if (module == null)
- throw new IllegalArgumentException();
-
- String newServerId = null;
- if (server != null)
- newServerId = server.getId();
-
- String serverId = (String) modules.get(module.getId());
- if (serverId == null && newServerId == null)
- return;
- if (serverId != null && serverId.equals(newServerId))
- return;
-
- modules.put(module.getId(), newServerId);
- save(monitor);
- }
-
- public String toString() {
- return "ModuleProperties[]";
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModulePublishInfo.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModulePublishInfo.java
deleted file mode 100644
index 2a7e720de..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModulePublishInfo.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import java.util.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.wst.server.core.model.IModuleFile;
-import org.eclipse.wst.server.core.model.IModuleFolder;
-import org.eclipse.wst.server.core.model.IModuleResource;
-/**
- * Publish information for a specific module on a specific server.
- */
-public class ModulePublishInfo {
- private static final String MODULE_ID = "module-ids";
- private static final String NAME = "name";
- private static final String PATH = "path";
- private static final String STAMP = "stamp";
- private static final String FILE = "file";
- private static final String FOLDER = "folder";
-
- private String moduleId;
- private String name;
- private IModuleResource[] resources = new IModuleResource[0];
-
- /**
- * ModulePublishInfo constructor.
- *
- * @param moduleId a module id
- * @param name the module's name
- */
- public ModulePublishInfo(String moduleId, String name) {
- super();
-
- this.moduleId = moduleId;
- this.name = name;
- }
-
- /**
- * ModulePublishInfo constructor.
- *
- * @param memento a memento
- */
- public ModulePublishInfo(IMemento memento) {
- super();
-
- load(memento);
- }
-
- public String getModuleId() {
- return moduleId;
- }
-
- public String getName() {
- return name;
- }
-
- public IModuleResource[] getResources() {
- return resources;
- }
-
- public void setResources(IModuleResource[] res) {
- resources = res;
- }
-
- /**
- *
- */
- protected void load(IMemento memento) {
- Trace.trace(Trace.FINEST, "Loading module publish info for: " + memento);
-
- try {
- moduleId = memento.getString(MODULE_ID);
- name = memento.getString(NAME);
-
- resources = loadResource(memento);
- } catch (Exception e) {
- Trace.trace(Trace.WARNING, "Could not load module publish info information: " + e.getMessage());
- }
- }
-
- protected IModuleResource[] loadResource(IMemento memento) {
- if (memento == null)
- return new IModuleResource[0];
-
- List list = new ArrayList(5);
- IMemento[] children = memento.getChildren(FILE);
- if (children != null) {
- int size = children.length;
- for (int i = 0; i < size; i++) {
- String name2 = children[i].getString(NAME);
- IPath path = new Path(children[i].getString(PATH));
- long stamp = Long.parseLong(children[i].getString(STAMP));
- ModuleFile file = new ModuleFile(null, name2, path, stamp);
- list.add(file);
- }
- }
- children = memento.getChildren(FOLDER);
- if (children != null) {
- int size = children.length;
- for (int i = 0; i < size; i++) {
- String name2 = children[i].getString(NAME);
- IPath path = new Path(children[i].getString(PATH));
- ModuleFolder folder = new ModuleFolder(null, name2, path);
- folder.setMembers(loadResource(children[i]));
- list.add(folder);
- }
- }
-
- IModuleResource[] resources2 = new IModuleResource[list.size()];
- list.toArray(resources2);
- return resources;
- }
-
- /**
- *
- */
- protected void save(IMemento memento) {
- try {
- memento.putString(MODULE_ID, moduleId);
- if (name != null)
- memento.putString(NAME, name);
-
- saveResource(memento, resources);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not save module publish info", e);
- }
- }
-
- protected void saveResource(IMemento memento, IModuleResource[] resources2) {
- if (resources2 == null)
- return;
- int size = resources2.length;
- for (int i = 0; i < size; i++) {
- if (resources2[i] instanceof IModuleFile) {
- IModuleFile file = (IModuleFile) resources2[i];
- IMemento child = memento.createChild(FILE);
- child.putString(NAME, file.getName());
- child.putString(PATH, file.getModuleRelativePath().toPortableString());
- child.putString(STAMP, "" + file.getModificationStamp());
- } else {
- IModuleFolder folder = (IModuleFolder) resources2[i];
- IMemento child = memento.createChild(FOLDER);
- child.putString(NAME, folder.getName());
- child.putString(PATH, folder.getModuleRelativePath().toPortableString());
- IModuleResource[] resources3 = folder.members();
- saveResource(child, resources3);
- }
- }
- }
-
- public String toString() {
- return "ModulePublishInfo [" + moduleId + "]";
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleResourceDelta.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleResourceDelta.java
deleted file mode 100644
index 8479c780c..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleResourceDelta.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.wst.server.core.model.IModuleResource;
-import org.eclipse.wst.server.core.model.IModuleResourceDelta;
-/**
- *
- */
-public class ModuleResourceDelta implements IModuleResourceDelta {
- protected IModuleResource resource;
- protected int kind;
-
- protected IModuleResourceDelta[] children;
-
- public ModuleResourceDelta(IModuleResource resource, int kind) {
- this.resource = resource;
- this.kind = kind;
- }
-
- public void setChildren(IModuleResourceDelta[] children) {
- this.children = children;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.core.model.IModuleResource#getModuleRelativePath()
- */
- public IPath getModuleRelativePath() {
- return resource.getModuleRelativePath();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.core.model.IModuleResourceDelta#getModuleResource()
- */
- public IModuleResource getModuleResource() {
- return resource;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.core.model.IModuleResourceDelta#getKind()
- */
- public int getKind() {
- return kind;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.core.model.IModuleResourceDelta#getAffectedChildren()
- */
- public IModuleResourceDelta[] getAffectedChildren() {
- return children;
- }
-
- public String toString() {
- return "ModuleResourceDelta [" + resource + ", " + kind + "]";
- }
-
- public void trace(String indent) {
- System.out.println(indent + toString());
- if (children != null) {
- int size = children.length;
- for (int i = 0; i < size; i++) {
- ((ModuleResourceDelta)children[i]).trace(indent + " ");
- }
- }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleType.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleType.java
deleted file mode 100644
index c3f02817e..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ModuleType.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.wst.server.core.IModuleType;
-/**
- *
- */
-public class ModuleType implements IModuleType {
- protected String id;
- protected String version;
-
- // cached copy of all module types
- private static List moduleTypes;
-
- public ModuleType(String id, String version) {
- super();
- this.id = id;
- this.version = version;
- }
-
- public String getId() {
- return id;
- }
-
- public String getName() {
- ModuleKind mt = findModuleType(id);
- if (mt != null)
- return mt.getName();
- return Messages.moduleTypeUnknown;
- }
-
- public String getVersion() {
- return version;
- }
-
- /**
- * Returns an array of all known module types.
- * <p>
- * A new array is returned on each call, so clients may store or modify the result.
- * </p>
- *
- * @return the array of module types {@link IModuleType}
- */
- /*public static IModuleType[] getModuleTypes() {
- if (moduleTypes == null)
- loadModuleTypes();
-
- IModuleType[] mt = new IModuleType[moduleTypes.size()];
- moduleTypes.toArray(mt);
- return mt;
- }*/
-
- /**
- * Returns the module type with the given id, or <code>null</code>
- * if none. This convenience method searches the list of known
- * module types for the one a matching
- * module type id ({@link ModuleType#getId()}). The id may not be null.
- *
- * @param id the module type id
- * @return the module type, or <code>null</code> if there is no module type
- * with the given id
- */
- public static ModuleKind findModuleType(String id) {
- if (id == null)
- throw new IllegalArgumentException();
-
- if (moduleTypes == null)
- loadModuleTypes();
-
- Iterator iterator = moduleTypes.iterator();
- while (iterator.hasNext()) {
- ModuleKind moduleType = (ModuleKind) iterator.next();
- if (id.equals(moduleType.getId()))
- return moduleType;
- }
- return null;
- }
-
- /**
- * Load the module types.
- */
- private static synchronized void loadModuleTypes() {
- if (moduleTypes != null)
- return;
- Trace.trace(Trace.EXTENSION_POINT, "->- Loading .moduleTypes extension point ->-");
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IConfigurationElement[] cf = registry.getConfigurationElementsFor(ServerPlugin.PLUGIN_ID, "moduleTypes");
-
- int size = cf.length;
- moduleTypes = new ArrayList(size);
- for (int i = 0; i < size; i++) {
- try {
- ModuleKind moduleType = new ModuleKind(cf[i]);
- moduleTypes.add(moduleType);
- Trace.trace(Trace.EXTENSION_POINT, " Loaded moduleType: " + cf[i].getAttribute("id"));
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, " Could not load moduleType: " + cf[i].getAttribute("id"), t);
- }
- }
-
- Trace.trace(Trace.EXTENSION_POINT, "-<- Done loading .moduleTypes extension point -<-");
- }
-
- public String toString() {
- return "ModuleType[" + id + ", " + version + "]";
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ProgressUtil.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ProgressUtil.java
deleted file mode 100644
index 5210d1a8a..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ProgressUtil.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.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 a progress monitor
- * @param ticks the number of ticks
- * @param style a style
- * @return a progress monitor
- */
- 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.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ProjectProperties.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ProjectProperties.java
deleted file mode 100644
index ff00fd191..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ProjectProperties.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import java.io.InputStream;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-
-import org.eclipse.wst.server.core.*;
-/**
- * Helper class that stores preference information for the server tools.
- *
- * TODO: Currently this class always reads from disk. It should cache the file
- * and have a resource listener.
- */
-public class ProjectProperties implements IProjectProperties {
- private static final String PROJECT_PREFERENCE_FILE = ".runtime";
-
- protected IProject project;
-
- protected String runtimeId;
- protected boolean serverProject = false;
-
- /**
- * ProjectProperties constructor.
- *
- * @param project a project
- */
- public ProjectProperties(IProject project) {
- super();
- this.project = project;
- }
-
- /**
- * Load the preferences.
- */
- private void loadPreferences() {
- Trace.trace(Trace.FINEST, "Loading project preferences: " + project);
-
- InputStream in = null;
- try {
- IPath path = project.getWorkingLocation(ServerPlugin.PLUGIN_ID).append(PROJECT_PREFERENCE_FILE);
-
- IMemento memento = XMLMemento.loadMemento(path.toOSString());
-
- if (memento == null)
- return;
-
- runtimeId = memento.getString("runtime-id");
- String s = memento.getString("servers");
- if (s != null && "true".equals(s))
- serverProject = true;
- else
- serverProject = false;
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not load preferences: " + e.getMessage());
- } finally {
- try {
- if (in != null)
- in.close();
- } catch (Exception e) {
- // ignore
- }
- }
- }
-
- private void savePreferences(IProgressMonitor monitor) throws CoreException {
- if (project.exists() && project.isOpen()) {
-
- IPath path = project.getWorkingLocation(ServerPlugin.PLUGIN_ID).append(PROJECT_PREFERENCE_FILE);
-
- InputStream in = null;
- try {
- XMLMemento memento = XMLMemento.createWriteRoot("runtime");
-
- if (runtimeId != null)
- memento.putString("runtime-id", runtimeId);
- if (serverProject)
- memento.putString("servers", "true");
- else
- memento.putString("servers", "false");
- in = memento.getInputStream();
-
- memento.saveToFile(path.toOSString());
- } catch (Exception e) {
- throw new CoreException(new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, "", e));
- } finally {
- try {
- in.close();
- } catch (Exception e) {
- // ignore
- }
- }
- return;
- }
- }
-
- protected String getRuntimeTargetId() {
- loadPreferences();
- return runtimeId;
- }
-
- protected void setRuntimeTargetId(String newRuntimeId, IProgressMonitor monitor) throws CoreException {
- loadPreferences();
- runtimeId = newRuntimeId;
- savePreferences(monitor);
- }
-
- /**
- * Returns the current runtime target type for the given project.
- *
- * @return the runtime target
- */
- public IRuntime getRuntimeTarget() {
- loadPreferences();
- if (runtimeId == null)
- return null;
- return ServerCore.findRuntime(runtimeId);
- }
-
- /**
- * Sets the runtime target for the project.
- *
- * @param runtime the target runtime
- * @param monitor a progress monitor
- * @throws CoreException if anything goes wrong
- */
- public void setRuntimeTarget(IRuntime runtime, IProgressMonitor monitor) throws CoreException {
- loadPreferences();
- IRuntime oldRuntime = null;
- if (runtimeId != null)
- oldRuntime = ServerCore.findRuntime(runtimeId);
- setRuntimeTarget(oldRuntime, runtime, true, monitor);
- }
-
- protected void setRuntimeTarget(IRuntime oldRuntime, IRuntime newRuntime, boolean save, IProgressMonitor monitor) throws CoreException {
- Trace.trace(Trace.RUNTIME_TARGET, "setRuntimeTarget : " + oldRuntime + " -> " + newRuntime);
-
- if (oldRuntime == null && newRuntime == null)
- return;
- if (oldRuntime != null && oldRuntime.equals(newRuntime))
- return;
-
- IRuntimeTargetHandler[] handlers = ServerCore.getRuntimeTargetHandlers();
- if (handlers == null)
- return;
-
- int size = handlers.length;
- // remove old target
- if (oldRuntime != null) {
- IRuntimeType runtimeType = oldRuntime.getRuntimeType();
- for (int i = 0; i < size; i++) {
- IRuntimeTargetHandler handler = handlers[i];
- long time = System.currentTimeMillis();
- boolean supports = handler.supportsRuntimeType(runtimeType);
- Trace.trace(Trace.RUNTIME_TARGET, " < " + handler + " " + supports);
- if (supports)
- ((RuntimeTargetHandler)handler).removeRuntimeTarget(project, oldRuntime, monitor);
- Trace.trace(Trace.PERFORMANCE, "Runtime target: <" + (System.currentTimeMillis() - time) + "> " + handler.getId());
- }
- }
-
- // add new target
- if (newRuntime != null) {
- runtimeId = newRuntime.getId();
- if (save)
- savePreferences(monitor);
- IRuntimeType runtimeType = newRuntime.getRuntimeType();
- for (int i = 0; i < size; i++) {
- IRuntimeTargetHandler handler = handlers[i];
- long time = System.currentTimeMillis();
- boolean supports = handler.supportsRuntimeType(runtimeType);
- Trace.trace(Trace.RUNTIME_TARGET, " > " + handler + " " + supports);
- if (supports)
- ((RuntimeTargetHandler)handler).setRuntimeTarget(project, newRuntime, monitor);
- Trace.trace(Trace.PERFORMANCE, "Runtime target: <" + (System.currentTimeMillis() - time) + "> " + handler.getId());
- }
- } else {
- runtimeId = null;
- if (save)
- savePreferences(monitor);
- }
-
- Trace.trace(Trace.RUNTIME_TARGET, "setRuntimeTarget <");
- }
-
- /**
- * Returns <code>true</code> if this project can contain server artifacts, and
- * <code>false</code> otherwise.
- *
- * @return <code>true</code> if this project can contain server artifacts, and
- * <code>false</code> otherwise
- */
- public boolean isServerProject() {
- loadPreferences();
- return serverProject;
- }
-
- /**
- * Sets whether the project can contain server resources.
- *
- * @param b <code>true</code> to allow the project to contain server
- * resources, or <code>false</code> to not allow the project to contain
- * servers
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @throws CoreException if there is a problem setting the server project
- */
- public void setServerProject(boolean b, IProgressMonitor monitor) throws CoreException {
- loadPreferences();
- serverProject = b;
- savePreferences(monitor);
- }
-
- public String toString() {
- return "ProjectProperties[" + project + ", " + runtimeId + "]";
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/PublishAdapter.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/PublishAdapter.java
deleted file mode 100644
index 25e72a0bd..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/PublishAdapter.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.wst.server.core.IServer;
-/**
- * Helper class which implements the IPublishListener interface
- * with empty methods.
- *
- * @see org.eclipse.wst.server.core.internal.IPublishListener
- */
-public class PublishAdapter implements IPublishListener {
- public void publishStarted(IServer server) {
- // do nothing
- }
-
- public void publishFinished(IServer server, IStatus status) {
- // do nothing
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/PublishInfo.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/PublishInfo.java
deleted file mode 100644
index 2f3a01a2c..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/PublishInfo.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import java.util.*;
-import java.io.File;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.wst.server.core.IServer;
-/**
- * Helper to obtain and store the global publish information.
- * (what files were published and when) Delegates to PublishState
- * for all server specific publishing information.
- */
-public class PublishInfo {
- protected static PublishInfo instance;
-
- protected static final String PUBLISH_DIR = "publish";
-
- // map of server ids to Strings of filename containing publish data
- protected Map serverIdToPath;
-
- // map of loaded serverIds to publish info
- protected Map serverIdToPublishInfo;
-
- /**
- * PublishInfo constructor comment.
- */
- private PublishInfo() {
- super();
-
- serverIdToPath = new HashMap();
- serverIdToPublishInfo = new HashMap();
- load();
- }
-
- /**
- * Return the publish info.
- *
- * @return org.eclipse.wst.server.core.internal.PublishInfo
- */
- public static PublishInfo getInstance() {
- if (instance == null)
- instance = new PublishInfo();
- return instance;
- }
-
- /**
- * Return the publish state.
- *
- * @return org.eclipse.wst.server.core.internal.PublishState
- * @param server org.eclipse.wst.server.core.IServer
- */
- public ServerPublishInfo getServerPublishInfo(IServer server) {
- // have we tried loading yet?
- String serverId = server.getId();
- if (serverIdToPath.containsKey(serverId)) {
- if (!serverIdToPublishInfo.containsKey(serverId)) {
- String partialPath = (String) serverIdToPath.get(serverId);
- IPath path = ServerPlugin.getInstance().getStateLocation().append(PUBLISH_DIR).append(partialPath);
- ServerPublishInfo spi = new ServerPublishInfo(path);
- serverIdToPublishInfo.put(serverId, spi);
- return spi;
- }
- // already loaded
- return (ServerPublishInfo) serverIdToPublishInfo.get(serverId);
- }
-
- // first time server is being used
- IPath path = ServerPlugin.getInstance().getStateLocation().append(PUBLISH_DIR);
- File file = new File(path.toOSString());
- if (!file.exists())
- file.mkdir();
-
- file = null;
- int i = 0;
- String partialPath = null;
- while (file == null || file.exists()) {
- partialPath = "publish" + i + ".xml";
- path = ServerPlugin.getInstance().getStateLocation().append(PUBLISH_DIR).append(partialPath);
- if (serverIdToPath.get(partialPath) == null)
- file = new File(path.toOSString());
- i++;
- }
-
- ServerPublishInfo spi = new ServerPublishInfo(path);
- serverIdToPath.put(serverId, partialPath);
- serverIdToPublishInfo.put(serverId, spi);
- save();
- return spi;
- }
-
- /**
- *
- */
- protected void load() {
- Trace.trace(Trace.FINEST, "Loading publish info");
- String filename = ServerPlugin.getInstance().getStateLocation().append("publish.xml").toOSString();
-
- try {
- IMemento memento = XMLMemento.loadMemento(filename);
-
- IMemento[] serverChild = memento.getChildren("server");
- int size = serverChild.length;
- serverIdToPath = new HashMap(size + 2);
-
- for (int i = 0; i < size; i++) {
- String id = serverChild[i].getString("id");
- String partialPath = serverChild[i].getString("path");
- serverIdToPath.put(id, partialPath);
- }
- } catch (Exception e) {
- Trace.trace(Trace.WARNING, "Could not load global publish info: " + e.getMessage());
- }
- }
-
- /**
- *
- */
- protected void save() {
- String filename = ServerPlugin.getInstance().getStateLocation().append("publish.xml").toOSString();
-
- try {
- XMLMemento memento = XMLMemento.createWriteRoot("publish-info");
-
- Iterator iterator = serverIdToPath.keySet().iterator();
- while (iterator.hasNext()) {
- String serverId = (String) iterator.next();
- String partialPath = (String) serverIdToPath.get(serverId);
-
- IMemento server = memento.createChild("server");
- server.putString("id", serverId);
- server.putString("path", partialPath);
- }
-
- memento.saveToFile(filename);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not save global publish info", e);
- }
- }
-
- protected void save(IServer server) {
- ServerPublishInfo spi = getServerPublishInfo(server);
- spi.save();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/PublishServerJob.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/PublishServerJob.java
deleted file mode 100644
index c2fd9c724..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/PublishServerJob.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import org.eclipse.core.resources.IResourceRuleFactory;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.core.runtime.jobs.MultiRule;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.server.core.IServer;
-/**
- * Job to publish to a particular server.
- */
-public class PublishServerJob extends ChainedJob {
- protected int kind;
- protected boolean check;
-
- /**
- * Create a new publishing job.
- *
- * @param server the server to publish to
- * @param kind the kind of publish
- * @param check
- */
- public PublishServerJob(IServer server, int kind, boolean check) {
- super(NLS.bind(Messages.publishing, server.getName()), server);
- this.kind = kind;
- this.check = check;
-
- IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace().getRuleFactory();
-
- // 102227 - lock entire workspace during publish
- // TODO will have to revisit post 0.7 to determine if there is a better way to
- // do this, since it would be preferrable not to lock the entire workspace, and
- // therefore allow multiple servers to publish at once
-
- // find all projects that modules are in
- /*List projectList = new ArrayList();
- Iterator iterator = ((Server)server).getAllModules().iterator();
- while (iterator.hasNext()) {
- IModule[] modules = (IModule[]) iterator.next();
- IProject project = modules[modules.length - 1].getProject();
- if (project != null && !projectList.contains(project))
- projectList.add(project);
- }
-
- // add dependant projects
- iterator = projectList.iterator();
- List depProjectList = new ArrayList(); // use to avoid concurrent modification
- while (iterator.hasNext()) {
- IProject project = (IProject) iterator.next();
- try {
- IProject[] refs = project.getDescription().getReferencedProjects();
- if (refs != null) {
- int size = refs.length;
- for (int i = 0; i < size; i++)
- if (refs[i] != null && !projectList.contains(refs[i]) && !depProjectList.contains(refs[i]))
- depProjectList.add(refs[i]);
- }
- } catch (CoreException ce) {
- Trace.trace(Trace.WARNING, "Could not compute referenced projects", ce);
- }
- }
-
- iterator = depProjectList.iterator();
- while (iterator.hasNext()) {
- projectList.add(iterator.next());
- }
-
- // combine and build all the rules
- List list = new ArrayList();
- iterator = projectList.iterator();
- while (iterator.hasNext()) {
- IProject project = (IProject) iterator.next();
- ISchedulingRule rule = ruleFactory.createRule(project);
- if (rule != null && !list.contains(rule))
- list.add(rule);
-
- rule = ruleFactory.modifyRule(project);
- if (rule != null && !list.contains(rule))
- list.add(rule);
-
- rule = ruleFactory.validateEditRule(new IResource[] { project });
- if (rule != null && !list.contains(rule))
- list.add(rule);
-
- rule = ruleFactory.markerRule(project);
- if (rule != null && !list.contains(rule))
- list.add(rule);
-
- rule = ruleFactory.refreshRule(project);
- if (rule != null && !list.contains(rule))
- list.add(rule);
- }
-
- int size = list.size();
- ISchedulingRule[] rules = new ISchedulingRule[size + 1];
- for (int i = 0; i < size; i++)
- rules[i] = (ISchedulingRule) list.get(i);
-
- rules[size] = new ServerSchedulingRule(server);*/
-
- ISchedulingRule[] rules = new ISchedulingRule[2];
- rules[0] = ruleFactory.createRule(ResourcesPlugin.getWorkspace().getRoot());
- rules[1] = new ServerSchedulingRule(server);
-
- setRule(MultiRule.combine(rules));
- }
-
- /**
- * Create a new publishing job.
- *
- * @param server the server to publish to
- */
- public PublishServerJob(IServer server) {
- this(server, IServer.PUBLISH_INCREMENTAL, true);
- }
-
- /**
- * @see org.eclipse.core.runtime.jobs.Job#shouldRun()
- */
- public boolean shouldRun() {
- if (!super.shouldRun())
- return false;
-
- if (!check)
- return true;
- return ServerPreferences.getInstance().isAutoPublishing() && ((Server)getServer()).shouldPublish();
- }
-
- /**
- * @see org.eclipse.core.runtime.jobs.Job#run(IProgressMonitor)
- */
- protected IStatus run(IProgressMonitor monitor) {
- return getServer().publish(kind, monitor);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/PublishTask.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/PublishTask.java
deleted file mode 100644
index ec9fbd5af..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/PublishTask.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-
-import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.core.model.*;
-/**
- *
- */
-public class PublishTask implements IPublishTask {
- private IConfigurationElement element;
- private PublishTaskDelegate delegate;
-
- /**
- * PublishTask constructor comment.
- *
- * @param element a configuration element
- */
- public PublishTask(IConfigurationElement element) {
- super();
- this.element = element;
- }
-
- /*
- * @see
- */
- public String getId() {
- return element.getAttribute("id");
- }
-
- /*
- * @see
- */
- protected String[] getTypeIds() {
- try {
- return ServerPlugin.tokenize(element.getAttribute("typeIds"), ",");
- } catch (Exception e) {
- return null;
- }
- }
-
- /*
- * @see
- */
- public boolean supportsType(String id) {
- return ServerPlugin.supportsType(getTypeIds(), id);
- }
-
- /*
- * @see IPublishTask#getDelegate()
- */
- public PublishTaskDelegate getDelegate() {
- if (delegate == null) {
- try {
- delegate = (PublishTaskDelegate) element.createExecutableExtension("class");
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, "Could not create delegate" + toString() + ": " + t.getMessage());
- }
- }
- return delegate;
- }
-
- /*
- * @see
- */
- public PublishOperation[] getTasks(IServer server, List modules) {
- try {
- Trace.trace(Trace.FINEST, "Task.init " + this);
- PublishOperation[] po = getDelegate().getTasks(server, modules);
- if (po != null)
- return po;
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate " + toString() + ": " + e.getMessage());
- }
- return new PublishOperation[0];
- }
-
- /*
- * @see
- */
- public PublishOperation[] getTasks(IServer server, int kind, List modules, List kindList) {
- try {
- Trace.trace(Trace.FINEST, "Task.init " + this);
- PublishOperation[] po = getDelegate().getTasks(server, kind, modules, kindList);
- if (po != null)
- return po;
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate " + toString() + ": " + e.getMessage());
- }
- return new PublishOperation[0];
- }
-
- /**
- * Return a string representation of this object.
- *
- * @return java.lang.String
- */
- public String toString() {
- return "PublishTask[" + getId() + "]";
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ResourceManager.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ResourceManager.java
deleted file mode 100644
index 91686c0ff..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ResourceManager.java
+++ /dev/null
@@ -1,1042 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import java.io.ByteArrayInputStream;
-import java.util.*;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.resources.*;
-
-import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.core.model.ServerDelegate;
-import org.eclipse.wst.server.core.util.ProjectModuleFactoryDelegate;
-/**
- * ResourceManager handles the mappings between resources
- * and servers or server configurations, and creates
- * notification of servers or server configurations
- * being added and removed.
- *
- * <p>Servers and server configurations may be a single
- * resource, or they may be a folder that contains a group
- * of files. Folder-resource may not contain other servers
- * or configurations.</p>
- */
-public class ResourceManager {
- private static final String SERVER_DATA_FILE = "servers.xml";
-
- private static final byte EVENT_ADDED = 0;
- private static final byte EVENT_CHANGED = 1;
- private static final byte EVENT_REMOVED = 2;
-
- private static ResourceManager instance;
-
- // currently active runtimes and servers
- protected List runtimes;
- protected List servers;
- protected IRuntime defaultRuntime;
-
- // lifecycle listeners
- protected transient List runtimeListeners;
- protected transient List serverListeners;
-
- // cache for disposing servers & runtimes
- protected List activeBundles;
-
- // resource change listeners
- private IResourceChangeListener resourceChangeListener;
- private Preferences.IPropertyChangeListener pcl;
- protected boolean ignorePreferenceChanges = false;
-
- /**
- * Server resource change listener.
- *
- * Resource listener - tracks changes on server resources so that
- * we can reload/drop server instances and configurations that
- * may change outside of our control.
- * Listens for two types of changes:
- * 1. Servers or configurations being added or removed
- * from their respective folders. (in the future, including
- * the addition or removal of a full server project, which
- * we currently can't listen for because there is no nature
- * attached to the project at this point - OTI defect)
- * 2. Projects being deleted.
- */
- public class ServerResourceChangeListener implements IResourceChangeListener {
- /**
- * Create a new ServerResourceChangeListener.
- */
- public ServerResourceChangeListener() {
- super();
- }
-
- /**
- * Listen for projects being added or removed and act accordingly.
- *
- * @param event org.eclipse.core.resources.IResourceChangeEvent
- */
- public void resourceChanged(IResourceChangeEvent event) {
- IResourceDelta delta = event.getDelta();
- if (delta == null)
- return;
-
- Trace.trace(Trace.RESOURCES, "->- ServerResourceChangeListener responding to resource change: " + event.getType() + " ->-");
- IResourceDelta[] children = delta.getAffectedChildren();
- if (children != null) {
- int size = children.length;
- for (int i = 0; i < size; i++) {
- IResource resource = children[i].getResource();
- if (resource != null && resource instanceof IProject) {
- projectChanged((IProject) resource, children[i]);
- }
- }
- }
-
- // search for changes to any project using a visitor
- try {
- delta.accept(new IResourceDeltaVisitor() {
- public boolean visit(IResourceDelta visitorDelta) {
- IResource resource = visitorDelta.getResource();
-
- // only respond to project changes
- if (resource != null && resource instanceof IProject) {
- publishHandleProjectChange(visitorDelta);
- return false;
- }
- return true;
- }
- });
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error responding to resource change", e);
- }
-
- Trace.trace(Trace.RESOURCES, "-<- Done ServerResourceChangeListener responding to resource change -<-");
- }
-
- /**
- * React to a change within a possible server project.
- *
- * @param delta org.eclipse.core.resources.IResourceDelta
- */
- protected void projectChanged(IProject project, IResourceDelta delta) {
- if (!((ProjectProperties)ServerCore.getProjectProperties(project)).isServerProject()) {
- Trace.trace(Trace.RESOURCES, "Not a server project: " + project.getName());
- return;
- }
-
- IResourceDelta[] children = delta.getAffectedChildren();
-
- int size = children.length;
- for (int i = 0; i < size; i++) {
- IResourceDelta child = children[i];
-
- // look for servers and server configurations
- try {
- child.accept(new IResourceDeltaVisitor() {
- public boolean visit(IResourceDelta delta2) {
- return handleResourceDelta(delta2);
- }
- });
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error responding to resource change", e);
- }
- }
- }
- }
-
- protected List moduleServerEventHandlers;
- protected List moduleServerEventHandlerIndexes;
-
- /**
- * Cannot directly create a ResourceManager. Use
- * ServersCore.getResourceManager().
- */
- private ResourceManager() {
- super();
- instance = this;
-
- init();
- }
-
- protected void init() {
- servers = new ArrayList();
- activeBundles = new ArrayList();
- loadRuntimesList();
- loadServersList();
-
- pcl = new Preferences.IPropertyChangeListener() {
- public void propertyChange(Preferences.PropertyChangeEvent event) {
- if (ignorePreferenceChanges)
- return;
- String property = event.getProperty();
- if (property.equals("runtimes")) {
- loadRuntimesList();
- saveRuntimesList();
- }
- }
- };
-
- ServerPlugin.getInstance().getPluginPreferences().addPropertyChangeListener(pcl);
-
- resolveServers();
-
- // keep track of future changes to the file system
- resourceChangeListener = new ServerResourceChangeListener();
- ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceChangeListener, IResourceChangeEvent.POST_CHANGE | IResourceChangeEvent.PRE_CLOSE | IResourceChangeEvent.PRE_DELETE);
-
- /*configurationListener = new IServerConfigurationListener() {
- public void childProjectChange(IServerConfiguration configuration) {
- handleConfigurationChildProjectsChange(configuration);
- }
- };*/
-
- Trace.trace(Trace.FINER, "Loading workspace servers and server configurations");
- IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
- if (projects != null) {
- int size = projects.length;
- for (int i = 0; i < size; i++) {
- if (((ProjectProperties)ServerCore.getProjectProperties(projects[i])).isServerProject())
- loadFromProject(projects[i]);
- }
- }
-
- addServerLifecycleListener(ServerListener.getInstance());
- }
-
- /**
- * Load all of the servers and server configurations from the given project.
- */
- protected static void loadFromProject(IProject project) {
- Trace.trace(Trace.FINER, "Initial server resource load for " + project.getName(), null);
- final ResourceManager rm = ResourceManager.getInstance();
-
- try {
- project.accept(new IResourceProxyVisitor() {
- public boolean visit(IResourceProxy proxy) {
- if (proxy.getType() == IResource.FILE &&
- Server.FILE_EXTENSION.equals(getFileExtension(proxy.getName()))) {
- IFile file = (IFile) proxy.requestResource();
- try {
- rm.handleNewFile(file, null);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error during initial server resource load", e);
- }
- return false;
- }
- return true;
- }
- }, 0);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not load server project " + project.getName(), e);
- }
- }
-
- protected static String getFileExtension(String name) {
- int index = name.lastIndexOf('.');
- if (index == -1)
- return null;
- if (index == (name.length() - 1))
- return ""; //$NON-NLS-1$
- return name.substring(index + 1);
- }
-
- public static ResourceManager getInstance() {
- if (instance == null)
- new ResourceManager();
-
- return instance;
- }
-
- public static void shutdown() {
- if (instance == null)
- return;
-
- try {
- instance.shutdownImpl();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error during shutdown", e);
- }
- }
-
- protected boolean isActiveBundle(String bundleId) {
- return activeBundles.contains(bundleId);
- }
-
- protected void shutdownBundle(String id) {
- // dispose servers
- Iterator iterator = servers.iterator();
- while (iterator.hasNext()) {
- Server server = (Server) iterator.next();
- try {
- ServerType serverType = (ServerType) server.getServerType();
- if (id.equals(serverType.getNamespace())) {
- //server.stop(true);
- server.dispose();
- }
- } catch (Exception e) {
- Trace.trace(Trace.WARNING, "Error disposing server", e);
- }
- }
-
- // dispose runtimes
- iterator = runtimes.iterator();
- while (iterator.hasNext()) {
- Runtime runtime = (Runtime) iterator.next();
- try {
- RuntimeType runtimeType = (RuntimeType) runtime.getRuntimeType();
- if (id.equals(runtimeType.getNamespace())) {
- runtime.dispose();
- }
- } catch (Exception e) {
- Trace.trace(Trace.WARNING, "Error disposing server", e);
- }
- }
- try {
- Thread.sleep(1000);
- } catch (Exception e) {
- // ignore
- }
- }
-
- protected void shutdownImpl() {
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- if (workspace != null)
- workspace.removeResourceChangeListener(resourceChangeListener);
-
- ServerPlugin.getInstance().getPluginPreferences().removePropertyChangeListener(pcl);
-
- removeServerLifecycleListener(ServerListener.getInstance());
- }
-
- /*
- *
- */
- public void addRuntimeLifecycleListener(IRuntimeLifecycleListener listener) {
- Trace.trace(Trace.LISTENERS, "Adding server resource listener " + listener + " to " + this);
-
- if (runtimeListeners == null)
- runtimeListeners = new ArrayList(3);
- runtimeListeners.add(listener);
- }
-
- /*
- *
- */
- public void removeRuntimeLifecycleListener(IRuntimeLifecycleListener listener) {
- Trace.trace(Trace.LISTENERS, "Removing server resource listener " + listener + " from " + this);
-
- if (runtimeListeners != null)
- runtimeListeners.remove(listener);
- }
-
- /*
- *
- */
- public void addServerLifecycleListener(IServerLifecycleListener listener) {
- Trace.trace(Trace.LISTENERS, "Adding server resource listener " + listener + " to " + this);
-
- if (serverListeners == null)
- serverListeners = new ArrayList(3);
- serverListeners.add(listener);
- }
-
- /*
- *
- */
- public void removeServerLifecycleListener(IServerLifecycleListener listener) {
- Trace.trace(Trace.LISTENERS, "Removing server resource listener " + listener + " from " + this);
-
- if (serverListeners != null)
- serverListeners.remove(listener);
- }
-
- /**
- * Deregister an existing runtime.
- *
- * @param runtime
- */
- protected void deregisterRuntime(IRuntime runtime) {
- if (runtime == null)
- return;
-
- Trace.trace(Trace.RESOURCES, "Deregistering runtime: " + runtime.getName());
- if (runtime.equals(getDefaultRuntime()))
- setDefaultRuntime(null);
-
- ((Runtime)runtime).dispose();
- fireRuntimeEvent(runtime, EVENT_REMOVED);
- runtimes.remove(runtime);
- }
-
- /**
- * Deregister an existing server resource.
- *
- * @param server
- */
- protected void deregisterServer(IServer server) {
- if (server == null)
- return;
-
- Trace.trace(Trace.RESOURCES, "Deregistering server: " + server.getName());
-
- ((Server) server).deleteLaunchConfigurations();
- ServerPlugin.getInstance().removeTempDirectory(server.getId());
-
- ((Server)server).dispose();
- fireServerEvent(server, EVENT_REMOVED);
- servers.remove(server);
- }
-
- /**
- * Fire a runtime event.
- */
- private void fireRuntimeEvent(final IRuntime runtime, byte b) {
- Trace.trace(Trace.LISTENERS, "->- Firing runtime event: " + runtime.getName() + " ->-");
-
- if (runtimeListeners == null || runtimeListeners.isEmpty())
- return;
-
- int size = runtimeListeners.size();
- IRuntimeLifecycleListener[] srl = new IRuntimeLifecycleListener[size];
- runtimeListeners.toArray(srl);
-
- for (int i = 0; i < size; i++) {
- Trace.trace(Trace.LISTENERS, " Firing runtime event to " + srl[i]);
- try {
- if (b == EVENT_ADDED)
- srl[i].runtimeAdded(runtime);
- else if (b == EVENT_CHANGED)
- srl[i].runtimeChanged(runtime);
- else
- srl[i].runtimeRemoved(runtime);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, " Error firing runtime event to " + srl[i], e);
- }
- }
- Trace.trace(Trace.LISTENERS, "-<- Done firing runtime event -<-");
- }
-
- /**
- * Fire a server event.
- */
- private void fireServerEvent(final IServer server, byte b) {
- Trace.trace(Trace.LISTENERS, "->- Firing server event: " + server.getName() + " ->-");
-
- if (serverListeners == null || serverListeners.isEmpty())
- return;
-
- int size = serverListeners.size();
- IServerLifecycleListener[] srl = new IServerLifecycleListener[size];
- serverListeners.toArray(srl);
-
- for (int i = 0; i < size; i++) {
- Trace.trace(Trace.LISTENERS, " Firing server event to " + srl[i]);
- try {
- if (b == EVENT_ADDED)
- srl[i].serverAdded(server);
- else if (b == EVENT_CHANGED)
- srl[i].serverChanged(server);
- else
- srl[i].serverRemoved(server);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, " Error firing server event to " + srl[i], e);
- }
- }
- Trace.trace(Trace.LISTENERS, "-<- Done firing server event -<-");
- }
-
- protected void saveRuntimesList() {
- try {
- ignorePreferenceChanges = true;
- XMLMemento memento = XMLMemento.createWriteRoot("runtimes");
-
- if (defaultRuntime != null) {
- int ind = runtimes.indexOf(defaultRuntime);
- if (ind >= 0)
- memento.putString("default", ind + "");
- }
-
- Iterator iterator = runtimes.iterator();
- while (iterator.hasNext()) {
- Runtime runtime = (Runtime) iterator.next();
-
- IMemento child = memento.createChild("runtime");
- runtime.save(child);
- }
-
- String xmlString = memento.saveToString();
- Preferences prefs = ServerPlugin.getInstance().getPluginPreferences();
- prefs.setValue("runtimes", xmlString);
- ServerPlugin.getInstance().savePluginPreferences();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not save runtimes", e);
- }
- ignorePreferenceChanges = false;
- }
-
- protected void saveServersList() {
- String filename = ServerPlugin.getInstance().getStateLocation().append(SERVER_DATA_FILE).toOSString();
-
- try {
- XMLMemento memento = XMLMemento.createWriteRoot("servers");
-
- Iterator iterator = servers.iterator();
- while (iterator.hasNext()) {
- Server server = (Server) iterator.next();
-
- IMemento child = memento.createChild("server");
- server.save(child);
- }
-
- memento.saveToFile(filename);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not save servers", e);
- }
- }
-
- protected void loadRuntimesList() {
- Trace.trace(Trace.FINEST, "Loading runtime info");
- Preferences prefs = ServerPlugin.getInstance().getPluginPreferences();
- String xmlString = prefs.getString("runtimes");
-
- runtimes = new ArrayList();
- if (xmlString != null && xmlString.length() > 0) {
- try {
- ByteArrayInputStream in = new ByteArrayInputStream(xmlString.getBytes("UTF-8"));
- IMemento memento = XMLMemento.loadMemento(in);
-
- IMemento[] children = memento.getChildren("runtime");
- int size = children.length;
-
- for (int i = 0; i < size; i++) {
- Runtime runtime = new Runtime(null);
- runtime.loadFromMemento(children[i], null);
- runtimes.add(runtime);
- }
-
- String s = memento.getString("default");
- try {
- int ind = Integer.parseInt(s);
- defaultRuntime = (IRuntime) runtimes.get(ind);
- } catch (Exception ex) {
- // ignore
- }
- } catch (Exception e) {
- Trace.trace(Trace.WARNING, "Could not load runtimes: " + e.getMessage());
- }
- }
- }
-
- protected void loadServersList() {
- Trace.trace(Trace.FINEST, "Loading server info");
- String filename = ServerPlugin.getInstance().getStateLocation().append(SERVER_DATA_FILE).toOSString();
-
- try {
- IMemento memento = XMLMemento.loadMemento(filename);
-
- IMemento[] children = memento.getChildren("server");
- int size = children.length;
-
- for (int i = 0; i < size; i++) {
- Server server = new Server(null);
- server.loadFromMemento(children[i], null);
- servers.add(server);
- }
- } catch (Exception e) {
- Trace.trace(Trace.WARNING, "Could not load servers: " + e.getMessage());
- }
-
- if (ServerPreferences.getInstance().isSyncOnStartup()) {
- Iterator iterator = servers.iterator();
- while (iterator.hasNext()) {
- IServer server = (IServer) iterator.next();
- UpdateServerJob job = new UpdateServerJob(server);
- job.schedule();
- }
- }
- }
-
- protected void addRuntime(IRuntime runtime) {
- if (runtime == null)
- return;
- if (!runtimes.contains(runtime))
- registerRuntime(runtime);
- else
- fireRuntimeEvent(runtime, EVENT_CHANGED);
- saveRuntimesList();
- resolveServers();
- RuntimeWorkingCopy.rebuildRuntime(runtime, true);
- }
-
- protected void removeRuntime(IRuntime runtime) {
- if (runtimes.contains(runtime)) {
- deregisterRuntime(runtime);
- saveRuntimesList();
- resolveServers();
- RuntimeWorkingCopy.rebuildRuntime(runtime, false);
- }
- }
-
- protected void addServer(IServer server) {
- if (!servers.contains(server))
- registerServer(server);
- else
- fireServerEvent(server, EVENT_CHANGED);
- saveServersList();
- resolveServers();
- }
-
- protected void removeServer(IServer server) {
- if (servers.contains(server)) {
- deregisterServer(server);
- saveServersList();
- resolveServers();
- }
- }
-
- /**
- * Returns an array of all runtimes.
- *
- * @return an array of runtimes
- */
- public IRuntime[] getRuntimes() {
- List list = new ArrayList(runtimes);
-
- if (defaultRuntime != null && list.contains(defaultRuntime)) {
- list.remove(defaultRuntime);
- list.add(0, defaultRuntime);
- }
-
- IRuntime[] r = new IRuntime[list.size()];
- list.toArray(r);
- return r;
- }
-
- /**
- * Returns the runtime with the given id.
- *
- * @param id a runtime id
- * @return IRuntime
- */
- public IRuntime getRuntime(String id) {
- if (id == null)
- throw new IllegalArgumentException();
-
- Iterator iterator = runtimes.iterator();
- while (iterator.hasNext()) {
- IRuntime runtime = (IRuntime) iterator.next();
- if (runtime.getId().equals(id))
- return runtime;
- }
- return null;
- }
-
- /**
- * Returns the default runtime. Test API - do not use.
- *
- * @return java.util.List
- */
- public IRuntime getDefaultRuntime() {
- return defaultRuntime;
- }
-
- /**
- * Sets the default runtime. Test API - do not use.
- *
- * @param runtime a runtime
- */
- public void setDefaultRuntime(IRuntime runtime) {
- defaultRuntime = runtime;
- saveRuntimesList();
- }
-
- public void resolveRuntimes() {
- Iterator iterator = runtimes.iterator();
- while (iterator.hasNext()) {
- Runtime runtime = (Runtime) iterator.next();
- runtime.resolve();
- }
- }
-
- public void resolveServers() {
- Iterator iterator = servers.iterator();
- while (iterator.hasNext()) {
- Server server = (Server) iterator.next();
- server.resolve();
- }
- }
-
- /**
- * Returns an array containing all servers.
- *
- * @return an array containing all servers
- */
- public IServer[] getServers() {
- IServer[] servers2 = new IServer[servers.size()];
- servers.toArray(servers2);
-
- Arrays.sort(servers2, new Comparator() {
- public int compare(Object o1, Object o2) {
- IServer a = (IServer) o1;
- IServer b = (IServer) o2;
- return a.getName().compareToIgnoreCase(b.getName());
- }
- });
-
- return servers2;
- }
-
- /**
- * Returns the server with the given id.
- *
- * @param id a server id
- * @return a server
- */
- public IServer getServer(String id) {
- if (id == null)
- throw new IllegalArgumentException();
-
- Iterator iterator = servers.iterator();
- while (iterator.hasNext()) {
- Server server = (Server) iterator.next();
- if (id.equals(server.getId()))
- return server;
- }
- return null;
- }
-
- /**
- * Returns true if the resource change was handled.
- *
- * @param delta org.eclipse.core.resources.IResourceDelta
- * @return boolean
- */
- protected boolean handleResourceDelta(IResourceDelta delta) {
- int kind = delta.getKind();
- int flags = delta.getFlags();
- IResource resource2 = delta.getResource();
-
- // ignore markers
- if (kind == IResourceDelta.CHANGED && (flags & IResourceDelta.MARKERS) != 0)
- return false;
-
- Trace.trace(Trace.RESOURCES, "Resource changed: " + resource2 + " " + kind);
-
- if (resource2 instanceof IFile) {
- IFile file = (IFile) resource2;
- if (Server.FILE_EXTENSION.equals(file.getFileExtension())) {
- IProgressMonitor monitor = null;
- if ((flags & IResourceDelta.MOVED_FROM) != 0 || (flags & IResourceDelta.MOVED_TO) != 0)
- handleMovedFile(file, delta, monitor);
- else if (kind == IResourceDelta.ADDED)
- handleNewFile(file, monitor);
- else if (kind == IResourceDelta.REMOVED)
- handleRemovedFile(file);
- else
- handleChangedFile(file, monitor);
- if (monitor != null)
- monitor.done();
- }
- return false;
- }
- IFolder folder = (IFolder) resource2;
- Iterator iterator = servers.iterator();
- while (iterator.hasNext()) {
- IServer server = (IServer) iterator.next();
- if (server.getServerType().hasServerConfiguration() && folder.equals(server.getServerConfiguration())
- && server.getAdapter(ServerDelegate.class) != null) {
- try {
- ((Server)server).getDelegate(null).configurationChanged();
- } catch (Exception e) {
- Trace.trace(Trace.WARNING, "Server failed on configuration change");
- }
- }
- }
- return true;
- }
-
- protected IServer loadServer(IFile file, IProgressMonitor monitor) throws CoreException {
- Server server = new Server(file);
- server.loadFromFile(monitor);
- return server;
- }
-
- /**
- * Tries to load a new server resource from the given resource.
- * Returns true if the load and register were successful.
- *
- * @param file
- * @param monitor
- * @return boolean
- */
- protected boolean handleNewFile(IFile file, IProgressMonitor monitor) {
- Trace.trace(Trace.RESOURCES, "handleNewFile: " + file);
- monitor = ProgressUtil.getMonitorFor(monitor);
- monitor.beginTask("", 2000);
-
- // try loading a server
- if (file.getFileExtension().equals(Server.FILE_EXTENSION)) {
- try {
- IServer server = loadServer(file, ProgressUtil.getSubMonitorFor(monitor, 1000));
- if (server != null) {
- if (getServer(server.getId()) == null)
- registerServer(server);
- monitor.done();
- return true;
- }
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error loading server", e);
- }
- }
-
- monitor.done();
- return false;
- }
-
- /**
- * Tries to load a new server resource from the given resource.
- * Returns true if the load and register were successful.
- *
- * @param file
- * @param monitor
- * @return boolean
- */
- protected boolean handleMovedFile(IFile file, IResourceDelta delta, IProgressMonitor monitor) {
- Trace.trace(Trace.RESOURCES, "handleMovedFile: " + file);
- monitor = ProgressUtil.getMonitorFor(monitor);
- monitor.beginTask("", 2000);
-
- IPath fromPath = delta.getMovedFromPath();
- if (fromPath != null) {
- IFile fromFile = ResourcesPlugin.getWorkspace().getRoot().getFile(fromPath);
- if (((ProjectProperties)ServerCore.getProjectProperties(fromFile.getProject())).isServerProject()) {
- Server server = (Server) findServer(fromFile);
- if (server != null)
- server.file = file;
- } else {
- handleNewFile(file, monitor);
- }
- } else {
- IPath toPath = delta.getMovedToPath();
- IFile toFile = ResourcesPlugin.getWorkspace().getRoot().getFile(toPath);
- if (((ProjectProperties)ServerCore.getProjectProperties(toFile.getProject())).isServerProject()) {
- Server server = (Server) findServer(file);
- if (server != null)
- server.file = toFile;
- } else {
- handleRemovedFile(file);
- }
- }
-
- monitor.done();
- return false;
- }
-
- /**
- * Returns the server that came from the given file, or <code>null</code>
- * if none. This convenience method searches the list of known
- * servers ({@link #getServers()}) for the one with a matching
- * location ({@link Server#getFile()}). The file may not be null.
- *
- * @param file a server file
- * @return the server instance, or <code>null</code> if
- * there is no server associated with the given file
- */
- public static IServer findServer(IFile file) {
- if (file == null)
- throw new IllegalArgumentException();
-
- IServer[] servers = ServerCore.getServers();
- if (servers != null) {
- int size = servers.length;
- for (int i = 0; i < size; i++) {
- if (file.equals(((Server)servers[i]).getFile()))
- return servers[i];
- }
- }
- return null;
- }
-
- /**
- * Tries to handle a resource change. Returns true if the reload
- * was successful.
- *
- * @param file a file
- * @param monitor
- * @return boolean
- */
- protected boolean handleChangedFile(IFile file, IProgressMonitor monitor) {
- Trace.trace(Trace.RESOURCES, "handleChangedFile: " + file);
- monitor = ProgressUtil.getMonitorFor(monitor);
- monitor.beginTask("", 1000);
- boolean found = false;
-
- IServer server = findServer(file);
- if (server != null) {
- found = true;
- try {
- Trace.trace(Trace.RESOURCES, "Reloading server: " + server);
- ((Server) server).loadFromFile(monitor);
- fireServerEvent(server, EVENT_CHANGED);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error reloading server " + server.getName() + " from " + file + ": " + e.getMessage());
- deregisterServer(server);
- }
- } else
- Trace.trace(Trace.RESOURCES, "No server found at: " + file);
-
- monitor.done();
- return found;
- }
-
- /**
- * Tries to remove a current resource. Returns true if the
- * deregistering was successful.
- *
- * @param file a file
- * @return boolean
- */
- protected boolean handleRemovedFile(IFile file) {
- Trace.trace(Trace.RESOURCES, "handleRemovedFile: " + file);
-
- IServer server = findServer(file);
- if (server != null) {
- deregisterServer(server);
- return true;
- }
-
- Trace.trace(Trace.RESOURCES, "No server found at: " + file);
- return false;
- }
-
- /**
- * A project has changed. If this is an add or remove, check
- * to see if it is part of a current server configuration.
- *
- * @param delta org.eclipse.core.resources.IResourceDelta
- */
- protected void publishHandleProjectChange(IResourceDelta delta) {
- Trace.trace(Trace.FINEST, "> publishHandleProjectChange " + delta.getResource());
- IProject project = (IProject) delta.getResource();
-
- if (project == null)
- return;
-
- if (!deltaContainsChangedFiles(delta))
- return;
-
- // process module changes
- ProjectModuleFactoryDelegate.handleGlobalProjectChange(project, delta);
-
- final IModule module = ServerUtil.getModule(project);
- if (module == null)
- return;
-
- Trace.trace(Trace.FINEST, "- publishHandleProjectChange");
-
- IServer[] servers2 = getServers();
- if (servers2 != null) {
- int size = servers2.length;
- for (int i = 0; i < size; i++) {
- if (servers2[i].getAdapter(ServerDelegate.class) != null)
- ((Server) servers2[i]).handleModuleProjectChange(module);
- }
- }
- Trace.trace(Trace.FINEST, "< publishHandleProjectChange");
- }
-
- /**
- * Returns <code>true</code> if at least one file in the delta is changed,
- * and <code>false</code> otherwise.
- *
- * @param delta a resource delta
- * @return <code>true</code> if at least one file in the delta is changed,
- * and <code>false</code> otherwise
- */
- public static boolean deltaContainsChangedFiles(IResourceDelta delta) {
- class Temp {
- boolean b = false;
- }
- final Temp t = new Temp();
- try {
- delta.accept(new IResourceDeltaVisitor() {
- public boolean visit(IResourceDelta delta2) throws CoreException {
- if (t.b)
- return false;
- //Trace.trace(Trace.FINEST, delta2.getResource() + " " + delta2.getKind() + " " + delta2.getFlags());
- if (delta2.getKind() == IResourceDelta.NO_CHANGE)
- return false;
- if (delta2.getResource() instanceof IFile) {
- if (delta2.getKind() == IResourceDelta.CHANGED
- && (delta2.getFlags() & IResourceDelta.CONTENT) == 0
- && (delta2.getFlags() & IResourceDelta.REPLACED) == 0
- && (delta2.getFlags() & IResourceDelta.SYNC) == 0)
- return true;
- //if (delta2.getKind() == IResourceDelta.CHANGED) { // && delta2.getAffectedChildren().length == 0) {
- t.b = true;
- return false;
- //return true;
- //}
- }
- return true;
- }
- });
- } catch (Exception e) {
- // ignore
- }
- //Trace.trace(Trace.FINEST, "Delta contains change: " + t.b);
- return t.b;
- }
-
- /**
- * Registers a new runtime.
- *
- * @param runtime org.eclipse.wst.server.core.IRuntime
- */
- protected void registerRuntime(IRuntime runtime) {
- if (runtime == null)
- return;
-
- Trace.trace(Trace.RESOURCES, "Registering runtime: " + runtime.getName());
-
- runtimes.add(runtime);
- fireRuntimeEvent(runtime, EVENT_ADDED);
-
- RuntimeType runtimeType = (RuntimeType) runtime.getRuntimeType();
- String bundleId = runtimeType.getNamespace();
- if (!activeBundles.contains(bundleId))
- activeBundles.add(bundleId);
- }
-
- /**
- * Registers a new server.
- *
- * @param server org.eclipse.wst.server.core.IServer
- */
- protected void registerServer(IServer server) {
- if (server == null)
- return;
-
- Trace.trace(Trace.RESOURCES, "Registering server: " + server.getName());
-
- servers.add(server);
- fireServerEvent(server, EVENT_ADDED);
-
- ServerType serverType = (ServerType) server.getServerType();
- String bundleId = serverType.getNamespace();
- if (!activeBundles.contains(bundleId))
- activeBundles.add(bundleId);
- }
-
- protected void fireModuleServerEvent(ModuleFactoryEvent[] factoryEvents, ModuleEvent[] events) {
- // do nothing
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/RestartServerJob.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/RestartServerJob.java
deleted file mode 100644
index 499d3ecf1..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/RestartServerJob.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.IServer.IOperationListener;
-import org.eclipse.wst.server.core.internal.ServerSchedulingRule;
-/**
- * A job for restarting a server.
- */
-public class RestartServerJob extends ChainedJob {
- protected String launchMode;
- protected boolean isRestartCompleted = false;
- protected IStatus resultStatus;
-
- public RestartServerJob(IServer server, String launchMode) {
- super(NLS.bind(Messages.jobRestartingServer, server.getName()), server);
- this.launchMode = launchMode;
- setRule(new ServerSchedulingRule(server));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.internal.jobs.InternalJob#run(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected IStatus run(IProgressMonitor monitor) {
- IOperationListener listener2 = new IOperationListener() {
- public void done(IStatus result) {
- isRestartCompleted = true;
- resultStatus = result;
- }
- };
- getServer().restart(launchMode, listener2);
-
- // block util the restart is completed
- while (!isRestartCompleted) {
- try {
- Thread.sleep(250);
- } catch (InterruptedException e) {
- // Do nothing.
- }
- }
-
- if (resultStatus != null)
- return resultStatus;
-
- return Status.OK_STATUS;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Runtime.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Runtime.java
deleted file mode 100644
index 6a4fcffe9..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Runtime.java
+++ /dev/null
@@ -1,212 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.*;
-import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.core.model.InternalInitializer;
-import org.eclipse.wst.server.core.model.RuntimeDelegate;
-/**
- *
- */
-public class Runtime extends Base implements IRuntime {
- protected static final String PROP_RUNTIME_TYPE_ID = "runtime-type-id";
- protected static final String PROP_LOCATION = "location";
- protected static final String PROP_TEST_ENVIRONMENT = "test-environment";
- protected static final String PROP_STUB = "stub";
-
- protected IRuntimeType runtimeType;
- protected RuntimeDelegate delegate;
-
- /**
- * Create a new runtime.
- *
- * @param file
- */
- public Runtime(IFile file) {
- super(file);
- }
-
- /**
- * Create a new runtime.
- *
- * @param file
- * @param id
- * @param runtimeType
- */
- public Runtime(IFile file, String id, IRuntimeType runtimeType) {
- super(file, id);
- this.runtimeType = runtimeType;
- map.put(PROP_NAME, runtimeType.getName());
- }
-
- /**
- * @see IRuntime#getRuntimeType()
- */
- public IRuntimeType getRuntimeType() {
- return runtimeType;
- }
-
- /**
- * @see IRuntime#validate(IProgressMonitor)
- */
- public IStatus validate(IProgressMonitor monitor) {
- try {
- return getDelegate(monitor).validate();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate validate() " + toString(), e);
- return null;
- }
- }
-
- protected RuntimeDelegate getDelegate(IProgressMonitor monitor) {
- if (delegate != null)
- return delegate;
-
- synchronized (this) {
- if (delegate == null) {
- try {
- long time = System.currentTimeMillis();
- delegate = ((RuntimeType) runtimeType).createRuntimeDelegate();
- InternalInitializer.initializeRuntimeDelegate(delegate, this, monitor);
- //delegate.initialize(this);
- Trace.trace(Trace.PERFORMANCE, "Runtime.getDelegate(): <" + (System.currentTimeMillis() - time) + "> " + getRuntimeType().getId());
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, "Could not create delegate " + toString(), t);
- }
- }
- }
- return delegate;
- }
-
- public void dispose() {
- if (delegate != null) {
- delegate.dispose();
- delegate = null;
- }
- }
-
- /**
- * @see IRuntime#createWorkingCopy()
- */
- public IRuntimeWorkingCopy createWorkingCopy() {
- return new RuntimeWorkingCopy(this);
- }
-
- /**
- * @see IRuntime#isWorkingCopy()
- */
- public boolean isWorkingCopy() {
- return false;
- }
-
- /**
- * @see IRuntime#getLocation()
- */
- public IPath getLocation() {
- String temp = getAttribute(PROP_LOCATION, (String)null);
- if (temp == null)
- return null;
- return new Path(temp);
- }
-
- protected void deleteFromMetadata() {
- ResourceManager.getInstance().removeRuntime(this);
- }
-
- protected void saveToMetadata(IProgressMonitor monitor) {
- super.saveToMetadata(monitor);
- ResourceManager.getInstance().addRuntime(this);
- }
-
- protected String getXMLRoot() {
- return "runtime";
- }
-
- public boolean isTestEnvironment() {
- return getAttribute(PROP_TEST_ENVIRONMENT, false);
- }
-
- /**
- * @see IRuntime#isStub()
- */
- public boolean isStub() {
- return getAttribute(PROP_STUB, false);
- }
-
- protected void setInternal(RuntimeWorkingCopy wc) {
- map = wc.map;
- runtimeType = wc.runtimeType;
- file = wc.file;
- delegate = wc.delegate;
-
- int timestamp = wc.getTimestamp();
- map.put("timestamp", Integer.toString(timestamp+1));
- }
-
- protected void loadState(IMemento memento) {
- resolve();
- }
-
- protected void resolve() {
- String runtimeTypeId = getAttribute(PROP_RUNTIME_TYPE_ID, (String) null);
- if (runtimeTypeId != null)
- runtimeType = ServerCore.findRuntimeType(runtimeTypeId);
- else
- runtimeType = null;
- }
-
- protected void saveState(IMemento memento) {
- if (runtimeType != null)
- memento.putString(PROP_RUNTIME_TYPE_ID, runtimeType.getId());
- }
-
- /**
- * @see Object#equals(Object)
- */
- public boolean equals(Object obj) {
- if (!(obj instanceof Runtime))
- return false;
-
- Runtime runtime = (Runtime) obj;
- return runtime.getId().equals(getId());
- }
-
- /**
- * @see IRuntime#getAdapter(Class)
- */
- public Object getAdapter(Class adapter) {
- if (delegate != null) {
- if (adapter.isInstance(delegate))
- return delegate;
- }
- return Platform.getAdapterManager().getAdapter(this, adapter);
- }
-
- /**
- * @see IRuntime#loadAdapter(Class, IProgressMonitor)
- */
- public Object loadAdapter(Class adapter, IProgressMonitor monitor) {
- getDelegate(monitor);
- if (adapter.isInstance(delegate))
- return delegate;
-
- return Platform.getAdapterManager().loadAdapter(this, adapter.getName());
- }
-
- /**
- * @see Object#toString()
- */
- public String toString() {
- return "Runtime[" + getId() + ", " + getName() + ", " + getLocation() + ", " + getRuntimeType() + "]";
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/RuntimeLocator.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/RuntimeLocator.java
deleted file mode 100644
index 0f83e7890..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/RuntimeLocator.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
-import org.eclipse.wst.server.core.model.RuntimeLocatorDelegate;
-/**
- *
- */
-public class RuntimeLocator implements IRuntimeLocator {
- private IConfigurationElement element;
- private RuntimeLocatorDelegate delegate;
-
- public RuntimeLocator(IConfigurationElement element) {
- super();
- this.element = element;
- }
-
- protected IConfigurationElement getElement() {
- return element;
- }
-
- /*
- * @see IRuntimeLocator#getId()
- */
- public String getId() {
- return element.getAttribute("id");
- }
-
- /*
- * @see IRuntimeLocator
- */
- protected String[] getTypeIds() {
- try {
- return ServerPlugin.tokenize(element.getAttribute("typeIds"), ",");
- } catch (Exception e) {
- return null;
- }
- }
-
- /*
- * @see IRuntimeLocator
- */
- public boolean supportsType(String id) {
- return ServerPlugin.supportsType(getTypeIds(), id);
- }
-
- protected RuntimeLocatorDelegate getDelegate() {
- if (delegate == null) {
- try {
- delegate = (RuntimeLocatorDelegate) element.createExecutableExtension("class");
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, "Could not create delegate " + toString() + ": " + t.getMessage());
- }
- }
- return delegate;
- }
-
- /*
- * @see IRuntimeLocator#searchForRuntimes()
- */
- public void searchForRuntimes(IPath path, final IRuntimeSearchListener found, IProgressMonitor monitor) {
- try {
- //getDelegate().searchForRuntimes(path, found, monitor);
- getDelegate().searchForRuntimes(path, new RuntimeLocatorDelegate.IRuntimeSearchListener() {
- public void runtimeFound(IRuntimeWorkingCopy runtime) {
- found.runtimeFound(runtime);
- }
- }, monitor);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate " + toString() + ": " + e.getMessage());
- }
- }
-
- public String toString() {
- return "RuntimeLocator[" + getId() + "]";
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/RuntimeTargetHandler.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/RuntimeTargetHandler.java
deleted file mode 100644
index 1b88c4c7e..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/RuntimeTargetHandler.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.core.model.RuntimeTargetHandlerDelegate;
-/**
- *
- */
-public class RuntimeTargetHandler implements IRuntimeTargetHandler, IOrdered {
- private IConfigurationElement element;
- private RuntimeTargetHandlerDelegate delegate;
-
- /**
- * Create a new runtime target handler.
- *
- * @param element a configuration element
- */
- public RuntimeTargetHandler(IConfigurationElement element) {
- super();
- this.element = element;
- }
-
- protected IConfigurationElement getElement() {
- return element;
- }
-
- /**
- *
- * @return the id
- */
- public String getId() {
- return element.getAttribute("id");
- }
-
- /**
- * Returns the order.
- *
- * @return the order
- */
- public int getOrder() {
- try {
- String o = element.getAttribute("order");
- return Integer.parseInt(o);
- } catch (NumberFormatException e) {
- return -1;
- }
- }
-
- public String[] getRuntimeTypeIds() {
- try {
- List list = new ArrayList();
- StringTokenizer st = new StringTokenizer(element.getAttribute("runtimeTypeIds"), ",");
- while (st.hasMoreTokens()) {
- String str = st.nextToken();
- if (str != null && str.length() > 0)
- list.add(str.trim());
- }
- String[] s = new String[list.size()];
- list.toArray(s);
- return s;
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not parse runtime type ids: " + element);
- return null;
- }
- }
-
- /**
- * Returns true if the given server resource type (given by the
- * id) can be opened with this editor. This result is based on
- * the result of the getServerResources() method.
- *
- * @param runtimeType a runtime type
- * @return boolean
- */
- public boolean supportsRuntimeType(IRuntimeType runtimeType) {
- if (runtimeType == null)
- return false;
- String id = runtimeType.getId();
- if (id == null || id.length() == 0)
- return false;
-
- String[] s = getRuntimeTypeIds();
- if (s == null)
- return false;
-
- int size = s.length;
- for (int i = 0; i < size; i++) {
- if (s[i].endsWith("*")) {
- if (id.length() >= s[i].length() && id.startsWith(s[i].substring(0, s[i].length() - 1)))
- return true;
- } else if (id.equals(s[i]))
- return true;
- }
- return false;
- }
-
- /*
- * @see IPublishManager#getDelegate()
- */
- public RuntimeTargetHandlerDelegate getDelegate() {
- if (delegate == null) {
- try {
- delegate = (RuntimeTargetHandlerDelegate) element.createExecutableExtension("class");
- delegate.initialize(this);
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, "Could not create delegate " + toString() + ": " + t.getMessage());
- }
- }
- return delegate;
- }
-
- /**
- * Set the runtime target on the given project.
- *
- * @param project the project to set the runtime on
- * @param runtime the target runtime
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- */
- public void setRuntimeTarget(IProject project, IRuntime runtime, IProgressMonitor monitor) {
- if (project == null || runtime == null)
- return;
- try {
- getDelegate().setRuntimeTarget(project, runtime, monitor);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate " + toString() + ": " + e.getMessage());
- }
- }
-
- /**
- * Remove the runtime target from the given project. This method will undo
- * all changes made in setRuntimeTarget().
- *
- * @param project the project to remove the runtime from
- * @param runtime the target runtime
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- */
- public void removeRuntimeTarget(IProject project, IRuntime runtime, IProgressMonitor monitor) {
- if (project == null || runtime == null)
- return;
- try {
- getDelegate().removeRuntimeTarget(project, runtime, monitor);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate " + toString() + ": " + e.getMessage());
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class adapter) {
- RuntimeTargetHandlerDelegate delegate2 = getDelegate();
- if (adapter.isInstance(delegate2))
- return delegate;
- return null;
- }
-
- public String toString() {
- return "RuntimeTargetHandler[" + getId() + "]";
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/RuntimeType.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/RuntimeType.java
deleted file mode 100644
index b12ee1e39..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/RuntimeType.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.core.model.RuntimeDelegate;
-/**
- *
- */
-public class RuntimeType implements IRuntimeType {
- private IConfigurationElement element;
- private List moduleTypes;
-
- public RuntimeType(IConfigurationElement element) {
- super();
- this.element = element;
- }
-
- /**
- *
- * @return the id
- */
- public String getId() {
- try {
- return element.getAttribute("id");
- } catch (Exception e) {
- return null;
- }
- }
-
- /**
- *
- * @return the name
- */
- public String getName() {
- try {
- return element.getAttribute("name");
- } catch (Exception e) {
- return null;
- }
- }
-
- /**
- *
- * @return the description
- */
- public String getDescription() {
- try {
- return element.getAttribute("description");
- } catch (Exception e) {
- return null;
- }
- }
-
- public String getVendor() {
- try {
- String vendor = element.getAttribute("vendor");
- if (vendor != null)
- return vendor;
- } catch (Exception e) {
- // ignore
- }
- return Messages.defaultVendor;
- }
-
- public String getVersion() {
- try {
- String version = element.getAttribute("version");
- if (version != null)
- return version;
- } catch (Exception e) {
- // ignore
- }
- return Messages.defaultVersion;
- }
-
- protected RuntimeDelegate createRuntimeDelegate() throws CoreException {
- try {
- return (RuntimeDelegate) element.createExecutableExtension("class");
- } catch (Exception e) {
- return null;
- }
- }
-
- /**
- * Return the supported module types.
- *
- * @return an array of module types
- */
- public IModuleType[] getModuleTypes() {
- try {
- if (moduleTypes == null)
- moduleTypes = ServerPlugin.getModuleTypes(element.getChildren("moduleType"));
-
- IModuleType[] mt = new IModuleType[moduleTypes.size()];
- moduleTypes.toArray(mt);
- return mt;
- } catch (Exception e) {
- return new IModuleType[0];
- }
- }
-
- public boolean canCreate() {
- try {
- String a = element.getAttribute("class");
- return a != null && a.length() > 0;
- } catch (Exception e) {
- return false;
- }
- }
-
- public IRuntimeWorkingCopy createRuntime(String id, IProgressMonitor monitor) {
- if (element == null)
- return null;
-
- RuntimeWorkingCopy rwc = new RuntimeWorkingCopy(null, id, this);
- rwc.setDefaults(monitor);
- return rwc;
- }
-
- public void dispose() {
- element = null;
- }
-
- public String getNamespace() {
- if (element == null)
- return null;
- return element.getDeclaringExtension().getNamespace();
- }
-
- public String toString() {
- return "RuntimeType[" + getId() + ", " + getName() + "]";
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/RuntimeWorkingCopy.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/RuntimeWorkingCopy.java
deleted file mode 100644
index 08951d9ef..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/RuntimeWorkingCopy.java
+++ /dev/null
@@ -1,363 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import java.beans.PropertyChangeListener;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.core.model.InternalInitializer;
-import org.eclipse.wst.server.core.model.RuntimeDelegate;
-/**
- *
- */
-public class RuntimeWorkingCopy extends Runtime implements IRuntimeWorkingCopy {
- protected String PROP_ID_SET = "id-set";
- protected Runtime runtime;
- protected WorkingCopyHelper wch;
-
- protected RuntimeDelegate workingCopyDelegate;
-
- /**
- * Create a new runtime working copy from existing runtime.
- *
- * @param runtime
- */
- public RuntimeWorkingCopy(Runtime runtime) {
- super(runtime.getFile());
- this.runtime = runtime;
-
- runtimeType = runtime.getRuntimeType();
-
- map = new HashMap(runtime.map);
- wch = new WorkingCopyHelper(this);
- }
-
- /**
- * Create a new runtime working copy for a new runtime.
- *
- * @param file
- * @param id
- * @param runtimeType
- */
- public RuntimeWorkingCopy(IFile file, String id, IRuntimeType runtimeType) {
- super(file, id, runtimeType);
- wch = new WorkingCopyHelper(this);
- wch.setDirty(true);
-
- if (id == null || id.length() == 0) {
- id = ServerPlugin.generateId();
- map.put(PROP_ID, id);
- } else
- setAttribute(PROP_ID_SET, true);
-
- // throw CoreException if the id already exists
- }
-
- /**
- * @see IRuntime#isWorkingCopy()
- */
- public boolean isWorkingCopy() {
- return true;
- }
-
- /**
- * @see IRuntime#createWorkingCopy()
- */
- public IRuntimeWorkingCopy createWorkingCopy() {
- return this;
- }
-
- public void setAttribute(String attributeName, int value) {
- wch.setAttribute(attributeName, value);
- }
-
- public void setAttribute(String attributeName, boolean value) {
- wch.setAttribute(attributeName, value);
- }
-
- public void setAttribute(String attributeName, String value) {
- wch.setAttribute(attributeName, value);
- }
-
- public void setAttribute(String attributeName, List value) {
- wch.setAttribute(attributeName, value);
- }
-
- public void setAttribute(String attributeName, Map value) {
- wch.setAttribute(attributeName, value);
- }
-
- /**
- * @see IRuntimeWorkingCopy#setName(String)
- */
- public void setName(String name) {
- wch.setName(name);
- boolean set = getAttribute(PROP_ID_SET, false);
- if (runtime == null && !set)
- setAttribute("id", name);
- }
-
- public void setTestEnvironment(boolean b) {
- setAttribute(PROP_TEST_ENVIRONMENT, b);
- }
-
- /**
- * @see IRuntimeWorkingCopy#setStub(boolean)
- */
- public void setStub(boolean b) {
- setAttribute(PROP_STUB, b);
- }
-
- /**
- * @see IRuntimeWorkingCopy#isDirty()
- */
- public boolean isDirty() {
- return wch.isDirty();
- }
-
- /**
- * @see IRuntimeWorkingCopy#getOriginal()
- */
- public IRuntime getOriginal() {
- return runtime;
- }
-
- /**
- * @see IRuntimeWorkingCopy#setReadOnly(boolean)
- */
- public void setReadOnly(boolean b) {
- wch.setLocked(b);
- }
-
- public void setPrivate(boolean b) {
- wch.setPrivate(b);
- }
-
- /**
- * @see IRuntimeWorkingCopy#setLocation(IPath)
- */
- public void setLocation(IPath path) {
- if (path == null)
- setAttribute(PROP_LOCATION, (String)null);
- else
- setAttribute(PROP_LOCATION, path.toString());
- }
-
- /**
- * @see IRuntimeWorkingCopy#save(boolean, IProgressMonitor)
- */
- public IRuntime save(boolean force, IProgressMonitor monitor) throws CoreException {
- monitor = ProgressUtil.getMonitorFor(monitor);
- monitor.subTask(NLS.bind(Messages.savingTask, getName()));
-
- if (!force && getOriginal() != null)
- wch.validateTimestamp(((Runtime) getOriginal()).getTimestamp());
-
- IRuntime origRuntime = runtime;
- if (runtime == null)
- runtime = new Runtime(file);
-
- String oldId = getId();
- String name = getName();
- boolean set = getAttribute(PROP_ID_SET, false);
- if (!oldId.equals(name) && !set) {
- setAttribute("id", name);
- } else
- oldId = null;
-
- runtime.setInternal(this);
- runtime.saveToMetadata(monitor);
- wch.setDirty(false);
-
- if (oldId != null)
- updateRuntimeReferences(oldId, name, origRuntime);
-
- return runtime;
- }
-
- protected void updateRuntimeReferences(final String oldId, final String newId, final IRuntime origRuntime) {
- class UpdateRuntimeReferencesJob extends Job {
- /**
- * A job that updates runtime references when a runtime changes.
- */
- public UpdateRuntimeReferencesJob() {
- super(NLS.bind(Messages.savingTask, newId));
- }
-
- public IStatus run(IProgressMonitor monitor) {
- // fix .runtime files
- IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
- if (projects != null) {
- int size = projects.length;
- for (int i = 0; i < size; i++) {
- ProjectProperties props = (ProjectProperties) ServerCore.getProjectProperties(projects[i]);
- if (oldId.equals(props.getRuntimeTargetId())) {
- try {
- props.setRuntimeTargetId(newId, monitor);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error setting runtime target", e);
- }
- }
- }
- }
-
- // save servers
- if (runtime != null) {
- ResourceManager rm = ResourceManager.getInstance();
- IServer[] servers = rm.getServers();
- if (servers != null) {
- int size = servers.length;
- for (int i = 0; i < size; i++) {
- if (oldId.equals(((Server)servers[i]).getRuntimeId())) {
- try {
- ServerWorkingCopy wc = (ServerWorkingCopy) servers[i].createWorkingCopy();
- wc.setRuntimeId(newId);
- wc.save(false, monitor);
- } catch (Exception e) {
- // ignore
- }
- }
- }
- }
- }
-
- return new Status(IStatus.OK, ServerPlugin.PLUGIN_ID, 0, "", null);
- }
- }
- UpdateRuntimeReferencesJob job = new UpdateRuntimeReferencesJob();
- job.schedule();
- }
-
- /**
- * Rebuild any projects that are targetted to this runtime.
- *
- * @param runtime
- * @param add
- */
- protected static void rebuildRuntime(final IRuntime runtime, final boolean add) {
- if (runtime == null)
- return;
-
- class RebuildRuntimeReferencesJob extends Job {
- /**
- * A job that rebuilds projects when a runtime changes.
- */
- public RebuildRuntimeReferencesJob() {
- super(Messages.taskPerforming);
- }
-
- public IStatus run(IProgressMonitor monitor) {
- String id = runtime.getId();
-
- IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
- if (projects != null) {
- int size = projects.length;
- for (int i = 0; i < size; i++) {
- ProjectProperties props = (ProjectProperties) ServerCore.getProjectProperties(projects[i]);
- if (id.equals(props.getRuntimeTargetId())) {
- try {
- if (add)
- props.setRuntimeTarget(null, runtime, false, monitor);
- else
- props.setRuntimeTarget(runtime, null, false, monitor);
- projects[i].build(IncrementalProjectBuilder.FULL_BUILD, monitor);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error setting runtime target", e);
- }
- }
- }
- }
-
- return new Status(IStatus.OK, ServerPlugin.PLUGIN_ID, 0, "", null);
- }
- }
- RebuildRuntimeReferencesJob job = new RebuildRuntimeReferencesJob();
- job.schedule();
- }
-
- protected RuntimeDelegate getWorkingCopyDelegate(IProgressMonitor monitor) {
- if (workingCopyDelegate != null)
- return workingCopyDelegate;
-
- synchronized (this) {
- if (workingCopyDelegate == null) {
- try {
- long time = System.currentTimeMillis();
- workingCopyDelegate = ((RuntimeType) runtimeType).createRuntimeDelegate();
- InternalInitializer.initializeRuntimeDelegate(workingCopyDelegate, this, monitor);
- Trace.trace(Trace.PERFORMANCE, "RuntimeWorkingCopy.getWorkingCopyDelegate(): <" + (System.currentTimeMillis() - time) + "> " + getRuntimeType().getId());
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not create delegate " + toString(), e);
- }
- }
- }
- return workingCopyDelegate;
- }
-
- public void dispose() {
- super.dispose();
- if (workingCopyDelegate != null)
- workingCopyDelegate.dispose();
- }
-
- /**
- * Add a property change listener to this server.
- *
- * @param listener java.beans.PropertyChangeListener
- */
- public void addPropertyChangeListener(PropertyChangeListener listener) {
- if (listener == null)
- throw new IllegalArgumentException("Listener cannot be null");
- wch.addPropertyChangeListener(listener);
- }
-
- /**
- * Remove a property change listener from this server.
- *
- * @param listener java.beans.PropertyChangeListener
- */
- public void removePropertyChangeListener(PropertyChangeListener listener) {
- if (listener == null)
- throw new IllegalArgumentException("Listener cannot be null");
- wch.removePropertyChangeListener(listener);
- }
-
- /**
- * Fire a property change event.
- *
- * @param propertyName a property name
- * @param oldValue the old value
- * @param newValue the new value
- */
- public void firePropertyChangeEvent(String propertyName, Object oldValue, Object newValue) {
- wch.firePropertyChangeEvent(propertyName, oldValue, newValue);
- }
-
- /**
- * Set the defaults.
- *
- * @param monitor
- */
- protected void setDefaults(IProgressMonitor monitor) {
- try {
- getWorkingCopyDelegate(monitor).setDefaults(monitor);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate setDefaults() " + toString(), e);
- }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Server.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Server.java
deleted file mode 100644
index db4a6c8ac..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Server.java
+++ /dev/null
@@ -1,2113 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import java.util.*;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.debug.core.*;
-
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.core.model.*;
-import org.eclipse.wst.server.core.util.SocketUtil;
-/**
- *
- */
-public class Server extends Base implements IServer {
- /**
- * Server id attribute (value "server-id") of launch configurations.
- * This attribute is used to tag a launch configuration with the
- * id of the corresponding server.
- *
- * @see ILaunchConfiguration
- */
- public static final String ATTR_SERVER_ID = "server-id";
-
- protected static final List EMPTY_LIST = new ArrayList(0);
-
- /**
- * File extension (value "server") for serialized representation of
- * server instances.
- * <p>
- * [issue: What is relationship between this file extension and
- * the file passed to IServerType.create(...) or returned by
- * IServer.getFile()? That is, are server files expected to end
- * in ".server", or is this just a default? If the former
- * (as I suspect), then IServerType.create needs to say so,
- * and the implementation should enforce the restriction.]
- * </p>
- */
- public static final String FILE_EXTENSION = "server";
-
- public static final int AUTO_PUBLISH_DEFAULT = 0;
- public static final int AUTO_PUBLISH_DISABLE = 1;
- public static final int AUTO_PUBLISH_OVERRIDE = 2;
-
- protected static final String PROP_HOSTNAME = "hostname";
- protected static final String SERVER_ID = "server-id";
- protected static final String RUNTIME_ID = "runtime-id";
- protected static final String CONFIGURATION_ID = "configuration-id";
- protected static final String MODULE_LIST = "modules";
- public static final String PROP_AUTO_PUBLISH_TIME = "auto-publish-time";
- public static final String PROP_AUTO_PUBLISH_SETTING = "auto-publish-setting";
-
- protected static final char[] INVALID_CHARS = new char[] {'\\', '/', ':', '*', '?', '"', '<', '>', '|', '\0', '@', '&'};
-
- protected IServerType serverType;
- protected ServerDelegate delegate;
- protected ServerBehaviourDelegate behaviourDelegate;
-
- protected IRuntime runtime;
- protected IFolder configuration;
-
- // the list of modules that are to be published to the server
- protected List modules;
-
- // transient fields
- protected transient String mode = ILaunchManager.RUN_MODE;
- protected transient int serverState = STATE_UNKNOWN;
- protected transient int serverSyncState;
- protected transient boolean serverRestartNeeded;
-
- protected transient Map moduleState = new HashMap();
- protected transient Map modulePublishState = new HashMap();
- protected transient Map moduleRestartState = new HashMap();
-
- protected transient IStatus serverStatus;
- protected transient Map moduleStatus = new HashMap();
-
- protected transient ServerPublishInfo publishInfo;
- protected transient AutoPublishThread autoPublishThread;
-
-/* private static final String[] stateStrings = new String[] {
- "unknown", "starting", "started", "started_debug",
- "stopping", "stopped", "started_unsupported", "started_profile"
- };*/
-
- // publish listeners
- protected transient List publishListeners;
-
- // Server listeners
- protected transient ServerNotificationManager notificationManager;
-
- public class AutoPublishThread extends Thread {
- public boolean stop;
- public int time = 0;
-
- public AutoPublishThread() {
- super("Automatic Publishing");
- }
-
- public void run() {
- Trace.trace(Trace.FINEST, "Auto-publish thread starting for " + Server.this + " - " + time + "s");
- if (stop)
- return;
-
- try {
- sleep(time * 1000);
- } catch (Exception e) {
- // ignore
- }
-
- if (stop)
- return;
-
- Trace.trace(Trace.FINEST, "Auto-publish thread publishing " + Server.this);
-
- PublishServerJob publishJob = new PublishServerJob(Server.this, IServer.PUBLISH_AUTO, false);
- publishJob.schedule();
- }
- }
-
- private static final Comparator PUBLISH_OPERATION_COMPARTOR = new Comparator() {
- public int compare(Object leftOp, Object rightOp) {
- PublishOperation left = (PublishOperation) leftOp;
- PublishOperation right = (PublishOperation) rightOp;
- if (left.getOrder() > right.getOrder())
- return 1;
- if (left.getOrder() < right.getOrder())
- return -1;
- return 0;
- }
- };
-
- // working copy, loaded resource
- public Server(IFile file) {
- super(file);
- map.put(PROP_HOSTNAME, "localhost");
- }
-
- // creation (working copy)
- public Server(String id, IFile file, IRuntime runtime, IServerType serverType) {
- super(file, id);
- this.runtime = runtime;
- this.serverType = serverType;
- map.put("server-type-id", serverType.getId());
- map.put(PROP_HOSTNAME, "localhost");
- if (runtime != null && runtime.getRuntimeType() != null) {
- String name = runtime.getRuntimeType().getName();
- map.put(PROP_NAME, name);
- }
- serverState = ((ServerType)serverType).getInitialState();
- }
-
- public IServerType getServerType() {
- return serverType;
- }
-
- public IServerWorkingCopy createWorkingCopy() {
- return new ServerWorkingCopy(this);
- }
-
- public boolean isWorkingCopy() {
- return false;
- }
-
- protected void deleteFromMetadata() {
- ResourceManager.getInstance().removeServer(this);
- }
-
- protected void saveToMetadata(IProgressMonitor monitor) {
- super.saveToMetadata(monitor);
- ResourceManager.getInstance().addServer(this);
- }
-
- /* (non-Javadoc)
- * @see com.ibm.wtp.server.core.IServer2#getRuntime()
- */
- public IRuntime getRuntime() {
- return runtime;
- }
-
- protected String getRuntimeId() {
- return getAttribute(RUNTIME_ID, (String) null);
- }
-
- /* (non-Javadoc)
- * @see com.ibm.wtp.server.core.IServer2#getServerConfiguration()
- */
- public IFolder getServerConfiguration() {
- return configuration;
- }
-
- protected ServerDelegate getDelegate(IProgressMonitor monitor) {
- if (delegate != null || serverType == null)
- return delegate;
-
- synchronized (this) {
- if (delegate == null) {
- try {
- long time = System.currentTimeMillis();
- delegate = ((ServerType) serverType).createServerDelegate();
- InternalInitializer.initializeServerDelegate(delegate, Server.this, monitor);
- Trace.trace(Trace.PERFORMANCE, "Server.getDelegate(): <" + (System.currentTimeMillis() - time) + "> " + getServerType().getId());
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, "Could not create delegate " + toString(), t);
- }
- }
- }
- return delegate;
- }
-
- protected ServerBehaviourDelegate getBehaviourDelegate(IProgressMonitor monitor) {
- if (behaviourDelegate != null || serverType == null)
- return behaviourDelegate;
-
- synchronized (this) {
- if (behaviourDelegate == null) {
- try {
- long time = System.currentTimeMillis();
- behaviourDelegate = ((ServerType) serverType).createServerBehaviourDelegate();
- InternalInitializer.initializeServerBehaviourDelegate(behaviourDelegate, Server.this, monitor);
- Trace.trace(Trace.PERFORMANCE, "Server.getBehaviourDelegate(): <" + (System.currentTimeMillis() - time) + "> " + getServerType().getId());
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, "Could not create behaviour delegate " + toString(), t);
- }
- }
- }
- return behaviourDelegate;
- }
-
- public void dispose() {
- if (delegate != null) {
- delegate.dispose();
- delegate = null;
- }
- if (behaviourDelegate != null) {
- behaviourDelegate.dispose();
- behaviourDelegate = null;
- }
- }
-
- public String getHost() {
- return getAttribute(PROP_HOSTNAME, "localhost");
- }
-
- public int getAutoPublishTime() {
- return getAttribute(PROP_AUTO_PUBLISH_TIME, -1);
- }
-
- public int getAutoPublishSetting() {
- return getAttribute(PROP_AUTO_PUBLISH_SETTING, AUTO_PUBLISH_DEFAULT);
- }
-
- /**
- * Returns the current state of the server. (see SERVER_XXX constants)
- *
- * @return int
- */
- public int getServerState() {
- return serverState;
- }
-
- public String getMode() {
- return mode;
- }
-
- public void setServerState(int state) {
- if (state == serverState)
- return;
-
- this.serverState = state;
- fireServerStateChangeEvent();
- }
-
- /**
- * Add a listener to this server.
- *
- * @param listener org.eclipse.wst.server.model.IServerListener
- */
- public void addServerListener(IServerListener listener) {
- if (listener == null)
- throw new IllegalArgumentException("Module cannot be null");
- Trace.trace(Trace.LISTENERS, "Adding server listener " + listener + " to " + this);
- getServerNotificationManager().addListener(listener);
- }
-
- /**
- * Add a listener to this server with the given event mask.
- *
- * @param listener org.eclipse.wst.server.model.IServerListener
- * @param eventMask to limit listening to certain types of events
- */
- public void addServerListener(IServerListener listener, int eventMask) {
- if (listener == null)
- throw new IllegalArgumentException("Module cannot be null");
- Trace.trace(Trace.LISTENERS, "Adding server listener " + listener + " to " + this + " with eventMask " + eventMask);
- getServerNotificationManager().addListener(listener, eventMask);
- }
-
- /**
- * Remove a listener from this server.
- *
- * @param listener org.eclipse.wst.server.model.IServerListener
- */
- public void removeServerListener(IServerListener listener) {
- if (listener == null)
- throw new IllegalArgumentException("Module cannot be null");
- Trace.trace(Trace.LISTENERS, "Removing server listener " + listener + " from " + this);
- getServerNotificationManager().removeListener(listener);
- }
-
- /**
- * Fire a server listener restart state change event.
- */
- protected void fireRestartStateChangeEvent() {
- Trace.trace(Trace.LISTENERS, "->- Firing server restart change event: " + getName() + " ->-");
-
- if (notificationManager == null || notificationManager.hasListenerEntries())
- return;
-
- notificationManager.broadcastChange(
- new ServerEvent(ServerEvent.SERVER_CHANGE | ServerEvent.RESTART_STATE_CHANGE, this, getServerState(),
- getServerPublishState(), getServerRestartState()));
- }
-
- /**
- * Fire a server listener state change event.
- */
- protected void fireServerStateChangeEvent() {
- Trace.trace(Trace.LISTENERS, "->- Firing server state change event: " + getName() + ", " + getServerState() + " ->-");
-
- if (notificationManager == null || notificationManager.hasListenerEntries())
- return;
-
- notificationManager.broadcastChange(
- new ServerEvent(ServerEvent.SERVER_CHANGE | ServerEvent.STATE_CHANGE, this, getServerState(),
- getServerPublishState(), getServerRestartState()));
- }
-
- /**
- * Fire a server listener module state change event.
- */
- protected void fireServerModuleStateChangeEvent(IModule[] module) {
- Trace.trace(Trace.LISTENERS, "->- Firing server module state change event: " + getName() + ", " + getServerState() + " ->-");
-
- if (notificationManager == null || notificationManager.hasListenerEntries())
- return;
-
- notificationManager.broadcastChange(
- new ServerEvent(ServerEvent.MODULE_CHANGE | ServerEvent.STATE_CHANGE, this, module, getModuleState(module),
- getModulePublishState(module), getModuleRestartState(module)));
- }
-
- public void setMode(String m) {
- if (m == mode)
- return;
-
- this.mode = m;
- fireServerStateChangeEvent();
- }
-
- public void setModuleState(IModule[] module, int state) {
- if (module == null)
- throw new IllegalArgumentException("Module cannot be null");
- Integer in = new Integer(state);
- moduleState.put(getKey(module), in);
- fireServerModuleStateChangeEvent(module);
- }
-
- public void setModulePublishState(IModule[] module, int state) {
- if (module == null)
- throw new IllegalArgumentException("Module cannot be null");
- Integer in = new Integer(state);
- modulePublishState.put(getKey(module), in);
- //fireServerModuleStateChangeEvent(module);
- }
-
- public void setModuleRestartState(IModule[] module, boolean r) {
- if (module == null)
- throw new IllegalArgumentException("Module cannot be null");
- Boolean b = new Boolean(r);
- moduleState.put(getKey(module), b);
- //fireServerModuleStateChangeEvent(module);
- }
-
- protected void handleModuleProjectChange(final IModule module) {
- Trace.trace(Trace.FINEST, "> handleDeployableProjectChange() " + this + " " + module);
-
- class Helper {
- boolean changed;
- }
- final Helper helper = new Helper();
-
- IModuleVisitor visitor = new IModuleVisitor() {
- public boolean visit(IModule[] module2) {
- int size = module2.length;
- IModule m = module2[size - 1];
- if (m.getProject() == null)
- return true;
-
- if (module.equals(m)) {
- IModuleResourceDelta[] delta2 = getPublishedResourceDelta(module2);
- if (delta2.length > 0)
- helper.changed = true;
-
- // TODO
- /*if (deployableDelta[i] == null)
- deployableDelta[i] = moduleProjects[i].getModuleResourceDelta(delta);
-
- if (deployableDelta[i] != null) {
- // updateDeployable(module, deployableDelta[i]);
-
- ModulePublishInfo control = PublishInfo.getPublishInfo().getPublishControl(Server.this, parents, module);
- if (control.isDirty())
- return true;
-
- control.setDirty(true);
- firePublishStateChange(parents, module);
- }*/
- return true;
- }
- return true;
- }
- };
-
- visit(visitor, null);
-
- if (!helper.changed)
- return;
-
- if (getServerState() != IServer.STATE_STOPPED && behaviourDelegate != null)
- behaviourDelegate.handleResourceChange();
-
- autoPublish();
-
- //Trace.trace(Trace.FINEST, "< handleDeployableProjectChange()");
- }
-
- protected void stopAutoPublish() {
- if (autoPublishThread == null)
- return;
-
- autoPublishThread.stop = true;
- autoPublishThread.interrupt();
- autoPublishThread = null;
- }
-
- /**
- * Reset automatic publish thread if it is running and start a new
- * thread if automatic publishing is currently enabled.
- */
- protected void autoPublish() {
- stopAutoPublish();
-
- int time = 0;
- if (getAutoPublishSetting() == AUTO_PUBLISH_DEFAULT) {
- boolean local = SocketUtil.isLocalhost(getHost());
- if (local && ServerPreferences.getInstance().getAutoPublishLocal())
- time = ServerPreferences.getInstance().getAutoPublishLocalTime();
- else if (!local && ServerPreferences.getInstance().getAutoPublishRemote())
- time = ServerPreferences.getInstance().getAutoPublishRemoteTime();
- } else {
- time = getAutoPublishTime();
- }
-
- if (time > 9) {
- autoPublishThread = new AutoPublishThread();
- autoPublishThread.time = time;
- autoPublishThread.setPriority(Thread.MIN_PRIORITY + 1);
- autoPublishThread.start();
- }
- }
-
- private ServerNotificationManager getServerNotificationManager() {
- if (notificationManager == null) {
- notificationManager = new ServerNotificationManager();
- }
- return notificationManager;
- }
-
- /**
- * Returns the configuration's sync state.
- *
- * @return int
- */
- public int getServerPublishState() {
- return serverSyncState;
- }
-
- /**
- * Sets the configuration sync state.
- *
- * @param state int
- */
- public void setServerPublishState(int state) {
- if (state == serverSyncState)
- return;
- serverSyncState = state;
- //fireConfigurationSyncStateChangeEvent();
- }
-
- /**
- * Adds a publish listener to this server.
- * Has no effect if an identical listener is already registered.
- *
- * @param listener the publish listener
- * @see #removePublishListener(IPublishListener)
- */
- public void addPublishListener(IPublishListener listener) {
- if (listener == null)
- throw new IllegalArgumentException("Listener cannot be null");
- Trace.trace(Trace.LISTENERS, "Adding publish listener " + listener + " to " + this);
-
- if (publishListeners == null)
- publishListeners = new ArrayList();
- publishListeners.add(listener);
- }
-
- /**
- * Removes a publish listener from this server.
- * Has no effect if the listener is not registered.
- *
- * @param listener the publish listener
- * @see #addPublishListener(IPublishListener)
- */
- public void removePublishListener(IPublishListener listener) {
- if (listener == null)
- throw new IllegalArgumentException("Listener cannot be null");
- Trace.trace(Trace.LISTENERS, "Removing publish listener " + listener + " from " + this);
-
- if (publishListeners != null)
- publishListeners.remove(listener);
- }
-
- /**
- * Fire a publish start event.
- */
- private void firePublishStarted() {
- Trace.trace(Trace.FINEST, "->- Firing publish started event ->-");
-
- if (publishListeners == null || publishListeners.isEmpty())
- return;
-
- int size = publishListeners.size();
- IPublishListener[] srl = new IPublishListener[size];
- publishListeners.toArray(srl);
-
- for (int i = 0; i < size; i++) {
- Trace.trace(Trace.FINEST, " Firing publish started event to " + srl[i]);
- try {
- srl[i].publishStarted(this);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, " Error firing publish started event to " + srl[i], e);
- }
- }
-
- Trace.trace(Trace.FINEST, "-<- Done firing publish started event -<-");
- }
-
- /**
- * Fire a publish stop event.
- *
- * @param status publishing status
- */
- private void firePublishFinished(IStatus status) {
- Trace.trace(Trace.FINEST, "->- Firing publishing finished event: " + status + " ->-");
-
- if (publishListeners == null || publishListeners.isEmpty())
- return;
-
- int size = publishListeners.size();
- IPublishListener[] srl = new IPublishListener[size];
- publishListeners.toArray(srl);
-
- for (int i = 0; i < size; i++) {
- Trace.trace(Trace.FINEST, " Firing publishing finished event to " + srl[i]);
- try {
- srl[i].publishFinished(this, status);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, " Error firing publishing finished event to " + srl[i], e);
- }
- }
-
- Trace.trace(Trace.FINEST, "-<- Done firing publishing finished event -<-");
- }
-
- /**
- * Fire a publish state change event.
- */
- protected void firePublishStateChange(IModule[] module) {
- Trace.trace(Trace.FINEST, "->- Firing publish state change event: " + module + " ->-");
-
- if (notificationManager == null || notificationManager.hasListenerEntries())
- return;
-
- notificationManager.broadcastChange(
- new ServerEvent(ServerEvent.MODULE_CHANGE | ServerEvent.PUBLISH_STATE_CHANGE, this, module, getModuleState(module),
- getModulePublishState(module), getModuleRestartState(module)));
- }
-
- /**
- * Returns true if the server is in a state that it can
- * be published to.
- *
- * @return boolean
- */
- public IStatus canPublish() {
- // can't publish if the server is starting or stopping
- int state = getServerState();
- if (state == STATE_STARTING || state == STATE_STOPPING)
- return new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, Messages.errorPublishStarting, null);
-
- // can't publish if there is no configuration
- if (getServerType() == null || getServerType().hasServerConfiguration() && configuration == null)
- return new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, Messages.errorPublishNoConfiguration, null);
-
- // return true if the configuration can be published
- if (getServerPublishState() != PUBLISH_STATE_NONE)
- return new Status(IStatus.OK, ServerPlugin.PLUGIN_ID, 0, Messages.canPublishOk, null);
-
- // return true if any modules can be published
- /*class Temp {
- boolean found = false;
- }*/
- //final Temp temp = new Temp();
-
- return new Status(IStatus.OK, ServerPlugin.PLUGIN_ID, 0, Messages.canPublishOk, null);
-
- /*IModuleVisitor visitor = new IModuleVisitor() {
- public boolean visit(IModule[] parents, IModule module) {
- if (getModulePublishState(module) != PUBLISH_STATE_NONE) {
- temp.found = true;
- return false;
- }
- return true;
- }
- };
- ServerUtil.visit(this, visitor, null);
-
- return temp.found;*/
- }
-
- /**
- * Returns true if the server is in a state that it can
- * be published to.
- *
- * @return boolean
- */
- public boolean shouldPublish() {
- if (!canPublish().isOK())
- return false;
-
- if (getServerPublishState() != PUBLISH_STATE_NONE)
- return true;
-
- //if (getUnpublishedModules().length > 0)
- return true;
-
- //return false;
- }
-
- public ServerPublishInfo getServerPublishInfo() {
- if (publishInfo == null) {
- publishInfo = PublishInfo.getInstance().getServerPublishInfo(this);
- }
- return publishInfo;
- }
-
- /*
- * Publish to the server using the progress monitor. The result of the
- * publish operation is returned as an IStatus.
- */
- public IStatus publish(final int kind, IProgressMonitor monitor) {
- if (getServerType() == null)
- return new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, Messages.errorPublishing, null);
-
- // check what is out of sync and publish
- if (getServerType().hasServerConfiguration() && configuration == null)
- return new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, Messages.errorNoConfiguration, null);
-
- // make sure that the delegate is loaded and the server state is correct
- loadAdapter(ServerBehaviourDelegate.class, monitor);
-
- if (((ServerType)getServerType()).startBeforePublish() && (getServerState() == IServer.STATE_STOPPED)) {
- try {
- synchronousStart(ILaunchManager.RUN_MODE, monitor);
- } catch (CoreException ce) {
- Trace.trace(Trace.SEVERE, "Error starting server", ce);
- return ce.getStatus();
- }
- }
-
- firePublishStarted();
- IStatus status = doPublish(kind, monitor);
- firePublishFinished(status);
- return status;
- }
-
- protected IStatus doPublish(int kind, IProgressMonitor monitor) {
- Trace.trace(Trace.FINEST, "-->-- Publishing to server: " + toString() + " -->--");
-
- stopAutoPublish();
-
- try {
- return getBehaviourDelegate(monitor).publish(kind, monitor);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate publish() " + toString(), e);
- return new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, Messages.errorPublishing, e);
- }
- }
-
- /**
- * Returns the publish tasks that have been targetted to this server.
- * These tasks should be run during publishing.
- *
- * @param kind one of the IServer.PUBLISH_XX constants
- * @param moduleList a list of modules
- * @param kindList one of the IServer publish change constants
- * @return a possibly empty array of IOptionalTasks
- */
- public PublishOperation[] getTasks(int kind, List moduleList, List kindList) {
- List tasks = new ArrayList();
-
- String serverTypeId = getServerType().getId();
-
- IPublishTask[] publishTasks = ServerPlugin.getPublishTasks();
- if (publishTasks != null) {
- int size = publishTasks.length;
- for (int i = 0; i < size; i++) {
- IPublishTask task = publishTasks[i];
- if (task.supportsType(serverTypeId)) {
- PublishOperation[] tasks2 = task.getTasks(this, kind, moduleList, kindList);
- if (tasks2 != null) {
- int size2 = tasks2.length;
- for (int j = 0; j < size2; j++) {
- if (tasks2[j].getKind() == PublishOperation.REQUIRED)
- tasks.add(tasks2[j]);
- }
- }
- }
- }
- }
-
- Collections.sort(tasks, PUBLISH_OPERATION_COMPARTOR);
-
- return (PublishOperation[]) tasks.toArray(new PublishOperation[tasks.size()]);
- }
-
- public List getAllModules() {
- final List moduleList = new ArrayList();
-
- IModuleVisitor visitor = new IModuleVisitor() {
- public boolean visit(IModule[] module) {
- if (!moduleList.contains(module))
- moduleList.add(module);
- return true;
- }
- };
-
- visit(visitor, null);
-
- return moduleList;
- }
-
- /*
- * Returns the module resources that have been published.
- *
- * @see ServerBehaviourDelegate.getPublishedResources(IModule[], IModule)
- */
- public IModuleResource[] getPublishedResources(IModule[] module) {
- if (module == null)
- throw new IllegalArgumentException("Module cannot be null");
- return getServerPublishInfo().getModulePublishInfo(module).getResources();
- }
-
- /*
- * Returns the delta of the current module resources that have been
- * published compared to the current state of the module.
- *
- * @see ServerBehaviourDelegate.getPublishedResourceDelta(IModule[], IModule)
- */
- public IModuleResourceDelta[] getPublishedResourceDelta(IModule[] module) {
- if (module == null)
- throw new IllegalArgumentException("Module cannot be null");
- return getServerPublishInfo().getDelta(module);
- }
-
- /**
- * @see IServer#getAdapter(Class)
- */
- public Object getAdapter(Class adapter) {
- if (delegate != null) {
- if (adapter.isInstance(delegate))
- return delegate;
- }
- if (behaviourDelegate != null) {
- if (adapter.isInstance(behaviourDelegate))
- return behaviourDelegate;
- }
- return Platform.getAdapterManager().getAdapter(this, adapter);
- }
-
- /**
- * @see IServer#loadAdapter(Class, IProgressMonitor)
- */
- public Object loadAdapter(Class adapter, IProgressMonitor monitor) {
- getDelegate(monitor);
- if (adapter.isInstance(delegate))
- return delegate;
-
- getBehaviourDelegate(monitor);
- if (adapter.isInstance(behaviourDelegate))
- return behaviourDelegate;
-
- return Platform.getAdapterManager().loadAdapter(this, adapter.getName());
- }
-
- public String toString() {
- return getName();
- }
-
- /**
- * Returns true if the server is in a state that it can
- * be started, and supports the given mode.
- *
- * @param mode2
- * @return status
- */
- public IStatus canStart(String mode2) {
- int state = getServerState();
- if (state != STATE_STOPPED && state != STATE_UNKNOWN)
- return new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, Messages.canStartErrorState, null);
-
- if (getServerType() == null || !getServerType().supportsLaunchMode(mode2))
- return new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, Messages.errorLaunchMode, null);
-
- return new Status(IStatus.OK, ServerPlugin.PLUGIN_ID, 0, Messages.canStartOk, null);
- }
-
- public ILaunch getExistingLaunch() {
- ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
-
- ILaunch[] launches = launchManager.getLaunches();
- int size = launches.length;
- for (int i = 0; i < size; i++) {
- ILaunchConfiguration launchConfig = launches[i].getLaunchConfiguration();
- try {
- if (launchConfig != null) {
- String serverId = launchConfig.getAttribute(SERVER_ID, (String) null);
- if (getId().equals(serverId)) {
- if (!launches[i].isTerminated())
- return launches[i];
- }
- }
- } catch (CoreException e) {
- // ignore
- }
- }
-
- return null;
- }
-
- public void setupLaunchConfiguration(ILaunchConfigurationWorkingCopy workingCopy, IProgressMonitor monitor) {
- try {
- getBehaviourDelegate(monitor).setupLaunchConfiguration(workingCopy, monitor);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate setLaunchDefaults() " + toString(), e);
- }
- }
-
- public void importConfiguration(IRuntime runtime2, IProgressMonitor monitor) {
- try {
- getDelegate(monitor).importConfiguration(runtime2, monitor);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate setLaunchDefaults() " + toString(), e);
- }
- }
-
- /**
- * Return the launch configuration for this server. If one does not exist, it
- * will be created if "create" is true, and otherwise will return null.
- *
- * @param create <code>true</code> if a new launch configuration should be
- * created if there are none already
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @return the launch configuration, no <code>null</code> if there was no
- * existing launch configuration and <code>create</code> was false
- * @throws CoreException
- */
- public ILaunchConfiguration getLaunchConfiguration(boolean create, IProgressMonitor monitor) throws CoreException {
- ILaunchConfigurationType launchConfigType = ((ServerType) getServerType()).getLaunchConfigurationType();
-
- ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
- ILaunchConfiguration[] launchConfigs = null;
- try {
- launchConfigs = launchManager.getLaunchConfigurations(launchConfigType);
- } catch (CoreException e) {
- // ignore
- }
-
- if (launchConfigs != null) {
- int size = launchConfigs.length;
- for (int i = 0; i < size; i++) {
- try {
- String serverId = launchConfigs[i].getAttribute(SERVER_ID, (String) null);
- if (getId().equals(serverId)) {
- final ILaunchConfigurationWorkingCopy wc = launchConfigs[i].getWorkingCopy();
- setupLaunchConfiguration(wc, monitor);
- if (wc.isDirty()) {
- class Temp {
- ILaunchConfiguration lc = null;
- }
- final Temp temp = new Temp();
- class SaveLaunchJob extends Job {
- public SaveLaunchJob() {
- super(NLS.bind(Messages.savingTask, wc.getName()));
- }
-
- public IStatus run(IProgressMonitor monitor2) {
- try {
- temp.lc = wc.doSave();
- } catch (Exception e) {
- // ignore
- }
- return new Status(IStatus.OK, ServerPlugin.PLUGIN_ID, 0, "", null);
- }
- }
- SaveLaunchJob job = new SaveLaunchJob();
- job.schedule();
- try {
- job.join();
- } catch (Exception e) {
- // ignore
- }
- return temp.lc;
- }
- return launchConfigs[i];
- }
- } catch (CoreException e) {
- Trace.trace(Trace.SEVERE, "Error configuring launch", e);
- }
- }
- }
-
- if (!create)
- return null;
-
- // create a new launch configuration
- String launchName = getValidLaunchConfigurationName(getName());
- launchName = launchManager.generateUniqueLaunchConfigurationNameFrom(launchName);
- ILaunchConfigurationWorkingCopy wc = launchConfigType.newInstance(null, launchName);
- wc.setAttribute(SERVER_ID, getId());
- setupLaunchConfiguration(wc, monitor);
- return wc.doSave();
- }
-
- protected String getValidLaunchConfigurationName(String s) {
- if (s == null || s.length() == 0)
- return "1";
- int size = INVALID_CHARS.length;
- for (int i = 0; i < size; i++) {
- s = s.replace(INVALID_CHARS[i], '_');
- }
- return s;
- }
-
- /**
- * @see IServer#start(String, IProgressMonitor)
- */
- public void start(String mode2, IProgressMonitor monitor) throws CoreException {
- Trace.trace(Trace.FINEST, "Starting server: " + toString() + ", launchMode: " + mode2);
-
- try {
- ILaunchConfiguration launchConfig = getLaunchConfiguration(true, monitor);
- ILaunch launch = launchConfig.launch(mode2, monitor); // , true); - causes workspace lock
- Trace.trace(Trace.FINEST, "Launch: " + launch);
- } catch (CoreException e) {
- Trace.trace(Trace.SEVERE, "Error starting server " + toString(), e);
- throw e;
- }
- }
-
- /**
- * Clean up any old launch configurations with the current server's id.
- */
- protected void deleteLaunchConfigurations() {
- if (getServerType() == null)
- return;
- ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
- ILaunchConfigurationType launchConfigType = ((ServerType) getServerType()).getLaunchConfigurationType();
-
- ILaunchConfiguration[] configs = null;
- try {
- configs = launchManager.getLaunchConfigurations(launchConfigType);
- int size = configs.length;
- for (int i = 0; i < size; i++) {
- try {
- if (getId().equals(configs[i].getAttribute(SERVER_ID, (String) null)))
- configs[i].delete();
- } catch (Exception e) {
- // ignore
- }
- }
- } catch (Exception e) {
- // ignore
- }
- }
-
- /**
- * @see IServer#canRestart(String)
- */
- public IStatus canRestart(String mode2) {
- if (!getServerType().supportsLaunchMode(mode2))
- return new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, Messages.errorLaunchMode, null);
-
- int state = getServerState();
- if (state == STATE_STARTED)
- return new Status(IStatus.OK, ServerPlugin.PLUGIN_ID, 0, Messages.canRestartOk, null);
-
- return new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, Messages.errorRestartNotStarted, null);
- }
-
- /**
- * Returns the current restart state of the server. This
- * implementation will always return false when the server
- * is stopped.
- *
- * @return boolean
- */
- public boolean getServerRestartState() {
- if (getServerState() == STATE_STOPPED)
- return false;
- return serverRestartNeeded;
- }
-
- /**
- * Sets the server restart state.
- *
- * @param state boolean
- */
- public synchronized void setServerRestartState(boolean state) {
- if (state == serverRestartNeeded)
- return;
- serverRestartNeeded = state;
- fireRestartStateChangeEvent();
- }
-
- /**
- * @see IServer#restart(String, IProgressMonitor)
- */
- public void restart(final String mode2, final IProgressMonitor monitor) {
- if (getServerState() == STATE_STOPPED)
- return;
-
- Trace.trace(Trace.FINEST, "Restarting server: " + getName());
-
- try {
- try {
- getBehaviourDelegate(null).restart(mode2);
- return;
- } catch (CoreException ce) {
- Trace.trace(Trace.SEVERE, "Error calling delegate restart() " + toString());
- }
-
- // add listener to start it as soon as it is stopped
- addServerListener(new IServerListener() {
- public void serverChanged(ServerEvent event) {
- int eventKind = event.getKind();
- IServer server = event.getServer();
- if (eventKind == (ServerEvent.SERVER_CHANGE | ServerEvent.STATE_CHANGE)) {
- if (server.getServerState() == STATE_STOPPED) {
- server.removeServerListener(this);
-
- // restart in a quarter second (give other listeners a chance
- // to hear the stopped message)
- Thread t = new Thread() {
- public void run() {
- try {
- Thread.sleep(250);
- } catch (Exception e) {
- // ignore
- }
- try {
- Server.this.start(mode2, monitor);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error while restarting server", e);
- }
- }
- };
- t.setDaemon(true);
- t.setPriority(Thread.NORM_PRIORITY - 2);
- t.start();
- }
- }
-
- }
- });
-
- // stop the server
- stop(false);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error restarting server", e);
- }
- }
-
- /**
- * Returns true if the server is in a state that it can
- * be stopped.
- *
- * @return boolean
- */
- public IStatus canStop() {
- if (getServerState() == STATE_STOPPED)
- return new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, Messages.errorStopAlreadyStopped, null);
-
- return new Status(IStatus.OK, ServerPlugin.PLUGIN_ID, 0, Messages.canStopOk, null);
- }
-
- /**
- * @see IServer#stop(boolean)
- */
- public void stop(boolean force) {
- if (getServerState() == STATE_STOPPED)
- return;
-
- Trace.trace(Trace.FINEST, "Stopping server: " + toString());
-
- try {
- getBehaviourDelegate(null).stop(force);
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, "Error calling delegate stop() " + toString(), t);
- }
- }
-
- /**
- * @see IServer#start(String, IOperationListener)
- */
- public void start(String mode2, IOperationListener listener2) {
- Trace.trace(Trace.FINEST, "synchronousStart 1");
- final Object mutex = new Object();
-
- // add listener to the server
- IServerListener listener = new IServerListener() {
- public void serverChanged(ServerEvent event) {
- int eventKind = event.getKind();
- IServer server = event.getServer();
- if (eventKind == (ServerEvent.SERVER_CHANGE | ServerEvent.STATE_CHANGE)) {
- int state = server.getServerState();
- if (state == IServer.STATE_STARTED || state == IServer.STATE_STOPPED) {
- // notify waiter
- synchronized (mutex) {
- try {
- Trace.trace(Trace.FINEST, "synchronousStart notify");
- mutex.notifyAll();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error notifying server start", e);
- }
- }
- }
- }
- }
- };
- addServerListener(listener);
-
- final int serverTimeout = ((ServerType) getServerType()).getStartTimeout();
- class Timer {
- boolean timeout;
- boolean alreadyDone;
- }
- final Timer timer = new Timer();
-
- Thread thread = new Thread() {
- public void run() {
- try {
- Thread.sleep(serverTimeout * 1000);
- if (!timer.alreadyDone) {
- timer.timeout = true;
- // notify waiter
- synchronized (mutex) {
- Trace.trace(Trace.FINEST, "synchronousStart notify timeout");
- mutex.notifyAll();
- }
- }
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error notifying server start timeout", e);
- }
- }
- };
- thread.setDaemon(true);
- thread.start();
-
- Trace.trace(Trace.FINEST, "synchronousStart 2");
-
- // start the server
- try {
- start(mode2, (IProgressMonitor)null);
- } catch (CoreException e) {
- removeServerListener(listener);
- timer.alreadyDone = true;
- listener2.done(e.getStatus());
- return;
- }
-
- Trace.trace(Trace.FINEST, "synchronousStart 3");
-
- // wait for it! wait for it! ...
- synchronized (mutex) {
- try {
- while (!timer.timeout && !(getServerState() == IServer.STATE_STARTED || getServerState() == IServer.STATE_STOPPED))
- mutex.wait();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error waiting for server start", e);
- }
- }
- removeServerListener(listener);
- timer.alreadyDone = true;
-
- if (timer.timeout) {
- listener2.done(new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, NLS.bind(Messages.errorStartTimeout, new String[] { getName(), serverTimeout + "" }), null));
- return;
- }
- timer.alreadyDone = true;
-
- if (getServerState() == IServer.STATE_STOPPED) {
- listener2.done(new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, NLS.bind(Messages.errorStartFailed, getName()), null));
- return;
- }
-
- Trace.trace(Trace.FINEST, "synchronousStart 4");
- listener2.done(new Status(IStatus.OK, ServerPlugin.PLUGIN_ID, 0, "", null));
- }
-
- public void synchronousStart(String mode2, IProgressMonitor monitor) throws CoreException {
- Trace.trace(Trace.FINEST, "synchronousStart 1");
- final Object mutex = new Object();
-
- monitor = ProgressUtil.getMonitorFor(monitor);
-
- // add listener to the server
- IServerListener listener = new IServerListener() {
- public void serverChanged(ServerEvent event) {
- int eventKind = event.getKind();
- IServer server = event.getServer();
- if (eventKind == (ServerEvent.SERVER_CHANGE | ServerEvent.STATE_CHANGE)) {
- int state = server.getServerState();
- if (state == IServer.STATE_STARTED || state == IServer.STATE_STOPPED) {
- // notify waiter
- synchronized (mutex) {
- try {
- Trace.trace(Trace.FINEST, "synchronousStart notify");
- mutex.notifyAll();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error notifying server start", e);
- }
- }
- }
- }
- }
- };
- addServerListener(listener);
-
- final int serverTimeout = ((ServerType) getServerType()).getStartTimeout();
- class Timer {
- boolean timeout;
- boolean alreadyDone;
- }
- final Timer timer = new Timer();
-
- final IProgressMonitor monitor2 = monitor;
- Thread thread = new Thread("Synchronous Server Start") {
- public void run() {
- try {
- int totalTimeout = serverTimeout;
- boolean userCancelled = false;
- int retryPeriod = 2500;
- while (totalTimeout > 0 && !userCancelled && !timer.alreadyDone) {
- Thread.sleep(retryPeriod);
- totalTimeout -= retryPeriod;
- if (monitor2.isCanceled()) {
- // user cancelled - set the server state to stopped
- userCancelled = true;
- setServerState(IServer.STATE_STOPPED);
- // notify waiter
- synchronized (mutex) {
- Trace.trace(Trace.FINEST, "synchronousStart user cancelled.");
- mutex.notifyAll();
- }
- }
- }
- if (!userCancelled && !timer.alreadyDone) {
- timer.timeout = true;
- // notify waiter
- synchronized (mutex) {
- Trace.trace(Trace.FINEST, "synchronousStart notify timeout");
- mutex.notifyAll();
- }
- }
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error notifying server start timeout", e);
- }
- }
- };
- thread.setDaemon(true);
- thread.start();
-
- Trace.trace(Trace.FINEST, "synchronousStart 2");
-
- // start the server
- try {
- start(mode2, monitor);
- } catch (CoreException e) {
- removeServerListener(listener);
- timer.alreadyDone = true;
- throw e;
- }
-
- Trace.trace(Trace.FINEST, "synchronousStart 3");
-
- // wait for it! wait for it! ...
- synchronized (mutex) {
- try {
- while (!monitor.isCanceled() && !timer.timeout && !(getServerState() == IServer.STATE_STARTED || getServerState() == IServer.STATE_STOPPED))
- mutex.wait();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error waiting for server start", e);
- }
- }
- removeServerListener(listener);
- timer.alreadyDone = true;
-
- if (timer.timeout)
- throw new CoreException(new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, NLS.bind(Messages.errorStartTimeout, new String[] { getName(), serverTimeout + "" }), null));
- timer.alreadyDone = true;
-
- if (getServerState() == IServer.STATE_STOPPED)
- throw new CoreException(new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, NLS.bind(Messages.errorStartFailed, getName()), null));
-
- Trace.trace(Trace.FINEST, "synchronousStart 4");
- }
-
- /*
- * @see IServer#synchronousRestart(String, IProgressMonitor)
- */
- public void synchronousRestart(String mode2, IProgressMonitor monitor) throws CoreException {
- synchronousStop(true);
- synchronousStart(mode2, monitor);
- }
-
- /*
- * @see IServer#restart(String, IOperationListener)
- */
- public void restart(String mode2, IOperationListener listener) {
- if (getServerState() == STATE_STOPPED)
- return;
-
- Trace.trace(Trace.FINEST, "Restarting server: " + getName());
-
- try {
- final IOperationListener listener2 = listener;
- IServerListener curListener = new IServerListener() {
- public void serverChanged(ServerEvent event) {
- int eventKind = event.getKind();
- IServer server = event.getServer();
- if (eventKind == (ServerEvent.SERVER_CHANGE | ServerEvent.STATE_CHANGE)) {
- if (server.getServerState() == STATE_STARTED) {
- server.removeServerListener(this);
- listener2.done(new Status(IStatus.OK, ServerPlugin.PLUGIN_ID, 0, "", null));
- }
- }
- }
- };
- try {
- addServerListener(curListener);
- getBehaviourDelegate(null).restart(mode2);
- return;
- } catch (CoreException ce) {
- Trace.trace(Trace.SEVERE, "Error calling delegate restart() " + toString());
- removeServerListener(curListener);
- }
-
- final String mode3 = mode2;
- // add listener to start it as soon as it is stopped
- addServerListener(new IServerListener() {
- public void serverChanged(ServerEvent event) {
- int eventKind = event.getKind();
- IServer server = event.getServer();
- if (eventKind == (ServerEvent.SERVER_CHANGE | ServerEvent.STATE_CHANGE)) {
- if (server.getServerState() == STATE_STOPPED) {
- server.removeServerListener(this);
-
- // restart in a quarter second (give other listeners a chance
- // to hear the stopped message)
- Thread t = new Thread() {
- public void run() {
- try {
- Thread.sleep(250);
- } catch (Exception e) {
- // ignore
- }
- try {
- Server.this.start(mode3, listener2);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error while restarting server", e);
- }
- }
- };
- t.setDaemon(true);
- t.setPriority(Thread.NORM_PRIORITY - 2);
- t.start();
- }
- }
-
- }
- });
-
- // stop the server
- stop(false);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error restarting server", e);
- listener.done(null);
- }
- }
-
- /*
- * @see IServer#stop(boolean, IOperationListener)
- */
- public void stop(boolean force, IOperationListener listener2) {
- if (getServerState() == IServer.STATE_STOPPED)
- return;
-
- final Object mutex = new Object();
-
- // add listener to the server
- IServerListener listener = new IServerListener() {
- public void serverChanged(ServerEvent event) {
- int eventKind = event.getKind();
- IServer server = event.getServer();
- if (eventKind == (ServerEvent.SERVER_CHANGE | ServerEvent.STATE_CHANGE)) {
- int state = server.getServerState();
- if (Server.this == server && state == IServer.STATE_STOPPED) {
- // notify waiter
- synchronized (mutex) {
- try {
- mutex.notifyAll();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error notifying server stop", e);
- }
- }
- }
- }
- }
- };
- addServerListener(listener);
-
- class Timer {
- boolean timeout;
- boolean alreadyDone;
- }
- final Timer timer = new Timer();
-
- Thread thread = new Thread() {
- public void run() {
- try {
- Thread.sleep(120000);
- if (!timer.alreadyDone) {
- timer.timeout = true;
- // notify waiter
- synchronized (mutex) {
- Trace.trace(Trace.FINEST, "stop notify timeout");
- mutex.notifyAll();
- }
- }
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error notifying server stop timeout", e);
- }
- }
- };
- thread.setDaemon(true);
- thread.start();
-
- // stop the server
- stop(force);
-
- // wait for it! wait for it!
- synchronized (mutex) {
- try {
- while (!timer.timeout && getServerState() != IServer.STATE_STOPPED)
- mutex.wait();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error waiting for server stop", e);
- }
- }
- removeServerListener(listener);
-
- /*
- //can't throw exceptions
- if (timer.timeout)
- throw new CoreException(new Status(IStatus.ERROR, ServerCore.PLUGIN_ID, 0, ServerPlugin.getResource("%errorStartFailed", getName()), null));
- else
- timer.alreadyDone = true;
-
- if (getServerState() == IServer.STATE_STOPPED)
- throw new CoreException(new Status(IStatus.ERROR, ServerCore.PLUGIN_ID, 0, ServerPlugin.getResource("%errorStartFailed", getName()), null));*/
- listener2.done(new Status(IStatus.OK, ServerPlugin.PLUGIN_ID, 0, "", null));
- }
-
- /*
- * @see IServer#synchronousStop()
- */
- public void synchronousStop(boolean force) {
- if (getServerState() == IServer.STATE_STOPPED)
- return;
-
- final Object mutex = new Object();
-
- // add listener to the server
- IServerListener listener = new IServerListener() {
- public void serverChanged(ServerEvent event) {
- int eventKind = event.getKind();
- IServer server = event.getServer();
- if (eventKind == (ServerEvent.SERVER_CHANGE | ServerEvent.STATE_CHANGE)) {
- int state = server.getServerState();
- if (Server.this == server && state == IServer.STATE_STOPPED) {
- // notify waiter
- synchronized (mutex) {
- try {
- mutex.notifyAll();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error notifying server stop", e);
- }
- }
- }
- }
- }
- };
- addServerListener(listener);
-
- class Timer {
- boolean timeout;
- boolean alreadyDone;
- }
- final Timer timer = new Timer();
-
- Thread thread = new Thread() {
- public void run() {
- try {
- Thread.sleep(120000);
- if (!timer.alreadyDone) {
- timer.timeout = true;
- // notify waiter
- synchronized (mutex) {
- Trace.trace(Trace.FINEST, "stop notify timeout");
- mutex.notifyAll();
- }
- }
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error notifying server stop timeout", e);
- }
- }
- };
- thread.setDaemon(true);
- thread.start();
-
- // stop the server
- stop(force);
-
- // wait for it! wait for it!
- synchronized (mutex) {
- try {
- while (!timer.timeout && getServerState() != IServer.STATE_STOPPED)
- mutex.wait();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error waiting for server stop", e);
- }
- }
- removeServerListener(listener);
-
- /*
- //can't throw exceptions
- if (timer.timeout)
- throw new CoreException(new Status(IStatus.ERROR, ServerCore.PLUGIN_ID, 0, ServerPlugin.getResource("%errorStartFailed", getName()), null));
- else
- timer.alreadyDone = true;
-
- if (getServerState() == IServer.STATE_STOPPED)
- throw new CoreException(new Status(IStatus.ERROR, ServerCore.PLUGIN_ID, 0, ServerPlugin.getResource("%errorStartFailed", getName()), null));*/
- }
-
- /*
- * Trigger a restart of the given module and wait until it has finished restarting.
- *
- * @param module org.eclipse.wst.server.core.IModule
- * @param monitor org.eclipse.core.runtime.IProgressMonitor
- * @exception org.eclipse.core.runtime.CoreException - thrown if an error occurs while trying to restart the module
- *
- public void synchronousRestartModule(final IModule[] module, IProgressMonitor monitor) throws CoreException {
- Trace.trace(Trace.FINEST, "synchronousModuleRestart 1");
-
- final Object mutex = new Object();
-
- // add listener to the module
- IServerListener listener = new IServerListener() {
- public void serverChanged(ServerEvent event) {
- int eventKind = event.getKind();
- IServer server = event.getServer();
- if (eventKind == (ServerEvent.MODULE_CHANGE | ServerEvent.STATE_CHANGE)) {
- int state = server.getModuleState(module);
- if (state == IServer.STATE_STARTED || state == IServer.STATE_STOPPED) {
- // notify waiter
- synchronized (mutex) {
- try {
- Trace.trace(Trace.FINEST, "synchronousModuleRestart notify");
- mutex.notifyAll();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error notifying module restart", e);
- }
- }
- }
- }
- }
- };
- addServerListener(listener);
-
- // make sure it times out after 30s
- class Timer {
- boolean timeout;
- boolean alreadyDone;
- }
- final Timer timer = new Timer();
-
- Thread thread = new Thread() {
- public void run() {
- try {
- Thread.sleep(30000);
- if (!timer.alreadyDone) {
- timer.timeout = true;
- // notify waiter
- synchronized (mutex) {
- Trace.trace(Trace.FINEST, "synchronousModuleRestart notify timeout");
- mutex.notifyAll();
- }
- }
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error notifying module restart timeout", e);
- }
- }
- };
- thread.setDaemon(true);
- thread.start();
-
- Trace.trace(Trace.FINEST, "synchronousModuleRestart 2");
-
- // restart the module
- try {
- getBehaviourDelegate(null).restartModule(module, monitor);
- } catch (CoreException e) {
- removeServerListener(listener);
- throw e;
- }
-
- Trace.trace(Trace.FINEST, "synchronousModuleRestart 3");
-
- // wait for it! wait for it! ...
- synchronized (mutex) {
- try {
- while (!timer.timeout && !(getModuleState(module) == IServer.STATE_STARTED || getModuleState(module) == IServer.STATE_STOPPED))
- mutex.wait();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error waiting for server start", e);
- }
- }
- removeServerListener(listener);
- if (timer.timeout)
- throw new CoreException(new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, NLS.bind(Messages.errorModuleRestartFailed, getName()), null));
- timer.alreadyDone = true;
-
- if (getModuleState(module) == IServer.STATE_STOPPED)
- throw new CoreException(new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, NLS.bind(Messages.errorModuleRestartFailed, getName()), null));
-
- Trace.trace(Trace.FINEST, "synchronousModuleRestart 4");
- }*/
-
- public IPath getTempDirectory() {
- return ServerPlugin.getInstance().getTempDirectory(getId());
- }
-
- protected String getXMLRoot() {
- return "server";
- }
-
- protected void loadState(IMemento memento) {
- resolve();
- }
-
- protected void resolve() {
- IServerType oldServerType = serverType;
- String serverTypeId = getAttribute("server-type-id", (String)null);
- if (serverTypeId != null)
- serverType = ServerCore.findServerType(serverTypeId);
- else
- serverType = null;
- if (serverType != null && !serverType.equals(oldServerType))
- serverState = ((ServerType)serverType).getInitialState();
-
- String runtimeId = getAttribute(RUNTIME_ID, (String)null);
- if (runtimeId != null)
- runtime = ServerCore.findRuntime(runtimeId);
-
- String configPath = getAttribute(CONFIGURATION_ID, (String)null);
- configuration = null;
- if (configPath != null)
- configuration = ResourcesPlugin.getWorkspace().getRoot().getFolder(new Path(configPath));
- }
-
- protected void setInternal(ServerWorkingCopy wc) {
- map = new HashMap(wc.map);
- configuration = wc.configuration;
- runtime = wc.runtime;
- serverSyncState = wc.serverSyncState;
- //restartNeeded = wc.restartNeeded;
- serverType = wc.serverType;
- modules = wc.modules;
-
- // can never modify the following properties via the working copy
- //serverState = wc.serverState;
- delegate = wc.delegate;
-
- autoPublish();
- }
-
- protected void saveState(IMemento memento) {
- if (serverType != null)
- memento.putString("server-type", serverType.getId());
-
- if (configuration != null)
- memento.putString(CONFIGURATION_ID, configuration.getFullPath().toString());
- else
- memento.putString(CONFIGURATION_ID, null);
-
- if (runtime != null)
- memento.putString(RUNTIME_ID, runtime.getId());
- else
- memento.putString(RUNTIME_ID, null);
- }
-
- /*public void updateConfiguration() {
- try {
- getDelegate(null).updateConfiguration();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate updateConfiguration() " + toString(), e);
- }
- }*/
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.core.IServerConfiguration#canModifyModule(org.eclipse.wst.server.core.model.IModule)
- */
- public IStatus canModifyModules(IModule[] add, IModule[] remove, IProgressMonitor monitor) {
- if ((add == null || add.length == 0) && (remove == null || remove.length == 0))
- throw new IllegalArgumentException("Add and remove cannot both be null/empty");
-
- if (add != null && add.length > 0) {
- int size = add.length;
- for (int i = 0; i < size; i++)
- if (!ServerUtil.isSupportedModule(getServerType().getRuntimeType().getModuleTypes(), add[i].getModuleType()))
- return new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, Messages.errorCannotAddModule, null);
- }
-
- try {
- return getDelegate(monitor).canModifyModules(add, remove);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate canModifyModules() " + toString(), e);
- return new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, "", null);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.core.IServer#getModules()
- */
- public IModule[] getModules() {
- if (modules == null) {
- // convert from attribute
- List list = getAttribute(MODULE_LIST, (List) null);
- if (list == null)
- list = new ArrayList(1);
-
- modules = new ArrayList(list.size() + 1);
- Iterator iterator = list.iterator();
- while (iterator.hasNext()) {
- String moduleId = (String) iterator.next();
- String name = "<unknown>";
- int index = moduleId.indexOf("::");
- if (index > 0) {
- name = moduleId.substring(0, index);
- moduleId = moduleId.substring(index+2);
- }
-
- IModule module = ServerUtil.getModule(moduleId);
- if (module == null)
- module = new DeletedModule(moduleId, name);
- if (module != null)
- modules.add(module);
- }
- }
-
- IModule[] modules2 = new IModule[modules.size()];
- modules.toArray(modules2);
- return modules2;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.core.IServer#getModuleState()
- */
- public int getModuleState(IModule[] module) {
- if (module == null)
- throw new IllegalArgumentException("Module cannot be null");
- try {
- Integer in = (Integer) moduleState.get(getKey(module));
- if (in != null)
- return in.intValue();
- } catch (Exception e) {
- // ignore
- }
- return STATE_UNKNOWN;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.core.IServer#getModuleState()
- */
- public int getModulePublishState(IModule[] module) {
- if (module == null)
- throw new IllegalArgumentException("Module cannot be null");
- try {
- Integer in = (Integer) modulePublishState.get(getKey(module));
- if (in != null)
- return in.intValue();
- } catch (Exception e) {
- // ignore
- }
- return PUBLISH_STATE_UNKNOWN;
- }
-
- /*
- * @see IServer#getChildModule(IModule[])
- */
- public IModule[] getChildModules(IModule[] module, IProgressMonitor monitor) {
- if (module == null)
- throw new IllegalArgumentException("Module cannot be null");
- try {
- return getDelegate(monitor).getChildModules(module);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate getChildModules() " + toString(), e);
- return null;
- }
- }
-
- /*
- * @see IServer#getRootModules(IModule)
- */
- public IModule[] getRootModules(IModule module, IProgressMonitor monitor) throws CoreException {
- if (module == null)
- throw new IllegalArgumentException("Module cannot be null");
- try {
- return getDelegate(monitor).getRootModules(module);
- } catch (CoreException se) {
- //Trace.trace(Trace.FINER, "CoreException calling delegate getParentModules() " + toString() + ": " + se.getMessage());
- throw se;
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate getParentModules() " + toString(), e);
- return null;
- }
- }
-
- /**
- * Returns whether the given module can be restarted.
- *
- * @param module the module
- * @param monitor
- * @return <code>true</code> if the given module can be
- * restarted, and <code>false</code> otherwise
- */
- public IStatus canControlModule(IModule[] module, IProgressMonitor monitor) {
- if (module == null)
- throw new IllegalArgumentException("Module cannot be null");
- try {
- boolean b = getBehaviourDelegate(monitor).canControlModule(module);
- if (b)
- return new Status(IStatus.OK, ServerPlugin.PLUGIN_ID, 0, Messages.canRestartModuleOk, null);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate canRestartRuntime() " + toString(), e);
- }
- return new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, Messages.errorRestartModule, null);
- }
-
- /**
- * Check if the given module is in sync on the server. It should
- * return true if the module should be restarted (is out of
- * sync) or false if the module does not need to be restarted.
- *
- * @param module org.eclipse.wst.server.core.model.IModule
- * @return boolean
- */
- public boolean getModuleRestartState(IModule[] module) {
- if (module == null)
- throw new IllegalArgumentException("Module cannot be null");
- try {
- Boolean b = (Boolean) moduleRestartState.get(getKey(module));
- if (b != null)
- return b.booleanValue();
- } catch (Exception e) {
- // ignore
- }
- return false;
- }
-
- /*
- * @see IServer#startModule(IModule[], IOperationListener)
- */
- public void startModule(IModule[] module, IOperationListener listener) {
- if (module == null)
- throw new IllegalArgumentException("Module cannot be null");
- try {
- getBehaviourDelegate(null).startModule(module, null);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate restartModule() " + toString(), e);
- }
- }
-
- /*
- * @see IServer#stopModule(IModule[], IOperationListener)
- */
- public void stopModule(IModule[] module, IOperationListener listener) {
- if (module == null)
- throw new IllegalArgumentException("Module cannot be null");
- try {
- getBehaviourDelegate(null).stopModule(module, null);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate restartModule() " + toString(), e);
- }
- }
-
- /*
- * @see IServer#restartModule(IModule[], IOperationListener, IProgressMonitor)
- */
- public void restartModule(IModule[] module, IOperationListener listener) {
- if (module == null)
- throw new IllegalArgumentException("Module cannot be null");
- try {
- getBehaviourDelegate(null).stopModule(module, null);
- getBehaviourDelegate(null).startModule(module, null);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate restartModule() " + toString(), e);
- }
- }
-
- /**
- * Returns an array of IServerPorts that this server has.
- *
- * @param monitor
- * @return a possibly empty array of servers ports
- */
- public ServerPort[] getServerPorts(IProgressMonitor monitor) {
- try {
- return getDelegate(monitor).getServerPorts();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate getServerPorts() " + toString(), e);
- return null;
- }
- }
-
- /**
- * Visit all the modules in the server with the given module visitor.
- *
- * @param visitor the visitor
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- */
- public void visit(IModuleVisitor visitor, IProgressMonitor monitor) {
- if (visitor == null)
- throw new IllegalArgumentException("Visitor cannot be null");
- IModule[] modules2 = getModules();
- if (modules2 != null) {
- int size = modules2.length;
- for (int i = 0; i < size; i++) {
- if (!visitModule(new IModule[] { modules2[i] }, visitor, monitor))
- return;
- }
- }
- }
-
- /**
- * Returns true to keep visiting, and false to stop.
- *
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- */
- private boolean visitModule(IModule[] module, IModuleVisitor visitor, IProgressMonitor monitor) {
- if (module == null)
- return true;
-
- if (!visitor.visit(module))
- return false;
-
- IModule[] children = getChildModules(module, monitor);
- if (children != null) {
- int size = children.length;
- for (int i = 0; i < size; i++) {
- IModule[] module2 = new IModule[module.length + 1];
- System.arraycopy(module, 0, module2, 0, module.length);
- module2[module.length] = children[i];
-
- if (!visitModule(module2, visitor, monitor))
- return false;
- }
- }
-
- return true;
- }
-
- private String getKey(IModule[] module) {
- StringBuffer sb = new StringBuffer();
-
- if (module != null) {
- int size = module.length;
- for (int i = 0; i < size; i++) {
- if (i != 0)
- sb.append("#");
- sb.append(module[i].getId());
- }
- }
-
- return sb.toString();
- }
-
- public void setModuleStatus(IModule[] module, IStatus status) {
- if (module == null)
- throw new IllegalArgumentException("Module cannot be null");
- moduleStatus.put(getKey(module), status);
- //fireServerModuleStateChangeEvent(module);
- }
-
- public IStatus getModuleStatus(IModule[] module) {
- if (module == null)
- throw new IllegalArgumentException("Module cannot be null");
- try {
- return (IStatus) moduleStatus.get(getKey(module));
- } catch (Exception e) {
- return null;
- }
- }
-
- public void setServerStatus(IStatus status) {
- serverStatus = status;
- //fireServerStateChangeEvent();
- }
-
- public IStatus getServerStatus() {
- return serverStatus;
- }
-
- /**
- * Switch the server's location between the workspace and .metadata.
- *
- * @param server a server
- * @param monitor a progress monitor
- * @throws CoreException if something goes wrong
- */
- public static void switchLocation(Server server, IProgressMonitor monitor) throws CoreException {
- IFile file = server.getFile();
- ServerWorkingCopy wc = (ServerWorkingCopy) server.createWorkingCopy();
- server.delete();
- if (file == null) {
- IProject project = ServerType.getServerProject();
- file = ServerUtil.getUnusedServerFile(project, wc);
- wc.setFile(file);
- server.file = file;
- } else {
- wc.setFile(null);
- server.file = null;
- }
- wc.save(true, monitor);
- }
-
- /**
- * Returns the current state of the server (see SERVER_XXX constants) after
- * refreshing the state of the server. The only difference between this method
- * and the method without a progress monitor is that this method may cause
- * plugin loading and not return immediately. However, the server will always
- * be updated and in sync, so the IServer.STATE_UNKNOWN state should never be
- * returned.
- *
- * @param monitor
- * @return the server state
- */
- public int getServerState(IProgressMonitor monitor) {
- loadAdapter(ServerBehaviourDelegate.class, monitor);
- return getServerState();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerListener.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerListener.java
deleted file mode 100644
index c1e48d1ec..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerListener.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.core.util.ServerLifecycleAdapter;
-/**
- * Listens for messages from the servers. This class keeps
- * track of server instances current state and any clients
- * that are waiting to run on the server.
- */
-public class ServerListener extends ServerLifecycleAdapter implements IServerListener {
- // static instance
- protected static ServerListener listener;
-
- /**
- * ServerListener constructor comment.
- */
- private ServerListener() {
- super();
- }
-
- /**
- * Get the static instance.
- *
- * @return org.eclipse.wst.server.core.internal.plugin.ServerListener
- */
- public static ServerListener getInstance() {
- if (listener == null)
- listener = new ServerListener();
- return listener;
- }
-
- /**
- * Called when the server configuration's sync state changes.
- *
- * @param server org.eclipse.wst.server.model.IServer
- */
- public void configurationSyncStateChange(IServer server) {
- // do nothing
- }
-
- /**
- * A new resource has been added.
- *
- * @param server org.eclipse.wst.server.core.IServer
- */
- public void serverAdded(IServer server) {
- server.addServerListener(this);
- }
-
- /**
- * A existing resource has been removed.
- *
- * @param server org.eclipse.wst.server.core.IServer
- */
- public void serverRemoved(IServer server) {
- server.removeServerListener(this);
- }
-
- public void serverChanged(ServerEvent event) {
- // do nothing
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerMonitor.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerMonitor.java
deleted file mode 100644
index 23a009a7b..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerMonitor.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.ServerPort;
-/**
- *
- */
-public class ServerMonitor implements IServerMonitor {
- private IConfigurationElement element;
- private ServerMonitorDelegate delegate;
-
- /**
- * Monitor constructor comment.
- *
- * @param element a configuration element
- */
- public ServerMonitor(IConfigurationElement element) {
- super();
- this.element = element;
- }
-
- /**
- * Returns the id of this default server.
- *
- * @return java.lang.String
- */
- public String getId() {
- return element.getAttribute("id");
- }
-
- /*
- * @see IMonitor#getDescription()
- */
- public String getDescription() {
- return element.getAttribute("description");
- }
-
- /*
- * @see IMonitor#getLabel()
- */
- public String getName() {
- String label = element.getAttribute("name");
- if (label == null)
- return "n/a";
- return label;
- }
-
- /*
- * @see IMonitor#getDelegate()
- */
- public ServerMonitorDelegate getDelegate() {
- if (delegate == null) {
- try {
- delegate = (ServerMonitorDelegate) element.createExecutableExtension("class");
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, "Could not create delegate" + toString() + ": " + t.getMessage());
- }
- }
- return delegate;
- }
-
- /**
- * Start monitoring the given port, and return the port number to
- * tunnel requests through.
- *
- * @param server a server
- * @param port a port
- * @param monitorPort the port used for monitoring
- * @return the port used for monitoring
- * @throws CoreException if anything goes wrong
- */
- public int startMonitoring(IServer server, ServerPort port, int monitorPort) throws CoreException {
- try {
- return getDelegate().startMonitoring(server, port, monitorPort);
- } catch (CoreException ce) {
- throw ce;
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate " + toString() + ": " + e.getMessage());
- return -1;
- }
- }
-
- /**
- * Stop monitoring the given port.
- *
- * @param server a server
- * @param port a port
- */
- public void stopMonitoring(IServer server, ServerPort port) {
- try {
- getDelegate().stopMonitoring(server, port);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate " + toString() + ": " + e.getMessage());
- }
- }
-
- /**
- * Return a string representation of this object.
- *
- * @return java.lang.String
- */
- public String toString() {
- return "Monitor[" + getId() + "]";
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerMonitorDelegate.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerMonitorDelegate.java
deleted file mode 100644
index 0cc3d6742..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerMonitorDelegate.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.ServerPort;
-/**
- * An interface to a TCP/IP monitor.
- */
-public abstract class ServerMonitorDelegate {
- /**
- * Start monitoring the given port, and return the port number to
- * tunnel requests through. The monitorPort is the new port to use, or
- * -1 to pick a random port.
- *
- * @param server a server
- * @param port a port
- * @param monitorPort the port used for monitoring
- * @return the port used for monitoring
- * @throws CoreException if anything goes wrong
- */
- public abstract int startMonitoring(IServer server, ServerPort port, int monitorPort) throws CoreException;
-
- /**
- * Stop monitoring the given port.
- *
- * @param server a server
- * @param port a port
- */
- public abstract void stopMonitoring(IServer server, ServerPort port);
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerMonitorManager.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerMonitorManager.java
deleted file mode 100644
index a91f4a768..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerMonitorManager.java
+++ /dev/null
@@ -1,371 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import java.util.*;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.wst.server.core.*;
-/**
- *
- */
-public class ServerMonitorManager implements IServerMonitorManager {
- private static final String MONITOR_DATA_FILE = "monitors.xml";
-
- protected static ServerMonitorManager instance;
-
- protected List ports = new ArrayList();
- protected ServerMonitor monitor;
-
- class MonitoredPort implements IMonitoredServerPort {
- protected IServer server;
- protected ServerPort port;
- protected int newPort = -1;
- protected String[] content;
- public boolean started;
-
- public MonitoredPort(IServer server, ServerPort port, int newPort, String[] content) {
- this.server = server;
- this.port = port;
- this.newPort = newPort;
- this.content = content;
- }
-
- public MonitoredPort(IMemento memento, IProgressMonitor monitor) {
- load(memento, monitor);
- }
-
- public IServer getServer() {
- return server;
- }
-
- public ServerPort getServerPort() {
- return port;
- }
-
- public int getMonitorPort() {
- return newPort;
- }
-
- public void setMonitorPort(int p) {
- newPort = p;
- }
-
- public String[] getContentTypes() {
- if (content == null)
- return new String[0];
- return content;
- }
-
- public boolean isStarted() {
- return started;
- }
-
- protected void setStarted(boolean s) {
- started = s;
- }
-
- public boolean equals(Object obj) {
- if (!(obj instanceof MonitoredPort))
- return false;
- MonitoredPort mp = (MonitoredPort) obj;
- if (!mp.server.equals(server))
- return false;
- if (!mp.port.equals(port))
- return false;
- if (newPort != mp.newPort)
- return false;
- if (content == null && mp.content != null)
- return false;
- if (content != null && mp.content == null)
- return false;
- if (content != null) {
- int size = content.length;
- if (size != mp.content.length)
- return false;
- for (int i = 0; i < size; i++)
- if (!content[i].equals(mp.content[i]))
- return false;
- }
- return true;
- }
-
- protected boolean canSave() {
- return (port.getId() != null);
- }
-
- protected void save(IMemento memento) {
- memento.putString("serverId", server.getId());
- if (newPort != -1)
- memento.putString("port", newPort + "");
- memento.putString("portId", port.getId());
- memento.putBoolean("started", started);
-
- if (content != null) {
- StringBuffer sb = new StringBuffer();
- int size = content.length;
- for (int i = 0; i < size; i++) {
- if (i > 0)
- sb.append(",");
- sb.append(content[i]);
- }
- memento.putString("contentTypes", sb.toString());
- }
- }
-
- protected void load(IMemento memento, IProgressMonitor monitor2) {
- String serverId = memento.getString("serverId");
- server = null;
- if (serverId != null)
- server = ServerCore.findServer(serverId);
- if (server == null)
- throw new RuntimeException("Server could not be found: " + serverId + " " + server);
- String newPortStr = memento.getString("port");
- if (newPortStr != null && newPortStr.length() > 0)
- newPort = Integer.parseInt(newPortStr);
- String portId = memento.getString("portId");
-
- ServerPort[] ports2 = server.getServerPorts(monitor2);
- if (ports2 != null) {
- int size = ports2.length;
- for (int i = 0; port == null && i < size; i++) {
- ServerPort sp = ports2[i];
- if (sp.getId() != null && sp.getId().equals(portId))
- port = sp;
- }
- }
- if (port == null)
- throw new RuntimeException("Could not relocate port: " + serverId + " " + server + " " + portId);
-
- String s = memento.getString("contentTypes");
- if (s != null)
- content = ServerPlugin.tokenize(s, ",");
-
- Boolean b = memento.getBoolean("started");
- if (b != null && b.booleanValue()) {
- try {
- newPort = monitor.startMonitoring(server, port, newPort);
- started = true;
- } catch (CoreException e) {
- Trace.trace(Trace.WARNING, "Could not restart server monitor", e);
- }
- }
- }
- }
-
- public ServerMonitorManager() {
- IServerMonitor[] monitors = ServerPlugin.getServerMonitors();
- if (monitors != null && monitors.length > 0)
- monitor = (ServerMonitor) monitors[0];
-
- instance = this;
- loadMonitors();
- }
-
- public static ServerMonitorManager getInstance() {
- if (instance == null)
- new ServerMonitorManager();
- return instance;
- }
-
- public static void shutdown() {
- if (instance == null)
- return;
- instance.saveMonitors();
- }
-
- /**
- * Returns the monitor that is currently being used.
- *
- * @return the current server monitor
- */
- public IServerMonitor getCurrentServerMonitor() {
- return monitor;
- }
-
- /**
- * Switch to use a different server monitor. All existing monitors will be
- * removed from the current monitor and added to the new monitor.
- *
- * @param newMonitor
- * @throws org.eclipse.core.runtime.CoreException
- */
- public void setServerMonitor(IServerMonitor newMonitor) throws CoreException {
- throw new CoreException(new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, "Not implemented yet", null));
- }
-
- /**
- * Returns the list of ports that are currently being monitored.
- *
- * @param server a server
- * @return a possibly empty array of monitored server ports
- */
- public IMonitoredServerPort[] getMonitoredPorts(IServer server) {
- List list = new ArrayList();
- Iterator iterator = ports.iterator();
- while (iterator.hasNext()) {
- MonitoredPort mp = (MonitoredPort) iterator.next();
- if (mp.server.equals(server))
- list.add(mp);
- }
-
- IMonitoredServerPort[] msp = new IMonitoredServerPort[list.size()];
- list.toArray(msp);
- return msp;
- }
-
- /**
- * Starts monitoring the given port, and returns the new port # to use that will
- * route to the monitored port.
- *
- * @param server a server
- * @param port a port
- * @param monitorPort the port used for monitoring
- * @param content the content
- * @return a monitored server port
- */
- public IMonitoredServerPort createMonitor(IServer server, ServerPort port, int monitorPort, String[] content) {
- if (port == null || monitor == null)
- return null;
-
- MonitoredPort mp = new MonitoredPort(server, port, monitorPort, content);
- ports.add(mp);
- return mp;
- }
-
- /**
- * Stop monitoring the given port. Throws a CoreException if there was a problem
- * stopping the monitoring
- *
- * @param port
- */
- public void removeMonitor(IMonitoredServerPort port) {
- if (port == null)
- return;
-
- try {
- ports.remove(port);
- if (port.isStarted())
- monitor.stopMonitoring(port.getServer(), port.getServerPort());
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not remove monitor", e);
- }
- }
-
- /**
- * Start the monitor. If the msp port is -1, it will be updated to the port that is actually in use.
- *
- * @param msp
- * @throws CoreException
- */
- public void startMonitor(IMonitoredServerPort msp) throws CoreException {
- if (msp == null || msp.isStarted())
- return;
-
- MonitoredPort port = (MonitoredPort) msp;
- port.setMonitorPort(monitor.startMonitoring(msp.getServer(), msp.getServerPort(), msp.getMonitorPort()));
- port.setStarted(true);
- }
-
- /**
- * Stop monitoring.
- *
- * @param msp
- */
- public void stopMonitor(IMonitoredServerPort msp) {
- if (msp == null || !msp.isStarted())
- return;
- MonitoredPort port = (MonitoredPort) msp;
- monitor.stopMonitoring(msp.getServer(), msp.getServerPort());
- port.setStarted(false);
- }
-
- /**
- * Returns the mapped port to use when making requests to the given server
- * and port number. Returns the existing port number if the port is not being
- * monitored.
- *
- * @param server a server
- * @param port a port number
- * @param content the content
- * @return the port used for monitoring
- */
- public int getMonitoredPort(IServer server, int port, String content) {
- try {
- Iterator iterator = ports.iterator();
- while (iterator.hasNext()) {
- MonitoredPort mp = (MonitoredPort) iterator.next();
- if (mp.isStarted() && mp.server.equals(server) && mp.port.getPort() == port) {
- String[] contentTypes = mp.getContentTypes();
- boolean found = false;
- if (content == null || contentTypes != null) {
- int size = contentTypes.length;
- for (int i = 0; i < size; i++)
- if (content.equals(contentTypes[i]))
- found = true;
- } else
- found = true;
- if (found && mp.newPort != -1)
- return mp.newPort;
- }
- }
- } catch (Exception e) {
- // ignore
- }
- return port;
- }
-
- protected void saveMonitors() {
- String filename = ServerPlugin.getInstance().getStateLocation().append(MONITOR_DATA_FILE).toOSString();
- try {
- XMLMemento memento = XMLMemento.createWriteRoot("monitors");
-
- Iterator iterator = ports.iterator();
- while (iterator.hasNext()) {
- MonitoredPort mp = (MonitoredPort) iterator.next();
- if (mp.canSave()) {
- IMemento child = memento.createChild("monitor");
- mp.save(child);
- }
- }
-
- memento.saveToFile(filename);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error saving monitor info", e);
- }
- }
-
- protected void loadMonitors() {
- Trace.trace(Trace.FINEST, "Loading monitor info");
- String filename = ServerPlugin.getInstance().getStateLocation().append(MONITOR_DATA_FILE).toOSString();
-
- try {
- IMemento memento = XMLMemento.loadMemento(filename);
-
- IMemento[] children = memento.getChildren("monitor");
- int size = children.length;
-
- for (int i = 0; i < size; i++) {
- try {
- MonitoredPort mp = new MonitoredPort(children[i], null);
- ports.add(mp);
- } catch (Exception e) {
- Trace.trace(Trace.WARNING, "Could not load monitor: " + e);
- }
- }
- } catch (Exception e) {
- Trace.trace(Trace.WARNING, "Could not load monitor info: " + e.getMessage());
- }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerNotificationManager.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerNotificationManager.java
deleted file mode 100644
index 38f2d4ae9..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerNotificationManager.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.wst.server.core.IServerListener;
-import org.eclipse.wst.server.core.ServerEvent;
-/**
- * Notification manager for server.
- */
-public class ServerNotificationManager {
- private List listenerList = new ArrayList();
-
- /**
- * For masking event on all changes.
- */
- public static final int ALL_EVENTS = 0xFFFF;
-
- private class ListenerEntry {
- private IServerListener listener;
- private int eventMask;
-
- private ListenerEntry(IServerListener curListener, int curEventMask) {
- listener = curListener;
- eventMask = curEventMask;
- }
-
- protected IServerListener getListener() {
- return listener;
- }
-
- protected int getEventMask() {
- return eventMask;
- }
- }
-
- /**
- * Create a new notification manager.
- */
- public ServerNotificationManager() {
- super();
- }
-
- /**
- * Add listener for all events.
- *
- * @param curListener
- */
- public void addListener(IServerListener curListener) {
- addListener(curListener, ALL_EVENTS);
- }
-
- /**
- * Add listener for the events specified by the mask.
- *
- * @param curListener
- * @param eventMask
- */
- public void addListener(IServerListener curListener, int eventMask) {
- Trace.trace(Trace.FINEST, "->- Adding server listener to notification manager: " + curListener + " " + eventMask + " ->-");
- if (curListener == null) {
- return;
- }
-
- synchronized (listenerList) {
- listenerList.add(new ListenerEntry(curListener, eventMask));
- }
- }
-
- protected void broadcastChange(ServerEvent event) {
- Trace.trace(Trace.FINEST, "->- Broadcasting server event: " + event + " ->-");
- if (event == null) {
- return;
- }
- int eventKind = event.getKind();
- Trace.trace(Trace.FINEST, " Server event kind: " + eventKind + " ->-");
-
- // only notify listeners that listen to module event
- int size;
- ListenerEntry[] listeners;
- synchronized (listenerList) {
- size = listenerList.size();
- listeners = (ListenerEntry[]) listenerList.toArray(new ListenerEntry[size]);
- }
- for (int i = 0; i < size; i++) {
- ListenerEntry curEntry = listeners[i];
- int mask = curEntry.getEventMask();
-
- // check if the type of the event matches the mask, e.g. server or module change
- boolean isTypeMatch = ((mask & eventKind & ServerEvent.SERVER_CHANGE) != 0)
- || ((mask & eventKind & ServerEvent.MODULE_CHANGE) != 0);
- // check the kind of change
- boolean isKindMatch = (mask & eventKind ^ ServerEvent.SERVER_CHANGE ^ ServerEvent.MODULE_CHANGE) != 0;
-
- if (isTypeMatch && isKindMatch) {
- Trace.trace(Trace.FINEST, "->- Firing server event to listener: " + curEntry.getListener() + " ->-");
- try {
- Trace.trace(Trace.LISTENERS, " Firing server event to listener: " + curEntry.getListener());
- curEntry.getListener().serverChanged(event);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, " Error firing server event: " + curEntry.getListener(), e);
- }
- Trace.trace(Trace.LISTENERS, "-<- Done Firing server event -<-");
- }
- }
- Trace.trace(Trace.FINEST, "-<- Done broadcasting server event -<-");
- }
-
- /**
- * Returns true if the listener list is not empty; otherwise, returns false.
- *
- * @return true if the listener list is not empty; otherwise, returns false
- */
- protected boolean hasListenerEntries() {
- return listenerList.size() == 0;
- }
-
- /**
- * Remove a listener from notification.
- *
- * @param curListener
- */
- public void removeListener(IServerListener curListener) {
- Trace.trace(Trace.FINEST, "->- Removing server listener from notification manager: " + curListener + " ->-");
- if (curListener == null) {
- return;
- }
- ListenerEntry matchedListenerEntry = null;
- Iterator listenerIter = listenerList.iterator();
- while (matchedListenerEntry == null && listenerIter.hasNext()) {
- ListenerEntry curEntry = (ListenerEntry)listenerIter.next();
- if (curListener.equals(curEntry.getListener())) {
- matchedListenerEntry = curEntry;
- }
- }
- if (matchedListenerEntry != null) {
- synchronized (listenerList) {
- listenerList.remove(matchedListenerEntry);
- }
- }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerPlugin.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerPlugin.java
deleted file mode 100644
index abd1e1eac..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerPlugin.java
+++ /dev/null
@@ -1,1050 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import java.io.*;
-import java.util.*;
-import java.text.DateFormat;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.server.core.IModuleArtifact;
-import org.eclipse.wst.server.core.IRuntimeType;
-import org.eclipse.wst.server.core.ServerCore;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleEvent;
-import org.osgi.framework.BundleListener;
-/**
- * The main server plugin class.
- */
-public class ServerPlugin extends Plugin {
- public static final String PROJECT_PREF_FILE = ".serverPreference";
-
- private static final String SHUTDOWN_JOB_FAMILY = "org.eclipse.wst.server.core.family";
-
- protected static final DateFormat df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
- protected static int num = 0;
-
- // cached copy of all launchable adapters
- private static List launchableAdapters;
-
- // cached copy of all launchable clients
- private static List clients;
-
- // cached copy of all module factories
- private static List moduleFactories;
-
- // singleton instance of this class
- private static ServerPlugin singleton;
-
- // cached copy of all publish tasks
- private static List publishTasks;
-
- // cached copy of all server monitors
- private static List monitors;
-
- // cached copy of all runtime locators
- private static List runtimeLocators;
-
- // cached copy of all module artifact adapters
- private static List moduleArtifactAdapters;
-
- // cached copy of all installable servers
- private static List installableServers;
-
- // cached copy of all installable runtimes
- private static List installableRuntimes;
-
- // registry listener
- private static IRegistryChangeListener registryListener;
-
- public static BundleContext bundleContext;
-
- // bundle listener
- private BundleListener bundleListener;
-
- private static final String TEMP_DATA_FILE = "tmp-data.xml";
-
- class TempDir {
- String path;
- int age;
- }
-
- // temp directories - String key to TempDir
- protected Map tempDirHash;
-
- /**
- * server core plugin id
- */
- public static final String PLUGIN_ID = "org.eclipse.wst.server.core";
-
- /**
- * Create the ServerPlugin.
- */
- public ServerPlugin() {
- super();
- singleton = this;
- }
-
- /**
- * Returns the singleton instance of this plugin.
- *
- * @return org.eclipse.wst.server.core.internal.plugin.ServerPlugin
- */
- public static ServerPlugin getInstance() {
- return singleton;
- }
-
- /**
- * Returns a temporary directory that the requestor can use
- * throughout it's lifecycle. This is primary to be used by
- * server instances for working directories, instance specific
- * files, etc.
- *
- * <p>As long as the same key is used to call this method on
- * each use of the workbench, this method directory will return
- * the same directory. If the directory is not requested over a
- * period of time, the directory may be deleted and a new one
- * will be assigned on the next request. For this reason, a
- * server instance should request the temp directory on startup
- * if it wants to store files there. In all cases, the instance
- * should have a backup plan anyway, as this directory may be
- * deleted accidentally.</p>
- *
- * @param key
- * @return java.io.File
- */
- public IPath getTempDirectory(String key) {
- if (key == null)
- return null;
-
- // first, look through hash of current directories
- IPath statePath = ServerPlugin.getInstance().getStateLocation();
- try {
- TempDir dir = (TempDir) tempDirHash.get(key);
- if (dir != null) {
- dir.age = 0;
- return statePath.append(dir.path);
- }
- } catch (Exception e) {
- // ignore
- }
-
- // otherwise, create a new directory
-
- // find first free directory
- String path = null;
- File dir = null;
- int count = 0;
- while (dir == null || dir.exists()) {
- path = "tmp" + count;
- dir = statePath.append(path).toFile();
- count ++;
- }
-
- dir.mkdirs();
-
- TempDir d = new TempDir();
- d.path = path;
- tempDirHash.put(key, d);
- saveTempDirInfo();
- return statePath.append(path);
- }
-
- /**
- * Remove a temp directory.
- * @param key
- */
- public void removeTempDirectory(String key) {
- if (key == null)
- return;
-
- IPath statePath = ServerPlugin.getInstance().getStateLocation();
- try {
- TempDir dir = (TempDir) tempDirHash.get(key);
- if (dir != null) {
- tempDirHash.remove(key);
- saveTempDirInfo();
- deleteDirectory(statePath.append(dir.path).toFile(), null);
- }
- } catch (Exception e) {
- Trace.trace(Trace.WARNING, "Could not remove temp directory", e);
- }
- }
-
- /**
- * Load the temporary directory information.
- */
- private void loadTempDirInfo() {
- Trace.trace(Trace.FINEST, "Loading temporary directory information");
- IPath statePath = ServerPlugin.getInstance().getStateLocation();
- String filename = statePath.append(TEMP_DATA_FILE).toOSString();
-
- tempDirHash = new HashMap();
- try {
- IMemento memento = XMLMemento.loadMemento(filename);
-
- IMemento[] children = memento.getChildren("temp-directory");
- int size = children.length;
- for (int i = 0; i < size; i++) {
- String key = children[i].getString("key");
-
- TempDir d = new TempDir();
- d.path = children[i].getString("path");
- d.age = children[i].getInteger("age").intValue();
- d.age++;
-
- tempDirHash.put(key, d);
- }
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not load temporary directory information: " + e.getMessage());
- }
- }
-
- /**
- * Convenience method for logging.
- *
- * @param status org.eclipse.core.runtime.IStatus
- */
- public static void log(IStatus status) {
- getInstance().getLog().log(status);
- }
-
- /**
- * Save the temporary directory information.
- */
- private void saveTempDirInfo() {
- // save remaining directories
- IPath statePath = ServerPlugin.getInstance().getStateLocation();
- String filename = statePath.append(TEMP_DATA_FILE).toOSString();
-
- try {
- XMLMemento memento = XMLMemento.createWriteRoot("temp-directories");
-
- Iterator iterator = tempDirHash.keySet().iterator();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
- TempDir d = (TempDir) tempDirHash.get(key);
-
- if (d.age < 5) {
- IMemento child = memento.createChild("temp-directory");
- child.putString("key", key);
- child.putString("path", d.path);
- child.putInteger("age", d.age);
- } else
- deleteDirectory(statePath.append(d.path).toFile(), null);
- }
-
- memento.saveToFile(filename);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not save temporary directory information", e);
- }
- }
-
- protected void initializeDefaultPluginPreferences() {
- ServerPreferences.getInstance().setDefaults();
- }
-
- /**
- * @see Plugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- Trace.trace(Trace.CONFIG, "----->----- Server Core plugin startup ----->-----");
- super.start(context);
- bundleContext = context;
-
- initializeDefaultPluginPreferences();
-
- // load temp directory information
- loadTempDirInfo();
-
- bundleListener = new BundleListener() {
- public void bundleChanged(BundleEvent event) {
- String bundleId = event.getBundle().getSymbolicName();
- //System.out.println(event.getType() + " " + bundleId);
- // TODO should also look for UNINSTALLED and UNRESOLVED
- if (BundleEvent.STOPPED == event.getType() && ResourceManager.getInstance().isActiveBundle(bundleId))
- stopBundle(bundleId);
- }
- };
- context.addBundleListener(bundleListener);
- }
-
- protected void stopBundle(final String bundleId) {
- class StopJob extends Job {
- public StopJob() {
- super("Disposing servers");
- }
-
- public boolean belongsTo(Object family) {
- return SHUTDOWN_JOB_FAMILY.equals(family);
- }
-
- public IStatus run(IProgressMonitor monitor2) {
- ResourceManager.getInstance().shutdownBundle(bundleId);
- return new Status(IStatus.OK, PLUGIN_ID, 0, "", null);
- }
- }
-
- StopJob job = new StopJob();
- job.setUser(false);
- job.schedule();
- }
-
- /**
- * @see Plugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- Trace.trace(Trace.CONFIG, "-----<----- Server Core plugin shutdown -----<-----");
- super.stop(context);
-
- if (registryListener != null)
- Platform.getExtensionRegistry().removeRegistryChangeListener(registryListener);
-
- ResourceManager.shutdown();
- ServerMonitorManager.shutdown();
-
- try {
- Platform.getJobManager().join(SHUTDOWN_JOB_FAMILY, null);
- } catch (Exception e) {
- Trace.trace(Trace.WARNING, "Error waiting for shutdown job", e);
- }
- context.removeBundleListener(bundleListener);
- }
-
- public static String[] tokenize(String param, String delim) {
- if (param == null)
- return new String[0];
-
- List list = new ArrayList();
-
- StringTokenizer st = new StringTokenizer(param, delim);
- while (st.hasMoreTokens()) {
- String str = st.nextToken();
- if (str != null && str.length() > 0)
- list.add(str.trim());
- }
-
- String[] s = new String[list.size()];
- list.toArray(s);
- return s;
- }
-
- protected static List getModuleTypes(IConfigurationElement[] elements) {
- List list = new ArrayList();
- if (elements == null)
- return list;
-
- int size = elements.length;
- for (int i = 0; i < size; i++) {
- String[] types = tokenize(elements[i].getAttribute("types"), ",");
- String[] versions = tokenize(elements[i].getAttribute("versions"), ",");
- int sizeT = types.length;
- int sizeV = versions.length;
- for (int j = 0; j < sizeT; j++) {
- for (int k = 0; k < sizeV; k++) {
- ModuleType module = new ModuleType(types[j], versions[k]);
- list.add(module);
- }
- }
- }
- return list;
- }
-
- public static String generateId() {
- String s = df.format(new Date()).toString() + num++;
- s = s.replace(' ', '_');
- s = s.replace(':', '_');
- s = s.replace('/', '_');
- s = s.replace('\\', '_');
- return s;
- }
-
- /**
- * Returns true if ids contains id.
- *
- * @param ids
- * @param id
- * @return true if the id is supported
- */
- public static boolean supportsType(String[] ids, String id) {
- if (id == null || id.length() == 0)
- return false;
-
- if (ids == null)
- return true;
-
- int size = ids.length;
- for (int i = 0; i < size; i++) {
- if (ids[i].endsWith("*")) {
- if (id.length() >= ids[i].length() && id.startsWith(ids[i].substring(0, ids[i].length() - 1)))
- return true;
- } else if (id.equals(ids[i]))
- return true;
- }
- return false;
- }
-
- /**
- * Recursively delete a directory.
- *
- * @param dir java.io.File
- * @param monitor a progress monitor, or <code>null</code> if no progress
- * reporting is required
- */
- public static void deleteDirectory(File dir, IProgressMonitor monitor) {
- try {
- if (!dir.exists() || !dir.isDirectory())
- return;
-
- File[] files = dir.listFiles();
- int size = files.length;
- monitor = ProgressUtil.getMonitorFor(monitor);
- monitor.beginTask(NLS.bind(Messages.deletingTask, new String[] {dir.getAbsolutePath()}), size * 10);
-
- // cycle through files
- for (int i = 0; i < size; i++) {
- File current = files[i];
- if (current.isFile()) {
- current.delete();
- monitor.worked(10);
- } else if (current.isDirectory()) {
- monitor.subTask(NLS.bind(Messages.deletingTask, new String[] {current.getAbsolutePath()}));
- deleteDirectory(current, ProgressUtil.getSubMonitorFor(monitor, 10));
- }
- }
- dir.delete();
- monitor.done();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error deleting directory " + dir.getAbsolutePath(), e);
- }
- }
-
- /**
- * Returns an array of all known launchable adapters.
- * <p>
- * A new array is returned on each call, so clients may store or modify the result.
- * </p>
- *
- * @return a possibly-empty array of launchable adapters {@link ILaunchableAdapter}
- */
- public static ILaunchableAdapter[] getLaunchableAdapters() {
- if (launchableAdapters == null)
- loadLaunchableAdapters();
- ILaunchableAdapter[] la = new ILaunchableAdapter[launchableAdapters.size()];
- launchableAdapters.toArray(la);
- return la;
- }
-
- /**
- * Returns an array of all known client instances.
- * <p>
- * A new array is returned on each call, so clients may store or modify the result.
- * </p>
- *
- * @return a possibly-empty array of client instances {@link IClient}
- */
- public static IClient[] getClients() {
- if (clients == null)
- loadClients();
- IClient[] c = new IClient[clients.size()];
- clients.toArray(c);
- return c;
- }
-
- /**
- * Load the launchable adapters extension point.
- */
- private static synchronized void loadLaunchableAdapters() {
- if (launchableAdapters != null)
- return;
- Trace.trace(Trace.EXTENSION_POINT, "->- Loading .launchableAdapters extension point ->-");
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IConfigurationElement[] cf = registry.getConfigurationElementsFor(ServerPlugin.PLUGIN_ID, "launchableAdapters");
-
- int size = cf.length;
- launchableAdapters = new ArrayList(size);
- for (int i = 0; i < size; i++) {
- try {
- launchableAdapters.add(new LaunchableAdapter(cf[i]));
- Trace.trace(Trace.EXTENSION_POINT, " Loaded launchableAdapter: " + cf[i].getAttribute("id"));
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, " Could not load launchableAdapter: " + cf[i].getAttribute("id"), t);
- }
- }
- Trace.trace(Trace.EXTENSION_POINT, "-<- Done loading .launchableAdapters extension point -<-");
- }
-
- /**
- * Load the client extension point.
- */
- private static synchronized void loadClients() {
- if (clients != null)
- return;
- Trace.trace(Trace.EXTENSION_POINT, "->- Loading .clients extension point ->-");
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IConfigurationElement[] cf = registry.getConfigurationElementsFor(ServerPlugin.PLUGIN_ID, "clients");
-
- int size = cf.length;
- clients = new ArrayList(size);
- for (int i = 0; i < size; i++) {
- try {
- clients.add(new Client(cf[i]));
- Trace.trace(Trace.EXTENSION_POINT, " Loaded clients: " + cf[i].getAttribute("id"));
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, " Could not load clients: " + cf[i].getAttribute("id"), t);
- }
- }
-
- // sort by index to put lower numbers first in order
- size = clients.size();
- for (int i = 0; i < size-1; i++) {
- for (int j = i+1; j < size; j++) {
- Client a = (Client) clients.get(i);
- Client b = (Client) clients.get(j);
- if (a.getPriority() < b.getPriority()) {
- clients.set(i, b);
- clients.set(j, a);
- }
- }
- }
-
- Trace.trace(Trace.EXTENSION_POINT, "-<- Done loading .clients extension point -<-");
- }
-
- /**
- * Returns an array of all known publish tasks.
- * <p>
- * A new array is returned on each call, so clients may store or modify the result.
- * </p>
- *
- * @return a possibly-empty array of publish tasks instances {@link IPublishTask}
- */
- public static IPublishTask[] getPublishTasks() {
- if (publishTasks == null)
- loadPublishTasks();
- IPublishTask[] st = new IPublishTask[publishTasks.size()];
- publishTasks.toArray(st);
- return st;
- }
-
- /**
- * Load the publish task extension point.
- */
- private static synchronized void loadPublishTasks() {
- if (publishTasks != null)
- return;
- Trace.trace(Trace.EXTENSION_POINT, "->- Loading .publishTasks extension point ->-");
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IConfigurationElement[] cf = registry.getConfigurationElementsFor(ServerPlugin.PLUGIN_ID, "publishTasks");
-
- int size = cf.length;
- publishTasks = new ArrayList(size);
- for (int i = 0; i < size; i++) {
- try {
- publishTasks.add(new PublishTask(cf[i]));
- Trace.trace(Trace.EXTENSION_POINT, " Loaded publishTask: " + cf[i].getAttribute("id"));
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, " Could not load publishTask: " + cf[i].getAttribute("id"), t);
- }
- }
-
- Trace.trace(Trace.EXTENSION_POINT, "-<- Done loading .publishTasks extension point -<-");
- }
-
- /**
- * Sort the given list of IOrdered items into indexed order.
- *
- * @param list java.util.List
- * @return java.util.List
- */
- private static List sortOrderedList(List list) {
- if (list == null)
- return null;
-
- int size = list.size();
- for (int i = 0; i < size - 1; i++) {
- for (int j = i + 1; j < size; j++) {
- IOrdered a = (IOrdered) list.get(i);
- IOrdered b = (IOrdered) list.get(j);
- if (a.getOrder() > b.getOrder()) {
- Object temp = a;
- list.set(i, b);
- list.set(j, temp);
- }
- }
- }
- return list;
- }
-
- /**
- * Returns an array of all known module module factories.
- * <p>
- * A new array is returned on each call, so clients may store or modify the result.
- * </p>
- *
- * @return the array of module factories {@link ModuleFactory}
- */
- public static ModuleFactory[] getModuleFactories() {
- if (moduleFactories == null)
- loadModuleFactories();
-
- ModuleFactory[] mf = new ModuleFactory[moduleFactories.size()];
- moduleFactories.toArray(mf);
- return mf;
- }
-
- /**
- * Returns the module factory with the given id, or <code>null</code>
- * if none. This convenience method searches the list of known
- * module factories ({@link #getModuleFactories()}) for the one a matching
- * module factory id ({@link ModuleFactory#getId()}). The id may not be null.
- *
- * @param id the module factory id
- * @return the module factory, or <code>null</code> if there is no module factory
- * with the given id
- */
- public static ModuleFactory findModuleFactory(String id) {
- if (id == null)
- throw new IllegalArgumentException();
-
- if (moduleFactories == null)
- loadModuleFactories();
-
- Iterator iterator = moduleFactories.iterator();
- while (iterator.hasNext()) {
- ModuleFactory factory = (ModuleFactory) iterator.next();
- if (id.equals(factory.getId()))
- return factory;
- }
- return null;
- }
-
- /**
- * Load the module factories extension point.
- */
- private static synchronized void loadModuleFactories() {
- if (moduleFactories != null)
- return;
- Trace.trace(Trace.EXTENSION_POINT, "->- Loading .moduleFactories extension point ->-");
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IConfigurationElement[] cf = registry.getConfigurationElementsFor(ServerPlugin.PLUGIN_ID, "moduleFactories");
-
- int size = cf.length;
- moduleFactories = new ArrayList(size);
- for (int i = 0; i < size; i++) {
- try {
- moduleFactories.add(new ModuleFactory(cf[i]));
- Trace.trace(Trace.EXTENSION_POINT, " Loaded moduleFactories: " + cf[i].getAttribute("id"));
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, " Could not load moduleFactories: " + cf[i].getAttribute("id"), t);
- }
- }
- sortOrderedList(moduleFactories);
-
- Trace.trace(Trace.EXTENSION_POINT, "-<- Done loading .moduleFactories extension point -<-");
- }
-
- /**
- * Returns all projects contained by the server. This included the
- * projects that are in the configuration, as well as their
- * children, and their children...
- *
- * @param server a server
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @return a possibly-empty array of module instances {@link IModule}
- */
- /*public static IModule[] getAllContainedModules(IServer server, IProgressMonitor monitor) {
- //Trace.trace("> getAllContainedModules: " + getName(configuration));
- List modules = new ArrayList();
- if (server == null)
- return new IModule[0];
-
- // get all of the directly contained projects
- IModule[] deploys = server.getModules();
- if (deploys == null || deploys.length == 0)
- return new IModule[0];
-
- int size = deploys.length;
- for (int i = 0; i < size; i++) {
- if (deploys[i] != null && !modules.contains(deploys[i]))
- modules.add(deploys[i]);
- }
-
- //Trace.trace(" getAllContainedModules: root level done");
-
- // get all of the module's children
- int count = 0;
- while (count < modules.size()) {
- IModule module = (IModule) modules.get(count);
- try {
- IModule[] children = server.getChildModules(module, monitor);
- if (children != null) {
- size = children.length;
- for (int i = 0; i < size; i++) {
- if (children[i] != null && !modules.contains(children[i]))
- modules.add(children[i]);
- }
- }
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error getting child modules for: " + module.getName(), e);
- }
- count ++;
- }
-
- //Trace.trace("< getAllContainedModules");
-
- IModule[] modules2 = new IModule[modules.size()];
- modules.toArray(modules2);
- return modules2;
- }*/
-
- /**
- * Returns an array of all known server monitor instances.
- * <p>
- * A new array is returned on each call, so clients may store or modify the result.
- * </p>
- *
- * @return a possibly-empty array of server monitor instances {@link IServerMonitor}
- */
- public static IServerMonitor[] getServerMonitors() {
- if (monitors == null)
- loadServerMonitors();
- IServerMonitor[] sm = new IServerMonitor[monitors.size()];
- monitors.toArray(sm);
- return sm;
- }
-
- /**
- * Load the server monitor extension point.
- */
- private static synchronized void loadServerMonitors() {
- if (monitors != null)
- return;
- Trace.trace(Trace.EXTENSION_POINT, "->- Loading .serverMonitors extension point ->-");
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IConfigurationElement[] cf = registry.getConfigurationElementsFor(ServerPlugin.PLUGIN_ID, "internalServerMonitors");
-
- int size = cf.length;
- monitors = new ArrayList(size);
- for (int i = 0; i < size; i++) {
- try {
- monitors.add(new ServerMonitor(cf[i]));
- Trace.trace(Trace.EXTENSION_POINT, " Loaded serverMonitor: " + cf[i].getAttribute("id"));
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, " Could not load serverMonitor: " + cf[i].getAttribute("id"), t);
- }
- }
-
- Trace.trace(Trace.EXTENSION_POINT, "-<- Done loading .serverMonitors extension point -<-");
- }
-
- /**
- * Returns an array of all known runtime locator instances.
- * <p>
- * A new array is returned on each call, so clients may store or modify the result.
- * </p>
- *
- * @return a possibly-empty array of runtime locator instances {@link IRuntimeLocator}
- */
- public static IRuntimeLocator[] getRuntimeLocators() {
- if (runtimeLocators == null)
- loadRuntimeLocators();
- IRuntimeLocator[] rl = new IRuntimeLocator[runtimeLocators.size()];
- runtimeLocators.toArray(rl);
- return rl;
- }
-
- /**
- * Load the runtime locators.
- */
- private static synchronized void loadRuntimeLocators() {
- if (runtimeLocators != null)
- return;
- Trace.trace(Trace.EXTENSION_POINT, "->- Loading .runtimeLocators extension point ->-");
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IConfigurationElement[] cf = registry.getConfigurationElementsFor(ServerPlugin.PLUGIN_ID, "runtimeLocators");
-
- int size = cf.length;
- runtimeLocators = new ArrayList(size);
- for (int i = 0; i < size; i++) {
- try {
- RuntimeLocator runtimeLocator = new RuntimeLocator(cf[i]);
- runtimeLocators.add(runtimeLocator);
- Trace.trace(Trace.EXTENSION_POINT, " Loaded runtimeLocator: " + cf[i].getAttribute("id"));
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, " Could not load runtimeLocator: " + cf[i].getAttribute("id"), t);
- }
- }
-
- Trace.trace(Trace.EXTENSION_POINT, "-<- Done loading .runtimeLocators extension point -<-");
- }
-
- /**
- * Returns an array of all module artifact adapters.
- *
- * @return a possibly empty array of module artifact adapters
- */
- protected static ModuleArtifactAdapter[] getModuleArtifactAdapters() {
- if (moduleArtifactAdapters == null)
- loadModuleArtifactAdapters();
-
- ModuleArtifactAdapter[] moa = new ModuleArtifactAdapter[moduleArtifactAdapters.size()];
- moduleArtifactAdapters.toArray(moa);
- return moa;
- }
-
- /**
- * Load the module artifact adapters extension point.
- */
- private static synchronized void loadModuleArtifactAdapters() {
- if (moduleArtifactAdapters != null)
- return;
- Trace.trace(Trace.EXTENSION_POINT, "->- Loading .moduleArtifactAdapters extension point ->-");
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IConfigurationElement[] cf = registry.getConfigurationElementsFor(ServerPlugin.PLUGIN_ID, "moduleArtifactAdapters");
-
- int size = cf.length;
- moduleArtifactAdapters = new ArrayList(size);
- for (int i = 0; i < size; i++) {
- try {
- moduleArtifactAdapters.add(new ModuleArtifactAdapter(cf[i]));
- Trace.trace(Trace.EXTENSION_POINT, " Loaded moduleArtifactAdapter: " + cf[i].getAttribute("id"));
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, " Could not load moduleArtifactAdapter: " + cf[i].getAttribute("id"), t);
- }
- }
-
- // sort by index to put lower numbers first in order
- size = moduleArtifactAdapters.size();
- for (int i = 0; i < size-1; i++) {
- for (int j = i+1; j < size; j++) {
- ModuleArtifactAdapter a = (ModuleArtifactAdapter) moduleArtifactAdapters.get(i);
- ModuleArtifactAdapter b = (ModuleArtifactAdapter) moduleArtifactAdapters.get(j);
- if (a.getPriority() < b.getPriority()) {
- moduleArtifactAdapters.set(i, b);
- moduleArtifactAdapters.set(j, a);
- }
- }
- }
-
- Trace.trace(Trace.EXTENSION_POINT, "-<- Done loading .moduleArtifactAdapters extension point -<-");
- }
-
- /**
- * Returns <code>true</code> if a module artifact may be available for the given object,
- * and <code>false</code> otherwise.
- *
- * @param obj an object
- * @return <code>true</code> if there is a module artifact adapter
- */
- public static boolean hasModuleArtifact(Object obj) {
- Trace.trace(Trace.FINEST, "ServerPlugin.hasModuleArtifact() " + obj);
- ModuleArtifactAdapter[] adapters = getModuleArtifactAdapters();
- if (adapters != null) {
- int size = adapters.length;
- for (int i = 0; i < size; i++) {
- try {
- if (adapters[i].isEnabled(obj)) {
- Trace.trace(Trace.FINER, "Run On Server for " + obj + " is enabled by " + adapters[i].getId());
- return true;
- }
- } catch (CoreException ce) {
- Trace.trace(Trace.WARNING, "Could not use moduleArtifactAdapter", ce);
- }
- }
- }
-
- return false;
- }
-
- /**
- * Returns a module artifact if one can be found without loading plugins.
- *
- * @param obj
- * @return a module artifact, or null
- */
- public static IModuleArtifact getModuleArtifact(Object obj) {
- Trace.trace(Trace.FINEST, "ServerPlugin.getModuleArtifact() " + obj);
- ModuleArtifactAdapter[] adapters = getModuleArtifactAdapters();
- if (adapters != null) {
- int size = adapters.length;
- for (int i = 0; i < size; i++) {
- try {
- if (adapters[i].isEnabled(obj)) {
- IModuleArtifact ma = adapters[i].getModuleArtifact(obj);
- if (ma != null)
- return ma;
- /*if (Platform.getAdapterManager().hasAdapter(obj, MODULE_ARTIFACT_CLASS)) {
- return (IModuleArtifact) Platform.getAdapterManager().getAdapter(obj, MODULE_ARTIFACT_CLASS);
- }*/
- }
- } catch (Exception e) {
- Trace.trace(Trace.WARNING, "Could not use moduleArtifactAdapter " + adapters[i], e);
- }
- }
- }
-
- return null;
- }
-
- /**
- * Returns a module artifact if possible, loading any plugins required.
- *
- * @param obj
- * @return a module artifact, or null
- */
- public static IModuleArtifact loadModuleArtifact(Object obj) {
- Trace.trace(Trace.FINEST, "ServerPlugin.loadModuleArtifact() " + obj);
- ModuleArtifactAdapter[] adapters = getModuleArtifactAdapters();
- if (adapters != null) {
- int size = adapters.length;
- for (int i = 0; i < size; i++) {
- try {
- if (adapters[i].isEnabled(obj)) {
- IModuleArtifact ma = adapters[i].getModuleArtifact(obj);
- if (ma != null)
- return ma;
- /*if (Platform.getAdapterManager().hasAdapter(obj, MODULE_ARTIFACT_CLASS)) {
- return (IModuleArtifact) Platform.getAdapterManager().loadAdapter(obj, MODULE_ARTIFACT_CLASS);
- }*/
- }
- } catch (Exception e) {
- Trace.trace(Trace.WARNING, "Could not use moduleArtifactAdapter " + adapters[i], e);
- }
- }
- }
-
- return null;
- }
-
- /**
- * Returns an array of all known installable servers.
- * <p>
- * A new array is returned on each call, so clients may store or modify the result.
- * </p>
- *
- * @return the array of installable servers {@link IInstallableServer}
- */
- public static IInstallableServer[] getInstallableServers() {
- if (installableServers == null)
- loadInstallableServers();
-
- List availableServers = new ArrayList();
- Iterator iterator = installableServers.iterator();
- IRuntimeType[] runtimeTypes = ServerCore.getRuntimeTypes();
- int size = runtimeTypes.length;
- while (iterator.hasNext()) {
- IInstallableServer server = (IInstallableServer) iterator.next();
- boolean found = false;
- for (int i = 0; i < size; i++) {
- if (server.getId().equals(runtimeTypes[i].getId()))
- found = true;
- }
- if (!found)
- availableServers.add(server);
- }
-
- IInstallableServer[] is = new IInstallableServer[availableServers.size()];
- availableServers.toArray(is);
- return is;
- }
-
- /**
- * Returns an array of all known installable runtimes.
- * <p>
- * A new array is returned on each call, so clients may store or modify the result.
- * </p>
- *
- * @return the array of installable runtimes {@link IInstallableRuntime}
- */
- public static IInstallableRuntime[] getInstallableRuntimes() {
- if (installableRuntimes == null)
- loadInstallableRuntimes();
-
- /*List availableServers = new ArrayList();
- Iterator iterator = installableServers.iterator();
- IRuntimeType[] runtimeTypes = ServerCore.getRuntimeTypes();
- int size = runtimeTypes.length;
- while (iterator.hasNext()) {
- IInstallableServer server = (IInstallableServer) iterator.next();
- boolean found = false;
- for (int i = 0; i < size; i++) {
- if (server.getId().equals(runtimeTypes[i].getId()))
- found = true;
- }
- if (!found)
- availableServers.add(server);
- }*/
-
- IInstallableRuntime[] ir = new IInstallableRuntime[installableRuntimes.size()];
- installableRuntimes.toArray(ir);
- return ir;
- }
-
- /**
- * Load the installable servers.
- */
- private static synchronized void loadInstallableServers() {
- if (installableServers != null)
- return;
- Trace.trace(Trace.EXTENSION_POINT, "->- Loading .installableServers extension point ->-");
-
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IConfigurationElement[] cf = registry.getConfigurationElementsFor(ServerPlugin.PLUGIN_ID, "installableServers");
-
- int size = cf.length;
- installableServers = new ArrayList(size);
- for (int i = 0; i < size; i++) {
- try {
- InstallableServer is = new InstallableServer(cf[i]);
- installableServers.add(is);
- Trace.trace(Trace.EXTENSION_POINT, " Loaded installableServer: " + cf[i].getAttribute("id"));
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, " Could not load installableServer: " + cf[i].getAttribute("id"), t);
- }
- }
-
- Trace.trace(Trace.EXTENSION_POINT, "-<- Done loading .installableServers extension point -<-");
- }
-
- /**
- * Load the installable runtimes.
- */
- private static synchronized void loadInstallableRuntimes() {
- if (installableRuntimes != null)
- return;
- Trace.trace(Trace.EXTENSION_POINT, "->- Loading .installableRuntimes extension point ->-");
-
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IConfigurationElement[] cf = registry.getConfigurationElementsFor(ServerPlugin.PLUGIN_ID, "installableRuntimes");
-
- int size = cf.length;
- installableRuntimes = new ArrayList(size);
- for (int i = 0; i < size; i++) {
- try {
- InstallableRuntime ir = new InstallableRuntime(cf[i]);
- installableRuntimes.add(ir);
- Trace.trace(Trace.EXTENSION_POINT, " Loaded installableRuntime: " + cf[i].getAttribute("id"));
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, " Could not load installableRuntime: " + cf[i].getAttribute("id"), t);
- }
- }
-
- Trace.trace(Trace.EXTENSION_POINT, "-<- Done loading .installableRuntimes extension point -<-");
- }
-
- public static void setRegistryListener(IRegistryChangeListener listener) {
- registryListener = listener;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerPreferences.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerPreferences.java
deleted file mode 100644
index 3a0002bd3..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerPreferences.java
+++ /dev/null
@@ -1,314 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import org.eclipse.core.runtime.*;
-/**
- * Helper class that stores preference information for server tools.
- */
-public class ServerPreferences {
- private static final String PREF_AUTO_RESTART = "auto-restart";
- private static final String PREF_AUTO_PUBLISH = "auto-publish";
- private static final String PREF_MODULE_START_TIMEOUT = "module-start-timeout";
-
- private static final String PREF_AUTO_PUBLISH_LOCAL = "auto-publish-local";
- private static final String PREF_AUTO_PUBLISH_LOCAL_TIME = "auto-publish-local-time";
- private static final String PREF_AUTO_PUBLISH_REMOTE = "auto-publish-remote";
- private static final String PREF_AUTO_PUBLISH_REMOTE_TIME = "auto-publish-remote-time";
-
- private static final String PREF_MACHINE_SPEED = "machine-speed";
-
- private static final String PREF_SYNC_ON_STARTUP = "sync-on-startup";
-
- private Preferences preferences;
-
- protected static ServerPreferences instance;
-
- /**
- * ServerPreference constructor comment.
- */
- private ServerPreferences() {
- super();
- preferences = ServerPlugin.getInstance().getPluginPreferences();
- }
-
- /**
- * Returns the static instance.
- *
- * @return the static instance
- */
- public static ServerPreferences getInstance() {
- if (instance == null)
- instance = new ServerPreferences();
- return instance;
- }
-
- /**
- * Returns whether servers will be automatically restarted when
- * required.
- *
- * @return boolean
- */
- public boolean isAutoRestarting() {
- return preferences.getBoolean(PREF_AUTO_RESTART);
- }
-
- /**
- * Returns whether servers will be automatically restarted when
- * required.
- *
- * @return boolean
- */
- public boolean isDefaultAutoRestarting() {
- return false;
- }
-
- /**
- * Returns whether publishing should occur before starting the
- * server.
- *
- * @return boolean
- */
- public boolean isAutoPublishing() {
- return preferences.getBoolean(PREF_AUTO_PUBLISH);
- }
-
- /**
- * Returns whether publishing should occur before starting the
- * server.
- *
- * @return boolean
- */
- public boolean isDefaultAutoPublishing() {
- return true;
- }
-
- /**
- * Set whether servers will be automatically restarted when
- * they need a restart.
- *
- * @param value
- */
- public void setAutoRestarting(boolean value) {
- preferences.setValue(PREF_AUTO_RESTART, value);
- ServerPlugin.getInstance().savePluginPreferences();
- }
-
- /**
- * Set whether publishing should happen before the server starts.
- *
- * @param value
- */
- public void setAutoPublishing(boolean value) {
- preferences.setValue(PREF_AUTO_PUBLISH, value);
- ServerPlugin.getInstance().savePluginPreferences();
- }
-
- /**
- * Returns the module start timeout.
- *
- * @return the module start timeout
- */
- public int getModuleStartTimeout() {
- return preferences.getInt(PREF_MODULE_START_TIMEOUT);
- }
-
- /**
- * Return the machine speed index, from 1 to 10.
- *
- * @return the relative speed
- */
- public int getMachineSpeed() {
- return preferences.getInt(PREF_MACHINE_SPEED);
- }
-
- /**
- * Return the default machine speed index, 5.
- *
- * @return the default speed index
- */
- public int getDefaultMachineSpeed() {
- return 5;
- }
-
- /**
- * Sets the relative machine speed index, from 1 to 10.
- *
- * @param speed the relative speed
- */
- public void setMachineSpeed(int speed) {
- preferences.setValue(PREF_MACHINE_SPEED, speed);
- }
-
- /**
- * Return the sync on startup value.
- *
- * @return the sync on startup value
- */
- public boolean isSyncOnStartup() {
- return preferences.getBoolean(PREF_SYNC_ON_STARTUP);
- }
-
- /**
- * Return the default sync on startup value.
- *
- * @return the default sync on startup value
- */
- public boolean getDefaultSyncOnStartup() {
- return false;
- }
-
- /**
- * Sets the sync on startup value.
- *
- * @param sync the sync on startup value
- */
- public void setSyncOnStartup(boolean sync) {
- preferences.setValue(PREF_SYNC_ON_STARTUP, sync);
- }
-
- /**
- * Returns the default setting for local auto-publishing.
- *
- * @return int
- */
- public boolean getDefaultAutoPublishLocal() {
- return false;
- }
-
- /**
- * Returns the setting for local auto-publishing.
- *
- * @return int
- */
- public boolean getAutoPublishLocal() {
- return preferences.getBoolean(PREF_AUTO_PUBLISH_LOCAL);
- }
-
- /**
- * Sets the value for local auto-publishing.
- *
- * @param auto
- */
- public void setAutoPublishLocal(boolean auto) {
- preferences.setValue(PREF_AUTO_PUBLISH_LOCAL, auto);
- ServerPlugin.getInstance().savePluginPreferences();
- }
-
- /**
- * Returns the default setting for local auto-publishing.
- *
- * @return int
- */
- public int getDefaultAutoPublishLocalTime() {
- return 15;
- }
-
- /**
- * Returns the setting for local auto-publishing.
- *
- * @return int
- */
- public int getAutoPublishLocalTime() {
- return preferences.getInt(PREF_AUTO_PUBLISH_LOCAL_TIME);
- }
-
- /**
- * Sets the value for local auto-publishing.
- *
- * @param auto
- */
- public void setAutoPublishLocalTime(int auto) {
- preferences.setValue(PREF_AUTO_PUBLISH_LOCAL_TIME, auto);
- ServerPlugin.getInstance().savePluginPreferences();
- }
-
- /**
- * Returns the default setting for remote auto-publishing.
- *
- * @return int
- */
- public boolean getDefaultAutoPublishRemote() {
- return false;
- }
-
- /**
- * Returns the setting for remote auto-publishing.
- *
- * @return int
- */
- public boolean getAutoPublishRemote() {
- return preferences.getBoolean(PREF_AUTO_PUBLISH_REMOTE);
- }
-
- /**
- * Sets the value for remote auto-publishing.
- *
- * @param auto
- */
- public void setAutoPublishRemote(boolean auto) {
- preferences.setValue(PREF_AUTO_PUBLISH_REMOTE, auto);
- ServerPlugin.getInstance().savePluginPreferences();
- }
-
- /**
- * Returns the default setting for remote auto-publishing.
- *
- * @return int
- */
- public int getDefaultAutoPublishRemoteTime() {
- return 60;
- }
-
- /**
- * Returns the setting for remote auto-publishing.
- *
- * @return int
- */
- public int getAutoPublishRemoteTime() {
- return preferences.getInt(PREF_AUTO_PUBLISH_REMOTE_TIME);
- }
-
- /**
- * Sets the value for remote auto-publishing.
- *
- * @param auto
- */
- public void setAutoPublishRemoteTime(int auto) {
- preferences.setValue(PREF_AUTO_PUBLISH_REMOTE_TIME, auto);
- ServerPlugin.getInstance().savePluginPreferences();
- }
-
- /**
- * Set the default values.
- */
- public void setDefaults() {
- preferences.setDefault(PREF_AUTO_PUBLISH, isDefaultAutoPublishing());
- preferences.setDefault(PREF_AUTO_RESTART, isDefaultAutoRestarting());
- preferences.setDefault(PREF_MACHINE_SPEED, getDefaultMachineSpeed());
-
- preferences.setDefault(PREF_AUTO_PUBLISH_LOCAL, getDefaultAutoPublishLocal());
- preferences.setDefault(PREF_AUTO_PUBLISH_LOCAL_TIME, getDefaultAutoPublishLocalTime());
- preferences.setDefault(PREF_AUTO_PUBLISH_REMOTE, getDefaultAutoPublishRemote());
- preferences.setDefault(PREF_AUTO_PUBLISH_REMOTE_TIME, getDefaultAutoPublishRemoteTime());
-
- preferences.setDefault(PREF_SYNC_ON_STARTUP, getDefaultSyncOnStartup());
-
- preferences.setDefault(PREF_MODULE_START_TIMEOUT, 300001);
- boolean save = false;
- if (preferences.isDefault(PREF_MODULE_START_TIMEOUT)) {
- preferences.setValue(PREF_MODULE_START_TIMEOUT, 300000);
- save = true;
- }
- if (save)
- ServerPlugin.getInstance().savePluginPreferences();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerPublishInfo.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerPublishInfo.java
deleted file mode 100644
index 1ee2c3358..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerPublishInfo.java
+++ /dev/null
@@ -1,322 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import java.io.File;
-import java.util.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.ServerUtil;
-import org.eclipse.wst.server.core.model.*;
-/**
- * Helper to obtain and store the publishing information (what files
- * were published and when) for a single server.
- */
-public class ServerPublishInfo {
- protected IPath path;
-
- // map of module ids to ModulePublishInfo
- protected Map modulePublishInfo;
-
- /**
- * ServerPublishInfo constructor comment.
- */
- protected ServerPublishInfo(IPath path) {
- super();
-
- this.path = path;
- modulePublishInfo = new HashMap();
- load();
- }
-
- private String getKey(IModule[] module) {
- StringBuffer sb = new StringBuffer();
-
- if (module != null) {
- int size = module.length;
- for (int i = 0; i < size; i++) {
- if (i != 0)
- sb.append("#");
- sb.append(module[i].getId());
- }
- }
-
- return sb.toString();
- }
-
- private String getKey(String moduleId) {
- return moduleId;
- }
-
- private IModule[] getModule(String moduleId) {
- if (moduleId == null || moduleId.length() == 0)
- return new IModule[0];
-
- List list = new ArrayList();
- StringTokenizer st = new StringTokenizer(moduleId, "#");
- while (st.hasMoreTokens()) {
- String mid = st.nextToken();
- if (mid != null && mid.length() > 0) {
- IModule m = ServerUtil.getModule(mid);
- if (m == null)
- return null;
- list.add(m);
- }
- }
-
- IModule[] modules = new IModule[list.size()];
- list.toArray(modules);
- return modules;
- }
-
- public boolean hasModulePublishInfo(IModule[] module) {
- String key = getKey(module);
- return modulePublishInfo.containsKey(key);
- }
-
- public void removeModulePublishInfo(IModule[] module) {
- String key = getKey(module);
- modulePublishInfo.remove(key);
-
- save();
- }
-
- /**
- * Return the publish state.
- */
- protected ModulePublishInfo getModulePublishInfo(IModule[] module) {
- String key = getKey(module);
-
- // check if it now exists
- if (modulePublishInfo.containsKey(key))
- return (ModulePublishInfo) modulePublishInfo.get(key);
-
- // have to create a new one
- ModulePublishInfo mpi = new ModulePublishInfo(getKey(module), module[module.length - 1].getName());
- modulePublishInfo.put(key, mpi);
- return mpi;
- }
-
- public void addRemovedModules(List moduleList, List kindList) {
- int size = moduleList.size();
- List removed = new ArrayList();
- Iterator iterator = modulePublishInfo.keySet().iterator();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
-
- boolean found = false;
- for (int i = 0; i < size; i++) {
- IModule[] module = (IModule[]) moduleList.get(i);
- String key2 = getKey(module);
- if (key != null && key.equals(key2))
- found = true;
- }
- if (!found) {
- ModulePublishInfo mpi = (ModulePublishInfo) modulePublishInfo.get(key);
- removed.add(mpi);
- }
- }
-
- iterator = removed.iterator();
- while (iterator.hasNext()) {
- ModulePublishInfo mpi = (ModulePublishInfo) iterator.next();
- IModule[] module2 = getModule(mpi.getModuleId());
- if (module2 == null || module2.length == 0) {
- String moduleId = mpi.getModuleId();
- if (moduleId != null) {
- int index = moduleId.lastIndexOf("#");
- module2 = new IModule[] { new DeletedModule(moduleId.substring(index + 1), mpi.getName()) };
- }
- }
- if (module2 != null && module2.length > 0) {
- moduleList.add(module2);
- kindList.add(new Integer(ServerBehaviourDelegate.REMOVED));
- }
- }
- }
-
- /**
- *
- */
- public void load() {
- String filename = path.toOSString();
- if (!(new File(filename).exists()))
- return;
-
- Trace.trace(Trace.FINEST, "Loading publish info from " + filename);
-
- try {
- IMemento memento2 = XMLMemento.loadMemento(filename);
- IMemento[] children = memento2.getChildren("module");
-
- int size = children.length;
- for (int i = 0; i < size; i++) {
- ModulePublishInfo mpi = new ModulePublishInfo(children[i]);
- modulePublishInfo.put(getKey(mpi.getModuleId()), mpi);
- }
- } catch (Exception e) {
- Trace.trace(Trace.WARNING, "Could not load publish information: " + e.getMessage());
- }
- }
-
- /**
- *
- */
- public void save() {
- String filename = path.toOSString();
- Trace.trace(Trace.FINEST, "Saving publish info to " + filename);
-
- try {
- XMLMemento memento = XMLMemento.createWriteRoot("server");
-
- Iterator iterator = modulePublishInfo.keySet().iterator();
- while (iterator.hasNext()) {
- String controlRef = (String) iterator.next();
- ModulePublishInfo mpi = (ModulePublishInfo) modulePublishInfo.get(controlRef);
- IMemento child = memento.createChild("module");
- mpi.save(child);
- }
- memento.saveToFile(filename);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not save publish information", e);
- }
- }
-
- public void fill(IModule[] module) {
- ModulePublishInfo mpi = getModulePublishInfo(module);
- int size = module.length;
- ModuleDelegate pm = (ModuleDelegate) module[size - 1].loadAdapter(ModuleDelegate.class, null);
- try {
- if (pm != null)
- mpi.setResources(pm.members());
- } catch (CoreException ce) {
- // ignore
- }
- save();
- }
-
- protected IModuleResourceDelta[] getDelta(IModule[] module) {
- if (module == null)
- return new IModuleResourceDelta[0];
-
- ModulePublishInfo mpi = getModulePublishInfo(module);
- int size = module.length;
- ModuleDelegate pm = (ModuleDelegate) module[size - 1].loadAdapter(ModuleDelegate.class, null);
- IModuleResource[] resources = null;
- try {
- if (pm != null)
- resources = pm.members();
- } catch (CoreException ce) {
- // ignore
- }
- if (resources == null)
- resources = new IModuleResource[0];
- return getDelta(mpi.getResources(), resources);
- }
-
- protected IModuleResourceDelta[] getDelta(IModuleResource[] original, IModuleResource[] current) {
- if (original == null || current == null)
- return new IModuleResourceDelta[0];
-
- List list = new ArrayList();
-
- // look for duplicates
- List found = new ArrayList();
- int size = original.length;
- int size2 = current.length;
- for (int i = 0; i < size; i++) {
- for (int j = 0; j < size2; j++) {
- if (!found.contains(original[i]) && !found.contains(current[j]) && original[i].equals(current[j])) {
- // found a match
- found.add(original[i]);
- if (original[i] instanceof IModuleFile) {
- // include files only if the modification stamp has changed
- IModuleFile mf1 = (IModuleFile) original[i];
- IModuleFile mf2 = (IModuleFile) current[j];
- if (mf1.getModificationStamp() != mf2.getModificationStamp()) {
- list.add(new ModuleResourceDelta(original[i], IModuleResourceDelta.CHANGED));
- }
- } else {
- // include folders only if their contents have changed
- IModuleFolder mf1 = (IModuleFolder) original[i];
- IModuleFolder mf2 = (IModuleFolder) current[j];
- IModuleResourceDelta[] mrdc = getDelta(mf1.members(), mf2.members());
- if (mrdc.length > 0) {
- ModuleResourceDelta mrd = new ModuleResourceDelta(original[i], IModuleResourceDelta.NO_CHANGE);
- mrd.setChildren(mrdc);
- list.add(mrd);
- }
- }
- }
- }
- }
-
- // add deletions (unfound items in the original list)
- for (int i = 0; i < size; i++) {
- if (!found.contains(original[i])) {
- if (original[i] instanceof IModuleFile) {
- list.add(new ModuleResourceDelta(original[i], IModuleResourceDelta.REMOVED));
- } else {
- IModuleFolder mf = (IModuleFolder) original[i];
- ModuleResourceDelta mrd = new ModuleResourceDelta(original[i], IModuleResourceDelta.REMOVED);
- IModuleResourceDelta[] mrdc = getDeltaTree(mf.members(), IModuleResourceDelta.REMOVED);
- mrd.setChildren(mrdc);
- list.add(mrd);
- }
- }
- }
-
- // add additions (unfound items in the current list)
- for (int j = 0; j < size2; j++) {
- if (!found.contains(current[j])) {
- if (current[j] instanceof IModuleFile) {
- list.add(new ModuleResourceDelta(current[j], IModuleResourceDelta.ADDED));
- } else {
- IModuleFolder mf = (IModuleFolder) current[j];
- ModuleResourceDelta mrd = new ModuleResourceDelta(current[j], IModuleResourceDelta.ADDED);
- IModuleResourceDelta[] mrdc = getDeltaTree(mf.members(), IModuleResourceDelta.ADDED);
- mrd.setChildren(mrdc);
- list.add(mrd);
- }
- }
- }
-
- IModuleResourceDelta[] delta = new IModuleResourceDelta[list.size()];
- list.toArray(delta);
- return delta;
- }
-
- /**
- * Create a resource delta for an entire tree.
- */
- protected IModuleResourceDelta[] getDeltaTree(IModuleResource[] resources, int kind) {
- if (resources == null)
- return new IModuleResourceDelta[0];
-
- List list = new ArrayList();
-
- // look for duplicates
- int size = resources.length;
- for (int i = 0; i < size; i++) {
- ModuleResourceDelta mrd = new ModuleResourceDelta(resources[i], kind);
- if (resources[i] instanceof IModuleFolder) {
- IModuleFolder mf = (IModuleFolder) resources[i];
- mrd.setChildren(getDeltaTree(mf.members(), kind));
- }
- list.add(mrd);
- }
-
- IModuleResourceDelta[] delta = new IModuleResourceDelta[list.size()];
- list.toArray(delta);
- return delta;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerSchedulingRule.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerSchedulingRule.java
deleted file mode 100644
index 9a5aaf2fa..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerSchedulingRule.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.wst.server.core.IServer;
-/**
- * Simple job scheduling rule that stops a server from starting,
- * publishing, or stopping at the same time.
- */
-public class ServerSchedulingRule implements ISchedulingRule {
- protected IServer server;
-
- public ServerSchedulingRule(IServer server) {
- this.server = server;
- }
-
- public boolean contains(ISchedulingRule rule) {
- if (!(rule instanceof ServerSchedulingRule))
- return false;
-
- return true;
- }
-
- public boolean isConflicting(ISchedulingRule rule) {
- if (!(rule instanceof ServerSchedulingRule))
- return false;
-
- ServerSchedulingRule ssrule = (ServerSchedulingRule) rule;
- return ssrule.server.equals(server);
- }
-
- public String toString() {
- return "Server scheduling rule for " + server;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerType.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerType.java
deleted file mode 100644
index a44d7e23c..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerType.java
+++ /dev/null
@@ -1,359 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunchConfigurationType;
-import org.eclipse.debug.core.ILaunchManager;
-
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.core.model.ServerBehaviourDelegate;
-import org.eclipse.wst.server.core.model.ServerDelegate;
-/**
- *
- */
-public class ServerType implements IServerType {
- private static final int DEFAULT_TIMEOUT = 1000 * 60 * 5;
- private IConfigurationElement element;
-
- /**
- * ServerType constructor comment.
- *
- * @param element a configuration element
- */
- public ServerType(IConfigurationElement element) {
- super();
- this.element = element;
- }
-
- /**
- * Returns the id of this factory.
- *
- * @return java.lang.String
- */
- public String getId() {
- try {
- return element.getAttribute("id");
- } catch (Exception e) {
- return null;
- }
- }
-
- public String getName() {
- try {
- return element.getAttribute("name");
- } catch (Exception e) {
- return null;
- }
- }
-
- public boolean startBeforePublish() {
- try {
- return "true".equals(element.getAttribute("startBeforePublish"));
- } catch (Exception e) {
- return false;
- }
- }
-
- public String getDescription() {
- try {
- return element.getAttribute("description");
- } catch (Exception e) {
- return null;
- }
- }
-
- protected ServerDelegate createServerDelegate() throws CoreException {
- try {
- return (ServerDelegate) element.createExecutableExtension("class");
- } catch (Exception e) {
- return null;
- }
- }
-
- protected ServerBehaviourDelegate createServerBehaviourDelegate() throws CoreException {
- try {
- return (ServerBehaviourDelegate) element.createExecutableExtension("behaviourClass");
- } catch (Exception e) {
- return null;
- }
- }
-
- public IRuntimeType getRuntimeType() {
- try {
- String typeId = element.getAttribute("runtimeTypeId");
- if (typeId == null)
- return null;
- return ServerCore.findRuntimeType(typeId);
- } catch (Exception e) {
- return null;
- }
- }
-
- public boolean hasRuntime() {
- try {
- String s = element.getAttribute("runtime");
- return "true".equals(s);
- } catch (Exception e) {
- return false;
- }
- }
-
- public ILaunchConfigurationType getLaunchConfigurationType() {
- try {
- String launchConfigId = element.getAttribute("launchConfigId");
- if (launchConfigId == null)
- return null;
- ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
- return launchManager.getLaunchConfigurationType(launchConfigId);
- } catch (Exception e) {
- return null;
- }
- }
-
- /**
- * Returns true if this server can start or may already be started
- * in the given mode, and false if not. Uses the launchMode attribute,
- * which may contain the strings "run", "debug", and/or "profile".
- *
- * @param launchMode String
- * @return boolean
- */
- public boolean supportsLaunchMode(String launchMode) {
- try {
- ILaunchConfigurationType configType = getLaunchConfigurationType();
- if (configType != null)
- return configType.supportsMode(launchMode);
-
- String mode = element.getAttribute("launchModes");
- if (mode == null)
- return false;
- return mode.indexOf(launchMode) >= 0;
- } catch (Exception e) {
- return false;
- }
- }
-
- public boolean supportsRemoteHosts() {
- try {
- String hosts = element.getAttribute("supportsRemoteHosts");
- return (hosts != null && hosts.toLowerCase().equals("true"));
- } catch (Exception e) {
- return false;
- }
- }
-
- public byte getInitialState() {
- try {
- String stateString = element.getAttribute("initialState");
- if (stateString != null)
- stateString = stateString.toLowerCase();
- if ("stopped".equals(stateString))
- return IServer.STATE_STOPPED;
- else if ("started".equals(stateString))
- return IServer.STATE_STARTED;
- } catch (Exception e) {
- // ignore
- }
- return IServer.STATE_UNKNOWN;
- }
-
- public boolean hasServerConfiguration() {
- try {
- return ("true".equalsIgnoreCase(element.getAttribute("hasConfiguration")));
- } catch (Exception e) {
- return false;
- }
- }
-
- public IServerWorkingCopy createServer(String id, IFile file, IRuntime runtime, IProgressMonitor monitor) throws CoreException {
- if (element == null)
- return null;
-
- if (id == null || id.length() == 0)
- id = ServerPlugin.generateId();
- ServerWorkingCopy swc = new ServerWorkingCopy(id, file, runtime, this);
- swc.setRuntime(runtime);
- swc.setDefaults(monitor);
-
- // TODO
- if (swc.getServerType().hasServerConfiguration())
- ((Server)swc).importConfiguration(runtime, null);
-
- return swc;
- }
-
- /**
- * Returns an array of all known runtime instances of
- * the given runtime type. This convenience method filters the list of known
- * runtime ({@link ServerCore#getRuntimes()}) for ones with a matching
- * runtime type ({@link IRuntime#getRuntimeType()}). The array will not
- * contain any working copies.
- * <p>
- * A new array is returned on each call, so clients may store or modify the result.
- * </p>
- *
- * @param runtimeType the runtime type
- * @return a possibly-empty list of runtime instances {@link IRuntime}
- * of the given runtime type
- */
- protected static IRuntime[] getRuntimes(IRuntimeType runtimeType) {
- List list = new ArrayList();
- IRuntime[] runtimes = ServerCore.getRuntimes();
- if (runtimes != null) {
- int size = runtimes.length;
- for (int i = 0; i < size; i++) {
- if (runtimes[i].getRuntimeType() != null && runtimes[i].getRuntimeType().equals(runtimeType))
- list.add(runtimes[i]);
- }
- }
-
- IRuntime[] r = new IRuntime[list.size()];
- list.toArray(r);
- return r;
- }
-
- public IServerWorkingCopy createServer(String id, IFile file, IProgressMonitor monitor) throws CoreException {
- if (element == null)
- return null;
-
- if (id == null || id.length() == 0)
- id = ServerPlugin.generateId();
-
- IRuntime runtime = null;
- if (hasRuntime()) {
- // look for existing runtime
- IRuntimeType runtimeType = getRuntimeType();
- IRuntime[] runtimes = getRuntimes(runtimeType);
- if (runtimes != null && runtimes.length > 0)
- runtime = runtimes[0];
- else {
- // create runtime
- try {
- IRuntimeWorkingCopy runtimeWC = runtimeType.createRuntime(id + "-runtime", monitor);
- ServerUtil.setRuntimeDefaultName(runtimeWC);
- runtime = runtimeWC;
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Couldn't create runtime", e);
- }
- }
- }
-
- ServerWorkingCopy swc = new ServerWorkingCopy(id, file, runtime, this);
- ServerUtil.setServerDefaultName(swc);
- if (runtime != null)
- swc.setRuntime(runtime);
-
- swc.setDefaults(monitor);
- if (swc.getServerType().hasServerConfiguration())
- ((Server)swc).importConfiguration(runtime, null);
-
- return swc;
- }
-
- public static IProject getServerProject() throws CoreException {
- IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
- if (projects != null) {
- int size = projects.length;
- for (int i = 0; i < size; i++) {
- if (((ProjectProperties)ServerCore.getProjectProperties(projects[i])).isServerProject())
- return projects[i];
- }
- }
-
- String s = findUnusedServerProjectName();
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(s);
- project.create(null);
- project.open(null);
- ((ProjectProperties)ServerCore.getProjectProperties(project)).setServerProject(true, null);
- return project;
- }
-
- /**
- * Finds an unused project name to use as a server project.
- *
- * @return java.lang.String
- */
- protected static String findUnusedServerProjectName() {
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- String name = NLS.bind(Messages.defaultServerProjectName, "").trim();
- int count = 1;
- while (root.getProject(name).exists()) {
- name = NLS.bind(Messages.defaultServerProjectName, ++count + "").trim();
- }
- return name;
- }
-
- /**
- * Return the timeout (in ms) that should be used to wait for the server to start.
- * The default is 2 minutes.
- *
- * @return the server startup timeout
- */
- public int getStartTimeout() {
- int timeout = -1;
- try {
- int i = Integer.parseInt(element.getAttribute("startTimeout"));
- int s = ServerPreferences.getInstance().getMachineSpeed();
- timeout = i * (10 - s) / 5;
- return i;
- } catch (NumberFormatException e) {
- // ignore
- }
- if (timeout <= 0)
- timeout = DEFAULT_TIMEOUT;
- return timeout;
- }
-
- /**
- * Return the timeout (in ms) to wait before assuming that the server
- * has failed to stop. The default is 2 minutes.
- *
- * @return the server shutdown timeout
- */
- public int getStopTimeout() {
- int timeout = -1;
- try {
- timeout = Integer.parseInt(element.getAttribute("stopTimeout"));
- } catch (NumberFormatException e) {
- // ignore
- }
- if (timeout <= 0)
- timeout = DEFAULT_TIMEOUT;
- return timeout;
- }
-
- public void dispose() {
- element = null;
- }
-
- public String getNamespace() {
- if (element == null)
- return null;
- return element.getDeclaringExtension().getNamespace();
- }
-
- /**
- * Return a string representation of this object.
- *
- * @return java.lang.String
- */
- public String toString() {
- return "ServerType[" + getId() + "]";
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerWorkingCopy.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerWorkingCopy.java
deleted file mode 100644
index 6a26d4daf..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerWorkingCopy.java
+++ /dev/null
@@ -1,441 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import java.beans.PropertyChangeListener;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.*;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.core.model.InternalInitializer;
-import org.eclipse.wst.server.core.model.ServerBehaviourDelegate;
-import org.eclipse.wst.server.core.model.ServerDelegate;
-/**
- *
- */
-public class ServerWorkingCopy extends Server implements IServerWorkingCopy {
- protected Server server;
- protected WorkingCopyHelper wch;
-
- protected ServerDelegate workingCopyDelegate;
-
- // working copy
- public ServerWorkingCopy(Server server) {
- super(server.getFile());
- this.server = server;
-
- map = new HashMap(server.map);
- wch = new WorkingCopyHelper(this);
-
- resolve();
- }
-
- // creation
- public ServerWorkingCopy(String id, IFile file, IRuntime runtime, IServerType serverType) {
- super(id, file, runtime, serverType);
- //server = this;
- wch = new WorkingCopyHelper(this);
- wch.setDirty(true);
- serverState = ((ServerType)serverType).getInitialState();
- }
-
- public boolean isWorkingCopy() {
- return true;
- }
-
- public IServer getOriginal() {
- return server;
- }
-
- public IServerWorkingCopy createWorkingCopy() {
- return this;
- }
-
- public int getServerState() {
- if (server != null)
- return server.getServerState();
- return serverState;
- }
-
- public void setServerState(int state) {
- if (server != null)
- server.setServerState(state);
- else
- super.setServerState(state);
- }
-
- public int getServerPublishState() {
- if (server != null)
- return server.getServerPublishState();
- return serverState;
- }
-
- public void setServerPublishState(int state) {
- if (server != null)
- server.setServerPublishState(state);
- else
- super.setServerPublishState(state);
- }
-
- public String getMode() {
- if (server != null)
- return server.getMode();
- return mode;
- }
-
- public void setMode(String mode) {
- if (server != null)
- server.setMode(mode);
- else
- super.setMode(mode);
- }
-
- public void setAttribute(String attributeName, int value) {
- wch.setAttribute(attributeName, value);
- }
-
- public void setAttribute(String attributeName, boolean value) {
- wch.setAttribute(attributeName, value);
- }
-
- public void setAttribute(String attributeName, String value) {
- wch.setAttribute(attributeName, value);
- }
-
- public void setAttribute(String attributeName, List value) {
- wch.setAttribute(attributeName, value);
- }
-
- public void setAttribute(String attributeName, Map value) {
- wch.setAttribute(attributeName, value);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.core.IServerWorkingCopy#setName(java.lang.String)
- */
- public void setName(String name) {
- setAttribute(PROP_NAME, name);
- }
-
- public void setReadOnly(boolean b) {
- setAttribute(PROP_LOCKED, b);
- }
-
- /**
- * Sets whether this element is private.
- * Generally speaking, elements marked private are internal ones
- * that should not be shown to users (because they won't know
- * anything about them).
- *
- * @param b <code>true</code> if this element is private,
- * and <code>false</code> otherwise
- * @see #isPrivate()
- */
- public void setPrivate(boolean b) {
- setAttribute(PROP_PRIVATE, b);
- }
-
- public void setHost(String host) {
- setAttribute(PROP_HOSTNAME, host);
- }
-
- public void setAutoPublishTime(int p) {
- setAttribute(PROP_AUTO_PUBLISH_TIME, p);
- }
-
- public void setAutoPublishSetting(int s) {
- setAttribute(PROP_AUTO_PUBLISH_SETTING, s);
- }
-
- public void setServerConfiguration(IFolder config) {
- this.configuration = config;
- if (configuration == null)
- setAttribute(CONFIGURATION_ID, (String)null);
- else
- setAttribute(CONFIGURATION_ID, configuration.getFullPath().toString());
- }
-
- /**
- * Sets the file where this server instance is serialized.
- *
- * @param file the file in the workspace where the server instance
- * is serialized, or <code>null</code> if the information is
- * instead to be persisted with the workspace but not with any
- * particular workspace resource
- */
- public void setFile(IFile file) {
- this.file = file;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.core.IServerWorkingCopy#isDirty()
- */
- public boolean isDirty() {
- return wch.isDirty();
- }
-
- public ServerDelegate getWorkingCopyDelegate(IProgressMonitor monitor) {
- // make sure that the regular delegate is loaded
- //getDelegate();
-
- if (workingCopyDelegate != null || serverType == null)
- return workingCopyDelegate;
-
- synchronized (this) {
- if (workingCopyDelegate == null) {
- try {
- long time = System.currentTimeMillis();
- workingCopyDelegate = ((ServerType) serverType).createServerDelegate();
- InternalInitializer.initializeServerDelegate(workingCopyDelegate, this, monitor);
- Trace.trace(Trace.PERFORMANCE, "ServerWorkingCopy.getWorkingCopyDelegate(): <" + (System.currentTimeMillis() - time) + "> " + getServerType().getId());
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not create delegate " + toString(), e);
- }
- }
- }
- return workingCopyDelegate;
- }
-
- protected ServerBehaviourDelegate getBehaviourDelegate(IProgressMonitor monitor) {
- if (server == null)
- return null;
-
- if (behaviourDelegate != null)
- return behaviourDelegate;
-
- synchronized (this) {
- if (behaviourDelegate == null)
- behaviourDelegate = server.getBehaviourDelegate(monitor);
- }
- return behaviourDelegate;
- }
-
- public void dispose() {
- // behaviour delegate is cached from the original server
- behaviourDelegate = null;
-
- super.dispose();
- if (workingCopyDelegate != null)
- workingCopyDelegate.dispose();
- }
-
- public IServer save(boolean force, IProgressMonitor monitor) throws CoreException {
- monitor = ProgressUtil.getMonitorFor(monitor);
- monitor.subTask(NLS.bind(Messages.savingTask, getName()));
-
- if (!force && getOriginal() != null)
- wch.validateTimestamp(((Server)getOriginal()).getTimestamp());
-
- if (server == null) {
- server = new Server(file);
- server.setServerState(serverState);
- server.publishListeners = publishListeners;
- server.notificationManager = notificationManager;
- }
-
- if (getServerType().hasServerConfiguration()) {
- IFolder folder = getServerConfiguration();
- if (folder == null) {
- folder = ServerType.getServerProject().getFolder(getName() + "-config");
- if (!folder.exists())
- folder.create(true, true, null);
- setServerConfiguration(folder);
- }
- }
-
- server.setInternal(this);
- server.doSave(monitor);
- if (getServerType().hasServerConfiguration()) {
- IFolder folder = getServerConfiguration();
- if (folder != null) {
- IProject project = folder.getProject();
- if (project != null && !project.exists()) {
- project.create(null);
- project.open(null);
- ((ProjectProperties)ServerCore.getProjectProperties(project)).setServerProject(true, monitor);
- }
- if (!folder.exists())
- folder.create(IResource.FORCE, true, null);
- }
- }
- getDelegate(monitor).saveConfiguration(monitor);
- wch.setDirty(false);
-
- return server;
- }
-
- public IServer saveAll(boolean force, IProgressMonitor monitor) throws CoreException {
- if (runtime != null && runtime.isWorkingCopy()) {
- IRuntimeWorkingCopy wc = (IRuntimeWorkingCopy) runtime;
- wc.save(force, monitor);
- }
-
- return save(force, monitor);
- }
-
- /**
- * Add a property change listener to this server.
- *
- * @param listener java.beans.PropertyChangeListener
- */
- public void addPropertyChangeListener(PropertyChangeListener listener) {
- if (listener == null)
- throw new IllegalArgumentException("Listener cannot be null");
- wch.addPropertyChangeListener(listener);
- }
-
- /**
- * Remove a property change listener from this server.
- *
- * @param listener java.beans.PropertyChangeListener
- */
- public void removePropertyChangeListener(PropertyChangeListener listener) {
- if (listener == null)
- throw new IllegalArgumentException("Listener cannot be null");
- wch.removePropertyChangeListener(listener);
- }
-
- /**
- * Fire a property change event.
- *
- * @param propertyName a property name
- * @param oldValue the old value
- * @param newValue the new value
- */
- public void firePropertyChangeEvent(String propertyName, Object oldValue, Object newValue) {
- wch.firePropertyChangeEvent(propertyName, oldValue, newValue);
- }
-
- public void addServerListener(IServerListener listener) {
- if (server != null)
- server.addServerListener(listener);
- else
- super.addServerListener(listener);
- }
-
- public void removeServerListener(IServerListener listener) {
- if (server != null)
- server.removeServerListener(listener);
- else
- super.removeServerListener(listener);
- }
-
- public void addPublishListener(IPublishListener listener) {
- if (server != null)
- server.addPublishListener(listener);
- else
- super.addPublishListener(listener);
- }
-
- public void removePublishListener(IPublishListener listener) {
- if (server != null)
- server.removePublishListener(listener);
- else
- super.removePublishListener(listener);
- }
-
- public void setRuntime(IRuntime runtime) {
- this.runtime = runtime;
- if (runtime != null)
- setAttribute(RUNTIME_ID, runtime.getId());
- else
- setAttribute(RUNTIME_ID, (String)null);
- }
-
- public void setRuntimeId(String runtimeId) {
- setAttribute(RUNTIME_ID, runtimeId);
- resolve();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.core.IServer#modifyModule(org.eclipse.wst.server.core.model.IModule)
- */
- public void modifyModules(IModule[] add, IModule[] remove, IProgressMonitor monitor) throws CoreException {
- if ((add == null || add.length == 0) && (remove == null || remove.length == 0))
- throw new IllegalArgumentException("Add and remove cannot both be null/empty");
-
- try {
- monitor = ProgressUtil.getMonitorFor(monitor);
- monitor.subTask(Messages.taskModifyModules);
- getWorkingCopyDelegate(monitor).modifyModules(add, remove, monitor);
- wch.setDirty(true);
-
- // trigger load of modules list
- getModules();
-
- if (add != null) {
- int size = add.length;
- for (int i = 0; i < size; i++) {
- if (!modules.contains(add[i]))
- modules.add(add[i]);
- }
- }
-
- if (remove != null) {
- int size = remove.length;
- for (int i = 0; i < size; i++) {
- if (modules.contains(remove[i]))
- modules.remove(remove[i]);
- }
- }
-
- // convert to attribute
- List list = new ArrayList();
- Iterator iterator = modules.iterator();
- while (iterator.hasNext()) {
- IModule module = (IModule) iterator.next();
- list.add(module.getName() + "::" + module.getId());
- }
- setAttribute(MODULE_LIST, list);
- } catch (CoreException ce) {
- throw ce;
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate modifyModule() " + toString(), e);
- throw new CoreException(new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, "" + e.getLocalizedMessage(), e));
- }
- }
-
- public void setDefaults(IProgressMonitor monitor) {
- try {
- getWorkingCopyDelegate(monitor).setDefaults(monitor);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate setDefaults() " + toString(), e);
- }
- }
-
- public void renameFiles(IProgressMonitor monitor) throws CoreException {
- if (getServerConfiguration() != null) {
- IFolder folder = getServerConfiguration();
- IFolder folder2 = ServerType.getServerProject().getFolder(getName() + "-config");
- folder.move(folder2.getFullPath(), true, true, monitor);
- setServerConfiguration(folder2);
- save(true, monitor);
- }
-
- if (file != null) {
- IFile file2 = ServerUtil.getUnusedServerFile(file.getProject(), this);
- file.move(file2.getFullPath(), true, true, monitor);
- }
- }
-
- public String toString() {
- return "ServerWorkingCopy " + getId();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/StartServerJob.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/StartServerJob.java
deleted file mode 100644
index 9cfe12599..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/StartServerJob.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.internal.ServerSchedulingRule;
-/**
- * A job for starting the server.
- */
-public class StartServerJob extends ChainedJob {
- protected String launchMode;
-
- public StartServerJob(IServer server, String launchMode) {
- super(NLS.bind(Messages.jobStartingServer, server.getName()), server);
- this.launchMode = launchMode;
- setRule(new ServerSchedulingRule(server));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.internal.jobs.InternalJob#run(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected IStatus run(IProgressMonitor monitor) {
- try {
- getServer().synchronousStart(launchMode, monitor);
- } catch (CoreException ce) {
- return ce.getStatus();
- }
- return new Status(IStatus.OK, ServerPlugin.PLUGIN_ID, 0, "", null);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Trace.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Trace.java
deleted file mode 100644
index 04bb5fedb..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Trace.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-/**
- * Helper class to route trace output.
- */
-public class Trace {
- public static int CONFIG = 0;
- public static int INFO = 1;
- public static int WARNING = 2;
- public static int SEVERE = 3;
- public static int FINER = 4;
- public static int FINEST = 5;
-
- public static int RESOURCES = 6;
- public static int EXTENSION_POINT = 7;
- public static int LISTENERS = 8;
- public static int RUNTIME_TARGET = 9;
- public static int PERFORMANCE = 10;
-
- private static final String[] levelNames = new String[] {
- "CONFIG ", "INFO ", "WARNING ", "SEVERE ", "FINER ", "FINEST ",
- "RESOURCES", "EXTENSION", "LISTENERS", "TARGET ", "PERF "};
- private static final String spacer = " ";
-
- private static final SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yy HH:mm.ss.SSS");
-
- protected static int pluginLength = -1;
-
- /**
- * Trace constructor comment.
- */
- private Trace() {
- super();
- }
-
- /**
- * Trace the given text.
- *
- * @param level a trace level
- * @param s a message
- */
- public static void trace(int level, String s) {
- trace(level, s, null);
- }
-
- /**
- * Trace the given message and exception.
- *
- * @param level a trace level
- * @param s a message
- * @param t a throwable
- */
- public static void trace(int level, String s, Throwable t) {
- trace(ServerPlugin.PLUGIN_ID, level, s, t);
- }
-
- /**
- * Trace the given message and exception.
- *
- * @param level a trace level
- * @param s a message
- * @param t a throwable
- */
- private static void trace(String pluginId, int level, String s, Throwable t) {
- if (pluginId == null || s == null)
- return;
-
- if (!ServerPlugin.getInstance().isDebugging())
- return;
-
- StringBuffer sb = new StringBuffer(pluginId);
- if (pluginId.length() > pluginLength)
- pluginLength = pluginId.length();
- else if (pluginId.length() < pluginLength)
- sb.append(spacer.substring(0, pluginLength - pluginId.length()));
- sb.append(" ");
- sb.append(levelNames[level]);
- sb.append(" ");
- sb.append(sdf.format(new Date()));
- sb.append(" ");
- sb.append(s);
- //Platform.getDebugOption(ServerCore.PLUGIN_ID + "/" + "resources");
-
- System.out.println(sb.toString());
- if (t != null)
- t.printStackTrace();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/UpdateServerJob.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/UpdateServerJob.java
deleted file mode 100644
index 0d4c4aa12..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/UpdateServerJob.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.model.ServerBehaviourDelegate;
-/**
- * Action to update a server's status.
- */
-public class UpdateServerJob extends ChainedJob {
- /**
- * An action to update the status of a server.
- *
- * @param server a server
- */
- public UpdateServerJob(IServer server) {
- super(NLS.bind(Messages.jobUpdateServer, server.getName()), server);
- }
-
- public IStatus run(IProgressMonitor monitor) {
- getServer().loadAdapter(ServerBehaviourDelegate.class, monitor);
-
- return new Status(IStatus.OK, ServerPlugin.PLUGIN_ID, 0, "", null);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/WorkingCopyHelper.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/WorkingCopyHelper.java
deleted file mode 100644
index fd78205b5..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/WorkingCopyHelper.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-/**
- *
- */
-public class WorkingCopyHelper {
- protected Base base;
- protected boolean isDirty;
-
- // property change listeners
- private transient List propertyListeners;
-
- public WorkingCopyHelper(Base base) {
- this.base = base;
- }
-
- public void setAttribute(String attributeName, int value) {
- int current = base.getAttribute(attributeName, 0);
- if (current != 0 && current == value)
- return;
-
- isDirty = true;
- base.map.put(attributeName, Integer.toString(value));
- firePropertyChangeEvent(attributeName, new Integer(current), new Integer(value));
- }
-
- public void setAttribute(String attributeName, boolean value) {
- boolean current = base.getAttribute(attributeName, false);
-
- isDirty = true;
- base.map.put(attributeName, Boolean.toString(value));
- firePropertyChangeEvent(attributeName, new Boolean(current), new Boolean(value));
- }
-
- public void setAttribute(String attributeName, String value) {
- String current = base.getAttribute(attributeName, (String)null);
- if (current != null && current.equals(value))
- return;
-
- isDirty = true;
- if (value == null)
- base.map.remove(attributeName);
- else
- base.map.put(attributeName, value);
- firePropertyChangeEvent(attributeName, current, value);
- }
-
- public void setAttribute(String attributeName, List value) {
- List current = base.getAttribute(attributeName, (List)null);
- if (current != null && current.equals(value))
- return;
-
- isDirty = true;
- if (value == null)
- base.map.remove(attributeName);
- else
- base.map.put(attributeName, value);
- firePropertyChangeEvent(attributeName, current, value);
- }
-
- public void setAttribute(String attributeName, Map value) {
- Map current = base.getAttribute(attributeName, (Map)null);
- if (current != null && current.equals(value))
- return;
-
- isDirty = true;
- if (value == null)
- base.map.remove(attributeName);
- else
- base.map.put(attributeName, value);
- firePropertyChangeEvent(attributeName, current, value);
- }
-
- public void setName(String name) {
- setAttribute(Base.PROP_NAME, name);
- }
-
- public void setLocked(boolean b) {
- setAttribute(Base.PROP_LOCKED, b);
- }
-
- public void setPrivate(boolean b) {
- setAttribute(Base.PROP_PRIVATE, b);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.core.IServerWorkingCopy#isDirty()
- */
- public boolean isDirty() {
- return isDirty;
- }
-
- protected void validateTimestamp(int timestamp) throws CoreException {
- if (base.getTimestamp() != timestamp)
- throw new CoreException(new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, IServerWorkingCopy.SAVE_CONFLICT, Messages.errorWorkingCopyTimestamp, null));
- }
-
- /**
- * Add a property change listener to this server.
- *
- * @param listener java.beans.PropertyChangeListener
- */
- public void addPropertyChangeListener(PropertyChangeListener listener) {
- if (propertyListeners == null)
- propertyListeners = new ArrayList(2);
- propertyListeners.add(listener);
- }
-
- /**
- * Remove a property change listener from this server.
- *
- * @param listener java.beans.PropertyChangeListener
- */
- public void removePropertyChangeListener(PropertyChangeListener listener) {
- if (propertyListeners != null)
- propertyListeners.remove(listener);
- }
-
- /**
- * Fire a property change event.
- *
- * @param propertyName a property name
- * @param oldValue the old value
- * @param newValue the new value
- */
- public void firePropertyChangeEvent(String propertyName, Object oldValue, Object 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(Trace.SEVERE, "Error firing property change event", e);
- }
- }
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error in property event", e);
- }
- }
-
- protected void setDirty(boolean dirty) {
- isDirty = dirty;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/XMLMemento.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/XMLMemento.java
deleted file mode 100644
index 3d0960cf6..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/XMLMemento.java
+++ /dev/null
@@ -1,412 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.internal;
-
-import java.io.*;
-import java.util.*;
-import org.w3c.dom.*;
-import org.xml.sax.*;
-
-import javax.xml.parsers.*;
-import javax.xml.transform.*;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-/**
- * A Memento is a class independent container for persistence
- * info. It is a reflection of 3 storage requirements.
- *
- * 1) We need the ability to persist an object and restore it.
- * 2) The class for an object may be absent. If so we would
- * like to skip the object and keep reading.
- * 3) The class for an object may change. If so the new class
- * should be able to read the old persistence info.
- *
- * We could ask the objects to serialize themselves into an
- * ObjectOutputStream, DataOutputStream, or Hashtable. However
- * all of these approaches fail to meet the second requirement.
- *
- * Memento supports binary persistance with a version ID.
- */
-public final class XMLMemento implements IMemento {
- private Document factory;
- private Element element;
-
- /**
- * Answer a memento for the document and element. For simplicity
- * you should use createReadRoot and createWriteRoot to create the initial
- * mementos on a document.
- */
- private XMLMemento(Document doc, Element el) {
- factory = doc;
- element = el;
- }
-
- /*
- * @see IMemento
- */
- public IMemento createChild(String type) {
- Element child = factory.createElement(type);
- element.appendChild(child);
- return new XMLMemento(factory, child);
- }
-
- /*
- * @see IMemento
- */
- public IMemento createChild(String type, String id) {
- Element child = factory.createElement(type);
- child.setAttribute(TAG_ID, id);
- element.appendChild(child);
- return new XMLMemento(factory, child);
- }
-
- /**
- * Create a Document from a Reader and answer a root memento for reading
- * a document.
- */
- protected static XMLMemento createReadRoot(InputStream in) {
- Document document = null;
- try {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- DocumentBuilder parser = factory.newDocumentBuilder();
- document = parser.parse(new InputSource(in));
- Node node = document.getFirstChild();
- if (node instanceof Element)
- return new XMLMemento(document, (Element) node);
- } catch (Exception e) {
- // ignore
- } finally {
- try {
- in.close();
- } catch (Exception e) {
- // ignore
- }
- }
- return null;
- }
-
- /**
- * Answer a root memento for writing a document.
- *
- * @param type a type
- * @return a memento
- */
- public static XMLMemento createWriteRoot(String type) {
- Document document;
- try {
- document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
- Element element = document.createElement(type);
- document.appendChild(element);
- return new XMLMemento(document, element);
- } catch (ParserConfigurationException e) {
- throw new Error(e);
- }
- }
-
- /*
- * @see IMemento
- */
- public IMemento getChild(String type) {
- // Get the nodes.
- NodeList nodes = element.getChildNodes();
- int size = nodes.getLength();
- if (size == 0)
- return null;
-
- // Find the first node which is a child of this node.
- for (int nX = 0; nX < size; nX ++) {
- Node node = nodes.item(nX);
- if (node instanceof Element) {
- Element element2 = (Element)node;
- if (element2.getNodeName().equals(type))
- return new XMLMemento(factory, element2);
- }
- }
-
- // A child was not found.
- return null;
- }
-
- /*
- * @see IMemento
- */
- public IMemento [] getChildren(String type) {
- // Get the nodes.
- NodeList nodes = element.getChildNodes();
- int size = nodes.getLength();
- if (size == 0)
- return new IMemento[0];
-
- // Extract each node with given type.
- ArrayList list = new ArrayList(size);
- for (int nX = 0; nX < size; nX ++) {
- Node node = nodes.item(nX);
- if (node instanceof Element) {
- Element element2 = (Element)node;
- if (element2.getNodeName().equals(type))
- list.add(element2);
- }
- }
-
- // Create a memento for each node.
- size = list.size();
- IMemento [] results = new IMemento[size];
- for (int x = 0; x < size; x ++) {
- results[x] = new XMLMemento(factory, (Element)list.get(x));
- }
- return results;
- }
-
- /**
- * Return the contents of this memento as a byte array.
- *
- * @return byte[]
- * @throws IOException if anything goes wrong
- */
- public byte[] getContents() throws IOException {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- save(out);
- return out.toByteArray();
- }
-
- /**
- * Returns an input stream for writing to the disk with a local locale.
- *
- * @return java.io.InputStream
- * @throws IOException if anything goes wrong
- */
- public InputStream getInputStream() throws IOException {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- save(out);
- return new ByteArrayInputStream(out.toByteArray());
- }
-
- /*
- * @see IMemento
- */
- public Float getFloat(String key) {
- Attr attr = element.getAttributeNode(key);
- if (attr == null)
- return null;
- String strValue = attr.getValue();
- try {
- return new Float(strValue);
- } catch (NumberFormatException e) {
- return null;
- }
- }
-
- /*
- * @see IMemento
- */
- public String getId() {
- return element.getAttribute(TAG_ID);
- }
-
- /*
- * @see IMemento
- */
- public String getName() {
- return element.getNodeName();
- }
-
- /*
- * @see IMemento
- */
- public Integer getInteger(String key) {
- Attr attr = element.getAttributeNode(key);
- if (attr == null)
- return null;
- String strValue = attr.getValue();
- try {
- return new Integer(strValue);
- } catch (NumberFormatException e) {
- return null;
- }
- }
-
- /*
- * @see IMemento
- */
- public String getString(String key) {
- Attr attr = element.getAttributeNode(key);
- if (attr == null)
- return null;
- return attr.getValue();
- }
-
- public List getNames() {
- NamedNodeMap map = element.getAttributes();
- int size = map.getLength();
- List list = new ArrayList();
- for (int i = 0; i < size; i++) {
- Node node = map.item(i);
- String name = node.getNodeName();
- list.add(name);
- }
- return list;
- }
-
- /**
- * Loads a memento from the given filename.
- *
- * @param in java.io.InputStream
- * @return org.eclipse.ui.IMemento
- */
- public static IMemento loadMemento(InputStream in) {
- return createReadRoot(in);
- }
-
- /**
- * Loads a memento from the given filename.
- *
- * @param filename java.lang.String
- * @return org.eclipse.ui.IMemento
- * @exception java.io.IOException
- */
- public static IMemento loadMemento(String filename) throws IOException {
- FileInputStream fin = null;
- try {
- fin = new FileInputStream(filename);
- return XMLMemento.createReadRoot(fin);
- } finally {
- try {
- if (fin != null)
- fin.close();
- } catch (Exception e) {
- // ignore
- }
- }
- }
-
- /*
- * @see IMemento
- */
- private void putElement(Element element2) {
- NamedNodeMap nodeMap = element2.getAttributes();
- int size = nodeMap.getLength();
- for (int i = 0; i < size; i++){
- Attr attr = (Attr)nodeMap.item(i);
- putString(attr.getName(),attr.getValue());
- }
-
- NodeList nodes = element2.getChildNodes();
- size = nodes.getLength();
- for (int i = 0; i < size; i ++) {
- Node node = nodes.item(i);
- if (node instanceof Element) {
- XMLMemento child = (XMLMemento)createChild(node.getNodeName());
- child.putElement((Element)node);
- }
- }
- }
-
- /*
- * @see IMemento
- */
- public void putFloat(String key, float f) {
- element.setAttribute(key, String.valueOf(f));
- }
-
- /*
- * @see IMemento
- */
- public void putInteger(String key, int n) {
- element.setAttribute(key, String.valueOf(n));
- }
-
- /*
- * @see IMemento
- */
- public void putMemento(IMemento memento) {
- XMLMemento xmlMemento = (XMLMemento) memento;
- putElement(xmlMemento.element);
- }
-
- /*
- * @see IMemento
- */
- public void putString(String key, String value) {
- if (value == null)
- return;
- element.setAttribute(key, value);
- }
-
- /**
- * Save this Memento to a Writer.
- */
- protected void save(OutputStream os) throws IOException {
- Result result = new StreamResult(os);
- Source source = new DOMSource(factory);
- try {
- Transformer transformer = TransformerFactory.newInstance().newTransformer();
- transformer.setOutputProperty(OutputKeys.INDENT, "yes");
- transformer.setOutputProperty(OutputKeys.METHOD, "xml");
- transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
- transformer.setOutputProperty("{http://xml.apache.org/xalan}indent-amount", "2");
- transformer.transform(source, result);
- } catch (Exception e) {
- throw (IOException) (new IOException().initCause(e));
- }
- }
-
- /**
- * Saves the memento to the given file.
- *
- * @param filename java.lang.String
- * @exception java.io.IOException
- */
- public void saveToFile(String filename) throws IOException {
- FileOutputStream w = null;
- try {
- w = new FileOutputStream(filename);
- save(w);
- } catch (IOException e) {
- throw e;
- } catch (Exception e) {
- throw new IOException(e.getLocalizedMessage());
- } finally {
- if (w != null) {
- try {
- w.close();
- } catch (Exception e) {
- // ignore
- }
- }
- }
- }
-
- public String saveToString() throws IOException {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- save(out);
- return out.toString("UTF-8");
- }
-
- /*
- * @see IMemento#getBoolean(String)
- */
- public Boolean getBoolean(String key) {
- Attr attr = element.getAttributeNode(key);
- if (attr == null)
- return null;
- String strValue = attr.getValue();
- if ("true".equalsIgnoreCase(strValue))
- return new Boolean(true);
- return new Boolean(false);
- }
-
- /*
- * @see IMemento#putBoolean(String, boolean)
- */
- public void putBoolean(String key, boolean value) {
- element.setAttribute(key, value ? "true" : "false");
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/provisional/ServerLocatorDelegate.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/provisional/ServerLocatorDelegate.java
deleted file mode 100644
index 04b9a67ca..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/provisional/ServerLocatorDelegate.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.internal.provisional;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-/**
- * A server locator provides the ability to locate or search for additional
- * server of a particular type, on a particular host.
- * <p>
- * This abstract class is intended to be extended only by clients
- * to extend the <code>serverLocators</code> extension point.
- * </p>
- *
- * @plannedfor 1.0
- */
-public abstract class ServerLocatorDelegate {
- /**
- * A callback listener used to report progress.
- */
- public interface IServerSearchListener {
- /**
- * Called when a new server is found by the locator.
- * The server must never be null.
- *
- * @param server the runtime that was found.
- */
- public void serverFound(IServerWorkingCopy server);
- }
-
- /**
- * Searches for servers.
- * It uses the callback listener to report servers that are found.
- *
- * @param host a host string conforming to RFC 2732
- * @param listener a listener to report status to
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- */
- public abstract void searchForServers(String host, IServerSearchListener listener, IProgressMonitor monitor);
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/ClientDelegate.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/ClientDelegate.java
deleted file mode 100644
index a86ebcf6c..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/ClientDelegate.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.model;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.wst.server.core.IServer;
-/**
- * A launchable client is a client side application or test harness that can
- * be launched (run) against a resource running on a server.
- * <p>
- * This abstract class is intended to be extended only by clients
- * to extend the <code>clients</code> extension point.
- * </p>
- *
- * @plannedfor 1.0
- */
-public abstract class ClientDelegate {
- /**
- * Returns true if this launchable can be run by this client.
- *
- * @param server the server that the client is being run against
- * @param launchable the object to run on the server
- * @param launchMode the launch mode
- * @return <code>true</code> if the client supports this combination, and <code>false</code>
- * otherwise
- */
- public boolean supports(IServer server, Object launchable, String launchMode) {
- return true;
- }
-
- /**
- * Opens or executes on the launchable.
- *
- * @param server the server that the client is being run against
- * @param launchable the object to run on the server
- * @param launchMode the launch mode
- * @param launch the launch of the server, if available
- * @return status indicating what (if anything) went wrong
- */
- public abstract IStatus launch(IServer server, Object launchable, String launchMode, ILaunch launch);
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/IModuleFile.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/IModuleFile.java
deleted file mode 100644
index f84f8d26a..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/IModuleFile.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core.model;
-/**
- * A file within a module.
- *
- * @plannedfor 1.0
- */
-public interface IModuleFile extends IModuleResource {
- /**
- * Returns a modification stamp. Whenever the modification
- * stamp changes, there may have been a change to the file.
- *
- * @return the modification stamp
- */
- public long getModificationStamp();
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/IModuleFolder.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/IModuleFolder.java
deleted file mode 100644
index e055fa8aa..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/IModuleFolder.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core.model;
-/**
- * A folder within a module.
- *
- * @plannedfor 1.0
- */
-public interface IModuleFolder extends IModuleResource {
- /**
- * Returns the members (contents) of this folder.
- *
- * @return an array containing the module resources contained in this folder
- */
- public IModuleResource[] members();
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/IModuleResource.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/IModuleResource.java
deleted file mode 100644
index 46e87f74a..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/IModuleResource.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core.model;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
-/**
- * A resource (file or folder) within a module.
- *
- * @plannedfor 1.0
- */
-public interface IModuleResource extends IAdaptable {
- /**
- * Returns the module relative path to this resource.
- *
- * @return the module relative path to this resource
- */
- public IPath getModuleRelativePath();
-
- /**
- * Returns the name of this resource.
- *
- * @return the name of this resource
- */
- public String getName();
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/IModuleResourceDelta.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/IModuleResourceDelta.java
deleted file mode 100644
index 81c59eb36..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/IModuleResourceDelta.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core.model;
-
-import org.eclipse.core.runtime.IPath;
-/**
- *
- * @plannedfor 1.0
- */
-public interface IModuleResourceDelta {
- /**
- * Kind constant (value 0) for no change.
- *
- * @see #getKind()
- */
- public static final int NO_CHANGE = 0;
-
- /**
- * Kind constant (value 1) for added resources.
- *
- * @see #getKind()
- */
- public static final int ADDED = 1;
-
- /**
- * Kind constant (value 2) for changed resources.
- *
- * @see #getKind()
- */
- public static final int CHANGED = 2;
-
- /**
- * Kind constant (value 3) for removed resources.
- *
- * @see #getKind()
- */
- public static final int REMOVED = 3;
-
- /**
- * Returns the module resource represented by this delta.
- *
- * @return the corresponding module resource
- */
- public IModuleResource getModuleResource();
-
- /**
- * Returns the kind of this resource delta.
- * Normally, one of <code>ADDED</code>,
- * <code>REMOVED</code>, <code>CHANGED</code>.
- *
- * @return the kind of this resource delta
- *
- * @see IModuleResourceDelta#ADDED
- * @see IModuleResourceDelta#REMOVED
- * @see IModuleResourceDelta#CHANGED
- */
- public int getKind();
-
- /**
- * Returns module resource deltas for all children of this resource
- * which were added, removed, or changed. Returns an empty
- * array if there are no affected children.
- * <p>
- * This is a convenience method, fully equivalent to:
- * <pre>
- * getAffectedChildren(ADDED | REMOVED | CHANGED, IResource.NONE);
- * </pre>
- * </p>
- *
- * @return the resource deltas for all affected children
- * @see IModuleResourceDelta#ADDED
- * @see IModuleResourceDelta#REMOVED
- * @see IModuleResourceDelta#CHANGED
- */
- public IModuleResourceDelta[] getAffectedChildren();
-
- /**
- * Returns the module-relative path of this resource delta.
- * Returns the empty path for resources in the module root.
- * <p>
- * A resource's module-relative path indicates the route from the module
- * to the resource. Within a module, there is exactly one such path
- * for any given resource. The returned path never has a trailing separator.
- * </p>
- * @return the module-relative path of this resource delta
- * @see IModuleResource#getModuleRelativePath()
- */
- public IPath getModuleRelativePath();
-
- /**
- * Finds and returns the descendent delta identified by the given path in
- * this delta, or <code>null</code> if no such descendent exists.
- * The supplied path may be absolute or relative; in either case, it is
- * interpreted as relative to this delta. Trailing separators are ignored.
- * If the path is empty this delta is returned.
- * <p>
- * This is a convenience method to avoid manual traversal of the delta
- * tree in cases where the listener is only interested in changes to
- * particular resources. Calling this method will generally be
- * faster than manually traversing the delta to a particular descendent.
- * </p>
- * @param path the path of the desired descendent delta
- * @return the descendent delta, or <code>null</code> if no such
- * descendent exists in the delta
- * @plannedfor 2.0
- */
- //public IModuleResourceDelta findMember(IPath path);
-
- /**
- * Returns resource deltas for all children of this resource
- * whose kind is included in the given mask. Kind masks are formed
- * by the bitwise or of <code>IResourceDelta</code> kind constants.
- * Returns an empty array if there are no affected children.
- * <p>
- * This is a convenience method, fully equivalent to:
- * <pre>
- * getAffectedChildren(kindMask, IResource.NONE);
- * </pre>
- * Team-private member resources are <b>not</b> included in the result.
- * </p>
- *
- * @param kindMask a mask formed by the bitwise or of <code>IResourceDelta </code>
- * delta kind constants
- * @return the resource deltas for all affected children
- * @see IResourceDelta#ADDED
- * @see IResourceDelta#REMOVED
- * @see IResourceDelta#CHANGED
- * @see #getAffectedChildren(int)
- */
- //public IModuleResourceDelta[] getAffectedChildren(int kindMask);
-
- /**
- * Accepts the given visitor.
- * The only kinds of resource deltas visited
- * are <code>ADDED</code>, <code>REMOVED</code>,
- * and <code>CHANGED</code>.
- * The visitor's <code>visit</code> method is called with this
- * resource delta if applicable. If the visitor returns <code>true</code>,
- * the resource delta's children are also visited.
- * <p>
- * This is a convenience method, fully equivalent to
- * <code>accept(visitor, IResource.NONE)</code>.
- * Although the visitor will be invoked for this resource delta, it will not be
- * invoked for any team-private member resources.
- * </p>
- *
- * @param visitor the visitor
- * @exception CoreException if the visitor failed with this exception.
- * @see IResourceDeltaVisitor#visit(IResourceDelta)
- */
- //public void accept(IModuleResourceDeltaVisitor visitor) throws CoreException;
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/IURLProvider.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/IURLProvider.java
deleted file mode 100644
index f08836299..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/IURLProvider.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.model;
-
-import java.net.URL;
-
-import org.eclipse.wst.server.core.IModule;
-/**
- *
- * @plannedfor 1.0
- */
-public interface IURLProvider {
- /**
- * Return the base URL of this module on the server. (e.g.
- * "http://localhost:8080/myProject")
- * <p>
- * This method may return null if this server does not have a valid configuration
- * or if the server is not running. The returned URL must not end in a trailing
- * slash.
- * </p>
- * <p>
- * If the module is null, the returned URL will just be to the root of
- * the server (e.g. "http://localhost:8080")
- * </p>
- * <p>
- * If the module is not already added to the server, the method will return
- * as close an approximation as possible. (for instance, for a J2EE web project
- * it may use the project's context root, which may not be the same when deployed
- * to a server)
- * </p>
- *
- * @param module com.ibm.etools.server.core.IModule
- * @return java.net.URL
- */
- public URL getModuleRootURL(IModule module);
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/InternalInitializer.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/InternalInitializer.java
deleted file mode 100644
index dfe441d73..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/InternalInitializer.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.model;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.server.core.internal.ModuleFactory;
-import org.eclipse.wst.server.core.internal.Runtime;
-import org.eclipse.wst.server.core.internal.Server;
-/**
- * This is an internal utility class that is used by the server framework.
- * It is not API and should never be used by clients.
- */
-public class InternalInitializer {
- /**
- * Internal method - do not call.
- *
- * @param delegate
- * @param newServer
- * @param monitor
- */
- public static void initializeServerDelegate(ServerDelegate delegate, Server newServer, IProgressMonitor monitor) {
- delegate.initialize(newServer, monitor);
- }
-
- /**
- * Internal method - do not call.
- *
- * @param delegate
- * @param newServer
- * @param monitor
- */
- public static void initializeServerBehaviourDelegate(ServerBehaviourDelegate delegate, Server newServer, IProgressMonitor monitor) {
- delegate.initialize(newServer, monitor);
- }
-
- /**
- * Internal method - do not call.
- *
- * @param delegate
- * @param newRuntime
- * @param monitor
- */
- public static void initializeRuntimeDelegate(RuntimeDelegate delegate, Runtime newRuntime, IProgressMonitor monitor) {
- delegate.initialize(newRuntime, monitor);
- }
-
- /**
- * Internal method - do not call.
- *
- * @param delegate
- * @param newModuleFactory
- * @param monitor
- */
- public static void initializeModuleFactoryDelegate(ModuleFactoryDelegate delegate, ModuleFactory newModuleFactory, IProgressMonitor monitor) {
- delegate.initialize(newModuleFactory, monitor);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/LaunchableAdapterDelegate.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/LaunchableAdapterDelegate.java
deleted file mode 100644
index de3af5fe8..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/LaunchableAdapterDelegate.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.model;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.wst.server.core.IModuleArtifact;
-import org.eclipse.wst.server.core.IServer;
-/**
- * This interface, typically implemented by the server code, converts from
- * an IModuleArtifact to an object launchable on the server.
- *
- * <p>This is the implementation of a launchableAdapter extension point.</p>
- * <p>
- * This abstract class is intended to be extended only by clients
- * to extend the <code>launchableAdapters</code> extension point.
- * </p>
- *
- * @plannedfor 1.0
- */
-public abstract class LaunchableAdapterDelegate {
- /**
- * Returns a launchable object from this module artifact.
- *
- * @param server the server
- * @param moduleArtifact a module artifact
- * [issue: if the launchable object cannot be found, should it throw a CoreExcpetion or return null?]
- * @return the launchable object
- * @throws CoreException if there was an error doing the conversion
- */
- public abstract Object getLaunchable(IServer server, IModuleArtifact moduleArtifact) throws CoreException;
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/ModuleArtifactAdapterDelegate.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/ModuleArtifactAdapterDelegate.java
deleted file mode 100644
index b6dffbb65..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/ModuleArtifactAdapterDelegate.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.model;
-
-import org.eclipse.wst.server.core.IModuleArtifact;
-/**
- * A module artifact adapter converts from some view's model
- * object into a module artifact that is recognized by one or
- * more server types.
- *
- * <p>This is the implementation of a moduleArtifactAdapter
- * extension point.</p>
- * <p>
- * This abstract class is intended to be extended only by clients
- * to extend the <code>moduleArtifactAdapters</code> extension point.
- * </p>
- *
- * @plannedfor 1.0
- */
-public abstract class ModuleArtifactAdapterDelegate {
- /**
- * Converts from an arbitrary object to an module artifact.
- *
- * @param obj an arbitrary object from a view or editor
- * @return an module artifact, or <code>null</code> if this
- * adapter does not recognize or cannot adapt the object
- */
- public abstract IModuleArtifact getModuleArtifact(Object obj);
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/ModuleDelegate.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/ModuleDelegate.java
deleted file mode 100644
index 09f2be582..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/ModuleDelegate.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.model;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.wst.server.core.IModule;
-/**
- * A module delegate provides a mechanism for discovering information
- * about individual modules. Modules are returned from module factory
- * delegates; their delegates are created when
- * ModuleFactoryDelegate.createModule() is called.
- * <p>
- * When the module needs to be given a delegate, the delegate class
- * specified for the module is instantiated with a 0-argument
- * constructor.
- * </p>
- * <p>
- * Module delegates may keep state in instance fields, but that state is
- * transient and will not be persisted across workbench sessions.
- * </p>
- * <p>
- * This abstract class is intended to be extended only by clients
- * to extend the <code>moduleFactories</code> extension point.
- * </p>
- *
- * @see org.eclipse.wst.server.core.IModule
- * @see ModuleFactoryDelegate
- * @plannedfor 1.0
- */
-public abstract class ModuleDelegate {
- private IModule module;
-
- /**
- * Delegates must have a public 0-arg constructor.
- */
- public ModuleDelegate() {
- // do nothing
- }
-
- /**
- * Initializes this module delegate with its life-long module instance.
- * <p>
- * This method is called by the server core framework.
- * Clients should never call this method.
- * </p>
- *
- * @param newModule the module instance
- */
- public final void initialize(IModule newModule) {
- this.module = newModule;
- initialize();
- }
-
- /**
- * Initializes this module delegate. This method gives delegates a chance
- * to do their own initialization.
- * <p>
- * This method is called by the server core framework.
- * Clients should never call this method.
- * </p>
- */
- public void initialize() {
- // do nothing
- }
-
- /**
- * Returns the module that this module delegate corresponds to.
- *
- * @return the module
- */
- public IModule getModule() {
- return module;
- }
-
- /**
- * Validates this module instance. Subclasses should
- * override and call super.validate() for basic validation.
- * <p>
- * This method is called by the web server core framework.
- * Clients should never call this method.
- * </p>
- *
- * @return a status object with code <code>IStatus.OK</code> if this
- * module is valid, otherwise a status object indicating what is
- * wrong with it
- */
- public abstract IStatus validate();
-
- /**
- * Returns the child modules of this module.
- *
- * @return a possibly empty array of child modules
- */
- public abstract IModule[] getChildModules();
-
- /**
- * Returns the current array of module artifacts.
- *
- * @return a possibly empty array containing the module resources
- * @throws CoreException thrown if there is a problem getting the members
- */
- public abstract IModuleResource[] members() throws CoreException;
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/ModuleFactoryDelegate.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/ModuleFactoryDelegate.java
deleted file mode 100644
index 3a94ee944..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/ModuleFactoryDelegate.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.model;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.internal.Module;
-import org.eclipse.wst.server.core.internal.ModuleFactory;
-/**
- * A module factory delegate provides a mechanism for discovering
- * modules. A module factory delegate is specified by the
- * <code>class</code> attribute of a <code>moduleFactories</code> extension.
- * <p>
- * When the module factory needs to be given a delegate, the delegate class
- * specified for the module factory is instantiated with a 0-argument
- * constructor.
- * </p>
- * <p>
- * Module factory delegates may keep state in instance fields, but that state is
- * transient and will not be persisted across workbench sessions.
- * </p>
- * <p>
- * This abstract class is intended to be extended only by clients
- * to extend the <code>moduleFactories</code> extension point.
- * </p>
- *
- * @see org.eclipse.wst.server.core.IModule
- * @see ModuleDelegate
- * @plannedfor 1.0
- */
-public abstract class ModuleFactoryDelegate {
- private ModuleFactory factory;
-
- /**
- * Delegates must have a public 0-arg constructor.
- */
- public ModuleFactoryDelegate() {
- // do nothing
- }
-
- /**
- * Initializes this module factory delegate with its life-long module
- * factory instance.
- * <p>
- * This method is called by the server core framework.
- * Clients should never call this method.
- * </p>
- *
- * @param newFactory the module factory instance
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- */
- final void initialize(ModuleFactory newFactory, IProgressMonitor monitor) {
- factory = newFactory;
- }
-
- /**
- * Returns the id of this factory.
- * Each factory has a distinct id, fixed for its lifetime. Ids are intended to
- * be used internally as keys; they are not intended to be shown to end users.
- *
- * @return the factory id
- */
- protected final String getId() {
- return factory.getId();
- }
-
- /**
- * Creates a module instance with the given static information. This method is used
- * by module factory delegates to create module instances.
- *
- * @param id the module id
- * @param name the module name
- * @param type the module type id
- * @param version the module version id
- * @param project the project that the module is contained in
- * @return a module instance
- */
- protected final IModule createModule(String id, String name, String type, String version, IProject project) {
- return new Module(factory, id, name, type, version, project);
- }
-
- /**
- * Creates the module delegate for a module with the given information.
- * This method is called when a client needs to access the module delegate
- * associated with the given module.
- *
- * @param module a module
- * @return the module delegate
- */
- public abstract ModuleDelegate getModuleDelegate(IModule module);
-
- /**
- * Return all modules created by this factory.
- * <p>
- * This method is normally called by the web server core framework.
- * Clients (other than the delegate) should never call this method.
- * </p>
- * <p>
- * A new array is returned on each call, so clients may store or modify the result.
- * </p>
- *
- * @return a possibly-empty array of modules {@link IModule}
- */
- public abstract IModule[] getModules();
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/PublishOperation.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/PublishOperation.java
deleted file mode 100644
index 8ec133120..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/PublishOperation.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.model;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.server.core.TaskModel;
-/**
- * An operation that will be executed during publishing.
- *
- * [issue: EY It is not clear to me that when this task will be run. Will the place where the
- * task is being run depend on the server, e.g. the TDC tasks for the v6 server should be run
- * after the server is started the modules are added to the server; however, the EJB deploy task
- * makes more sense to be run before adding the project to the server.]
- *
- * @plannedfor 1.0
- */
-public abstract class PublishOperation {
- private TaskModel model;
- private String label;
- private String description;
-
- /**
- * Operation kind constant (value 0) indicating that the operation
- * does not need be executed.
- *
- * @see #getKind()
- */
- public static final int OPTIONAL = 0;
-
- /**
- * Operation kind constant (value 1) indicating that the operation
- * should be executed.
- *
- * @see #getKind()
- */
- public static final int PREFERRED = 1;
-
- /**
- * Operation kind constant (value 2) indicating that the operation
- * must be executed.
- *
- * @see #getKind()
- */
- public static final int REQUIRED = 2;
-
- /**
- * Create a new operation. The label and description must be supplied
- * by overriding the getLabel() and getDescription() methods.
- */
- public PublishOperation() {
- // do nothing
- }
-
- /**
- * Create a new operation with the given label and description.
- *
- * @param label a translated label for the operation
- * @param description the operation description
- */
- public PublishOperation(String label, String description) {
- this.label = label;
- this.description = description;
- }
-
- /**
- * Returns the kind of this operation. Operations can either be OPTIONAL
- * (do not have to be executed), PREFERRED (should be executed), or
- * REQUIRED (must be executed).
- *
- * @return one of the kind constants (e.g. <code>REQUIRED</code>)
- * declared on {@link PublishOperation}
- */
- public int getKind() {
- return OPTIONAL;
- }
-
- /**
- * Returns the order (index/priority) of the task that will be run. The task with
- * a smaller order value will be run before the task with a bigger order value.
- * For tasks that have the same order value, the order of running those task are
- * not guaranteed.
- *
- * @return the order (index/priority) of the task that will be run.
- */
- public abstract int getOrder();
-
- /**
- * Returns the displayable label for this operation.
- * <p>
- * Note that this label is appropriate for the current locale.
- * </p>
- *
- * @return a displayable label for this operation
- */
- public String getLabel() {
- return label;
- }
-
- /**
- * Returns the displayable description for this operation.
- * <p>
- * Note that this description is appropriate for the current locale.
- * </p>
- *
- * @return a displayable description for this operation
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * Return the task model.
- * <p>
- * A task model contains information about the overall task flow and allows
- * tasks to store and retreive data. Its usage allows mutliple tasks to be
- * chained together and share data from the output of one task to the input
- * of another.
- * </p>
- *
- * @return the task model
- */
- public TaskModel getTaskModel() {
- return model;
- }
-
- /**
- * Set the task model.
- * <p>
- * A task model contains information about the overall task flow and allows
- * tasks to store and retreive data. Its usage allows mutliple tasks to be
- * chained together and share data from the output of one task to the input
- * of another.
- * </p>
- *
- * @param taskModel the task model
- */
- public void setTaskModel(TaskModel taskModel) {
- this.model = taskModel;
- }
-
- /**
- * Execute (perform) the operation.
- *
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @param info the IAdaptable (or <code>null</code>) provided by the
- * caller in order to supply UI information for prompting the
- * user if necessary. When this parameter is not
- * <code>null</code>, it should minimally contain an adapter
- * for the org.eclipse.swt.widgets.Shell.class.
- * @throws CoreException if there was an error while executing the task
- */
- public abstract void execute(IProgressMonitor monitor, IAdaptable info) throws CoreException;
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/PublishTaskDelegate.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/PublishTaskDelegate.java
deleted file mode 100644
index 2442c3b8d..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/PublishTaskDelegate.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.model;
-
-import java.util.List;
-
-import org.eclipse.wst.server.core.IServer;
-/**
- * A publish task delegate.
- *
- * <p>This is the implementation of a publishTask extension point.</p>
- * <p>
- * This abstract class is intended to be extended only by clients
- * to extend the <code>publishTask</code> extension point.
- * </p>
- *
- * @plannedfor 1.0
- */
-public abstract class PublishTaskDelegate {
- /**
- * Returns the tasks that should be performed during publishing.
- *
- * @param server the server
- * @param modules a list containing IModule arrays
- * @return the tasks that should be performed on the server.
- */
- public PublishOperation[] getTasks(IServer server, List modules) {
- return null;
- }
-
- /**
- * Returns the tasks that should be performed during publishing.
- *
- * @param server the server
- * @param modules a list containing IModule arrays
- * @param kind one of the IServer.PUBLISH_XX constants.
- * @param kindList one of the IServer publish change constants.
- * @return the tasks that should be performed on the server.
- */
- public PublishOperation[] getTasks(IServer server, int kind, List modules, List kindList) {
- return getTasks(server, modules);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/RuntimeDelegate.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/RuntimeDelegate.java
deleted file mode 100644
index 3a2e1c11d..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/RuntimeDelegate.java
+++ /dev/null
@@ -1,311 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.model;
-
-import java.util.List;
-import java.util.Map;
-
-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.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
-import org.eclipse.wst.server.core.ServerCore;
-import org.eclipse.wst.server.core.internal.Messages;
-import org.eclipse.wst.server.core.internal.Runtime;
-import org.eclipse.wst.server.core.internal.RuntimeWorkingCopy;
-import org.eclipse.wst.server.core.internal.ServerPlugin;
-/**
- * A runtime delegate provides the implementation for various
- * generic and server-type-specific operations for a specific type of runtime.
- * A runtime delegate is specified by the
- * <code>class</code> attribute of a <code>runtimeTypes</code> extension.
- * <p>
- * When the runtime instance needs to be given a delegate, the delegate class
- * specified for the runtime type is instantiated with a 0-argument constructor
- * and primed with <code>delegate.initialize(runtime)</code>,
- * which it is expected to hang on to. Later, when
- * <code>delegate.dispose()</code> is called as the runtime instance is
- * being discarded, the delegate is expected to let go of the runtime instance.
- * </p>
- * <p>
- * RuntimeDelegate supports an open-ended set of attribute-value pairs. All
- * state stored in this manner will be saved when the runtime working copy is
- * saved, and persisted across workbench sessions.
- * Runtime delegates may keep state in instance fields, but that state is
- * transient and will not be persisted across workbench sessions. To save state
- * across workbench sessions, it must be persisted using the attributes.
- * </p>
- * <p>
- * This abstract class is intended to be extended only by clients
- * to extend the <code>runtimeTypes</code> extension point.
- * </p>
- *
- * @see IRuntime
- * @see IRuntimeWorkingCopy
- * @plannedfor 1.0
- */
-public abstract class RuntimeDelegate {
- private Runtime runtime;
- private RuntimeWorkingCopy runtimeWC;
-
- /**
- * Delegates must have a public 0-arg constructor.
- */
- public RuntimeDelegate() {
- // do nothing
- }
-
- /**
- * Initializes this runtime delegate with its life-long runtime instance.
- * <p>
- * This method is called by the server core framework.
- * Clients should never call this method.
- * </p>
- *
- * @param newRuntime the runtime instance
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- */
- final void initialize(Runtime newRuntime, IProgressMonitor monitor) {
- runtime = newRuntime;
- if (runtime instanceof RuntimeWorkingCopy)
- runtimeWC = (RuntimeWorkingCopy) runtime;
- initialize();
- }
-
- /**
- * Initializes this runtime delegate. This method gives delegates a chance
- * to do their own initialization.
- * <p>
- * This method is called by the server core framework.
- * Clients should never call this method.
- * </p>
- */
- protected void initialize() {
- // do nothing
- }
-
- /**
- * Returns the runtime that this runtime delegate corresponds to.
- *
- * @return the runtime
- */
- public final IRuntime getRuntime() {
- return runtime;
- }
-
- /**
- * Returns the runtime working copy that this runtime delegate corresponds to.
- *
- * @return the runtime
- */
- public final IRuntimeWorkingCopy getRuntimeWorkingCopy() {
- return runtimeWC;
- }
-
- /**
- * Validates this runtime instance. Subclasses should
- * override and call super.validate() for basic validation.
- * <p>
- * This method is called by the web server core framework,
- * in response to a call to <code>IRuntime.validate(IProgressMonitor)</code>.
- * Clients should never call this method.
- * </p>
- *
- * @return a status object with code <code>IStatus.OK</code> if this
- * runtime is valid, otherwise a status object indicating what is
- * wrong with it
- */
- public IStatus validate() {
- if (runtime.getName() == null || runtime.getName().length() == 0)
- return new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, Messages.errorRuntimeName, null);
-
- if (isNameInUse())
- return new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, Messages.errorDuplicateRuntimeName, null);
-
- IPath path = runtime.getLocation();
- if (path == null || path.isEmpty())
- return new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, "", null);
-
- return new Status(IStatus.OK, ServerPlugin.PLUGIN_ID, 0, "", null);
- }
-
- /**
- * Returns <code>true</code> if the current name is already in use.
- *
- * @return <code>true</code> if the name is in use, and <code>false</code>
- * otherwise
- */
- private boolean isNameInUse() {
- IRuntime orig = runtime;
- if (runtimeWC != null)
- orig = runtimeWC.getOriginal();
-
- IRuntime[] runtimes = ServerCore.getRuntimes();
- if (runtimes != null) {
- int size = runtimes.length;
- for (int i = 0; i < size; i++) {
- if (orig != runtimes[i] && runtime.getName().equals(runtimes[i].getName()))
- return true;
- }
- }
- return false;
- }
-
- /**
- * Returns the value of the specified int-valued attribute.
- *
- * @param id the attribute id
- * @param defaultValue the default value of the specified attribute
- * @return the attribute value
- * @see #setAttribute(String, int)
- */
- protected final int getAttribute(String id, int defaultValue) {
- return runtime.getAttribute(id, defaultValue);
- }
-
- /**
- * Returns the value of the specified boolean-valued attribute.
- *
- * @param id the attribute id
- * @param defaultValue the default value of the specified attribute
- * @return the attribute value
- * @see #setAttribute(String, boolean)
- */
- protected final boolean getAttribute(String id, boolean defaultValue) {
- return runtime.getAttribute(id, defaultValue);
- }
-
- /**
- * Returns the value of the specified String-valued attribute.
- *
- * @param id the attribute id
- * @param defaultValue the default value of the specified attribute
- * @return the attribute value
- * @see #setAttribute(String, String)
- */
- protected final String getAttribute(String id, String defaultValue) {
- return runtime.getAttribute(id, defaultValue);
- }
-
- /**
- * Returns the value of the specified List-valued attribute.
- *
- * @param id the attribute id
- * @param defaultValue the default value of the specified attribute
- * @return the attribute value
- * @see #setAttribute(String, List)
- */
- protected final List getAttribute(String id, List defaultValue) {
- return runtime.getAttribute(id, defaultValue);
- }
-
- /**
- * Returns the value of the specified Map-valued attribute.
- *
- * @param id the attribute id
- * @param defaultValue the default value of the specified attribute
- * @return the attribute value
- * @see #setAttribute(String, Map)
- */
- protected final Map getAttribute(String id, Map defaultValue) {
- return runtime.getAttribute(id, defaultValue);
- }
-
- /**
- * Disposes of this runtime delegate.
- * <p>
- * This method is called by the web server core framework.
- * Clients should never call this method.
- * </p>
- * <p>
- * Implementations are expected to let go of the delegate's reference
- * to the runtime, deregister listeners, etc.
- * </p>
- */
- public void dispose() {
- // do nothing
- }
-
- /**
- * Initializes this runtime with default values. This method is called when
- * a new runtime is created so that the runtime can be initialized with
- * meaningful values.
- *
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- */
- public void setDefaults(IProgressMonitor monitor) {
- // do nothing
- }
-
- /**
- * Sets the value of the specified integer-valued attribute of this
- * element.
- *
- * @param id the attribute id
- * @param value the value of the specified attribute
- * @see #getAttribute(String, int)
- */
- protected final void setAttribute(String id, int value) {
- runtimeWC.setAttribute(id, value);
- }
-
- /**
- * Sets the value of the specified boolean-valued attribute of this
- * element.
- *
- * @param id the attribute id
- * @param value the value of the specified attribute
- * @see #getAttribute(String, boolean)
- */
- protected final void setAttribute(String id, boolean value) {
- runtimeWC.setAttribute(id, value);
- }
-
- /**
- * Sets the value of the specified string-valued attribute of this
- * element.
- *
- * @param id the attribute id
- * @param value the value of the specified attribute
- * @see #getAttribute(String, String)
- */
- protected final void setAttribute(String id, String value) {
- runtimeWC.setAttribute(id, value);
- }
-
- /**
- * Sets the value of the specified list-valued attribute of this
- * element. The list may only contain String values.
- *
- * @param id the attribute id
- * @param value the value of the specified attribute
- * @see #getAttribute(String, List)
- */
- protected final void setAttribute(String id, List value) {
- runtimeWC.setAttribute(id, value);
- }
-
- /**
- * Sets the value of the specified map-valued attribute of this
- * element. The map may only contain String values.
- *
- * @param id the attribute id
- * @param value the value of the specified attribute
- * @see #getAttribute(String, Map)
- */
- protected final void setAttribute(String id, Map value) {
- runtimeWC.setAttribute(id, value);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/RuntimeLocatorDelegate.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/RuntimeLocatorDelegate.java
deleted file mode 100644
index 55b8b988f..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/RuntimeLocatorDelegate.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.model;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
-/**
- * A runtime locator provides the ability to locate or search for additional
- * runtimes of a particular type.
- * <p>
- * This abstract class is intended to be extended only by clients
- * to extend the <code>runtimeLocators</code> extension point.
- * </p>
- *
- * @plannedfor 1.0
- */
-public abstract class RuntimeLocatorDelegate {
- /**
- * A callback listener used to report progress.
- */
- public interface IRuntimeSearchListener {
- /**
- * Called when a new runtime is found by the locator.
- * The runtime must never be null.
- *
- * @param runtime the runtime that was found.
- */
- public void runtimeFound(IRuntimeWorkingCopy runtime);
- }
-
- /**
- * Searches for local runtimes.
- * It uses the callback listener to report runtimes that are found.
- * The path contains the absolute path of the folder to search in,
- * or <code>null</code> to search the entire machine.
- *
- * @param path the path to search for runtimes in
- * @param listener a listener to report status to
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- */
- public abstract void searchForRuntimes(IPath path, IRuntimeSearchListener listener, IProgressMonitor monitor);
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/RuntimeTargetHandlerDelegate.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/RuntimeTargetHandlerDelegate.java
deleted file mode 100644
index 053085e9d..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/RuntimeTargetHandlerDelegate.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.model;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.IRuntimeTargetHandler;
-/**
- * A runtime target handler is used when associating a runtime with
- * a particular project. It has the ability to make any changes it requires
- * on the projects - adding or removing files, setting up the classpath, etc.
- * <p>
- * This abstract class is intended to be extended only by clients
- * to extend the <code>runtimeTargetHandlers</code> extension point.
- * </p>
- * <p>
- * <b>Provisional API:</b> This class/interface is part of an interim API that is still under development and expected to
- * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
- * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
- * (repeatedly) as the API evolves.
- * </p>
- *
- * @plannedfor 1.0
- */
-public abstract class RuntimeTargetHandlerDelegate {
- private IRuntimeTargetHandler handler;
-
- /**
- * Initializes the runtime target handler.
- *
- * @param newHandler the new handler
- */
- public final void initialize(IRuntimeTargetHandler newHandler) {
- handler = newHandler;
- }
-
- /**
- * Returns the runtime target handler that this delegate is associated with.
- *
- * @return the runtime target handler
- */
- public IRuntimeTargetHandler getRuntimeTargetHandler() {
- return handler;
- }
-
- /**
- * Set the runtime target on the given project.
- *
- * @param project the project to set the runtime on
- * @param runtime the target runtime
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @throws CoreException thrown if there is a problem setting the runtime
- */
- public abstract void setRuntimeTarget(IProject project, IRuntime runtime, IProgressMonitor monitor) throws CoreException;
-
- /**
- * Remove the runtime target from the given project.
- *
- * @param project the project to remove the runtime from
- * @param runtime the target runtime
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @throws CoreException thrown if there is a problem removing the runtime
- */
- public abstract void removeRuntimeTarget(IProject project, IRuntime runtime, IProgressMonitor monitor) throws CoreException;
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/ServerBehaviourDelegate.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/ServerBehaviourDelegate.java
deleted file mode 100644
index 278a8d2ef..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/ServerBehaviourDelegate.java
+++ /dev/null
@@ -1,766 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core.model;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.core.runtime.*;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.internal.Messages;
-import org.eclipse.wst.server.core.internal.ProgressUtil;
-import org.eclipse.wst.server.core.internal.Server;
-import org.eclipse.wst.server.core.internal.ServerPlugin;
-import org.eclipse.wst.server.core.internal.Trace;
-/**
- * A server delegate provides the implementation for various
- * generic and server-type-specific operations for a specific type of server.
- * A server delegate is specified by the
- * <code>class</code> attribute of a <code>serverTypes</code> extension.
- * <p>
- * When the server instance needs to be given a delegate, the delegate class
- * specified for the server type is instantiated with a 0-argument constructor
- * and primed with <code>delegate.initialize(((IServerState)server)</code>,
- * which it is expected to hang on to. Later, when
- * <code>delegate.dispose()</code> is called as the server instance is
- * being discarded, the delegate is expected to let go of the server instance.
- * </p>
- * <p>
- * Server delegates may keep state in instance fields, but that state is
- * transient and will not be persisted across workbench sessions.
- * </p>
- * <p>
- * This abstract class is intended to be extended only by clients
- * to extend the <code>serverTypes</code> extension point.
- * </p>
- *
- * @see org.eclipse.wst.server.core.IServer
- * @see org.eclipse.wst.server.core.IServerWorkingCopy
- * @plannedfor 1.0
- */
-public abstract class ServerBehaviourDelegate {
- private Server server;
-
- /**
- * Publish kind constant (value 0) for no change.
- *
- * @see #publishModule(int, int, IModule[], IProgressMonitor)
- */
- public static final int NO_CHANGE = 0;
-
- /**
- * Publish kind constant (value 1) for added resources.
- *
- * @see #publishModule(int, int, IModule[], IProgressMonitor)
- */
- public static final int ADDED = 1;
-
- /**
- * Publish kind constant (value 2) for changed resources.
- *
- * @see #publishModule(int, int, IModule[], IProgressMonitor)
- */
- public static final int CHANGED = 2;
-
- /**
- * Publish kind constant (value 3) for removed resources.
- *
- * @see #publishModule(int, int, IModule[], IProgressMonitor)
- */
- public static final int REMOVED = 3;
-
- /**
- * Delegates must have a public 0-arg constructor.
- */
- public ServerBehaviourDelegate() {
- // do nothing
- }
-
- /**
- * Initializes this server delegate with its life-long server instance.
- * <p>
- * This method is called by the server core framework.
- * Clients should never call this method.
- * </p>
- *
- * @param newServer the server instance
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- */
- final void initialize(Server newServer, IProgressMonitor monitor) {
- server = newServer;
- initialize(monitor);
- }
-
- /**
- * Initializes this server delegate. This method gives delegates a chance
- * to do their own initialization.
- * <p>
- * If the server state is initially unknown, this method should attempt
- * to connect to the server and update the state. On servers where the
- * state may change, this is also an excellent place to create a background
- * thread that will constantly ping the server (or have a listener) to
- * update the server state as changes occur.
- * </p>
- * <p>
- * This method is called by the server core framework.
- * Clients should never call this method.
- * </p>
- */
- protected void initialize(IProgressMonitor monitor) {
- // do nothing
- }
-
- /**
- * Returns the server that this server delegate corresponds to.
- *
- * @return the server
- */
- public final IServer getServer() {
- return server;
- }
-
- /**
- * Sets the current state of this server.
- *
- * @param state the current state of the server, one of the state
- * constants defined by {@link IServer}
- * @see IServer#getServerState()
- */
- protected final void setServerState(int state) {
- server.setServerState(state);
- }
-
- /**
- * Sets the ILaunchManager mode that the server is running in. The server
- * implementation will automatically return <code>null</code> to clients
- * when the server is stopped, so you only need to update the mode when
- * it changes.
- *
- * @param mode the mode in which a server is running, one of the mode constants
- * defined by {@link org.eclipse.debug.core.ILaunchManager}
- */
- protected final void setMode(String mode) {
- server.setMode(mode);
- }
-
- /**
- * Sets the server restart state.
- *
- * @param state <code>true</code> if the server needs to be restarted,
- * and <code>false</code> otherwise
- */
- protected final void setServerRestartState(boolean state) {
- server.setServerRestartState(state);
- }
-
- /**
- * Sets the server publish state.
- *
- * @param state the current publish state of the server, one of the
- * publish constants defined by {@link IServer}
- */
- protected final void setServerPublishState(int state) {
- server.setServerPublishState(state);
- }
-
- /**
- * Hook to fire an event when a module state changes.
- *
- * @param module the module
- * @param state the current state of the module, one of the state
- * constants defined by {@link IServer}
- */
- protected final void setModuleState(IModule[] module, int state) {
- server.setModuleState(module, state);
- }
-
- /**
- * Sets the module publish state.
- *
- * @param module the module
- * @param state the current publish state of the module, one of the
- * publish constants defined by {@link IServer}
- */
- protected final void setModulePublishState(IModule[] module, int state) {
- server.setModulePublishState(module, state);
- }
-
- /**
- * Sets the module restart state.
- *
- * @param module the module
- * @param state <code>true</code> if the module needs to be restarted,
- * and <code>false</code> otherwise
- */
- protected final void setModuleRestartState(IModule[] module, boolean state) {
- server.setModuleRestartState(module, state);
- }
-
- /**
- * Disposes of this server delegate.
- * <p>
- * This method is called by the web server core framework.
- * Clients should never call this method.
- * </p>
- * <p>
- * Implementations are expected to let go of the delegate's reference
- * to the server, deregister listeners, etc.
- * </p>
- */
- public void dispose() {
- // do nothing
- }
-
- /**
- * 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.
- * <p>
- * This method is called by the server core framework,
- * in response to a call to <code>IServer.publish()</code>.
- * Clients should never call this method.
- * </p>
- *
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @throws CoreException if there is a problem starting the publish
- */
- protected void publishStart(IProgressMonitor monitor) throws CoreException {
- // do nothing
- }
-
- /**
- * Publish the server.
- * <p>
- * This method is called by the server core framework,
- * in response to a call to <code>IServer.publish()</code>.
- * Clients should never call this method.
- * </p>
- *
- * @param kind one of the IServer.PUBLISH_XX constants. Valid values are
- * <ul>
- * <li><code>PUBLSIH_FULL</code>- indicates a full publish.</li>
- * <li><code>PUBLISH_INCREMENTAL</code>- indicates a incremental publish.
- * <li><code>PUBLSIH_AUTO</code>- indicates an automatic incremental publish.</li>
- * <li><code>PUBLISH_CLEAN</code>- indicates a clean request. Clean throws
- * out all state and cleans up the module on the server before doing a
- * full publish.
- * </ul>
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @throws CoreException if there is a problem publishing the server
- */
- protected void publishServer(int kind, IProgressMonitor monitor) throws CoreException {
- // do nothing
- }
-
- /**
- * Publish a single module to the server.
- * <p>
- * This method is called by the server core framework,
- * in response to a call to <code>IServer.publish()</code>.
- * Clients should never call this method directly.
- * </p>
- * <p>
- * If the deltaKind is IServer.REMOVED, the module may have been completely
- * deleted and does not exist anymore. In this case, a dummy module (with the
- * correct id) will be passed to this method.
- * </p>
- *
- * @param kind one of the IServer.PUBLISH_XX constants. Valid values are:
- * <ul>
- * <li><code>PUBLSIH_FULL</code>- indicates a full publish.</li>
- * <li><code>PUBLISH_INCREMENTAL</code>- indicates a incremental publish.
- * <li><code>PUBLSIH_AUTO</code>- indicates an automatic incremental publish.</li>
- * <li><code>PUBLISH_CLEAN</code>- indicates a clean request. Clean throws
- * out all state and cleans up the module on the server before doing a
- * full publish.
- * </ul>
- * @param module the module to publish
- * @param deltaKind one of the IServer publish change constants. Valid values are:
- * <ul>
- * <li><code>ADDED</code>- indicates the module has just been added to the server
- * and this is the first publish.
- * <li><code>NO_CHANGE</code>- indicates that nothing has changed in the module
- * since the last publish.</li>
- * <li><code>CHANGED</code>- indicates that the module has been changed since
- * the last publish. Call <code>getPublishedResourceDelta()</code> for
- * details of the change.
- * <li><code>REMOVED</code>- indicates the module has been removed and should be
- * removed/cleaned up from the server.
- * </ul>
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @throws CoreException if there is a problem publishing the module
- */
- protected void publishModule(int kind, int deltaKind, IModule[] module, IProgressMonitor monitor) throws CoreException {
- // do nothing
- }
-
- /**
- * Methods called to notify that publishing has finished.
- * The server can close any open connections to the server
- * and do any cleanup operations.
- * <p>
- * This method is called by the server core framework,
- * in response to a call to <code>IServer.publish()</code>.
- * Clients should never call this method.
- * </p>
- *
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @throws CoreException if there is a problem stopping the publish
- */
- protected void publishFinish(IProgressMonitor monitor) throws CoreException {
- // do nothing
- }
-
- /**
- * Configure the given launch configuration to start this server. This method is called whenever
- * the server is started to ensure that the launch configuration is accurate and up to date.
- * This method should not blindly update the launch configuration in cases where the user has
- * access to change the launch configuration by hand.
- *
- * @param workingCopy a launch configuration working copy
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @throws CoreException if there is an error setting up the configuration
- */
- public void setupLaunchConfiguration(ILaunchConfigurationWorkingCopy workingCopy, IProgressMonitor monitor) throws CoreException {
- // do nothing
- }
-
- /**
- * Restart this server. The server should use the server
- * listener to notify progress. It must use the same debug
- * flags as was originally passed into the start() method.
- *
- * This method is used if there is a quick/better way to restart
- * the server. If it throws a CoreException, the normal stop/start
- * actions will be used.
- *
- * @param launchMode the mode to restart in, one of the mode constants
- * defined by {@link org.eclipse.debug.core.ILaunchManager}
- * @throws CoreException if there was a problem restarting
- */
- public void restart(String launchMode) throws CoreException {
- throw new CoreException(new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, "Could not restart", null));
- }
-
- /**
- * Returns whether the given module can be restarted.
- * <p>
- * [issue: It's unclear whether this operations is guaranteed to be fast
- * or whether it could involve communication with any actual
- * server. If it is not fast, the method should take a progress
- * monitor.]
- * </p>
- *
- * @param module the module
- * @return <code>true</code> if the given module can be
- * restarted, and <code>false</code> otherwise
- */
- public boolean canControlModule(IModule[] module) {
- return false;
- }
-
- /**
- * Starts the given module on the server. See the specification of
- * {@link IServer#startModule(IModule[], IServer.IOperationListener)}
- * for further details.
- * <p>
- * The implementation should update the module sync state and fire
- * an event for the module.
- * </p>
- * <p>
- * This method will throw an exception if the module does not exist on
- * the server.
- * </p>
- * <p>
- * [issue: Since this method is ascynchronous, is there
- * any need for the progress monitor?]
- * </p>
- *
- * @param module the module to be started
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @exception CoreException if an error occurs while trying to restart the module
- */
- public void startModule(IModule[] module, IProgressMonitor monitor) throws CoreException {
- // do nothing
- }
-
- /**
- * Stops the given module on the server. See the specification of
- * {@link IServer#stopModule(IModule[], IServer.IOperationListener)}
- * for further details.
- * <p>
- * The implementation should update the module sync state and fire
- * an event for the module.
- * </p>
- * <p>
- * This method will throw an exception if the module does not exist on
- * the server.
- * </p>
- * <p>
- * [issue: Since this method is ascynchronous, is there
- * any need for the progress monitor?]
- * </p>
- *
- * @param module the module to be stopped
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @exception CoreException if an error occurs while trying to restart the module
- */
- public void stopModule(IModule[] module, IProgressMonitor monitor) throws CoreException {
- // do nothing
- }
-
- /**
- * Shuts down and stops this server. The server should return from this method
- * quickly and use the server listener to notify shutdown progress.
- * <p>
- * If force is <code>false</code>, it will attempt to stop the server
- * normally/gracefully. If force is <code>true</code>, then the server
- * process will be terminated any way that it can.
- * </p>
- * <p>
- * [issue: There is no way to communicate failure to the
- * client. Given that this operation can go awry, there probably
- * should be a mechanism that allows failing asynch operations
- * to be diagnosed.]
- * </p>
- * @param force <code>true</code> to kill the server, or <code>false</code>
- * to stop normally
- */
- public abstract void stop(boolean force);
-
- /**
- * Returns the module resources that have been published to the server.
- *
- * <p>
- * If the module has just been added to the server, an empty list will
- * be returned. If the module has never existed on the server, a CoreException
- * will be thrown.
- * </p>
- *
- * @param module the module
- * @return an array containing the published module resource
- */
- protected IModuleResource[] getPublishedResources(IModule[] module) {
- return server.getPublishedResources(module);
- }
-
- /**
- * Returns the delta of the current module resources that have been
- * published compared to the current state of the module.
- *
- * @param module the module
- * @return an array containing the publish resource delta
- */
- protected IModuleResourceDelta[] getPublishedResourceDelta(IModule[] module) {
- return server.getPublishedResourceDelta(module);
- }
-
- /**
- * Returns a temporary directory that the requestor can use
- * throughout it's lifecycle. This is primary to be used by
- * servers for working directories, server specific
- * files, etc.
- * <p>
- * This method directory will return the same directory on
- * each use of the workbench. If the directory is not requested
- * over a period of time, the directory may be deleted and a
- * new one will be assigned on the next request. For this
- * reason, a server may want to request the temp directory on
- * startup if it wants to store files there. In any case, the
- * server should have a backup plan to refill the directory
- * in case it has been deleted since last use.</p>
- *
- * @return a temporary directory
- */
- protected IPath getTempDirectory() {
- return server.getTempDirectory();
- }
-
- /**
- * Set a global status on the server.
- *
- * @param status the status
- */
- protected final void setServerStatus(IStatus status) {
- server.setServerStatus(status);
- }
-
- /**
- * Set a status on a specific module.
- *
- * @param module the module
- * @param status the status
- */
- protected final void setModuleStatus(IModule[] module, IStatus status) {
- server.setModuleStatus(module, status);
- }
-
- public IStatus publish(int kind, IProgressMonitor monitor) {
- Trace.trace(Trace.FINEST, "-->-- Publishing to server: " + toString() + " -->--");
-
- if (getServer().getServerType().hasRuntime() && getServer().getRuntime() == null)
- return new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, Messages.errorPublishNoRuntime, null);
-
- final List moduleList = getAllModules();
- final List kindList = new ArrayList();
-
- Iterator iterator = moduleList.iterator();
- while (iterator.hasNext()) {
- IModule[] module = (IModule[]) iterator.next();
- if (hasBeenPublished(module)) {
- if (getPublishedResourceDelta(module).length == 0)
- kindList.add(new Integer(ServerBehaviourDelegate.NO_CHANGE));
- else
- kindList.add(new Integer(ServerBehaviourDelegate.CHANGED));
- } else
- kindList.add(new Integer(ServerBehaviourDelegate.ADDED));
- }
-
- addRemovedModules(moduleList, kindList);
-
- while (moduleList.size() > kindList.size()) {
- kindList.add(new Integer(ServerBehaviourDelegate.REMOVED));
- }
-
- PublishOperation[] tasks = getTasks(kind, moduleList, kindList);
- int size = 2000 + 3500 * moduleList.size() + 500 * tasks.length;
-
- monitor = ProgressUtil.getMonitorFor(monitor);
- monitor.beginTask(NLS.bind(Messages.publishing, getServer().getName()), size);
-
- MultiStatus tempMulti = new MultiStatus(ServerPlugin.PLUGIN_ID, 0, "", null);
-
- if (monitor.isCanceled())
- return Status.CANCEL_STATUS;
-
- // start publishing
- Trace.trace(Trace.FINEST, "Calling publishStart()");
- try {
- publishStart(ProgressUtil.getSubMonitorFor(monitor, 1000));
- } catch (CoreException ce) {
- Trace.trace(Trace.INFO, "CoreException publishing to " + toString(), ce);
- return ce.getStatus();
- }
-
- // perform tasks
- MultiStatus taskStatus = performTasks(tasks, monitor);
- if (taskStatus != null)
- tempMulti.addAll(taskStatus);
-
- // publish the server
- try {
- if (!monitor.isCanceled()) {
- publishServer(kind, ProgressUtil.getSubMonitorFor(monitor, 1000));
- }
- } catch (CoreException ce) {
- Trace.trace(Trace.INFO, "CoreException publishing to " + toString(), ce);
- tempMulti.add(ce.getStatus());
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error publishing configuration to " + toString(), e);
- tempMulti.add(new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, Messages.errorPublishing, e));
- }
-
- // publish modules
- if (!monitor.isCanceled()) {
- try {
- publishModules(kind, moduleList, kindList, tempMulti, monitor);
- } catch (Exception e) {
- Trace.trace(Trace.WARNING, "Error while publishing modules", e);
- tempMulti.add(new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, Messages.errorPublishing, e));
- }
- }
-
- // end the publishing
- Trace.trace(Trace.FINEST, "Calling publishFinish()");
- try {
- publishFinish(ProgressUtil.getSubMonitorFor(monitor, 500));
- } catch (CoreException ce) {
- Trace.trace(Trace.INFO, "CoreException publishing to " + toString(), ce);
- tempMulti.add(ce.getStatus());
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error stopping publish to " + toString(), e);
- tempMulti.add(new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, Messages.errorPublishing, e));
- }
-
- if (monitor.isCanceled())
- return Status.CANCEL_STATUS;
-
- monitor.done();
-
- Trace.trace(Trace.FINEST, "--<-- Done publishing --<--");
-
- if (tempMulti.getChildren().length == 1)
- return tempMulti.getChildren()[0];
-
- MultiStatus multi = null;
- if (tempMulti.getSeverity() == IStatus.OK)
- multi = new MultiStatus(ServerPlugin.PLUGIN_ID, 0, Messages.publishingStatusOk, null);
- else if (tempMulti.getSeverity() == IStatus.INFO)
- multi = new MultiStatus(ServerPlugin.PLUGIN_ID, 0, Messages.publishingStatusInfo, null);
- else if (tempMulti.getSeverity() == IStatus.WARNING)
- multi = new MultiStatus(ServerPlugin.PLUGIN_ID, 0, Messages.publishingStatusWarning, null);
- else if (tempMulti.getSeverity() == IStatus.ERROR)
- multi = new MultiStatus(ServerPlugin.PLUGIN_ID, 0, Messages.publishingStatusError, null);
- multi.addAll(tempMulti);
-
- return multi;
- }
-
- /**
- * Publish a single module.
- */
- protected IStatus publishModule(int kind, IModule[] module, int deltaKind, IProgressMonitor monitor) {
- Trace.trace(Trace.FINEST, "Publishing module: " + module);
-
- int size = module.length;
- IModule m = module[size - 1];
- monitor.beginTask(NLS.bind(Messages.publishingModule, m.getName()), 1000);
-
- IStatus status = new Status(IStatus.OK, ServerPlugin.PLUGIN_ID, 0, NLS.bind(Messages.publishedModule, m.getName()), null);
- try {
- publishModule(kind, deltaKind, module, monitor);
- } catch (CoreException ce) {
- status = ce.getStatus();
- } catch (Exception e) {
- status = new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, Messages.errorPublishing, e);
- }
-
- /*Trace.trace(Trace.FINEST, "Delta:");
- IModuleResourceDelta[] delta = getServerPublishInfo().getDelta(parents, module);
- int size = delta.length;
- for (int i = 0; i < size; i++) {
- ((ModuleResourceDelta)delta[i]).trace("> ");
- }*/
- updatePublishInfo(deltaKind, module);
-
- monitor.done();
-
- Trace.trace(Trace.FINEST, "Done publishing: " + module);
- return status;
- }
-
- protected boolean hasBeenPublished(IModule[] module) {
- return server.getServerPublishInfo().hasModulePublishInfo(module);
- }
-
- protected void addRemovedModules(List moduleList, List kindList) {
- server.getServerPublishInfo().addRemovedModules(moduleList, kindList);
- }
-
- protected void updatePublishInfo(int deltaKind, IModule[] module) {
- if (deltaKind == ServerBehaviourDelegate.REMOVED)
- server.getServerPublishInfo().removeModulePublishInfo(module);
- else
- server.getServerPublishInfo().fill(module);
- }
-
- /**
- * Publishes the given modules. Returns true if the publishing
- * should continue, or false if publishing has failed or is cancelled.
- *
- * Uses 500 ticks plus 3500 ticks per module
- */
- protected void publishModules(int kind, List modules, List deltaKind, MultiStatus multi, IProgressMonitor monitor) {
- if (modules == null)
- return;
-
- int size = modules.size();
- if (size == 0)
- return;
-
- if (monitor.isCanceled())
- return;
-
- // publish modules
- for (int i = 0; i < size; i++) {
- IStatus status = publishModule(kind, (IModule[]) modules.get(i), ((Integer)deltaKind.get(i)).intValue(), ProgressUtil.getSubMonitorFor(monitor, 3000));
- multi.add(status);
- }
- }
-
- /**
- * Returns the publish tasks that have been targetted to this server.
- * These tasks should be run during publishing.
- *
- * @param kind one of the IServer.PUBLISH_XX constants
- * @param moduleList a list of modules
- * @param kindList list of one of the IServer publish change constants
- * @return a possibly empty array of IOptionalTasks
- */
- protected final PublishOperation[] getTasks(int kind, List moduleList, List kindList) {
- return server.getTasks(kind, moduleList, kindList);
- }
-
- /**
- * Returns all the modules that are on the server, including root
- * modules and all their children.
- *
- * @return a list of IModule[]s
- */
- protected final List getAllModules() {
- return server.getAllModules();
- }
-
- /**
- * Perform (execute) all the given tasks.
- *
- * @param tasks an array of tasks
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @return the status
- */
- protected MultiStatus performTasks(PublishOperation[] tasks, IProgressMonitor monitor) {
- int size = tasks.length;
- Trace.trace(Trace.FINEST, "Performing tasks: " + size);
-
- if (size == 0)
- return null;
-
- MultiStatus multi = new MultiStatus(ServerPlugin.PLUGIN_ID, 0, Messages.taskPerforming, null);
-
- for (int i = 0; i < size; i++) {
- PublishOperation task = tasks[i];
- monitor.subTask(NLS.bind(Messages.taskPerforming, task.toString()));
- try {
- task.execute(ProgressUtil.getSubMonitorFor(monitor, 500), null);
- } catch (CoreException ce) {
- Trace.trace(Trace.SEVERE, "Task failed", ce);
- multi.add(ce.getStatus());
- }
-
- // return early if the monitor has been cancelled
- if (monitor.isCanceled())
- return multi;
- }
-
- return multi;
- }
-
- /**
- * Called when resources change within the workspace.
- * This gives the server an opportunity to update the server or module
- * restart state.
- */
- public void handleResourceChange() {
- // do nothing
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/ServerDelegate.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/ServerDelegate.java
deleted file mode 100644
index 94d5f8c95..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/ServerDelegate.java
+++ /dev/null
@@ -1,392 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core.model;
-
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.core.internal.Server;
-import org.eclipse.wst.server.core.internal.ServerWorkingCopy;
-/**
- * A server delegate provides the implementation for various
- * generic and server-type-specific operations for a specific type of server.
- * A server delegate is specified by the
- * <code>class</code> attribute of a <code>serverTypes</code> extension.
- * <p>
- * When the server instance needs to be given a delegate, the delegate class
- * specified for the server type is instantiated with a 0-argument constructor
- * and primed with <code>delegate.initialize(((IServerState)server)</code>,
- * which it is expected to hang on to. Later, when
- * <code>delegate.dispose()</code> is called as the server instance is
- * being discarded, the delegate is expected to let go of the server instance.
- * </p>
- * <p>
- * ServerDelegate supports an open-ended set of attribute-value pairs. All
- * state stored in this manner will be saved when the server working copy is
- * saved, and persisted across workbench sessions.
- * Server delegates may keep state in instance fields, but that state is
- * transient and will not be persisted across workbench sessions. To save
- * state across workbench sessions, it must be persisted using the
- * attributes.
- * </p>
- * <p>
- * This abstract class is intended to be extended only by clients
- * to extend the <code>serverTypes</code> extension point.
- * </p>
- *
- * @see IServer
- * @see IServerWorkingCopy
- * @plannedfor 1.0
- */
-public abstract class ServerDelegate {
- private Server server;
- private ServerWorkingCopy serverWC;
-
- /**
- * Delegates must have a public 0-arg constructor.
- */
- public ServerDelegate() {
- // do nothing
- }
-
- /**
- * Initializes this server delegate with its life-long server instance.
- * <p>
- * This method is called by the server core framework.
- * Clients should never call this method.
- * </p>
- *
- * @param newServer the server instance
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- */
- final void initialize(Server newServer, IProgressMonitor monitor) {
- server = newServer;
- if (newServer instanceof ServerWorkingCopy)
- serverWC = (ServerWorkingCopy) newServer;
- initialize();
- }
-
- /**
- * Initializes this server delegate. This method gives delegates a chance
- * to do their own initialization.
- * <p>
- * This method is called by the server core framework.
- * Clients should never call this method.
- * </p>
- */
- protected void initialize() {
- // do nothing
- }
-
- /**
- * Returns the server that this server delegate corresponds to.
- *
- * @return the server
- */
- public final IServer getServer() {
- return server;
- }
-
- /**
- * Returns the server working copy that this server delegate corresponds to.
- *
- * @return the server
- */
- public final IServerWorkingCopy getServerWorkingCopy() {
- return serverWC;
- }
-
- /**
- * Returns the value of the specified int-valued attribute.
- *
- * @param id the attribute id
- * @param defaultValue the default value of the specified attribute
- * @return the attribute value
- * @see #setAttribute(String, int)
- */
- protected final int getAttribute(String id, int defaultValue) {
- return server.getAttribute(id, defaultValue);
- }
-
- /**
- * Returns the value of the specified boolean-valued attribute.
- *
- * @param id the attribute id
- * @param defaultValue the default value of the specified attribute
- * @return the attribute value
- * @see #setAttribute(String, boolean)
- */
- protected final boolean getAttribute(String id, boolean defaultValue) {
- return server.getAttribute(id, defaultValue);
- }
-
- /**
- * Returns the value of the specified String-valued attribute.
- *
- * @param id the attribute id
- * @param defaultValue the default value of the specified attribute
- * @return the attribute value
- * @see #setAttribute(String, String)
- */
- protected final String getAttribute(String id, String defaultValue) {
- return server.getAttribute(id, defaultValue);
- }
-
- /**
- * Returns the value of the specified List-valued attribute.
- *
- * @param id the attribute id
- * @param defaultValue the default value of the specified attribute
- * @return the attribute value
- * @see #setAttribute(String, List)
- */
- protected final List getAttribute(String id, List defaultValue) {
- return server.getAttribute(id, defaultValue);
- }
-
- /**
- * Returns the value of the specified Map-valued attribute.
- *
- * @param id the attribute id
- * @param defaultValue the default value of the specified attribute
- * @return the attribute value
- * @see #setAttribute(String, Map)
- */
- protected final Map getAttribute(String id, Map defaultValue) {
- return server.getAttribute(id, defaultValue);
- }
-
- /**
- * Disposes of this server delegate.
- * <p>
- * This method is called by the web server core framework.
- * Clients should never call this method.
- * </p>
- * <p>
- * Implementations are expected to let go of the delegate's reference
- * to the server, deregister listeners, etc.
- * </p>
- */
- public void dispose() {
- // do nothing
- }
-
- /**
- * Returns whether the specified module modifications could be made to this
- * server at this time. See the specification of
- * {@link IServerAttributes#canModifyModules(IModule[], IModule[], IProgressMonitor)}
- * for further details.
- * <p>
- * This method is called by the web server core framework,
- * in response to a call to <code>IServer.canModifyModules</code>.
- * Clients should never call this method.
- * </p>
- * <p>
- * [issue: See IServerAttributes.canModifyModules(IModule[], IModule[], IProgressMonitor).]
- * </p>
- * [issue: doc that it should be quick]
- *
- * @param add a possibly-empty list of modules to add
- * @param remove a possibly-empty list of modules to remove
- * @return a status object with code <code>IStatus.OK</code> if the modules
- * can be modified, otherwise a status object indicating why they can't
- */
- public abstract IStatus canModifyModules(IModule[] add, IModule[] remove);
-
- /**
- * Returns the child module(s) of this module. If this
- * module contains other modules, it should list those
- * modules. If not, it should return an empty list.
- *
- * <p>This method should only return the direct children.
- * To obtain the full module tree, this method may be
- * recursively called on the children.</p>
- *
- * @param module a module
- * @return the child modules
- * @see IServerAttributes#getChildModules(IModule[], IProgressMonitor)
- */
- public abstract IModule[] getChildModules(IModule[] module);
-
- /**
- * Returns the parent module(s) of this module. When determining if a given
- * project can run on a server, this method will be used to find the actual
- * module(s) that may be run on the server. For instance, a Web module may
- * return a list of EAR modules that it is contained in if the server only
- * supports configuring EAR modules.
- *
- * <p>If the module type is not supported, this method will return null.
- * If the type is normally supported but there is a configuration
- * problem or missing parent, etc., this method will fire a CoreException
- * that may then be presented to the user.</p>
- *
- * <p>If it does return valid parent(s), this method will always return
- * the topmost parent module(s), even if there are a few levels
- * (a heirarchy) of modules.</p>
- *
- * [issue: should the parameter be IModule[]?]
- *
- * @param module a module
- * @return an array of possible root modules
- * @throws CoreException if anything went wrong
- *
- * @see org.eclipse.wst.server.core.IServerAttributes#getRootModules(IModule, IProgressMonitor)
- */
- public abstract IModule[] getRootModules(IModule module) throws CoreException;
-
- /**
- * Returns an array of ServerPorts that this server has.
- *
- * @return the server's ports
- */
- public ServerPort[] getServerPorts() {
- return null;
- }
-
- /**
- * Initializes this server with default values. This method is called when
- * a new server is created so that the server can be initialized with
- * meaningful values.
- *
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- */
- public void setDefaults(IProgressMonitor monitor) {
- // do nothing
- }
-
- /**
- * Sets the value of the specified integer-valued attribute of this
- * element.
- *
- * @param id the attribute id
- * @param value the value of the specified attribute
- * @see #getAttribute(String, int)
- */
- protected final void setAttribute(String id, int value) {
- serverWC.setAttribute(id, value);
- }
-
- /**
- * Sets the value of the specified boolean-valued attribute of this
- * element.
- *
- * @param id the attribute id
- * @param value the value of the specified attribute
- * @see #getAttribute(String, boolean)
- */
- protected final void setAttribute(String id, boolean value) {
- serverWC.setAttribute(id, value);
- }
-
- /**
- * Sets the value of the specified string-valued attribute of this
- * element.
- *
- * @param id the attribute id
- * @param value the value of the specified attribute
- * @see #getAttribute(String, String)
- */
- protected final void setAttribute(String id, String value) {
- serverWC.setAttribute(id, value);
- }
-
- /**
- * Sets the value of the specified list-valued attribute of this
- * element. The list may only contain String values.
- *
- * @param id the attribute id
- * @param value the value of the specified attribute
- * @see #getAttribute(String, List)
- */
- protected final void setAttribute(String id, List value) {
- serverWC.setAttribute(id, value);
- }
-
- /**
- * Sets the value of the specified map-valued attribute of this
- * element. The map may only contain String values.
- *
- * @param id the attribute id
- * @param value the value of the specified attribute
- * @see #getAttribute(String, Map)
- */
- protected final void setAttribute(String id, Map value) {
- serverWC.setAttribute(id, value);
- }
-
- /**
- * Modifies the list of modules associated with the server.
- * See the specification of
- * {@link IServerWorkingCopy#modifyModules(IModule[], IModule[], IProgressMonitor)}
- * for further details.
- * <p>
- * This method is called by the web server core framework,
- * in response to a call to <code>IServerWorkingCopy.modifyModules</code>.
- * Clients should never call this method.
- * </p>
- * <p>
- * This method is called to update the server configuration (if any)
- * or update the delegates internal state. Note that the actual list
- * of modules is stored on the server and can be accessed at any time
- * using server.getModules(). getModules() will not be updated until
- * after this method successfully returns.
- * </p>
- * <p>
- * This method will not communicate with the server. After saving,
- * publish() can be used to sync up with the server.
- * </p>
- *
- * @param add a possibly-empty list of modules to add
- * @param remove a possibly-empty list of modules to remove
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @throws CoreException [missing]
- */
- public abstract void modifyModules(IModule[] add, IModule[] remove, IProgressMonitor monitor) throws CoreException;
-
- /**
- * This method is called to import the server configuration from the given
- * runtime.
- *
- * @param runtime a server runtime
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- */
- public void importConfiguration(IRuntime runtime, IProgressMonitor monitor) {
- // do nothing
- }
-
- /**
- * This method is called whenever the server configuration should be saved.
- *
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @throws CoreException if there was a problem saving
- */
- public void saveConfiguration(IProgressMonitor monitor) throws CoreException {
- // do nothing
- }
-
- /**
- * This method is called whenever the server configuration folder has changed.
- * It gives the server a chance to throw out any old data and be ready to
- * reload the server configuration when it is needed next.
- */
- public void configurationChanged() {
- // do nothing
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/package.html b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/package.html
deleted file mode 100644
index d0fe41200..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/package.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<html>
-<head>
-<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link rel="stylesheet" href="../../../../../..//apistyles.css" type="text/css">
-<title>WTP API overview</title>
-</head>
-<body>
-<p>SPI support for the server tools framework.</p>
-<table width="500">
-<tr>
-<td>
-<p>The classes in this package would typically be extended or used by
-SPI clients of the server tools framework who are providing a new server
-type, runtime type, or other extension. These delegates are never visible
-to regular API clients unless explicitly exposed by the provider.</p>
-</td>
-</tr>
-</table>
-<table width="500">
-<tr>
-<td>
-<p>The majority of these classes are delegates to implement one of the
-extension points. View the extension point documentation for further
-details.</p>
-</td>
-</tr>
-</table>
-</body>
-</html>
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/package.xml b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/package.xml
deleted file mode 100644
index 4e3120321..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/package.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<html>
-<head>
- <!-- Escape to the root of your source folder -->
- <meta
- name="root"
- content="../../../../../../" />
- <title>WTP API overview</title>
-</head>
-
-<body>
-
-<abstract>SPI support for the server tools framework.</abstract>
-
-<p>The classes in this package would typically be extended or used by
-SPI clients of the server tools framework who are providing a new server
-type, runtime type, or other extension. These delegates are never visible
-to regular API clients unless explicitly exposed by the provider.</p>
-
-<p>The majority of these classes are delegates to implement one of the
-extension points. View the extension point documentation for further
-details.</p>
-
-</body>
-</html> \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/package.html b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/package.html
deleted file mode 100644
index 236cdb5ec..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/package.html
+++ /dev/null
@@ -1,58 +0,0 @@
-<html>
-<head>
-<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link rel="stylesheet" href="../../../../../..//apistyles.css" type="text/css">
-<title>WTP API overview</title>
-</head>
-<body>
-<p>The main server tools framework client API.</p>
-<table width="500">
-<tr>
-<td>
-<p>ServerCore is the main entry-point and provides access to most of the
-remaining API. From here, you can get the existing server runtimes and
-servers, get the available server types, and access interfaces for all
-extension points.</p>
-</td>
-</tr>
-</table>
-<table width="500">
-<tr>
-<td>
-<p>ServerUtil provides utility and convenience methods for dealing with
-server tools. It provides easy access to modules, server runtimes, and
-what combinations are supported (e.g. which runtimes can be used to
-target a particular project).</p>
-</td>
-</tr>
-</table>
-<table width="500">
-<tr>
-<td>
-<p>IRuntime and IServer are the two main API objects. IRuntime is used
-to target projects to a particular server installation and compile/build
-against them. When a runtime is targetted to a particular runtime,
-all of the applicable IRuntimeTargetHandler extensions are called to
-set the classpath or modify other project settings for the runtime.</p>
-</td>
-</tr>
-</table>
-<table width="500">
-<tr>
-<td>
-<p>IServer is the main server class that clients can use to start/stop
-and publish to servers.</p>
-</td>
-</tr>
-</table>
-<table width="500">
-<tr>
-<td>
-<p>IModules provide the "content" that can be published to servers.
-See the server tools API overview for more information.</p>
-</td>
-</tr>
-</table>
-</body>
-</html>
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/package.xml b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/package.xml
deleted file mode 100644
index 9a254d3ae..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/package.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<html>
-<head>
- <!-- Escape to the root of your source folder -->
- <meta
- name="root"
- content="../../../../../../" />
- <title>WTP API overview</title>
-</head>
-
-<body>
-
-<abstract>The main server tools framework client API.</abstract>
-
-<p>ServerCore is the main entry-point and provides access to most of the
-remaining API. From here, you can get the existing server runtimes and
-servers, get the available server types, and access interfaces for all
-extension points.</p>
-
-<p>ServerUtil provides utility and convenience methods for dealing with
-server tools. It provides easy access to modules, server runtimes, and
-what combinations are supported (e.g. which runtimes can be used to
-target a particular project).</p>
-
-<p>IRuntime and IServer are the two main API objects. IRuntime is used
-to target projects to a particular server installation and compile/build
-against them. When a runtime is targetted to a particular runtime,
-all of the applicable IRuntimeTargetHandler extensions are called to
-set the classpath or modify other project settings for the runtime.</p>
-
-<p>IServer is the main server class that clients can use to start/stop
-and publish to servers.</p>
-
-<p>IModules provide the "content" that can be published to servers.
-See the server tools API overview for more information.</p>
-
-</body>
-</html> \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/HttpLaunchable.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/HttpLaunchable.java
deleted file mode 100644
index 53bc4938c..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/HttpLaunchable.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.util;
-
-import java.net.URL;
-/**
- *
- * @plannedfor 1.0
- */
-public class HttpLaunchable {
- private URL url;
-
- /**
- * Create a reference to something accessible via HTTP.
- *
- * @param url the URL to the object
- */
- public HttpLaunchable(URL url) {
- this.url = url;
- }
-
- /**
- * Return the URL to the object.
- *
- * @return the URL to the object
- */
- public URL getURL() {
- return url;
- }
-
- /**
- * @see Object#toString()
- */
- public String toString() {
- return "HttpLaunchable[url=" + url.toString() + "]";
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/IStaticWeb.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/IStaticWeb.java
deleted file mode 100644
index cb7be7ab2..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/IStaticWeb.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.util;
-/**
- * A static Web module that could be deployed to Apache or another
- * HTTP server.
- *
- * @plannedfor 1.0
- */
-public interface IStaticWeb {
- /**
- * Returns the context root of the Web.
- *
- * @return java.lang.String
- */
- public String getContextRoot();
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/NullModuleArtifact.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/NullModuleArtifact.java
deleted file mode 100644
index 0f44e9a7e..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/NullModuleArtifact.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.util;
-
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IModuleArtifact;
-/**
- *
- * @plannedfor 1.0
- */
-public class NullModuleArtifact implements IModuleArtifact {
- private IModule module;
-
- /**
- * Create a new reference to a module.
- *
- * @param module the module
- */
- public NullModuleArtifact(IModule module) {
- this.module = module;
- }
-
- /**
- * @see IModuleArtifact#getModule()
- */
- public IModule getModule() {
- return module;
- }
-
- /**
- * @see Object#toString()
- */
- public String toString() {
- return "NullModuleArtifact [module=" + module + "]";
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/ProjectModule.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/ProjectModule.java
deleted file mode 100644
index 40311e26e..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/ProjectModule.java
+++ /dev/null
@@ -1,296 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core.util;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.internal.ModuleFile;
-import org.eclipse.wst.server.core.internal.ModuleFolder;
-import org.eclipse.wst.server.core.model.*;
-/**
- * A simple IModuleProject that maps a folder within a project
- * (or the root of the project itself) to the module.
- *
- * @plannedfor 1.0
- */
-public abstract class ProjectModule extends ModuleDelegate {
- protected IProject project;
- protected IPath root;
-
- /**
- * Create a new project module.
- */
- public ProjectModule() {
- // do nothing
- }
-
- /**
- * Create a new project module in the given project.
- *
- * @param project the project containing the module
- */
- public ProjectModule(IProject project) {
- this.project = project;
- }
-
- /**
- * Returns the project that the module is contained in.
- *
- * @return the project that the module is contained in
- */
- public IProject getProject() {
- return project;
- }
-
- /**
- * Returns the root folder. The root folder is the project relative path
- * that points to the root directory of the module. All resources contained
- * within this folder belong to the module.
- *
- * @return the root project-relative folder that contains the contents
- * of the module
- */
- public IPath getRootFolder() {
- return root;
- }
-
- /*
- * @see IModuleProject#getModuleResourceDelta(IResourceDelta)
- */
- /*public IModuleResourceDelta getModuleResourceDelta(IResourceDelta delta) {
- Trace.trace(Trace.FINEST, "> getModuleResourceDelta");
- IPath root2 = null;
- try {
- root2 = getRootFolder();
- } catch (Exception e) {
- Trace.trace(Trace.FINEST, "Error getting root2");
- }
- if (root2 == null) {
- return convertChildren(delta, null);
- }
- class Helper {
- boolean found = false;
- IModuleResourceDelta delta2;
- }
- final Helper helper = new Helper();
- final IPath root3 = root2;
- try {
- delta.accept(new IResourceDeltaVisitor() {
- public boolean visit(IResourceDelta visitDelta) {
- if (!helper.found && root3.equals(visitDelta.getProjectRelativePath())) {
- helper.delta2 = convertChildren(visitDelta, null);
- helper.found = true;
- return false;
- }
- return true;
- }
- });
- Trace.trace(Trace.FINEST, "< getModuleResourceDelta");
- return helper.delta2;
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not get module resource delta");
- }
- Trace.trace(Trace.FINEST, "< getModuleResourceDelta null");
- return null;
- }*/
-
- /**
- *
- */
- /*protected IModuleResourceDelta convertChildren(IResourceDelta delta, IModuleFolder parent) {
- int flags = delta.getKind();
- int kind = IModuleResourceDelta.NO_CHANGE;
- if (flags == IResourceDelta.ADDED)
- kind = IModuleResourceDelta.ADDED;
- else if (flags == IResourceDelta.REMOVED)
- kind = IModuleResourceDelta.REMOVED;
- else if (flags == IResourceDelta.CHANGED)
- kind = IModuleResourceDelta.CHANGED;
-
- IResource resource = delta.getResource();
-
- IModuleResource pubResource = null;
- if (resource instanceof IContainer)
- pubResource = new ProjectModuleFolder(this, parent, (IContainer) resource);
- else if (resource instanceof IFile) {
- if (delta.getFlags() == IResourceDelta.MARKERS)
- return null;
- pubResource = new ProjectModuleFile(this, parent, (IFile) resource);
- }
-
- ModuleResourceDelta deployDelta = new ModuleResourceDelta(pubResource, kind);
-
- IResourceDelta[] children = delta.getAffectedChildren();
- if (children != null && pubResource instanceof IModuleFolder) {
- int size = children.length;
- for (int i = 0; i < size; i++) {
- IModuleResourceDelta childDelta = convertChildren(children[i], (IModuleFolder) pubResource);
- if (childDelta != null)
- deployDelta.addChild(childDelta);
- }
- }
- return deployDelta;
- }*/
-
- /**
- * Helper method - returns the module's id.
- *
- * @return the module id
- */
- public String getId() {
- return getProject().getName();
- //return getModule().getId();
- }
-
- /**
- * @see ModuleDelegate#validate()
- */
- public IStatus validate() {
- return null;
- }
-
- /**
- * @see ModuleDelegate#members()
- */
- public IModuleResource[] members() throws CoreException {
- IPath root2 = null;
- try {
- root2 = getRootFolder();
- } catch (Exception e) {
- // ignore
- }
- try {
- if (root2 == null || root2.isRoot() || root2.equals(new Path("")) || root2.equals(new Path("/")))
- return getModuleResources(Path.EMPTY, getProject());
-
- IFolder folder = project.getFolder(root2);
- return getModuleResources(Path.EMPTY, folder);
- } catch (CoreException e) {
- throw e;
- }
- }
-
- protected IModuleResource[] getModuleResources(IPath path, IContainer container) throws CoreException {
- List list = new ArrayList();
-
- IResource[] resources = container.members();
- if (resources != null) {
- int size = resources.length;
- for (int i = 0; i < size; i++) {
- IResource resource = resources[i];
- if (resource instanceof IContainer) {
- IContainer container2 = getContainerResource(resource);
- if (container2 != null && container2.exists()) {
- ModuleFolder mf = new ModuleFolder(container, container2.getName(), path);
- mf.setMembers(getModuleResources(path.append(container2.getName()), container2));
- list.add(mf);
- }
- } else if (resource instanceof IFile) {
- IFile file = getFileResource(resource);
- if (file != null && file.exists())
- list.add(new ModuleFile(file, file.getName(), path, file.getModificationStamp()));
- }
- }
- }
-
- IModuleResource[] moduleResources = new IModuleResource[list.size()];
- list.toArray(moduleResources);
- return moduleResources;
- }
-
- protected IContainer getContainerResource(IResource resource){
- return (IContainer)resource;
- }
-
- protected IFile getFileResource(IResource resource){
- return (IFile)resource;
- }
-
- /**
- * Helper method - returns the module's name.
- *
- * @return the module name
- */
- public String getName() {
- return getProject().getName();
- //return getModule().getName();
- }
-
- /**
- * Returns true if this module currently exists, and false if it has
- * been deleted or moved and is no longer represented by this module.
- *
- * @return boolean
- */
- public boolean exists() {
- return (getProject() != null && getProject().exists());
- }
-
- /**
- * @see Object#equals(Object)
- */
- public boolean equals(Object obj) {
- if (obj == null || !(obj instanceof ProjectModule))
- return false;
-
- ProjectModule dp = (ProjectModule) obj;
- //if (getFactoryId() != null && !getFactoryId().equals(dp.getFactoryId()))
- // return false;
-
- IPath root2 = null;
- try {
- root2 = getRootFolder();
- } catch (Exception e) {
- // ignore
- }
-
- IPath root3 = null;
- try {
- root3 = dp.getRootFolder();
- } catch (Exception e) {
- // ignore
- }
-
- if (project != null && project.exists() && !project.equals(dp.getProject()))
- return false;
-
- if (getId() != null && !getId().equals(dp.getId()))
- return false;
-
- if (root2 == null && root3 != null)
- return false;
- if (root2 != null && !root2.equals(root3))
- return false;
-
- return true;
- }
-
- /**
- * Called when the listener paths from the module factory change.
- * Use this method to re-cache information about the module.
- */
- protected void update() {
- // do nothing
- }
-
- /**
- * Returns the child modules of this module.
- *
- * @return org.eclipse.wst.server.core.model.IModule[]
- */
- public IModule[] getChildModules() {
- return null;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/ProjectModuleFactoryDelegate.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/ProjectModuleFactoryDelegate.java
deleted file mode 100644
index 84061b86b..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/ProjectModuleFactoryDelegate.java
+++ /dev/null
@@ -1,406 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.core.util;
-
-import java.util.*;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.internal.ModuleFactory;
-import org.eclipse.wst.server.core.internal.ServerPlugin;
-import org.eclipse.wst.server.core.internal.Trace;
-import org.eclipse.wst.server.core.model.ModuleFactoryDelegate;
-/**
- *
- *
- * @plannedfor 1.0
- */
-public abstract class ProjectModuleFactoryDelegate extends ModuleFactoryDelegate {
- protected static IResourceChangeListener listener;
-
- protected static List factories = new ArrayList();
-
- protected List added;
- protected List removed;
-
- // map from IProject to IModule[]
- protected final Map projects = new HashMap();
- protected boolean initialized = false;
-
- /**
- * Construct a new ProjectModuleFactoryDelegate.
- */
- public ProjectModuleFactoryDelegate() {
- super();
-
- factories.add(this);
-
- //addListener();
- }
-
- /**
- * Cache any preexisting module.
- * TODO: When/where is this called?
- */
- protected void cacheModules() {
- cacheModules(true);
- }
-
- /**
- * Cache any preexisting module.
- * TODO: When/where is this called?
- */
- protected void cacheModules(boolean forceUpdate) {
- try {
- IProject[] projects2 = getWorkspaceRoot().getProjects();
- int size = projects2.length;
- for (int i = 0; i < size; i++) {
- //Trace.trace("caching: " + this + " " + projects[i] + " " + isValidModule(projects[i]));
- if(!projects2[i].isAccessible())
- removeModules(projects2[i]);
- else if (forceUpdate || needsUpdating(projects2[i]) && (isValidModule(projects2[i]))) {
- addModules(projects2[i]);
- }
- }
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error caching modules", e);
- } finally {
- initialized = true;
- }
- }
-
- protected boolean needsUpdating(IProject project) {
- return true;
- }
-
- /**
- * Return the workspace root.
- *
- * @return the workspace root
- */
- private static IWorkspaceRoot getWorkspaceRoot() {
- return ResourcesPlugin.getWorkspace().getRoot();
- }
-
- /**
- * Returns the modules for the given project, or null
- * if this factory does not have a module for the given project.
- *
- * @param project a project
- * @return an array of modules.
- */
- public IModule[] getModules(IProject project) {
- try {
- return (IModule[]) projects.get(project);
- } catch (Exception e) {
- // ignore
- }
- return null;
- }
-
- /**
- * Add a resource listener to the workspace.
- *
- * @deprecated
- */
- protected static void addListener() {
- // do nothing
- /*if (listener != null)
- return;
-
- listener = new IResourceChangeListener() {
- public void resourceChanged(IResourceChangeEvent event) {
- Trace.trace(Trace.FINEST, "->- ProjectModuleFactoryDelegate listener responding to resource change: " + event.getType() + " ->-");
- try {
- IResourceDelta delta = event.getDelta();
-
- if (!ResourceManager.deltaContainsChangedFiles(delta))
- return;
-
- delta.accept(new IResourceDeltaVisitor() {
- public boolean visit(IResourceDelta visitorDelta) {
- IResource resource = visitorDelta.getResource();
- // Trace.trace(Trace.FINEST, "resource: " + resource);
-
- // only respond to changes within projects
- if (resource != null && resource instanceof IProject) {
- IProject project = (IProject) resource;
- handleGlobalProjectChange(project, visitorDelta);
- return false;
- } else if (resource != null && resource.getProject() != null) {
- return false;
- } else
- return true;
- }
- });
- } catch (Exception e) {
- //Trace.trace(Trace.SEVERE, "Error responding to resource change", e);
- }
- fireGlobalEvents();
- Trace.trace(Trace.FINEST, "-<- Done ProjectModuleFactoryDelegate responding to resource change -<-");
- }
- };
-
- ResourcesPlugin.getWorkspace().addResourceChangeListener(listener, IResourceChangeEvent.POST_CHANGE);*/
- }
-
- /**
- * Handle changes to a project.
- *
- * @param project a project
- * @param delta a resource delta
- */
- public static void handleGlobalProjectChange(final IProject project, IResourceDelta delta) {
- if (!deltaContainsChangedModules(delta))
- return;
-
- // clear cache
- ModuleFactory[] factories2 = ServerPlugin.getModuleFactories();
- int size = factories2.length;
- for (int i = 0; i < size; i++)
- factories2[i].clearModuleCache();
-
-
- Trace.trace(Trace.FINEST, "Firing global project change");
- // handle project level changes
- Iterator iterator = factories.iterator();
- while (iterator.hasNext()) {
- ProjectModuleFactoryDelegate factory = (ProjectModuleFactoryDelegate) iterator.next();
- Trace.trace(Trace.FINEST, "Firing to: " + factory);
- factory.handleProjectChange(project, delta);
- }
-
- // handle internal updates
- // TODO uncomment - this is already being called by the temporary updateProjects() method
- /*iterator = factories.iterator();
- while (iterator.hasNext()) {
- ProjectModuleFactoryDelegate factory = (ProjectModuleFactoryDelegate) iterator.next();
- Trace.trace(Trace.FINER, "Firing to: " + factory);
- factory.handleProjectInternalChange(project, delta);
- }*/
-
- fireGlobalEvents();
- }
-
- /**
- * Fire the accumulated module factory events.
- */
- protected static void fireGlobalEvents() {
- Trace.trace(Trace.FINEST, "Firing global module event");
- Iterator iterator = factories.iterator();
- while (iterator.hasNext()) {
- ProjectModuleFactoryDelegate factory = (ProjectModuleFactoryDelegate) iterator.next();
- Trace.trace(Trace.FINEST, "Firing to: " + factory);
- factory.updateProjects();
- }
- }
-
- /**
- * Temporary to make sure that all project modules are updated.
- */
- private void updateProjects() {
- IModule[] modules2 = getModules();
- if (modules2 != null) {
- int size = modules2.length;
- for (int i = 0; i < size; i++) {
- if (modules2[i] instanceof ProjectModule)
- ((ProjectModule) modules2[i]).update();
- }
- }
- }
-
- /**
- * Handle changes to a project.
- *
- * @param project a project
- * @param delta a resource delta
- */
- private void handleProjectChange(final IProject project, IResourceDelta delta) {
- if(!initialized)
- cacheModules(false);
- if (projects.containsKey(project)) {
- // already a module
- if (((delta.getKind() & IResourceDelta.REMOVED) != 0) || !isValidModule(project)) {
- removeModules(project);
- }
- } else {
- // not a module
- if (isValidModule(project)) {
- addModules(project);
- }
- }
- }
-
- /**
- * Handle changes to a project.
- *
- * @param project a project
- * @param delta a resource delta
- */
- /*private void handleProjectInternalChange(final IProject project, IResourceDelta delta) {
- final IPath[] paths = getListenerPaths();
- if (paths != null) {
- final IModule[] modules = getModules(project);
- if (modules != null) {
- for (int i = 0; i < modules.length; i++) {
- final IModule module = modules[i];
- if (module != null && module instanceof ProjectModule) {
- // check for listener paths
- final int size = paths.length;
- class Temp {
- boolean found = false;
- }
- final Temp temp = new Temp();
- try {
- delta.accept(new IResourceDeltaVisitor() {
- public boolean visit(IResourceDelta visitorDelta) {
- if (temp.found)
- return false;
- IPath path = visitorDelta.getProjectRelativePath();
-
- boolean prefix = false;
- for (int j = 0; j < size && !temp.found; j++) {
- if (paths[j].equals(path))
- temp.found = true;
- else if (path.isPrefixOf(paths[j]))
- prefix = true;
- }
- if (temp.found) {
- ((ProjectModule) module).update();
- return false;
- } else if (prefix)
- return true;
- else
- return false;
- }
- });
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error searching for listening paths", e);
- }
- }
- }
- }
- }
- }*/
-
- /**
- * Add a module for the given project.
- *
- * @param project a project
- */
- protected void addModules(IProject project) {
- IModule[] modules = null;
- try {
- modules = createModules(project);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error creating modules", e);
- }
- if (modules == null || modules.length == 0)
- return;
- projects.put(project, modules);
- added = new ArrayList(2);
- added.addAll(Arrays.asList(modules));
- }
-
- /**
- * Remove the modules that represents the given project.
- *
- * @param project a project
- */
- protected void removeModules(IProject project) {
- try {
- IModule[] modules = (IModule[]) projects.get(project);
-
- projects.remove(project);
- if (removed == null)
- removed = new ArrayList(2);
- if(modules == null)
- return;
- removed.addAll(Arrays.asList(modules));
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error removing module project", e);
- }
- }
-
- /**
- * Returns true if the project may contain modules of the correct type.
- * This method is used only to improve performance.
- *
- * @param project a project
- * @return <code>true</code> if the project may contain modules, and
- * <code>false</code> if it definitely does not
- */
- protected abstract boolean isValidModule(IProject project);
-
- /**
- * Creates the modules for a given project.
- *
- * @param project a project to create modules for
- * @return a possibly empty array of modules
- */
- protected abstract IModule[] createModules(IProject project);
-
- /**
- * Returns <code>true</code> if at least one file in the delta is changed,
- * and <code>false</code> otherwise.
- *
- * @param delta a resource delta
- * @return <code>true</code> if at least one file in the delta is changed,
- * and <code>false</code> otherwise
- */
- private static boolean deltaContainsChangedModules(IResourceDelta delta) {
- class Temp {
- boolean b = false;
- }
- final Temp t = new Temp();
- try {
- delta.accept(new IResourceDeltaVisitor() {
- public boolean visit(IResourceDelta delta2) throws CoreException {
- if (t.b)
- return false;
- //Trace.trace(Trace.FINEST, delta2.getResource() + " " + delta2.getKind() + " " + delta2.getFlags());
- if (".wtpmodules".equals(delta2.getResource().getName())) {
- t.b = true;
- return false;
- } else if (".facets".equals(delta2.getResource().getName())) {
- t.b = true;
- return false;
- } else if (".component".equals(delta2.getResource().getName())) {
- t.b = true;
- return false;
- } else if ("org.eclipse.wst.common.project.facet.core.xml".equals(delta2.getResource().getName())) {
- t.b = true;
- return false;
- }
-
- return true;
- }
- });
- } catch (Exception e) {
- // ignore
- }
- //Trace.trace(Trace.FINEST, "Delta contains change: " + t.b);
- return t.b;
- }
-
- /**
- * Returns the list of resources that the module should listen to
- * for state changes. The paths should be project relative paths.
- * Subclasses can override this method to provide the paths.
- *
- * @return a possibly empty array of paths
- */
- protected IPath[] getListenerPaths() {
- return null;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/RuntimeLifecycleAdapter.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/RuntimeLifecycleAdapter.java
deleted file mode 100644
index 4f9480ecd..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/RuntimeLifecycleAdapter.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.util;
-
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.IRuntimeLifecycleListener;
-/**
- * Helper class which implements the IRuntimeLifecycleListener interface
- * with empty methods.
- *
- * @see org.eclipse.wst.server.core.IRuntimeLifecycleListener
- * @plannedfor 1.0
- */
-public class RuntimeLifecycleAdapter implements IRuntimeLifecycleListener {
- /**
- * @see IRuntimeLifecycleListener#runtimeAdded(IRuntime)
- */
- public void runtimeAdded(IRuntime runtime) {
- // do nothing
- }
-
- /**
- * @see IRuntimeLifecycleListener#runtimeChanged(IRuntime)
- */
- public void runtimeChanged(IRuntime runtime) {
- // do nothing
- }
-
- /**
- * @see IRuntimeLifecycleListener#runtimeRemoved(IRuntime)
- */
- public void runtimeRemoved(IRuntime runtime) {
- // do nothing
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/ServerLifecycleAdapter.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/ServerLifecycleAdapter.java
deleted file mode 100644
index ad7980a5c..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/ServerLifecycleAdapter.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.util;
-
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.IServerLifecycleListener;
-/**
- * Helper class which implements the IServerLifecycleListener interface
- * with empty methods.
- *
- * @see org.eclipse.wst.server.core.IServerLifecycleListener
- * @plannedfor 1.0
- */
-public class ServerLifecycleAdapter implements IServerLifecycleListener {
- /**
- * @see IServerLifecycleListener#serverAdded(IServer)
- */
- public void serverAdded(IServer server) {
- // do nothing
- }
-
- /**
- * @see IServerLifecycleListener#serverChanged(IServer)
- */
- public void serverChanged(IServer server) {
- // do nothing
- }
-
- /**
- * @see IServerLifecycleListener#serverRemoved(IServer)
- */
- public void serverRemoved(IServer server) {
- // do nothing
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/SocketUtil.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/SocketUtil.java
deleted file mode 100644
index 7ac75291e..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/SocketUtil.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.util;
-
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.net.InetAddress;
-import java.net.ServerSocket;
-import java.net.SocketException;
-import java.util.Random;
-
-import org.eclipse.wst.server.core.internal.Trace;
-/**
- * A utility class for socket-related function. It's main purposes are to find
- * unused ports, check whether a port is in use, and check whether a given
- * address is a local(host) address.
- *
- * @plannedfor 1.0
- */
-public class SocketUtil {
- private static final Random rand = new Random(System.currentTimeMillis());
-
- private static String dnsHostname;
-
- private static final String DNSNAMESERVICE_CLASS = "sun.net.spi.nameservice.dns.DNSNameService";
-
- /**
- * Static utility class - cannot create an instance.
- */
- private SocketUtil() {
- // cannot create
- }
-
- /**
- * Finds an unused port between the given from and to values.
- *
- * @param low lowest possible port number
- * @param high highest possible port number
- * @return an usused port number, or <code>-1</code> if no used ports could be found
- */
- public static int findUnusedPort(int low, int high) {
- if (high < low)
- return -1;
-
- for (int i = 0; i < 10; i++) {
- int port = getRandomPort(low, high);
- if (!isPortInUse(port))
- return port;
- }
- return -1;
- }
-
- /**
- * Return a random port number in the given range.
- *
- * @param low lowest possible port number
- * @param high highest possible port number
- * @return a random port number in the given range
- */
- private static int getRandomPort(int low, int high) {
- return rand.nextInt(high - low) + low;
- }
-
- /**
- * Checks to see if the given port number is being used.
- * Returns <code>true</code> if the given port is in use, and <code>false</code>
- * otherwise. Retries every 500ms for "count" tries.
- *
- * @param port the port number to check
- * @param count the number of times to retry
- * @return boolean <code>true</code> if the port is in use, and
- * <code>false</code> otherwise
- */
- public static boolean isPortInUse(int port, int count) {
- boolean inUse = isPortInUse(port);
- while (inUse && count > 0) {
- try {
- Thread.sleep(500);
- } catch (Exception e) {
- // ignore
- }
- inUse = isPortInUse(port);
- count --;
- }
-
- return inUse;
- }
-
- /**
- * Checks to see if the given port number is being used.
- * Returns <code>true</code> if the given port is in use, and <code>false</code>
- * otherwise.
- *
- * @param port the port number to check
- * @return boolean <code>true</code> if the port is in use, and
- * <code>false</code> otherwise
- */
- public static boolean isPortInUse(int port) {
- ServerSocket s = null;
- try {
- s = new ServerSocket(port);
- } catch (SocketException e) {
- return true;
- } catch (IOException e) {
- return true;
- } catch (Exception e) {
- return true;
- } finally {
- if (s != null) {
- try {
- s.close();
- } catch (Exception e) {
- // ignore
- }
- }
- }
-
- return false;
- }
-
- /**
- * Checks if the given host (name or IP address) is pointing to the local
- * machine.
- * Although this method is not foolproof (especially if the network
- * configuration of the current machine is incorrect or failing), it will
- * correctly identify just about all loopback adapters and the local hostname
- * or IP address.
- * <p>
- * This method will not attempt to make an external network connection, so
- * it returns quickly and is safe to use in UI interfaces.
- * </p>
- *
- * @param host a hostname or IP address
- * @return <code>true</code> if the given host is localhost, and
- * <code>false</code> otherwise
- */
- public static boolean isLocalhost(String host) {
- if (host == null)
- return false;
- try {
- if ("localhost".equals(host) || "127.0.0.1".equals(host))
- return true;
-
- InetAddress localHostaddr = InetAddress.getLocalHost();
- if (localHostaddr.getHostName().equals(host) || host.equals(localHostaddr.getCanonicalHostName()))
- return true;
-
- if (localHostaddr.getHostAddress().equals(host))
- return true;
-
- if (dnsHostname == null)
- try {
- // workaround to break dependency with Sun's classes
- Class cl = Class.forName(DNSNAMESERVICE_CLASS);
- Method getHostByAddrMeth = cl.getMethod("getHostByAddr", new Class[] {byte[].class});
- Object dns = cl.newInstance();
-
- dnsHostname = (String)getHostByAddrMeth.invoke(dns,
- new Object[] { localHostaddr.getAddress() });
- } catch (Throwable t) {
- dnsHostname = "*****************";
- }
-
- if (dnsHostname != null && dnsHostname.equals(host))
- return true;
- } catch (Exception e) {
- Trace.trace(Trace.WARNING, "Error checking for localhost", e);
- }
- return false;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/WebResource.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/WebResource.java
deleted file mode 100644
index de97aa894..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/WebResource.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.core.util;
-
-import org.eclipse.core.runtime.IPath;
-
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IModuleArtifact;
-/**
- *
- * @plannedfor 1.0
- */
-public class WebResource implements IModuleArtifact {
- private IModule module;
- private IPath path;
-
- /**
- * Create a new reference to a Web resource (HTML, GIF, etc. on a server).
- *
- * @param module a module
- * @param path a relative path within the module
- */
- public WebResource(IModule module, IPath path) {
- this.module = module;
- this.path = path;
- }
-
- /**
- * @see IModuleArtifact#getModule()
- */
- public IModule getModule() {
- return module;
- }
-
- /**
- * Return the relative path to the artifact within the module.
- *
- * @return the relative path
- */
- public IPath getPath() {
- return path;
- }
-
- /**
- * @see Object#toString()
- */
- public String toString() {
- return "WebResource [module=" + module + ", path=" + path + "]";
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/package.html b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/package.html
deleted file mode 100644
index 41d3ed62f..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/package.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<html>
-<head>
-<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link rel="stylesheet" href="../../../../../..//apistyles.css" type="text/css">
-<title>WTP API overview</title>
-</head>
-<body>
-<p>Utility classes for the server tools framework.</p>
-<table width="500">
-<tr>
-<td>
-<p>PingThread is a utility class for pinging a server to determine if
-it is running and updating the server's state.</p>
-</td>
-</tr>
-</table>
-<table width="500">
-<tr>
-<td>
-<p>SocketUtil contains utility methods for determining if ports are
-free and whether a given hostname is a local hostname.</p>
-</td>
-</tr>
-</table>
-<table width="500">
-<tr>
-<td>
-<p>The four XXXAdapter classes are implementations of server tools
-listener interfaces with the method bodies stubbed in; they can be
-subclassed by clients who only want to implement a single listener
-interface method.</p>
-</td>
-</tr>
-</table>
-<table width="500">
-<tr>
-<td>
-<p>ServerPort, Task, and TaskModel are standard implementations of
-other interface classes.</p>
-</td>
-</tr>
-</table>
-</body>
-</html>
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/package.xml b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/package.xml
deleted file mode 100644
index ffb244455..000000000
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/package.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<html>
-<head>
- <!-- Escape to the root of your source folder -->
- <meta
- name="root"
- content="../../../../../../" />
- <title>WTP API overview</title>
-</head>
-
-<body>
-
-<abstract>Utility classes for the server tools framework.</abstract>
-
-<p>PingThread is a utility class for pinging a server to determine if
-it is running and updating the server's state.</p>
-
-<p>SocketUtil contains utility methods for determining if ports are
-free and whether a given hostname is a local hostname.</p>
-
-<p>The four XXXAdapter classes are implementations of server tools
-listener interfaces with the method bodies stubbed in; they can be
-subclassed by clients who only want to implement a single listener
-interface method.</p>
-
-<p>ServerPort, Task, and TaskModel are standard implementations of
-other interface classes.</p>
-
-</body>
-</html> \ No newline at end of file

Back to the top