View Javadoc

1   package com.atlassian.plugin.osgi.hostcomponents;
2   
3   /**
4    * Defines an object that provides host components.  Host applications that wish to register their internal components
5    * should implement this interface.  Classes like the {@link com.atlassian.plugin.osgi.factory.OsgiPluginFactory} use
6    * this interface to retreive a list of host components to register into the OSGi service registry.  
7    *
8    * <p>Here is an example implementation that registers two host components:
9    * </p>
10   * <pre>
11   * public class MyHostComponentProvider implements HostComponentProvider {
12   *      public void provide(ComponentRegistrar registrar) {
13   *          registrar.register(SomeInterface.class).forInstance(someInstance).withName("some-bean");
14   *          registrar.register(InterfaceA.class, InterfaceB.class)
15   *                   .forInstance(MyBean.class)
16   *                   .withProperty("propertyA", "valueA")
17   *                   .withProperty("propertyB", "valueB");
18   *      }
19   * }
20   * </pre>
21   */
22  public interface HostComponentProvider
23  {
24  
25      /**
26       * Gives the object a chance to register its host components with the registrar
27       *
28       * @param registrar The host component registrar
29       */
30      void provide(ComponentRegistrar registrar);
31  }