org.springframework.osgi.mock
Class MockServiceReference

java.lang.Object
  extended by org.springframework.osgi.mock.MockServiceReference
All Implemented Interfaces:
ServiceReference

public class MockServiceReference
extends Object
implements ServiceReference

ServiceReference mock.

This mock tries to adhere to the OSGi spec as much as possible by providing the mandatory serviceId properties such as Constants.SERVICE_ID, Constants.OBJECTCLASS and Constants.SERVICE_RANKING.

Author:
Costin Leau

Constructor Summary
MockServiceReference()
           
MockServiceReference(Bundle bundle)
           
MockServiceReference(Bundle bundle, Dictionary properties, ServiceRegistration registration)
           
MockServiceReference(Bundle bundle, Dictionary properties, ServiceRegistration registration, String[] classes)
           
MockServiceReference(Bundle bundle, String[] classes)
           
MockServiceReference(ServiceRegistration registration)
           
MockServiceReference(String[] classes)
           
 
Method Summary
 int compareTo(Object reference)
           
 boolean equals(Object obj)
          Two mock service references are equal if they contain the same service id.
 Bundle getBundle()
           
 Object getProperty(String key)
           
 String[] getPropertyKeys()
           
 Bundle[] getUsingBundles()
           
 int hashCode()
          Return a hash code based on the class and service id.
 boolean isAssignableTo(Bundle bundle, String className)
           
 void setProperties(Dictionary properties)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MockServiceReference

public MockServiceReference()

MockServiceReference

public MockServiceReference(Bundle bundle)

MockServiceReference

public MockServiceReference(String[] classes)

MockServiceReference

public MockServiceReference(Bundle bundle,
                            String[] classes)

MockServiceReference

public MockServiceReference(ServiceRegistration registration)

MockServiceReference

public MockServiceReference(Bundle bundle,
                            Dictionary properties,
                            ServiceRegistration registration)

MockServiceReference

public MockServiceReference(Bundle bundle,
                            Dictionary properties,
                            ServiceRegistration registration,
                            String[] classes)
Method Detail

getBundle

public Bundle getBundle()
Specified by:
getBundle in interface ServiceReference

getProperty

public Object getProperty(String key)
Specified by:
getProperty in interface ServiceReference

getPropertyKeys

public String[] getPropertyKeys()
Specified by:
getPropertyKeys in interface ServiceReference

getUsingBundles

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

isAssignableTo

public boolean isAssignableTo(Bundle bundle,
                              String className)
Specified by:
isAssignableTo in interface ServiceReference

setProperties

public void setProperties(Dictionary properties)

equals

public boolean equals(Object obj)
Two mock service references are equal if they contain the same service id.

Overrides:
equals in class Object

hashCode

public int hashCode()
Return a hash code based on the class and service id.

Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

compareTo

public int compareTo(Object reference)


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