Server Tools API Changes
Server Tools API Changes
WTP LogoWTP Home
 

This document contains information on API changes that have been made to the WTP Server Tools API.

M1 Changes
 

Here are the Server Tools API changes that went into M1.

Package renames:
 

com.ibm.wtp.server.core -> org.eclipse.wst.server.core
com.ibm.wtp.server.ui -> org.eclipse.wst.server.ui
com.ibm.wtp.server.util -> org.eclipse.wst.server.util
com.ibm.wtp.server.java.core -> org.eclipse.jst.server.core
com.ibm.wtp.server.java.ui -> org.eclipse.jst.server.ui
com.ibm.wtp.server.tomcat.core -> org.eclipse.jst.server.tomcat.core
com.ibm.wtp.server.tomcat.ui -> org.eclipse.jst.server.tomcat.ui
com.ibm.wtp.monitor.core -> org.eclipse.wst.internet.monitor.core
com.ibm.wtp.monitor.ui -> org.eclipse.wst.internet.monitor.ui
com.ibm.wtp.webbrowser -> org.eclipse.wst.internet.webbrowser

M2 Changes
 

Here are the Server Tools API changes that went into M2.

 

Change Reason Old Code New Code
All java.util.Lists returned from methods have been changed to arrays of the corresponding content type. Stronger typed return values are safer, and returning a copy of the list (instead of the list itself) blocks against clients modifying internal data structures. List list = ServerCore.getRuntimeTypes(); IRuntimeType[] rt = ServerCore.getRuntimeTypes();
IResourceManager has been removed. Most of it's methods have been moved to the ServerCore class, with the remaining ones in ServerUtil. There was no client benefit of the resource manager, and it was misnamed. ServerCore.getResourceManager().getServers(); ServerCore.getServers();
All extension point interfaces have been changed to abstract classes, and the "I" removed from the name. Allows for future support and maintenance without breaking existing interfaces.
Several interfaces were moved from the .core.model package to .core. The .core.model package was meant for SPIs, not API. All API classes & interfaces will be moved or remain in .core so that API users do not need to use the .core.model package. import org.eclipse.wst.server.code.model.IModule; import org.eclipse.wst.server.code.IModule;
IServerResourceListener renamed to IServerLifecycleListener. Several methods moved out to new IRuntimeListener and IServerConfigurationListener interfaces. "Resource" had to be removed from the name, and the interface contained methods for runtimes and server configurations as well. They are split up so that API users do not need to listen for all types of changes from a single interface. ServerCore.getResourceManager().addServerResourceListener(myListener); ServerCore.addRuntimeLifecycleListener(myListener);
Publishing interfaces completely rewritten & .core.resources package removed. The publishing interface was outdated and written before the Eclipse team support, ANT, or other recent publishing methods had been developed. The new API allows for better support and for each server type to use it's own publishing mechanism.
IRuntimeDelegate and IRuntimeWorkingCopyDelegate merged into a single RuntimeDelegate. IServerDelegate and IServerWorkingCopyDelegate reworked into ServerDelegate and ServerBehaviourDelegate. Making clients provide two separate classes for the delegates was excessive, unnecessary, and ended up with too many SPI classes. Only a single delegate class is now required for these extension points.
IRuntime.getDelegate(), IRuntime.getWorkingCopyDelegate() changed into IRuntime extending IAdaptable. Similar for IServer and other delegates IAdaptable is a common Eclipse mechanism, and allows for other extension as well. Clients should still remember that calling this method may involve plugin loading, so it should not be used in popup menus, etc. ITomcatRuntime tr = (ITomcatRuntime) runtime.getDelegate(); ITomcatRuntime tr = (ITomcatRuntime) runtime.getAdapter(ITomcatRuntime.class);
IModuleType and IModuleKind interfaces merged. IModuleKind was created late in the previous release cycle and couldn't be merged at the time it was created.
IServerTask changed and IModuleTask removed. The existing interfaces had an ITask directly returned as a delegate, and only allowed a single task per extension point. The new IServerTask allows the delegate to return multiple tasks from a single extension point, and it is not itself a task.
*Update* The extension point has been renamed to publishTask, and the class is PublishTaskDelegate. This single extension point can be used to return multiple PublishOperations at the module or server level, which are executed during the publish.
IServerConfiguration, IServerConfigurationWorkingCopy, etc. removed The server config was a relic and did not need to be a first class resource. ServerDelegates are now directly responsible for maintaining the configuration. see Tomcat implementation
Various minor cleanup - methods renamed, parameters changed, etc. Cleanup and future maintenance.
IModuleObjectAdapter -> IModuleArtifactAdapter, IModuleObject -> IModuleArtifact Object was too generic and didn't have any real meaning. Artifact represents what the IModuleObject really represents - resources within a module
getServerType(String id) -> findServerType(String id) Lookup methods on ServerCore and ServerUtil renamed to be more accurate to what they do. IServerType st = getServerType("com.x") IServerType st = findServerType("com.x")
Lots of methods & interfaces moved to internal packages Need to trim down the exposed API to only what is required for ongoing maintenance. If there is anything in an internal package that you were previously using, or plan to use in the future, please contact me and we'll work out an API solution
Publishing changes - several interfaces and the org.eclipse.wst.server.core.resource package removed The old publishing mechanism did not allow flexibility in publishing options (e.g. ANT, Eclipse team support, or some other mechanism) and used an outdated publishing manager framework. ServerDelegate.publishStart(); // Called to tell the server that publishing is starting. Can be used to connect to a remote server, etc.
ServerDelegate.publishStart(); // Called once to allow the server to publish any "global" resources or a server config
ServerDelegate.publishStart(); // Called for each module to give the server a chance to publish using any method it wants
ServerDelegate.publishFinish(); // Called to disconnect from the server or cleanup
IMonitorableServer merged with IServer No need for additional interface IServerDelegate delegate = server.getDelegate()
if (delegate instanceof IMonitorableServer) {
IMonitorableServer ms = (IMonitorableServer) delegate;
List ports = ms.getServerPorts();
}
IServerPort[] ports = server.getServerPorts();
Working copy changes Previously, references were kept to every working copy, and clients had to save() or release() them in finally blocks or else the reference would be dangling (and possibly blocking other changes) forever. This code was unsafe and caused problems if a client tried to use a working copy after it had been saved or released. Now, clients can create a working copy at any time, and references are not kept. On save, a client can specify whether the working copy changes should be forced, or not (in which case the save will fail if someone else has made changes to the object in the meantime). If the changes do not need to be saved, clients can just drop the reference to the working copy at any time. As before, working copies should not be used for long periods of time since it increases the chances that another client has made changes IServerWorkingCopy wc = IServer.getWorkingCopy();
// do something with wc
wc.save(); or wc.release();
IServerWorkingCopy wc = IServer.createWorkingCopy();
// do something with wc
wc.save(); or lose reference
Change IServer.isRestartNeeded() to match other methods IServer.isRestartNeeded(); IServer.getServerRestartState();

