Derby and Osgi

View: New views
4 Messages — Rating Filter:   Alert me  

Derby and Osgi

by Santiago Miguel Aranda Rojas :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
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
 

Re: Derby and Osgi

by francois.orsini :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Santiago,

Yes, you can start/enable Derby's network server from a Java application by setting Derby's 'derby.drda.startNetworkServer=true' property.

More info at:
http://db.apache.org/derby/docs/dev/adminguide/adminguide-single.html#tadminconfig814963
http://db.apache.org/derby/docs/dev/adminguide/radminconfigstartnetworkserver.html

Cheers

--francois

On Thu, Oct 1, 2009 at 3:19 PM, Santiago Miguel Aranda Rojas <santiago.aranda.telvent@...> 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
 


Re: Derby and Osgi

by Kristian Waagan-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

Hello,

If doing what Francois described in his answer isn't enough, maybe we
can create more bundles if that is required?
I'm not very familiar with OSGi, but I assume two more bundles could be
provided:
 - a bundle for the Derby client driver
 - a bundle for the Derby network server (which would be dependent on
the Derby embedded bundle)

I don't know what OSGi provides when it comes to bundle configuration
(and I haven't checked either), but the Derby network server bundle will
be pretty much useless if it can't be configured (IP to listen to, port
to listen to etc). The solution described by Francois can be configured
using system properties, and I suppose the same could be done for an
OSGi server bundle. But is this good enough?

If there are any OSGi users out there, feel free to comment on this and
provide some pieces of advice.


Regards,
--
Kristian
>  
> Thank you
> Santiago Miguel Aranda Rojas
>  


Re: Derby and Osgi

by Charlie Kelly :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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
>