com.atlassian.plugin.osgi.hostcomponents.impl
Class DefaultComponentRegistrar

java.lang.Object
  extended by com.atlassian.plugin.osgi.hostcomponents.impl.DefaultComponentRegistrar
All Implemented Interfaces:
ComponentRegistrar

public class DefaultComponentRegistrar
extends Object
implements ComponentRegistrar

Default component registrar that also can write registered host components into the OSGi service registry.


Field Summary
 
Fields inherited from interface com.atlassian.plugin.osgi.hostcomponents.ComponentRegistrar
HOST_COMPONENT_FLAG
 
Constructor Summary
DefaultComponentRegistrar()
           
 
Method Summary
 List<HostComponentRegistration> getRegistry()
           
 InstanceBuilder register(Class<?>... mainInterfaces)
          Starts the single host component registration by declaring it as implementing one or more interfaces
protected  Object wrapService(Class<?>[] interfaces, Object service)
          Wraps the service in a dynamic proxy that ensures all methods are executed with the object class's class loader as the context class loader
 List<org.osgi.framework.ServiceRegistration> writeRegistry(org.osgi.framework.BundleContext ctx)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultComponentRegistrar

public DefaultComponentRegistrar()
Method Detail

register

public InstanceBuilder register(Class<?>... mainInterfaces)
Description copied from interface: ComponentRegistrar
Starts the single host component registration by declaring it as implementing one or more interfaces

Specified by:
register in interface ComponentRegistrar
Parameters:
mainInterfaces - The list of interfaces this host component implements
Returns:
The instance builder that will tie these interfaces with a host component instance

writeRegistry

public List<org.osgi.framework.ServiceRegistration> writeRegistry(org.osgi.framework.BundleContext ctx)

getRegistry

public List<HostComponentRegistration> getRegistry()

wrapService

protected Object wrapService(Class<?>[] interfaces,
                             Object service)
Wraps the service in a dynamic proxy that ensures all methods are executed with the object class's class loader as the context class loader

Parameters:
interfaces - The interfaces to proxy
service - The instance to proxy
Returns:
A proxy that wraps the service


Copyright © 2012 Atlassian. All Rights Reserved.