Changes

Jump to: navigation, search

OSGi : Develop Simple Apps

506 bytes added, 15:27, 22 January 2011
step 1
{{Ecl_activities|type=OSGi|type-repo=osgi}}
<h2>Important Interfaces</h2># Check out the [httphttps://wwwguest:1673852@zenit.senecac.osgion.orgca/javadocsvn/r4v42ecl500/orgLectures/trunk/w11-osgi-simple-interface/framework/Bundle.html BundleService Interface]# Check out the [httphttps://wwwguest:1673852@zenit.osgisenecac.on.orgca/svn/javadocecl500/r4v42Lectures/orgtrunk/w11-osgi-simple-serviceprovider/framework/BundleContext.html BundleContextService Provider]# Check out the [httphttps://wwwguest:1673852@zenit.osgisenecac.on.orgca/javadocsvn/r4v42ecl500/orgLectures/trunk/w11-osgi-simple-serviceconsumer/framework/BundleActivator.html BundleActivatorService Consumer]  
<strong>Steps for Building Bundels</strong>
<h4>1. Study the Interfaces</h4>
* [http://www.osgi.org/javadoc/r4v42/org/osgi/framework/Bundle.html Bundle]
* [http://www.osgi.org/javadoc/r4v42/org/osgi/framework/BundleContext.html BundleContext]
* [http://www.osgi.org/javadoc/r4v42/org/osgi/framework/BundleActivator.html BundleActivator]
<h4>2. Define the Bundle that provide the service (Provider Bundle)</h4>
<h5>2.1 Define the Java Interface that exposes the services</h5>
Let us suppose that you want to define a service that allows the user to find a book from the book isbn. Then the interface should look similare with this one:
<source lang="java">
package cs.ecl.osgi.simple.bookfinder;
# Check out the [https://guest:1673852@zenit.senecac.on.ca/svn/ecl500/Lectures/trunk/w11-osgi-simple-public interface/ Service Interface]BookFinder { Book findBook(int isbn) throws BookNotFoundException;# Check out the [https://guest:1673852@zenit.senecac.on.ca/svn/ecl500/Lectures/trunk/w11-osgi-simple-serviceprovider/ Service Provider]}# Check out the [https://guest:1673852@zenit.senecac.on.ca/svn/ecl500/Lectures/trunk/w11-osgi-simple-serviceconsumer</ Service Consumer]source>

Navigation menu