org.apache.cocoon.core.osgi
Class OSGiCoreServiceManager

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLogEnabled
      extended byorg.apache.cocoon.core.container.CoreServiceManager
          extended byorg.apache.cocoon.core.osgi.OSGiCoreServiceManager
All Implemented Interfaces:
Configurable, Contextualizable, Disposable, Initializable, LogEnabled, ServiceManager, ThreadSafe

public class OSGiCoreServiceManager
extends CoreServiceManager

An extension of CoreServiceManager that registers some of its components as OSGi services.

The component role is used to find a component's interface. If the role is a hinted one (e.g. "org.apache.cocoon.generation.Generator/file", then the hint is registered as the "component.hint" property of the OSGi service.

Only those components whose configuration has an exported="true" attribute are exported. An important constraint is that such components be singleton (either real singletons or singleton proxies to non-singleton components).

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

Nested Class Summary
static class OSGiCoreServiceManager.ComponentHandlerFactory
          An OSGi service factory implemented on top of a ComponentHandler.
 
Field Summary
 
Fields inherited from class org.apache.cocoon.core.container.CoreServiceManager
classloader, componentEnv, componentHandlers, componentMapping, context, CONTEXT_PARAMETERS, disposed, EMPTY_CONFIGURATION, initialized, location, loggerManager, parentManager, roleManager
 
Constructor Summary
OSGiCoreServiceManager(ServiceManager parent, ClassLoader classloader, org.osgi.framework.BundleContext ctx)
           
 
Method Summary
 void addComponent(String role, String className, Configuration configuration, ComponentInfo info)
          Catch component declarations and register exported ones as OSGi services.
 void addInstance(String role, Object instance)
          Catch a component insertion and register it as OSGi services.
protected  void addService(String role, ComponentHandler handler)
          Register a component as an OSGi service.
 
Methods inherited from class org.apache.cocoon.core.container.CoreServiceManager
addRoleAlias, configure, contextualize, dispose, enableLogging, hasService, initialize, initialize, lookup, release, setLoggerManager, setRoleManager
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OSGiCoreServiceManager

public OSGiCoreServiceManager(ServiceManager parent,
                              ClassLoader classloader,
                              org.osgi.framework.BundleContext ctx)
Method Detail

addComponent

public void addComponent(String role,
                         String className,
                         Configuration configuration,
                         ComponentInfo info)
                  throws ConfigurationException
Catch component declarations and register exported ones as OSGi services.

Overrides:
addComponent in class CoreServiceManager
Parameters:
role - the role name for the new component.
className - the class of this component.
configuration - the configuration for this component.
Throws:
ConfigurationException

addInstance

public void addInstance(String role,
                        Object instance)
                 throws ServiceException
Catch a component insertion and register it as OSGi services.

Overrides:
addInstance in class CoreServiceManager
Parameters:
role - the role under which the object will be known
instance - the component instance
Throws:
ServiceException

addService

protected void addService(String role,
                          ComponentHandler handler)
Register a component as an OSGi service.



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