org.springframework.osgi.mock
Class MockBundle

java.lang.Object
  extended by org.springframework.osgi.mock.MockBundle
All Implemented Interfaces:
Bundle
Direct Known Subclasses:
EntryLookupControllingMockBundle

public class MockBundle
extends Object
implements Bundle

Bundle Mock.

The mock will the thread current classloader for loading classes/resources.

Author:
Costin Leau

Field Summary
 
Fields inherited from interface org.osgi.framework.Bundle
ACTIVE, INSTALLED, RESOLVED, STARTING, STOPPING, UNINSTALLED
 
Constructor Summary
MockBundle()
           
MockBundle(BundleContext context)
           
MockBundle(Dictionary headers)
           
MockBundle(String symName)
           
MockBundle(String symName, Dictionary headers, BundleContext context)
           
 
Method Summary
 Enumeration findEntries(String path, String filePattern, boolean recurse)
          Delegates to the classloader.
 BundleContext getBundleContext()
           
 long getBundleId()
           
 BundleContext getContext()
           
 URL getEntry(String name)
           
 Enumeration getEntryPaths(String path)
           
 Dictionary getHeaders()
           
 Dictionary getHeaders(String locale)
           
 long getLastModified()
           
 String getLocation()
           
 ServiceReference[] getRegisteredServices()
           
 URL getResource(String name)
           
 Enumeration getResources(String name)
           
 ServiceReference[] getServicesInUse()
           
 int getState()
           
 String getSymbolicName()
           
 boolean hasPermission(Object permission)
           
 Class loadClass(String name)
           
 void setBundleId(long bundleId)
           
 void setLocation(String location)
           
 void start()
           
 void stop()
           
 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()

MockBundle

public MockBundle(Dictionary headers)

MockBundle

public MockBundle(BundleContext context)

MockBundle

public MockBundle(String symName)

MockBundle

public MockBundle(String symName,
                  Dictionary headers,
                  BundleContext 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 Bundle
See Also:
Bundle.findEntries(java.lang.String, java.lang.String, boolean)

getBundleId

public long getBundleId()
Specified by:
getBundleId in interface Bundle

setBundleId

public void setBundleId(long bundleId)

getEntry

public URL getEntry(String name)
Specified by:
getEntry in interface Bundle

getEntryPaths

public Enumeration getEntryPaths(String path)
Specified by:
getEntryPaths in interface Bundle

getHeaders

public Dictionary getHeaders()
Specified by:
getHeaders in interface Bundle

getHeaders

public Dictionary getHeaders(String locale)
Specified by:
getHeaders in interface Bundle

getLastModified

public long getLastModified()
Specified by:
getLastModified in interface Bundle

getLocation

public String getLocation()
Specified by:
getLocation in interface Bundle

getRegisteredServices

public ServiceReference[] getRegisteredServices()
Specified by:
getRegisteredServices in interface Bundle

getResource

public URL getResource(String name)
Specified by:
getResource in interface Bundle

getResources

public Enumeration getResources(String name)
                         throws IOException
Specified by:
getResources in interface Bundle
Throws:
IOException

getServicesInUse

public ServiceReference[] getServicesInUse()
Specified by:
getServicesInUse in interface Bundle

getState

public int getState()
Specified by:
getState in interface Bundle

getSymbolicName

public String getSymbolicName()
Specified by:
getSymbolicName in interface Bundle

hasPermission

public boolean hasPermission(Object permission)
Specified by:
hasPermission in interface Bundle

loadClass

public Class loadClass(String name)
                throws ClassNotFoundException
Specified by:
loadClass in interface Bundle
Throws:
ClassNotFoundException

start

public void start()
           throws BundleException
Specified by:
start in interface Bundle
Throws:
BundleException

stop

public void stop()
          throws BundleException
Specified by:
stop in interface Bundle
Throws:
BundleException

uninstall

public void uninstall()
               throws BundleException
Specified by:
uninstall in interface Bundle
Throws:
BundleException

update

public void update()
            throws BundleException
Specified by:
update in interface Bundle
Throws:
BundleException

update

public void update(InputStream in)
            throws BundleException
Specified by:
update in interface Bundle
Throws:
BundleException

getContext

public BundleContext getContext()

getBundleContext

public BundleContext getBundleContext()
Specified by:
getBundleContext in interface Bundle

toString

public String toString()
Overrides:
toString in class Object

setLocation

public void setLocation(String location)


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