Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Corona/HowTo/ServerApplication

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

Create Application Extension

EclipseApplicationExtPoint.jpg
  • 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

Implement Application Lifecyle

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();

Step 3: Start OSGi Server Application

Autostart When Corona Starts

To have the OSGi server application automatically start when the Corona server is started, add the name of the application to the osgi.applications property defined in config.ini

Start within IDE Run/Debug Launch

  • Define the property osgi.applications via VM arguments
    • ex: -Dosgi.applications=org.eclipse.corona.test.application

Back to the top