Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.gemini.blueprint.bundle
Class BundleFactoryBean

    java.lang.Object
      org.eclipse.gemini.blueprint.bundle.BundleFactoryBean

All Implemented Interfaces:
  BundleContextAware, DisposableBean, FactoryBean<Bundle>, InitializingBean, ResourceLoaderAware

    public class BundleFactoryBean

extends Object
implements FactoryBean<Bundle>, BundleContextAware, InitializingBean, DisposableBean, ResourceLoaderAware

`Bundle` installer.

This `FactoryBean` allows customers to use Spring to drive bundle management. Bundles states can be modified using the `action` (defaults to start) and `destroyAction` (not set by default) parameters.

For example, to automatically install and start a bundle from the local maven repository (assuming the bundle has been already retrieved), one can use the following configuration:

     <osgi:bundle id="aBundle" symbolic-name="org.company.bundles.a"
     location="file:${localRepository }/org/company/bundles/a/${pom.version}/a-${pom.version}.jar"
     action="start"/>

Note: Pay attention when installing bundles dynamically since classes can be loaded aggressively.

Author:
  Andy Piper, Costin Leau
See Also:
  `BundleAction`

Constructor Summary
`BundleFactoryBean()`

Method Summary
`void` | `afterPropertiesSet()`
`void` | `destroy()`
`protected void` | `executeAction(BundleActionEnum action)`
`BundleAction` | `getAction()` Deprecated. As of Spring DM 2.0, replaced by `getBundleAction()`
`Bundle` | `getBundle()` Returns the bundle with which the class interacts.
`BundleActionEnum` | `getBundleAction()` Returns the bundle action.
`BundleActionEnum` | `getBundleDestroyAction()` Returns the bundle destroy action.
`BundleAction` | `getDestroyAction()` Deprecated. As of Spring DM 2.0, replaced by `getBundleDestroyAction()`
`String` | `getLocation()` Return the given location.
`Bundle` | `getObject()`
`Class<? extends Bundle>` | `getObjectType()`
`Resource` | `getResource()` Return the `Resource` object (if a `ResourceLoader` is available) from the given location (if any).
`int` | `getStartLevel()` Gets the bundle start level.
`String` | `getSymbolicName()` Return the given bundle symbolic name.
`boolean` | `isSingleton()`
`void` | `setAction(BundleAction action)` Deprecated. As of Spring DM 2.0, replaced by `#setBundleAction(BundleAction)`
`void` | `setBundle(Bundle bundle)` Set the backing bundle used by this class.
`void` | `setBundleAction(BundleActionEnum action)` Action to execute at startup.
`void` | `setBundleContext(BundleContext context)` Set the `BundleContext` that this bean runs in.
`void` | `setBundleDestroyAction(BundleActionEnum action)` Action to execute at shutdown.
`void` | `setClassLoader(ClassLoader classloader)`
`void` | `setDestroyAction(BundleAction action)` Deprecated. As of Spring DM 2.0, replaced by `setBundleDestroyAction(BundleActionEnum)`
`void` | `setLocation(String url)` Set the bundle location (optional operation).
`void` | `setPushBundleAsContextClassLoader(boolean pushBundleAsContextClassLoader)` Determines whether invocations on the remote service should be performed in the context (thread context class loader) of the target bundle's ClassLoader.
`void` | `setResourceLoader(ResourceLoader resourceLoader)`
`void` | `setStartLevel(int startLevel)` Sets the bundle start level.
`void` | `setSymbolicName(String symbolicName)` Set the bundle symbolic name (optional operation).

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### BundleFactoryBean

    public BundleFactoryBean()

Method Detail

### getObjectType

    public Class<? extends Bundle> getObjectType()

  Specified by:
    `getObjectType` in interface `FactoryBean<Bundle>`

### isSingleton

    public boolean isSingleton()

  Specified by:
    `isSingleton` in interface `FactoryBean<Bundle>`

### getObject

    public Bundle getObject()
                     throws Exception

  Specified by:
    `getObject` in interface `FactoryBean<Bundle>`
  Throws:
    `Exception`

### afterPropertiesSet

    public void afterPropertiesSet()
                            throws Exception

  Specified by:
    `afterPropertiesSet` in interface `InitializingBean`
  Throws:
    `Exception`

