public final class ServiceManagerImpl extends Object implements ServiceManager
Constructor and Description |
---|
ServiceManagerImpl(FrameworkEvents frameworkEvents) |
Modifier and Type | Method and Description |
---|---|
void |
fireFrameworkEvent(org.jboss.osgi.resolver.XBundle bundle,
int type,
org.osgi.framework.ServiceException ex) |
void |
fireServiceEvent(org.jboss.osgi.resolver.XBundle bundle,
int type,
ServiceState<?> serviceState) |
<S> S |
getService(org.jboss.osgi.resolver.XBundle bundle,
ServiceState<S> serviceState)
Returns the service object referenced by the specified
ServiceReference object. |
ServiceState<?> |
getServiceReference(org.jboss.osgi.resolver.XBundle bundle,
String clazz)
Returns a
ServiceReference object for a service that implements and was registered under the specified
class. |
List<ServiceState<?>> |
getServiceReferences(org.jboss.osgi.resolver.XBundle bundle,
String clazz,
String filterStr,
boolean checkAssignable)
Returns an array of
ServiceReference objects. |
ServiceState |
registerService(org.jboss.osgi.resolver.XBundle bundle,
String[] classNames,
Object serviceValue,
Dictionary properties)
Registers the specified service object with the specified properties under the specified class names into the Framework.
|
boolean |
ungetService(org.jboss.osgi.resolver.XBundle bundle,
ServiceState<?> serviceState)
Releases the service object referenced by the specified
ServiceReference object. |
void |
unregisterService(ServiceState<?> serviceState)
Unregister the given service.
|
public ServiceManagerImpl(FrameworkEvents frameworkEvents)
public void fireFrameworkEvent(org.jboss.osgi.resolver.XBundle bundle, int type, org.osgi.framework.ServiceException ex)
fireFrameworkEvent
in interface ServiceManager
public void fireServiceEvent(org.jboss.osgi.resolver.XBundle bundle, int type, ServiceState<?> serviceState)
fireServiceEvent
in interface ServiceManager
public ServiceState registerService(org.jboss.osgi.resolver.XBundle bundle, String[] classNames, Object serviceValue, Dictionary properties)
ServiceRegistration
object is returned. The ServiceRegistration
object is for the private use
of the bundle registering the service and should not be shared with other bundles. The registering bundle is defined to
be the context bundle.registerService
in interface ServiceManager
classNames
- The class names under which the service can be located.serviceValue
- The service object or a ServiceFactory
object.properties
- The properties for this service.ServiceRegistration
object for use by the bundle registering the servicepublic ServiceState<?> getServiceReference(org.jboss.osgi.resolver.XBundle bundle, String clazz)
ServiceReference
object for a service that implements and was registered under the specified
class.getServiceReference
in interface ServiceManager
clazz
- The class name with which the service was registered.ServiceReference
object, or null
public List<ServiceState<?>> getServiceReferences(org.jboss.osgi.resolver.XBundle bundle, String clazz, String filterStr, boolean checkAssignable) throws org.osgi.framework.InvalidSyntaxException
ServiceReference
objects. The returned array of ServiceReference
objects
contains services that were registered under the specified class, match the specified filter expression.
If checkAssignable is true, the packages for the class names under which the services were registered match the context
bundle's packages as defined in ServiceReference.isAssignableTo(Bundle, String)
.getServiceReferences
in interface ServiceManager
clazz
- The class name with which the service was registered or null
for all services.filterStr
- The filter expression or null
for all services.ServiceReference
objects.org.osgi.framework.InvalidSyntaxException
public <S> S getService(org.jboss.osgi.resolver.XBundle bundle, ServiceState<S> serviceState)
ServiceReference
object.getService
in interface ServiceManager
reference
or null
public void unregisterService(ServiceState<?> serviceState)
unregisterService
in interface ServiceManager
public boolean ungetService(org.jboss.osgi.resolver.XBundle bundle, ServiceState<?> serviceState)
ServiceReference
object. If the context bundle's use
count for the service is zero, this method returns false
. Otherwise, the context bundle's use count for the
service is decremented by one.ungetService
in interface ServiceManager
false
if the context bundle's use count for the service is zero or if the service has been
unregistered; true
otherwise.Copyright © 2013 JBoss by Red Hat. All rights reserved.