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 MockServiceReference

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

All Implemented Interfaces:
  Comparable, org.osgi.framework.ServiceReference

    public class MockServiceReference

extends Object
implements org.osgi.framework.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()` Constructs a new `MockServiceReference` instance using defaults.
`MockServiceReference(org.osgi.framework.Bundle bundle)` Constructs a new `MockServiceReference` instance associated with the given bundle.
`MockServiceReference(org.osgi.framework.Bundle bundle, Dictionary properties, org.osgi.framework.ServiceRegistration registration)` Constructs a new `MockServiceReference` instance associated with the given bundle, service registration and having the given service properties.
`MockServiceReference(org.osgi.framework.Bundle bundle, Dictionary properties, org.osgi.framework.ServiceRegistration registration, String[] classes)` Constructs a new `MockServiceReference` instance.
`MockServiceReference(org.osgi.framework.Bundle bundle, String[] classes)` Constructs a new `MockServiceReference` instance associated with the given bundle and matching the given class names.
`MockServiceReference(org.osgi.framework.ServiceRegistration registration)` Constructs a new `MockServiceReference` instance associated with the given service registration.
`MockServiceReference(String[] classes)` Constructs a new `MockServiceReference` instance matching the given class namess.

Method Summary
`int` | `compareTo(Object reference)`
`boolean` | `equals(Object obj)` Two mock service references are equal if they contain the same service id.
`org.osgi.framework.Bundle` | `getBundle()`
`Object` | `getProperty(String key)`
`String[]` | `getPropertyKeys()`
`org.osgi.framework.Bundle[]` | `getUsingBundles()`
`int` | `hashCode()` Returns a hash code based on the class and service id.
`boolean` | `isAssignableTo(org.osgi.framework.Bundle bundle, String className)`
`void` | `setProperties(Dictionary properties)` Sets the properties associated with this reference.
`String` | `toString()`

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

Constructor Detail

### MockServiceReference

    public MockServiceReference()

  Constructs a new `MockServiceReference` instance using defaults.

### MockServiceReference

    public MockServiceReference(org.osgi.framework.Bundle bundle)

  Constructs a new `MockServiceReference` instance associated with the given bundle.

  Parameters:
    `bundle` - associated reference bundle

### MockServiceReference

    public MockServiceReference(String[] classes)

  Constructs a new `MockServiceReference` instance matching the given class namess.

  Parameters:
    `classes` - associated class names

### MockServiceReference

    public MockServiceReference(org.osgi.framework.Bundle bundle,
                                String[] classes)

  Constructs a new `MockServiceReference` instance associated with the given bundle and matching the given class names.

  Parameters:
    `bundle` - associated bundle
    `classes` - matching class names

### MockServiceReference

    public MockServiceReference(org.osgi.framework.ServiceRegistration registration)

  Constructs a new `MockServiceReference` instance associated with the given service registration.

  Parameters:
    `registration` - service registration

### MockServiceReference

    public MockServiceReference(org.osgi.framework.Bundle bundle,
                                Dictionary properties,
                                org.osgi.framework.ServiceRegistration registration)

  Constructs a new `MockServiceReference` instance associated with the given bundle, service registration and having the given service properties.

  Parameters:
    `bundle` - associated bundle
    `properties` - reference properties
    `registration` - associated service registrations

### MockServiceReference

    public MockServiceReference(org.osgi.framework.Bundle bundle,
                                Dictionary properties,
                                org.osgi.framework.ServiceRegistration registration,
                                String[] classes)

  Constructs a new `MockServiceReference` instance. This constructor gives access to all the parameters of the mock service reference such as associated bundle, reference properties, service registration and reference class names.

  Parameters:
    `bundle` - associated bundle
    `properties` - reference properties
    `registration` - service registration
    `classes` - reference class names

Method Detail

### getBundle

    public org.osgi.framework.Bundle getBundle()

  Specified by:
    `getBundle` in interface `org.osgi.framework.ServiceReference`

### getProperty

    public Object getProperty(String key)

  Specified by:
    `getProperty` in interface `org.osgi.framework.ServiceReference`

### getPropertyKeys

    public String[] getPropertyKeys()

  Specified by:
    `getPropertyKeys` in interface `org.osgi.framework.ServiceReference`

### getUsingBundles

    public org.osgi.framework.Bundle[] getUsingBundles()

  Specified by:
    `getUsingBundles` in interface `org.osgi.framework.ServiceReference`

### isAssignableTo

    public boolean isAssignableTo(org.osgi.framework.Bundle bundle,
                                  String className)

  Specified by:
    `isAssignableTo` in interface `org.osgi.framework.ServiceReference`

### setProperties

    public void setProperties(Dictionary properties)

  Sets the properties associated with this reference.

  Parameters:
    `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()

  Returns 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)

  Specified by:
    `compareTo` in interface `Comparable`
  Specified by:
    `compareTo` in interface `org.osgi.framework.ServiceReference`

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.