|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.felix.ipojo.junit4osgi.Helper
org.apache.felix.ipojo.junit4osgi.helpers.IPOJOHelper
public class IPOJOHelper
iPOJO Helper.
This helper helps getting Factory
, and managing
ComponentInstance
.
Constructor Summary | |
---|---|
IPOJOHelper(OSGiTestCase tc)
Creates a IPOJOHelper. |
Method Summary | |
---|---|
static ComponentInstance |
createComponentInstance(Bundle bundle,
String factoryName,
Dictionary configuration)
Creates a new component instance with the given configuration, from the factory specified in the given bundle. |
static ComponentInstance |
createComponentInstance(Bundle bundle,
String factoryName,
String instanceName)
Creates a new component instance with the given name (and empty configuration), from the factory specified in the given bundle. |
static ComponentInstance |
createComponentInstance(Bundle bundle,
String factoryName,
String instanceName,
Dictionary configuration)
Creates a new component instance with the given name and configuration, from the factory specified in the given bundle. |
static ComponentInstance |
createComponentInstance(ServiceContext serviceContext,
String factoryName,
Dictionary configuration)
Creates a new component instance with the given name and configuration, from the factory specified in the given service context. |
static ComponentInstance |
createComponentInstance(ServiceContext serviceContext,
String factoryName,
String instanceName)
Creates a new component instance with the given name (and an empty configuration), from the factory specified in the given service context. |
static ComponentInstance |
createComponentInstance(ServiceContext serviceContext,
String factoryName,
String instanceName,
Dictionary configuration)
Creates a new component instance with the given name and configuration, from the factory specified in the given service context. |
ComponentInstance |
createComponentInstance(String factoryName)
Creates a new component instance with no configuration, from the factory specified in the local bundle. |
ComponentInstance |
createComponentInstance(String factoryName,
Dictionary configuration)
Creates a new component instance with the given configuration, from the factory specified in the local bundle. |
ComponentInstance |
createComponentInstance(String factoryName,
String instanceName)
Creates a new component instance with the given name (and empty configuration), from the factory specified in the local bundle. |
ComponentInstance |
createComponentInstance(String factoryName,
String instanceName,
Dictionary configuration)
Creates a new component instance with the given name and configuration, from the factory specified in the given bundle. |
void |
dispose()
Disposes created instances. |
static Factory |
getFactory(Bundle bundle,
String factoryName)
Returns the component factory with the given name in the given bundle. |
static Factory |
getFactory(ServiceContext serviceContext,
String factoryName)
Returns the component factory with the given name, registered in the given service context. |
Factory |
getFactory(String factoryName)
Returns the component factory with the given name in the local bundle. |
static HandlerFactory |
getHandlerFactory(Bundle bundle,
String factoryName)
Returns the handler factory with the given name in the given bundle. |
HandlerFactory |
getHandlerFactory(String factoryName)
Returns the handler factory with the given name in the local bundle. |
ComponentInstance |
getInstanceByName(String name)
Gets a created instance from the instance name. |
static Element |
getMetadata(Bundle bundle,
String component)
Returns the metadata description of the component with the given name, defined in the given bundle. |
Element |
getMetadata(String component)
Returns the metadata description of the component defined in this bundle. |
static Object |
getServiceObject(ServiceContext serviceContext,
String itf,
String filter)
Returns the service object of a service registered in the specified service context, offering the specified interface and matching the given filter. |
static Object[] |
getServiceObjects(ServiceContext serviceContext,
String itf,
String filter)
Returns the service objects of the services registered in the specified service context, offering the specified interface and matching the given filter. |
static ServiceReference |
getServiceReference(ServiceContext serviceContext,
String itf,
String filter)
Returns the service reference of a service registered in the specified service context, offering the specified interface and matching the given filter. |
static ServiceReference |
getServiceReferenceByName(Bundle bundle,
String itf,
String name)
Returns the service reference of a service provided by the specified bundle, offering the specified interface and having the given name. |
static ServiceReference |
getServiceReferenceByName(ServiceContext serviceContext,
String itf,
String name)
Returns the service reference of a service registered in the specified service context, offering the specified interface and having the given name. |
ServiceReference |
getServiceReferenceByName(String itf,
String name)
Returns the service reference of a service provided by the local bundle, offering the specified interface and having the given name. |
static ServiceReference |
getServiceReferenceByPID(ServiceContext serviceContext,
String itf,
String pid)
Returns the service reference of the service registered in the specified service context, offering the specified interface and having the given persistent ID. |
static ServiceReference[] |
getServiceReferences(ServiceContext serviceContext,
String itf,
String filter)
Returns the service reference of all the services registered in the specified service context, offering the specified interface and matching the given filter. |
static boolean |
isServiceAvailable(ServiceContext sc,
String itf)
Checks the availability of a service inside the given service context. |
static boolean |
isServiceAvailableByName(ServiceContext sc,
String itf,
String name)
Checks the availability of a service inside the given service context. |
boolean |
isServiceAvailableByName(String itf,
String name)
Checks if the service is available. |
static boolean |
isServiceAvailableByPID(ServiceContext sc,
String itf,
String pid)
Checks the availability of a service inside the given service context. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public IPOJOHelper(OSGiTestCase tc)
tc
- the OSGi Test CaseMethod Detail |
---|
public void dispose()
dispose
in class Helper
Helper.dispose()
public ComponentInstance getInstanceByName(String name)
name
- the instance name.
ComponentInstance
or null
if the instance was not created during the session.public static ComponentInstance createComponentInstance(Bundle bundle, String factoryName, String instanceName)
bundle
- the bundle from which the component factory is defined.factoryName
- the name of the component factory, defined in the
specified bundle.instanceName
- the name of the component instance to create.
public static ComponentInstance createComponentInstance(Bundle bundle, String factoryName, Dictionary configuration)
bundle
- the bundle from which the component factory is defined.factoryName
- the name of the component factory, defined in the
specified bundle.configuration
- the configuration of the component instance to
create.
public static ComponentInstance createComponentInstance(Bundle bundle, String factoryName, String instanceName, Dictionary configuration)
bundle
- the bundle from which the component factory is defined.factoryName
- the name of the component factory, defined in the
specified bundle.instanceName
- the name of the component instance to create.configuration
- the configuration of the instance to create.
public static ComponentInstance createComponentInstance(ServiceContext serviceContext, String factoryName, String instanceName)
serviceContext
- the service context in which the component factory
service is registered.factoryName
- the name of the component factory, defined in the
specified service context.instanceName
- the name of the component instance to create.
public static ComponentInstance createComponentInstance(ServiceContext serviceContext, String factoryName, Dictionary configuration)
serviceContext
- the service context in which the component factory
service is registered.factoryName
- the name of the component factory, defined in the
specified service context.configuration
- the configuration of the instance to create.
public static ComponentInstance createComponentInstance(ServiceContext serviceContext, String factoryName, String instanceName, Dictionary configuration)
serviceContext
- the service context in which the component factory
service is registered.factoryName
- the name of the component factory, defined in the
specified service context.instanceName
- the name of the component instance to create.configuration
- the configuration of the instance to create.
public ComponentInstance createComponentInstance(String factoryName, String instanceName)
factoryName
- the name of the component factory, defined in the
local bundle.instanceName
- the name of the component instance to create.
public ComponentInstance createComponentInstance(String factoryName, Dictionary configuration)
factoryName
- the name of the component factory, in the local
bundle.configuration
- the configuration of the component instance to
create.
public ComponentInstance createComponentInstance(String factoryName)
factoryName
- the name of the component factory, in the local
bundle.
public ComponentInstance createComponentInstance(String factoryName, String instanceName, Dictionary configuration)
factoryName
- the name of the component factory, defined in the
specified bundle.instanceName
- the name of the component instance to create.configuration
- the configuration of the instance to create.
public Factory getFactory(String factoryName)
factoryName
- the name of the factory to retrieve.
null
if not found.public HandlerFactory getHandlerFactory(String factoryName)
factoryName
- the name of the handler factory to retrieve.
null
if not found.public Element getMetadata(String component)
component
- the name of the locally defined component.
null
if not found.public static Factory getFactory(Bundle bundle, String factoryName)
bundle
- the bundle from which the component factory is defined.factoryName
- the name of the defined factory.
null
if not found.public static Factory getFactory(ServiceContext serviceContext, String factoryName)
serviceContext
- the service context in which the factory service is
defined.factoryName
- the name of the factory.
public static HandlerFactory getHandlerFactory(Bundle bundle, String factoryName)
bundle
- the bundle from which the handler factory is defined.factoryName
- the name of the handler factory to retrieve.
null
if not found.public static Element getMetadata(Bundle bundle, String component)
bundle
- the bundle from which the component is defined.component
- the name of the defined component.
null
if not found.public static Object getServiceObject(ServiceContext serviceContext, String itf, String filter)
serviceContext
- the service context in which the service is
searched.itf
- the interface provided by the searched service.filter
- an additional filter (can be null
).
public static Object[] getServiceObjects(ServiceContext serviceContext, String itf, String filter)
serviceContext
- the service context in which services are searched.itf
- the interface provided by the searched services.filter
- an additional filter (can be null
).
public static ServiceReference getServiceReference(ServiceContext serviceContext, String itf, String filter)
serviceContext
- the service context in which services are searched.itf
- the interface provided by the searched service.filter
- an additional filter (can be null
).
null
is returned.public static ServiceReference getServiceReferenceByPID(ServiceContext serviceContext, String itf, String pid)
serviceContext
- the service context in which services are searched.itf
- the interface provided by the searched service.pid
- the persistent ID of the searched service.
public static ServiceReference[] getServiceReferences(ServiceContext serviceContext, String itf, String filter)
serviceContext
- the service context in which services are searched.itf
- the interface provided by the searched services.filter
- an additional filter (can be null
).
public static ServiceReference getServiceReferenceByName(ServiceContext serviceContext, String itf, String name)
serviceContext
- the service context in which services are searched.itf
- the interface provided by the searched service.name
- the name of the searched service.
public static boolean isServiceAvailable(ServiceContext sc, String itf)
sc
- the service contextitf
- the service interface to found
true
if the service is available in the service
context, false
otherwise.public static boolean isServiceAvailableByName(ServiceContext sc, String itf, String name)
sc
- the service contextitf
- the service interface to foundname
- the service provider name
true
if the service is available in the service
context, false
otherwise.public static boolean isServiceAvailableByPID(ServiceContext sc, String itf, String pid)
sc
- the service contextitf
- the service interface to foundpid
- the pid of the service
true
if the service is available in the service
context, false
otherwise.public static ServiceReference getServiceReferenceByName(Bundle bundle, String itf, String name)
bundle
- the bundle from which the service is searched.itf
- the interface provided by the searched service.name
- the name of the searched service.
public ServiceReference getServiceReferenceByName(String itf, String name)
itf
- the interface provided by the searched service.name
- the name of the searched service.
public boolean isServiceAvailableByName(String itf, String name)
itf
- the service interfacename
- the service provider name
true
if the service is available, false
otherwise.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |