org.jclouds.osgi
Class MetadataBundleListener

java.lang.Object
  extended by org.jclouds.osgi.MetadataBundleListener
All Implemented Interfaces:
EventListener, org.osgi.framework.BundleListener

public class MetadataBundleListener
extends Object
implements org.osgi.framework.BundleListener

A BundleListener that listens for BundleEvent and searches for ProviderMetadata and ApiMetadata in newly installed Bundles. This is used as a workaround for OSGi environments where the ServiceLoader cannot cross bundle boundaries.


Constructor Summary
MetadataBundleListener()
           
 
Method Summary
 void bundleChanged(org.osgi.framework.BundleEvent event)
           
 ApiMetadata getApiMetadata(org.osgi.framework.Bundle bundle)
          Creates an instance of ApiMetadata from the Bundle.
 String getApiMetadataClassName(org.osgi.framework.Bundle bundle)
          Retrieves the ProviderMetadata class name for the bundle if it exists.
 String getMetadataClassName(org.osgi.framework.Bundle bundle, String pathToMetadata)
           
 ProviderMetadata getProviderMetadata(org.osgi.framework.Bundle bundle)
          Creates an instance of ProviderMetadata from the Bundle.
 String getProviderMetadataClassName(org.osgi.framework.Bundle bundle)
          Retrieves the ProviderMetadata class name for the bundle if it exists.
 void start(org.osgi.framework.BundleContext bundleContext)
           
 void stop(org.osgi.framework.BundleContext bundleContext)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetadataBundleListener

public MetadataBundleListener()
Method Detail

start

public void start(org.osgi.framework.BundleContext bundleContext)

stop

public void stop(org.osgi.framework.BundleContext bundleContext)

bundleChanged

public void bundleChanged(org.osgi.framework.BundleEvent event)
Specified by:
bundleChanged in interface org.osgi.framework.BundleListener

getProviderMetadata

public ProviderMetadata getProviderMetadata(org.osgi.framework.Bundle bundle)
Creates an instance of ProviderMetadata from the Bundle.

Parameters:
bundle -
Returns:

getApiMetadata

public ApiMetadata getApiMetadata(org.osgi.framework.Bundle bundle)
Creates an instance of ApiMetadata from the Bundle.

Parameters:
bundle -
Returns:

getMetadataClassName

public String getMetadataClassName(org.osgi.framework.Bundle bundle,
                                   String pathToMetadata)

getProviderMetadataClassName

public String getProviderMetadataClassName(org.osgi.framework.Bundle bundle)
Retrieves the ProviderMetadata class name for the bundle if it exists.

Parameters:
bundle -
Returns:

getApiMetadataClassName

public String getApiMetadataClassName(org.osgi.framework.Bundle bundle)
Retrieves the ProviderMetadata class name for the bundle if it exists.

Parameters:
bundle -
Returns:


Copyright © 2009-2012 jclouds. All Rights Reserved.