Difference between revisions of "Corona/HowTo/ServerApplication"

From Eclipsepedia

Jump to: navigation, search
Line 25: Line 25:
 
:;thread:this must be set to '''any'''
 
:;thread:this must be set to '''any'''
 
:;icon:leave this value blank.  server-side applications do not require an icon.
 
:;icon:leave this value blank.  server-side applications do not require an icon.
 +
** Define OSGi ''Server'' Application
 +
*** Right mouse click on the extension, select '''New-run'''
 +
*** In the ''Extension Element Details'', enter the name of your OSGi application
 +
*** Click on the '''class''' label to open the application class in the Java editor
 +
**** The ''New Java Class'' dialog should appear
 +
** Create the OSGi server application class
 +
*** Using the ''New Java Class'' dialog, set ''org.eclipse.corona.server.AbstractServerApplication'' as the ''Superclass''.
 +
*** Select '''Finish'''
  
 +
At this point, the shell of the OSGi server application class has been created.  By extending ''AbstractServerApplication'', several interfaces require implementation.  Most of generic functionality is provided by ''AbstractServerApplication''.  However your OSGi server application requires customer ''start()'' and ''stop()'' handling.
 +
 +
* Implement ''start()''
 +
** must invoke ''super.start(ctxBundle, ctxApplication, SERVER_NAME);''
 +
** must not return until application has finished
 +
*** use ''stop()'' to interrupt application
 +
 +
* Implement ''stop()''
 +
** must invoke ''super.stop();
 +
 +
** Implement the
 
=Step 3: Update ''osgi.applications''=
 
=Step 3: Update ''osgi.applications''=
  
 
[[Category:Corona]]
 
[[Category:Corona]]

Revision as of 08:09, 31 July 2008

Corona's server-side environment supports the execution of multiple servers. These servers are OSGi applications that are (optionally) started when the Corona server is started. Corona provides the main OSGi application used to manage the start/stop lifecycle of the secondary server applications. The following server applications are provided as samples:

Database Server
based upon Apache Derby
Collaboration Server
based upon ECF generic server

Step 1: Create Plug-in

Assuming you are already familiar with creating plug-in projects within the PDE/IDE...

  • Create a new plug-in using the PDE project wizard
    • Select File->New->Project
    • Expand Plug-in Development
    • Select Plug-in Project
  • Complete the Plug-in Project dialog, select Next
  • Complete the Plug-in Content dialog, select Finish
    • ensure the plug-in does not contribute to the UI
  • Create dependency upon the org.eclipse.corona plug-in
    • Open the plug-in's meta-data via manifest editor
    • Select the Dependencies tab
    • Add org.eclipse.corona as a required plug-in
  • Save the plug-in's meta-data
    • This will update the plug-in's classpath needed in the following steps

Step 2: Create OSGi Application

  • Within a plug-in project, create an extension to the org.eclipse.core.runtime.applications extension point
visibility
set this value specific to your server application
cardinality
set this value specific to your server application
thread
this must be set to any
icon
leave this value blank. server-side applications do not require an icon.
    • Define OSGi Server Application
      • Right mouse click on the extension, select New-run
      • In the Extension Element Details, enter the name of your OSGi application
      • Click on the class label to open the application class in the Java editor
        • The New Java Class dialog should appear
    • Create the OSGi server application class
      • Using the New Java Class dialog, set org.eclipse.corona.server.AbstractServerApplication as the Superclass.
      • Select Finish

At this point, the shell of the OSGi server application class has been created. By extending AbstractServerApplication, several interfaces require implementation. Most of generic functionality is provided by AbstractServerApplication. However your OSGi server application requires customer start() and stop() handling.

  • Implement start()
    • must invoke super.start(ctxBundle, ctxApplication, SERVER_NAME);
    • must not return until application has finished
      • use stop() to interrupt application
  • Implement stop()
    • must invoke super.stop();
    • Implement the

Step 3: Update osgi.applications