M3 Changes
 

Here are the Server Tools API changes that went into M3.

 

Change Reason Old Code New Code
Remove serverAction extension point Duplicate function exists in Eclipse v3.0 <extension point="org.eclipse.wst.server.ui.serverActions">
<serverAction id="org.eclipse.wst.server.ui.projects"
typeIds="org.eclipse.jst.*"
label="%actionModifyModules"
category="control"
icon="icons/ctool16/wiz_modify_modules.gif"
order="50"
class="org.eclipse.wst.server.ui.internal.actions.AddRemoveModulesAction"/>
</extension>
<extension point="org.eclipse.ui.popupMenus">
<objectContribution
id="org.eclipse.wst.server.ui.popupMenu"
objectClass="org.eclipse.wst.server.core.IServer"
adaptable="true">
<filter name="typeIds" value="org.eclipse.jst.*"/>
<action
id="org.eclipse.wst.server.ui.action.modifyModules"
label="%actionModifyModules"
icon="icons/ctool16/wiz_modify_modules.gif"
class="org.eclipse.wst.server.ui.internal.actions.ModifyModulesAction">
</action>
</objectContribution>
</extension>
Remove objectClass attribute from moduleArtifactAdapter extension point and switch to expressions Removal of IModuleArtifactAdapter class
IElement and IElementWorkingCopy removed There was no point having common code between IRuntime and IServer, since they didn't really have any common structure. Existing methods moved to correct location in IRuntime, IServer, and their working copies.
IModuleEvent and IModuleFactoryEvent changed to ModuleEvent and ModuleFactoryEvent Event classes are not typically interfaces, and there was no reason to abstract these two classes. IModuleEvent
IModuleFactoryEvent
ModuleEvent
ModuleFactoryEvent
IServerPreferences removed IServerPreferences was not required as API and was not being used by external plugins. To clean up API, it is being removed from the first API version.
ServerBehaviourDelegate.setLaunchDefaults() renamed ServerBehaviourDelegate.setLaunchDefaults() was renamed to ServerBehaviourDelegate.setupLaunchConfiguration(). It is now called on every launch instead of just the first time. This allows servers to update the launch configuration before it is executed.
org.eclipse.jst.server.j2ee package renamed Package renamed/moved to org.eclipse.jst.server.core since the name was redundant (already in jst). import org.eclipse.jst.server.j2ee.*; import org.eclipse.jst.server.core.*;