This project has retired. For details please refer to its Attic page.
OSGi Starter Template for Bootstrap
Overview
Scripting
Alarms
Circuit Breaker
Constraints
FileConfig
HTTP
Invocation Cache
JMX
Locking
Logging
OSGi
RDF
ReST Client
ReST - HATEOAS Primer
ReST Common
ReST Server
Restlet Support
Servlet
Shiro Security
Shiro Web Security
Spring Integration
SQL
UID
UoWFile

OSGi

code

docs

tests

OSGi Library allows you to import OSGi services as Polygene™ Services and to export Polygene™ Services as OSGi Services both leveraging the Polygene™ Availability and OSGi FallbackStrategy mechanisms.

Table 32. Artifact

Group IDArtifact IDVersion

org.apache.polygene.libraries

org.apache.polygene.library.osgi

0


Export Polygene™ services to an OSGi Bundle

interface MyPolygeneService
    extends OSGiEnabledService
{
    // ...
}
  [...snip...]

public void assemble( ModuleAssembly module )
    throws AssemblyException
{
    BundleContext bundleContext = // ...
      [...snip...]

    module.services( OSGiServiceExporter.class ).
        setMetaInfo( bundleContext );
    module.services( MyPolygeneService.class );
}

Import OSGi services in a Polygene™ Module

public void assemble( ModuleAssembly module )
    throws AssemblyException
{
  [...snip...]

    module.services( OSGiServiceImporter.class ).
        setMetaInfo( new OSGiImportInfo( bundleContext,
                                         MyOSGiService.class,
                                         MyOtherOSGiService.class ) ).
        setMetaInfo( new MyFallbackStrategy() );
}

The fallback strategy is invoked when the OSGi service is not available and a method call is invoked.