db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charlie Kelly <Char...@CharlieKelly.com>
Subject Re: Derby and Osgi
Date Fri, 02 Oct 2009 16:10:15 GMT
Hello Santiago,

You can write an osgi service interface and a class that implements the 
Interface.
The implementation class is an ordinary Java class that can (for example)
open, close, update, or query your Derby database.

For example, the code below is used within the start method of a Bundle, 
called by Eclipse.
ICodeGeneratorService is an Interface (which I wrote).
RcpCodeGeneratorService is an ordinary Java class that implements the 
Interface.

bundleContext.registerService(...) registers the service with osgi so 
that RcpCodeGeneratorService is available at runtime.

Hope this helps.

Charlie



    /*
     * (non-Javadoc)
     * @see 
org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
     */
    @SuppressWarnings("unchecked")
    public void start(BundleContext bundleContext) throws Exception
    {
        super.start(bundleContext);
        plugin = this;       
               
        ICodeGeneratorService iCodeGeneratorService = new 
RcpCodeGeneratorService();
        iCodeGeneratorService.setBundleContext(bundleContext);
        Hashtable hashtable = new Hashtable();    // currently, no 
properties
        
bundleContext.registerService(ICodeGeneratorService.class.getName(), 
iCodeGeneratorService, hashtable);
       
        int tempDebug = 0;
    }// public void start(BundleContext bundleContext) throws Exception


Santiago Miguel Aranda Rojas wrote:
> I like Derby. I am using OSGi in order to have a SOA platform. I know 
> derby is working in Embedded mode as OSGi bundle. I would like to know 
> if it is possible run Derby in client-server mode using OSGi. I have 
> dowloaded derby and I have found a 
> org.apache.derby.osgi.EmbeddedActivator class. I think this is the 
> only way for running Derby inside OSGi.
>  
>  
> Do you know any options for having a database server inside OSGi??? I 
> would like run only one proccess and that all my components were 
> included in the OSGi framework, Derby too. But using client-server 
> arquitecture
>  
> Thank you
> Santiago Miguel Aranda Rojas
>  

Mime
View raw message