org.apache.cocoon.core.osgi
Class OSGiServiceManager

java.lang.Object
  extended byorg.apache.cocoon.core.osgi.OSGiServiceManager
All Implemented Interfaces:
ServiceManager

public class OSGiServiceManager
extends Object
implements ServiceManager

A ServiceManager that looks up components by getting OSGi services.

Roles are supposed to be interface names, which the OSGi framework will use. As some roles may contain hints (e.g. "org.apache.cocoon.generation.Generator/file"), in such cases the interface name is extracted, and the hint is expected to be found in the "component.hint" service property.

Since:
2.2
Version:
$Id: OSGiServiceManager.java 312637 2005-10-10 13:00:42Z cziegeler $

Field Summary
static String HINT_PROPERTY
          The property that's used to hold component hints in component selectors.
 
Constructor Summary
OSGiServiceManager(org.osgi.framework.BundleContext context)
           
 
Method Summary
static String getServiceHint(String role)
           
static String getServiceInterface(String role)
           
static org.osgi.framework.ServiceReference getServiceReference(org.osgi.framework.BundleContext ctx, String role)
           
 boolean hasService(String role)
           
 Object lookup(String role)
           
 void release(Object obj)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HINT_PROPERTY

public static final String HINT_PROPERTY
The property that's used to hold component hints in component selectors.

See Also:
Constant Field Values
Constructor Detail

OSGiServiceManager

public OSGiServiceManager(org.osgi.framework.BundleContext context)
Method Detail

lookup

public Object lookup(String role)
              throws ServiceException
Specified by:
lookup in interface ServiceManager
Throws:
ServiceException

hasService

public boolean hasService(String role)
Specified by:
hasService in interface ServiceManager

release

public void release(Object obj)
Specified by:
release in interface ServiceManager

getServiceReference

public static org.osgi.framework.ServiceReference getServiceReference(org.osgi.framework.BundleContext ctx,
                                                                      String role)
                                                               throws org.osgi.framework.InvalidSyntaxException
Throws:
org.osgi.framework.InvalidSyntaxException

getServiceInterface

public static String getServiceInterface(String role)

getServiceHint

public static String getServiceHint(String role)


Copyright ? 1999-2005 The Apache Software Foundation. All Rights Reserved.