Implementing Generic Servers for Eclipse WebTools


Published on

A tutorial for implementing generic server adapters for the Eclipse WebTools Platform. This was presented on EclipseCon 2006.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Implementing Generic Servers for Eclipse WebTools

  1. 1. Gorkem Ercan – Nokia EclipseCon 2006 Implementing Generic Servers
  2. 2. What is Generic Server Framework <ul><li>Easiest way to add server support to WTP </li></ul><ul><ul><li>No coding </li></ul></ul><ul><li>A special server and runtime that can adjust behavior </li></ul><ul><ul><li>Server type definition files determine behavior </li></ul></ul><ul><li>Uses WTP server tool extensions </li></ul><ul><ul><li>RuntimeTypes </li></ul></ul><ul><ul><li>ServerTypes </li></ul></ul><ul><li>Provides UI support </li></ul><ul><ul><li>Server type definition file driven </li></ul></ul>
  3. 3. Extensions - Runtime type <ul><li>Extension: org.eclipse.wst.server.core.runtimeTypes </li></ul><ul><li>Implementation: org.eclipse.jst.server.generic.core.internal.GenericServerRuntime </li></ul>
  4. 4. Extensions – Server Type <ul><li>Extension: org.eclipse.wst.server.core.serverTypes </li></ul><ul><li>Implementation: org.eclipse.jst.server.generic.core.internal.GenericServer </li></ul><ul><li>behaviourClass: </li></ul><ul><li>org.eclipse.jst.server.generic.core.internal.GenericServerBehaviour </li></ul>
  5. 5. Extensions - UI <ul><li>Extension: org.eclipse.wst.server.ui.wizardFragments </li></ul><ul><li>Implementation(Server): org.eclipse.jst.server.generic.ui.internal.GenericServerWizardFragment </li></ul><ul><li>Implementation(Runtime): org.eclipse.jst.server.generic.ui.internal.GenericServerRuntimeWizardFragment </li></ul>
  6. 6. Extensions - Classpath <ul><li>Extension: org.eclipse.jst.server.core.runtimeClasspathProviders </li></ul><ul><li>Implementation: org.eclipse.jst.server.generic.core.internal.GenericServerRuntimeTargetHandler </li></ul>
  7. 7. Extension – Server definition file <ul><li>org.eclipse.jst.server.generic.core.serverdefinition </li></ul><ul><li>Also remember other server extension points </li></ul><ul><ul><li>Server Images - org.eclipse.wst.server.ui.serverImages </li></ul></ul><ul><ul><li>Facet runtimes - org.eclipse.wst.common.project.facet.core.runtimes </li></ul></ul><ul><ul><li>Facet images- org.eclipse.wst.common.project.facet.ui.images </li></ul></ul><ul><ul><li>Facet mappings - org.eclipse.jst.server.core.runtimeFacetMappings </li></ul></ul>
  8. 8. Generic Publishers <ul><li>Handles publishing modules to servers for generic servers </li></ul><ul><li>Introduced using org.eclipse.jst.server.generic. generic publisher extension point </li></ul><ul><li>You do not need one for basic scenarios </li></ul><ul><ul><li>use ANT build file based publisher that is part of WTP </li></ul></ul><ul><li>Simple API </li></ul><ul><ul><li>extend org.eclipse.jst.server.generic.core.internal.GenericPublisher class </li></ul></ul><ul><ul><li>See org.eclipse.jst.server.generic.core.internal.publishers.AntPublishe </li></ul></ul>
  9. 9. .serverdef file explained <ul><li>XML based meta information about the server </li></ul><ul><li>Introduced using “org.eclipse.jst.server.generic.core.serverdefinition ” extension </li></ul><ul><li>Two parts </li></ul><ul><ul><li>Properties </li></ul></ul><ul><ul><li>Derived server information </li></ul></ul><ul><li>Properties are variables that users provide values using server tools UI </li></ul><ul><li>Derived server information used by the generic server to enable functionality </li></ul>
  10. 10. Properties to collect user data <ul><li>Properties determine the generic server user interface for collecting user data. </li></ul><ul><li>Has following mandatory properties </li></ul><ul><ul><li>id: unique value to refer to property later in the file </li></ul></ul><ul><ul><li>label: User friendly alias for the property. This is value is diplayed to users. </li></ul></ul><ul><ul><li>type: determines the type of GUI to use. The allowed values, &quot;string&quot; renders a text widget, &quot;boolean&quot; renders a check box, &quot;directory&quot; renders a file path dialog, &quot;file&quot; renders a file dialog. “select” renders a Combo. </li></ul></ul><ul><ul><li>context: Determineds whether the property is part of server runtime or a server instance. </li></ul></ul><ul><ul><li>default: This is the initial value presented to user. </li></ul></ul>
  11. 11. Property example
  12. 12. Classpath definitions <ul><li>Can be consumed by different sections of the server definition. </li></ul><ul><ul><li>start, stop </li></ul></ul><ul><ul><li>project build path </li></ul></ul><ul><li>Contains following attributes </li></ul><ul><ul><li>id: identified by this in the framework </li></ul></ul><ul><ul><li>archive and path: points either to a directory or a java library that will be a part of the classpath. </li></ul></ul><ul><ul><li>Project classpaths are determined by the project element </li></ul></ul>
  13. 13. Info that starts/stops <ul><li>used to define parameters to launch and stop a server, </li></ul><ul><li>two launch kinds </li></ul><ul><ul><li>java launch </li></ul></ul><ul><ul><li>external launch. </li></ul></ul><ul><ul><li>determined by the launch configuration in the definition of the server type. </li></ul></ul><ul><li>These attributes are common to both launch types </li></ul><ul><ul><li>workingDirectory: directory in which the application server starts. </li></ul></ul><ul><ul><li>programArguments: Specific values that the server is expecting </li></ul></ul><ul><ul><li>environmentVariable: These are the name and value pairs for environment variables </li></ul></ul>
  14. 14. A java launch <ul><li>In addition to common attributes the following is required </li></ul><ul><ul><li>mainClass Name of the class with main to start the server </li></ul></ul><ul><ul><li>vmParameters: parameters to java virtual machine </li></ul></ul><ul><ul><li>classpathReference: classpath definition used to invoke main class </li></ul></ul>
  15. 15. External launch <ul><li>In addition to common attributes the following is required </li></ul><ul><ul><li>debugPort: port number eclipse debugger uses to connect </li></ul></ul><ul><ul><li>external: This is the external executable or script that will be used </li></ul></ul>
  16. 16. Publisher <ul><li>It is possible to provide server specific information for initializing the publisher </li></ul><ul><ul><li>id: id of the publisher that matches the id int the plugin.xml where publisher is defined </li></ul></ul><ul><ul><li>publisherdata: value pair that will be passed to publisher </li></ul></ul>
  17. 17. Modules <ul><li>Determines the supported module types and publisher information </li></ul><ul><li>Has these attributes </li></ul><ul><li>type: The module type, must match the plugin.xml value where the module type is defined </li></ul><ul><li>publishDir: The directory where published </li></ul><ul><li>publisherReference: The id of the generic publisher </li></ul>
  18. 18. Ports <ul><li>the port element indicates the ports and the protocols that the server starts </li></ul><ul><ul><li>no: The port number </li></ul></ul><ul><ul><li>protocol: The protocol supported by this port </li></ul></ul><ul><ul><li>name: User friendly name of the protocol </li></ul></ul>
  19. 19. JNDI Properties <ul><li>The JNDI properties for a server. The jndiConnection element is used to provide the jndi information for accessing an application server. </li></ul><ul><ul><li>providerUrl: The url to jndi server. </li></ul></ul><ul><ul><li>initialContextFactory: initial context factory class </li></ul></ul><ul><ul><li>jndiProperty: Name, value pairs that may be used for connection </li></ul></ul>
  20. 20. LAB <ul><li>Certain parts of a tomcat generic server plug-in project is commented </li></ul><ul><li>Commented files are tomcat.serverdef and plugin.xml </li></ul><ul><li>Search for “***” to discover commented parts. </li></ul>