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.
Difference between revisions of "EclipseLink/Examples/DBWS/AdvancedOSGi"
(→Create a new Plug-in project) |
(→Create a new Plug-in project) |
||
Line 33: | Line 33: | ||
Proceed to the next panel of the wizard where the (OSGi bundle) Activator for SimpleTable is defined:<br/> | Proceed to the next panel of the wizard where the (OSGi bundle) Activator for SimpleTable is defined:<br/> | ||
[[Image:EclipseLink DBWS with OSGi SimpleTableActivator.png]]<br/> | [[Image:EclipseLink DBWS with OSGi SimpleTableActivator.png]]<br/> | ||
+ | Click 'Finish' and open the generated Activator: | ||
+ | |||
+ | <java5> | ||
+ | package simpletable; | ||
+ | |||
+ | import org.osgi.framework.BundleActivator; | ||
+ | import org.osgi.framework.BundleContext; | ||
+ | |||
+ | public class Activator implements BundleActivator { | ||
+ | |||
+ | private static BundleContext context; | ||
+ | |||
+ | static BundleContext getContext() { | ||
+ | return context; | ||
+ | } | ||
+ | |||
+ | /* | ||
+ | * (non-Javadoc) | ||
+ | * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) | ||
+ | */ | ||
+ | public void start(BundleContext bundleContext) throws Exception { | ||
+ | Activator.context = bundleContext; | ||
+ | } | ||
+ | |||
+ | /* | ||
+ | * (non-Javadoc) | ||
+ | * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) | ||
+ | */ | ||
+ | public void stop(BundleContext bundleContext) throws Exception { | ||
+ | Activator.context = null; | ||
+ | } | ||
+ | } | ||
+ | </java5> |
Revision as of 15:46, 11 August 2010
DBWS in an OSGi Environment
An Eclipselink DBWS service can be run in an OSGi environment using Javase 6's 'containerless' javax.xml.ws.Endpoint API.
Environment Setup
Download a version of the Eclipse IDE that includes the Plug-in Development Environment (PDE) (Eclipse IDE for Java EE Developers, Eclipse Classic 3.6.0 or
Eclipse for RCP and RAP Developers).
Install an OSGi-friendly JDBC driver - use Derby bundle:
- Download Apache Derby (org.apache.derby) bundle from Orbit.
- Place the org.apache.derby bundle into your $ECLIPSE_HOME/dropins folder.
- Install the EclipseLink and Jetty target Components:
Accept the license and proceed through the prompts for re-starting Eclipse ...
{NB - later, a set of updated EclipseLink bundles will be required}
Under 'Preferences' -> 'Plug-in Development' -> 'Target Platform', reload the Running Platform (Active)
Create a new Plug-in project
From the 'Plug-in Development' Perspective, create a new Plug-in project SimpleTable:
{Note the choice of 'standard' for OSGi framework}
Proceed to the next panel of the wizard where the (OSGi bundle) Activator for SimpleTable is defined:
Click 'Finish' and open the generated Activator:
<java5> package simpletable;
import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext;
public class Activator implements BundleActivator {
private static BundleContext context;
static BundleContext getContext() { return context; }
/* * (non-Javadoc) * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) */ public void start(BundleContext bundleContext) throws Exception { Activator.context = bundleContext; }
/* * (non-Javadoc) * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) */ public void stop(BundleContext bundleContext) throws Exception { Activator.context = null; } } </java5>