### destroy

    public void destroy()
                 throws Exception

  Specified by:
    `destroy` in interface `DisposableBean`
  Throws:
    `Exception`

### executeAction

    protected void executeAction(BundleActionEnum action)

### getResource

    public Resource getResource()

  Return the `Resource` object (if a `ResourceLoader` is available) from the given location (if any).

  Returns:
    `Resource` object for the given location

### getLocation

    public String getLocation()

  Return the given location.

  Returns:
    bundle location

### setLocation

    public void setLocation(String url)

  Set the bundle location (optional operation).

  Parameters:
    `url` - bundle location (normally an URL or a Spring Resource)

### getSymbolicName

    public String getSymbolicName()

  Return the given bundle symbolic name.

  Returns:
    bundle symbolic name

### setSymbolicName

    public void setSymbolicName(String symbolicName)

  Set the bundle symbolic name (optional operation).

  Parameters:
    `symbolicName` - bundle symbolic name

### setBundleContext

    public void setBundleContext(BundleContext context)

  Description copied from interface: `BundleContextAware`
  Set the `BundleContext` that this bean runs in. Normally this can be used to initialize an object.

  Specified by:
    `setBundleContext` in interface `BundleContextAware`
  Parameters:
    `context` - the `BundleContext` object to be used by this object

### getAction

    public BundleAction getAction()

  Deprecated. As of Spring DM 2.0, replaced by `getBundleAction()`

  Returns the action.

  Returns:
    Returns the action

### getBundleAction

    public BundleActionEnum getBundleAction()

  Returns the bundle action.

  Returns:
    the bundle action.

### setAction

    public void setAction(BundleAction action)

  Deprecated. As of Spring DM 2.0, replaced by `#setBundleAction(BundleAction)`

  Action to execute at startup.

  Parameters:
    `action` - action to execute at startup

### setBundleAction

    public void setBundleAction(BundleActionEnum action)

  Action to execute at startup.

  Parameters:
    `action` - action to execute at startup

### getDestroyAction

    public BundleAction getDestroyAction()

  Deprecated. As of Spring DM 2.0, replaced by `getBundleDestroyAction()`

  Returns the destroyAction.

  Returns:
    Returns the destroyAction

### getBundleDestroyAction

    public BundleActionEnum getBundleDestroyAction()

  Returns the bundle destroy action.

  Returns:

### setDestroyAction

    public void setDestroyAction(BundleAction action)

  Deprecated. As of Spring DM 2.0, replaced by `setBundleDestroyAction(BundleActionEnum)`

  Action to execute at shutdown.

  Parameters:
    `action` - action to execute at shutdown

### setBundleDestroyAction

    public void setBundleDestroyAction(BundleActionEnum action)

  Action to execute at shutdown.

  Parameters:
    `action` - action to execute at shutdown

### getStartLevel

    public int getStartLevel()

  Gets the bundle start level.

  Returns:
    bundle start level

### setStartLevel

    public void setStartLevel(int startLevel)

  Sets the bundle start level.

  Parameters:
    `startLevel` - bundle start level.

### setPushBundleAsContextClassLoader

    public void setPushBundleAsContextClassLoader(boolean pushBundleAsContextClassLoader)

  Determines whether invocations on the remote service should be performed in the context (thread context class loader) of the target bundle's ClassLoader. The default is `false`.

  Parameters:
    `pushBundleAsContextClassLoader` - true if the thread context class loader will be set to the target bundle or false otherwise

### setClassLoader

    public void setClassLoader(ClassLoader classloader)

### setResourceLoader

    public void setResourceLoader(ResourceLoader resourceLoader)

  Specified by:
    `setResourceLoader` in interface `ResourceLoaderAware`

### getBundle

    public Bundle getBundle()

  Returns the bundle with which the class interacts.

  Returns:
    Returns this factory backing bundle

### setBundle

    public void setBundle(Bundle bundle)

  Set the backing bundle used by this class. Allows programmatic configuration of already retrieved/created bundle.

  Parameters:
    `bundle` - The bundle to set

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006-2010 Spring Framework. All Rights Reserved.