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.mock
Class MockBundle

    java.lang.Object
      org.eclipse.gemini.blueprint.mock.MockBundle

All Implemented Interfaces:
  org.osgi.framework.Bundle

Direct Known Subclasses:
  EntryLookupControllingMockBundle

    public class MockBundle

extends Object
implements org.osgi.framework.Bundle

Bundle mock. Except resource/class loading operations (which are executed on its internal class loader), the rest of the methods are dummies.

Author:
  Costin Leau

Field Summary

Fields inherited from interface org.osgi.framework.Bundle
`ACTIVE, INSTALLED, RESOLVED, SIGNERS_ALL, SIGNERS_TRUSTED, START_ACTIVATION_POLICY, START_TRANSIENT, STARTING, STOP_TRANSIENT, STOPPING, UNINSTALLED`

Constructor Summary
`MockBundle()` Constructs a new `MockBundle` instance using default values.
`MockBundle(org.osgi.framework.BundleContext context)` Constructs a new `MockBundle` instance associated with the given bundle context.
`MockBundle(Dictionary headers)` Constructs a new `MockBundle` instance with the given bundle headers.
`MockBundle(String symName)` Constructs a new `MockBundle` instance with the given symbolic name.
`MockBundle(String symName, Dictionary headers, org.osgi.framework.BundleContext context)` Constructs a new `MockBundle` instance using the given bundle symbolic name, properties and associated bundle context.

Method Summary
`Enumeration` | `findEntries(String path, String filePattern, boolean recurse)` Delegates to the classloader.
`org.osgi.framework.BundleContext` | `getBundleContext()`
`long` | `getBundleId()`
`org.osgi.framework.BundleContext` | `getContext()`
`URL` | `getEntry(String name)`
`Enumeration` | `getEntryPaths(String path)`
`Dictionary` | `getHeaders()`
`Dictionary` | `getHeaders(String locale)`
`long` | `getLastModified()`
`String` | `getLocation()`
`org.osgi.framework.ServiceReference[]` | `getRegisteredServices()`
`URL` | `getResource(String name)`
`Enumeration` | `getResources(String name)`
`org.osgi.framework.ServiceReference[]` | `getServicesInUse()`
`Map` | `getSignerCertificates(int signerType)`
`int` | `getState()`
`String` | `getSymbolicName()`
`org.osgi.framework.Version` | `getVersion()`
`boolean` | `hasPermission(Object permission)`
`Class<?>` | `loadClass(String name)`
`void` | `setBundleId(long bundleId)`
`void` | `setClassLoader(ClassLoader loader)` Sets the class loader internally used by the bundle to mock the loading operations.
`void` | `setLocation(String location)` Sets the location for this mock bundle.
`void` | `start()`
`void` | `start(int options)`
`void` | `stop()`
`void` | `stop(int options)`
`String` | `toString()`
`void` | `uninstall()`
`void` | `update()`
`void` | `update(InputStream in)`

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

Constructor Detail

### MockBundle

    public MockBundle()

  Constructs a new `MockBundle` instance using default values.

### MockBundle

    public MockBundle(Dictionary headers)

  Constructs a new `MockBundle` instance with the given bundle headers.

  Parameters:
    `headers` - bundle headers

### MockBundle

    public MockBundle(org.osgi.framework.BundleContext context)

  Constructs a new `MockBundle` instance associated with the given bundle context.

  Parameters:
    `context` - associated bundle context

### MockBundle

    public MockBundle(String symName)

  Constructs a new `MockBundle` instance with the given symbolic name.

  Parameters:
    `symName` - bundle symbolic name

### MockBundle

    public MockBundle(String symName,
                      Dictionary headers,
                      org.osgi.framework.BundleContext context)

  Constructs a new `MockBundle` instance using the given bundle symbolic name, properties and associated bundle context.

  Parameters:
    `symName` - bundle symbolic name
    `headers` - bundle headers
    `context` - associated bundle context

Method Detail

### findEntries

    public Enumeration findEntries(String path,
                                   String filePattern,
                                   boolean recurse)

  Delegates to the classloader. Identical to classLoader.getResources(path + filePattern);

  Specified by:
    `findEntries` in interface `org.osgi.framework.Bundle`
  See Also:
    `Bundle.findEntries(java.lang.String, java.lang.String, boolean)`

### getBundleId

    public long getBundleId()

  Specified by:
    `getBundleId` in interface `org.osgi.framework.Bundle`

### setBundleId

    public void setBundleId(long bundleId)

