You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

This document outlines the work that is underway to extend the Eclipse Web Tools Platform so that it can offer support for JBI components.  In order to understand a little about the process we'll walk through the steps involved in added a new module type,  creating a server definition and then ultimately adding the a new project type and deployables.

Its a work in progress,  but hopefully by seeing the process of adding the extension we help feed innovation around WTP and JBI.

OK.. Lets start at the begining, we will basically create three plug-in projects,  these will be for the server definition,  the UI components of JBI and the JBI core components (which will cover creating deployables).

We will start in the UI project,  and do our first big step,  we will declare a new type of module.  In our case this will be a jst.jbi.component (though obviously we could create a new module type for other things ie a BPEL module).

<extension point="org.eclipse.wst.server.core.moduleTypes">
    <moduleType id="jst.jbi.component" name="%jbi.component.module.type.name" />
</extension>

A fine first move, and certainly one that we can be proud of. Now we have our new module type we will want to build up all that wonderful functionality around it.

Now we have a module type we need to move on to the defining the ServiceMix server, we aren't going to go into all the details here since it is more of a general overview of the functionality and steps required. Server Definitions are basically just plug-in themselves, though they need to implement some extension points to allow themselves to be added. WTP supports the concept of a generic server, this is one that is able to be started and controlled through a simple definition XML file and one that can handle publishing a project using an ANT task. You can override this functionality and implement real Java classes to do it all though for our purposes we should be able to function using the Generic (though we do need to override the behaviour since generic servers look for an http connection to be in place to determine that the server has started).

To start lets look at our plugin.xml :

<extension point="org.eclipse.wst.server.core.runtimeTypes">
	   <runtimeType
			id="org.eclipse.jst.server.generic.runtime.servicemix30"
			name="%servicemix30.runtime.name"
			description="%servicemix30.runtime.description" vendor="%servicemix30.vendor"
			version="3.0"
			class="org.eclipse.jst.server.generic.core.internal.GenericServerRuntime">
			<moduleType types="jst.jbi.component" versions="1.0" />
		</runtimeType>
	</extension>

First up we declare a runtime, in WTP there is a separation between a runtime which contains the libraries and functionality that wish to associate to a project and a server which is a running instance of the runtime. In this extension point we basically declare that we have a new runtime which is based on generic called servicemix30, we also associate our modulue type with this runtime.

<extension point="org.eclipse.wst.server.core.serverTypes">
		<serverType
			class="org.eclipse.jst.server.generic.core.internal.GenericServer"
			id="org.eclipse.jst.server.generic.servicemix30"
			initialState="stopped" supportsRemoteHosts="false"
			runtimeTypeId="org.eclipse.jst.server.generic.runtime.servicemix30"
			description="%servicemix30.server.description"
			launchConfigId="org.eclipse.jst.server.generic.core.launchConfigurationType"
			behaviourClass="org.eclipse.jst.server.servicemix.ServiceMixServerBehaviour"
			name="%servicemix30.server.name" startTimeout="75000" stopTimeout="15000"
			hasConfiguration="false" launchModes="run,debug,profile" runtime="true"
			startBeforePublish="false" />
	</extension>

Next up we need to declare our server type, it sits on top of our runtime and determine some basic information as to how the server is started and stopped as well as whether it needs to be running to publish to. Publish is where a project can be deployed (published) to a server, note that publishing is always to a server not a runtime.

Next up since we are using the GenericServer class in our server type (see above) we need to declare where to get the definition for the server:

<extension
		point="org.eclipse.jst.server.generic.core.serverdefinition">
		<serverdefinition
			definitionfile="/servers/servicemix30.serverdef.xml"
			id="org.eclipse.jst.server.generic.runtime.servicemix30" />
	</extension>

The server definition is an interesting file (there is a good write-up on server definitions here), obviously our server definition will include the jst.jbi.component deploy and undeploy in the place of the EJB/WAR or EAR stuff that normally is used:

<?xml version="1.0" encoding="UTF-8"?>
<tns:ServerRuntime
	xmlns:tns="http://eclipse.org/jst/server/generic/ServerTypeDefinition"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://eclipse.org/jst/server/generic/ServerTypeDefinition"
	name="Apache ServiceMix 3.0" version="3.0">

	<property id="serverRootDirectory"
		label="%servicemix30.installation.path" type="directory"
		context="runtime" default="C:/servicemix-3.0" />

	<module>
		<type>jst.jbi.component</type>
		<publishDir>${serverRootDirectory}/install</publishDir>
		<publisherReference>org.eclipse.jst.server.generic.antpublisher</publisherReference>
	</module>
	
	<publisher id="org.eclipse.jst.server.generic.antpublisher">
		<publisherdata>
			<dataname>build.file</dataname>
			<datavalue>/buildfiles/servicemix30.xml</datavalue>
		</publisherdata>
		<publisherdata>
			<dataname>target.publish.jst.jbi.component</dataname>
			<datavalue>deploy.jbi.component</datavalue>
		</publisherdata>	
		<publisherdata>
			<dataname>target.unpublish.jst.jbi.component</dataname>
			<datavalue>undeploy.jbi.component</datavalue>
		</publisherdata>	
	</publisher>

	<project>
		<classpathReference>servicemix.project</classpathReference>
	</project>

	<start>
		<mainClass>org.codehaus.classworlds.Launcher</mainClass>
		<workingDirectory>${serverRootDirectory}</workingDirectory>
		<programArguments></programArguments>
		<vmParameters>
			-Xms128m
			-Dclassworlds.conf=${serverRootDirectory}\conf\servicemix.conf
			-Xmx512m
			-Djava.endorsed.dirs=${serverRootDirectory}\lib\endorsed
			-Dservicemix.home=${serverRootDirectory}
		</vmParameters>
		<classpathReference>servicemix</classpathReference>
	</start>

	<stop>
		<mainClass>org.jboss.Shutdown</mainClass>
		<workingDirectory>${serverRootDirectory}/bin</workingDirectory>		
		<vmParameters></vmParameters>
		<classpathReference>jboss.shutdown</classpathReference>
	</stop>

	<publisher id="org.eclipse.jst.server.generic.antpublisher">
		<publisherdata>
			<dataname>build.file</dataname>
			<datavalue>/buildfiles/servicemix30.xml</datavalue>
		</publisherdata>
		<publisherdata>
			<dataname>target.publish.jbi</dataname>
			<datavalue>deploy.jbi.component</datavalue>
		</publisherdata>
		<publisherdata>
			<dataname>target.unpublish.jbi</dataname>
			<datavalue>undeploy.jbi.component</datavalue>
		</publisherdata>
	</publisher>

	<classpath id="servicemix">
		<archive path="${serverRootDirectory}/conf" />
		<archive
			path="${serverRootDirectory}/lib/classworlds-1.0.1.jar" />
	</classpath>

	<classpath id="servicemix.project">
		<archive path="${serverRootDirectory}/servicemix-3.0-M1.jar" />
	</classpath>
</tns:ServerRuntime>
  • No labels