Skip to main content
Jump to: navigation, search


< EclipseLink‎ | Development‎ | DBWS‎ | OSGi

Modifying Activator to implement

Change the Activator to extend org.eclipse.persistence.internal.dbws.ProviderHelper (NB - will show errors):
EclipseLink DBWS with OSGi ProviderHelperwavy.png
In order to correct the errors, the SimpleTable project needs to update its list of required bundles. Open the MANIFEST.MF file in the 'Plug-in Manifest Editor' and select the 'Dependencies' tab and add the following bundles: EclipseLink DBWS with OSGi Dependencies.png

The Activator needs to be annotated to support a (dynamic) Web services Endpoint:

public class Constants {
    //DBWS Properties
    public static final String TEST_PROJECT = 
    //JAX-WS properties
    public static final String TEST_NAMESPACE = 
    	"urn:" + TEST_PROJECT;
    public static final String TEST_SERVICE = 
    	TEST_PROJECT + "Service";
    public static final String TEST_SERVICE_NAMESPACE = 
    	"urn:" + TEST_SERVICE;
    public static final String TEST_PORT = 
    	TEST_SERVICE + "Port";
    public static final String ENDPOINT_ADDRESS = 
    	"http://localhost:9999/" + TEST_PROJECT;
package simpletable;
//java eXtension imports
import javax.xml.namespace.QName;
import javax.xml.soap.SOAPMessage;
import static;
import static;
//EclipseLink imports
import org.eclipse.persistence.internal.dbws.ProviderHelper;
import org.eclipse.persistence.sessions.Session;
//OSGi/PDE imports
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
//test imports
import static simpletable.Constants.ENDPOINT_ADDRESS;
import static simpletable.Constants.TEST_PORT;
import static simpletable.Constants.TEST_SERVICE_NAMESPACE;
import static simpletable.Constants.TEST_SERVICE;
    targetNamespace = TEST_SERVICE_NAMESPACE,
    serviceName = TEST_SERVICE,
    portName = TEST_PORT
public class Activator extends ProviderHelper implements BundleActivator, Provider<SOAPMessage> {
	private static BundleContext context;
	private static Endpoint endpoint = null;
	private static QName portQName = null;
	private static Service testService = null;
	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;
            super.init(getClass().getClassLoader(), null, false);
            endpoint = Endpoint.create(this);
            QName serviceQName = new QName(TEST_SERVICE_NAMESPACE, TEST_SERVICE);
            portQName = new QName(TEST_SERVICE_NAMESPACE, TEST_PORT);
            testService = Service.create(serviceQName);
            testService.addPort(portQName, SOAP11HTTP_BINDING, ENDPOINT_ADDRESS);
	    System.out.println("Hello, " + testService.toString());
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
	public void stop(BundleContext bundleContext) throws Exception {
	    Activator.context = null;
            if (endpoint != null) {

Back to the top