selfmade osgi services [message #54138] |
Fri, 02 December 2005 11:04  |
Eclipse User |
|
|
|
Originally posted by: matthias.luebken.deletethisgmx.de
Hi
we are currently examining rcp as our new application plattform.
And we want to have some sort of service architecture. Just simple
domain service like getBook(title) which mostly wrap the database access
classes. And probably some more technical services. One service would be
an authentication service.
Now I've got serveral questions:
What is an osgi service? Would my local service benefit?
Are there any predefined servies?
E.g. I've found the osgi.service.useradmin but I've not found an
implementation.
Are there any articles out there?
Thanks in advance
matt
|
|
|
Re: selfmade osgi services [message #54246 is a reply to message #54138] |
Tue, 06 December 2005 03:52  |
Eclipse User |
|
|
|
Originally posted by: kbs777.lge.com
As you know, OSGi is a framework that means different services can be
monitored by OSGi implementation.
The important thing is that OSGi consists of not Java classes but
interfaces.
Actually you can see the sources of OSGi downloading from
http://www.osgi.org/osgi_technology/download_specs.asp?secti on=2#Release4.
Unzip and go to "osgi.core\OSGI-OPT\src", then you will see the source.
If you have seen those source, easily understand what I've been talking.
Therefore, there's no service just giving architecture.
Let me show you simple procedures to make OSGi service.
1. Make interface
package com.mycompany.osgi.bookservice;
public interface BookService {
public String getBook (String title);
}
2. Make implementation
package com.mycompany.osgi.bookserviceimpl;
import com.mycompany.osgi.bookservice.*;
public class BookServiceImpl implements BookService {
BookServiceImpl () { }
public String getBook (String title); {
String bookLocation = getDB(title);
....
....
return bookLocation;
}
}
3. Make activator
package com.mycompany.osgi.bookserviceimpl;
import org.osgi.framework.*;
import com.mycompany.osgi.bookservice.*;
public class BookActivator implements BundleActivator {
private ServiceRegistration serviceRegistration;
public BookActivator () { }
public void start (BundleContext context) throws Exception {
BookServiceImpl impl = new EchoServiceImpl ();
serviceRegistration= context.registerService (
BookService.class.getName(), impl, null);
}
public void stop (BundleContext context) throws Exception {
serviceRegistration.unregister ();
}
}
If I made a mistake, please let me know it.
Thank you.
-------------------------------------------------
Kim, Bong-Sang
Assistant Manager
Technology Planning Group
Digital Media Lab.
LG Electronics
-------------------------------------------------
|
|
|
Powered by
FUDForum. Page generated in 0.05257 seconds