### getEntry

    public URL getEntry(String name)

  Specified by:
    `getEntry` in interface `org.osgi.framework.Bundle`

### getEntryPaths

    public Enumeration getEntryPaths(String path)

  Specified by:
    `getEntryPaths` in interface `org.osgi.framework.Bundle`

### getHeaders

    public Dictionary getHeaders()

  Specified by:
    `getHeaders` in interface `org.osgi.framework.Bundle`

### getHeaders

    public Dictionary getHeaders(String locale)

  Specified by:
    `getHeaders` in interface `org.osgi.framework.Bundle`

### getLastModified

    public long getLastModified()

  Specified by:
    `getLastModified` in interface `org.osgi.framework.Bundle`

### getLocation

    public String getLocation()

  Specified by:
    `getLocation` in interface `org.osgi.framework.Bundle`

### getRegisteredServices

    public org.osgi.framework.ServiceReference[] getRegisteredServices()

  Specified by:
    `getRegisteredServices` in interface `org.osgi.framework.Bundle`

### getResource

    public URL getResource(String name)

  Specified by:
    `getResource` in interface `org.osgi.framework.Bundle`

### getResources

    public Enumeration getResources(String name)
                             throws IOException

  Specified by:
    `getResources` in interface `org.osgi.framework.Bundle`
  Throws:
    `IOException`

### getServicesInUse

    public org.osgi.framework.ServiceReference[] getServicesInUse()

  Specified by:
    `getServicesInUse` in interface `org.osgi.framework.Bundle`

### getState

    public int getState()

  Specified by:
    `getState` in interface `org.osgi.framework.Bundle`

### getSymbolicName

    public String getSymbolicName()

  Specified by:
    `getSymbolicName` in interface `org.osgi.framework.Bundle`

### hasPermission

    public boolean hasPermission(Object permission)

  Specified by:
    `hasPermission` in interface `org.osgi.framework.Bundle`

### loadClass

    public Class<?> loadClass(String name)
                       throws ClassNotFoundException

  Specified by:
    `loadClass` in interface `org.osgi.framework.Bundle`
  Throws:
    `ClassNotFoundException`

### start

    public void start()
               throws org.osgi.framework.BundleException

  Specified by:
    `start` in interface `org.osgi.framework.Bundle`
  Throws:
    `org.osgi.framework.BundleException`

### start

    public void start(int options)
               throws org.osgi.framework.BundleException

  Specified by:
    `start` in interface `org.osgi.framework.Bundle`
  Throws:
    `org.osgi.framework.BundleException`

### stop

    public void stop()
              throws org.osgi.framework.BundleException

  Specified by:
    `stop` in interface `org.osgi.framework.Bundle`
  Throws:
    `org.osgi.framework.BundleException`

### stop

    public void stop(int options)
              throws org.osgi.framework.BundleException

  Specified by:
    `stop` in interface `org.osgi.framework.Bundle`
  Throws:
    `org.osgi.framework.BundleException`

### uninstall

    public void uninstall()
                   throws org.osgi.framework.BundleException

  Specified by:
    `uninstall` in interface `org.osgi.framework.Bundle`
  Throws:
    `org.osgi.framework.BundleException`

### update

    public void update()
                throws org.osgi.framework.BundleException

  Specified by:
    `update` in interface `org.osgi.framework.Bundle`
  Throws:
    `org.osgi.framework.BundleException`

### update

    public void update(InputStream in)
                throws org.osgi.framework.BundleException

  Specified by:
    `update` in interface `org.osgi.framework.Bundle`
  Throws:
    `org.osgi.framework.BundleException`

### getVersion

    public org.osgi.framework.Version getVersion()

  Specified by:
    `getVersion` in interface `org.osgi.framework.Bundle`

### getSignerCertificates

    public Map getSignerCertificates(int signerType)

  Specified by:
    `getSignerCertificates` in interface `org.osgi.framework.Bundle`

### getContext

    public org.osgi.framework.BundleContext getContext()

### getBundleContext

    public org.osgi.framework.BundleContext getBundleContext()

  Specified by:
    `getBundleContext` in interface `org.osgi.framework.Bundle`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### setLocation

    public void setLocation(String location)

  Sets the location for this mock bundle.

  Parameters:
    `location` - bundle location

### setClassLoader

    public void setClassLoader(ClassLoader loader)

  Sets the class loader internally used by the bundle to mock the loading operations. By default, the MockBundle uses its own class loader.

  Parameters:
    `loader` - mock bundle class loader

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-2012. All Rights Reserved.