public class ServiceState extends NotificationBroadcasterSupport implements ServiceStateMBean, MBeanRegistration
ServiceStateMBean which emits JMX Notification for framework
ServiceEvent events and changes to the ServiceIds attribute.| Modifier and Type | Field and Description |
|---|---|
protected ExecutorService |
eventDispatcher |
protected Logger |
logger |
static String |
SERVICE_EVENT |
protected org.osgi.framework.AllServiceListener |
serviceListener |
BUNDLE_IDENTIFIER, BUNDLE_IDENTIFIER_ITEM, BUNDLE_LOCATION, BUNDLE_LOCATION_ITEM, BUNDLE_SYMBOLIC_NAME, BUNDLE_SYMBOLIC_NAME_ITEM, EVENT, EVENT_ITEM, IDENTIFIER, IDENTIFIER_ITEM, OBJECT_CLASS, OBJECT_CLASS_ITEM, OBJECTNAME, PROPERTIES, PROPERTIES_ITEM, SERVICE_EVENT_TYPE, SERVICE_TYPE, SERVICES_TYPE, USING_BUNDLES, USING_BUNDLES_ITEM| Constructor and Description |
|---|
ServiceState(org.osgi.framework.BundleContext bundleContext,
Logger logger) |
| Modifier and Type | Method and Description |
|---|---|
protected AttributeChangeNotification |
getAttributeChangeNotification(org.osgi.framework.ServiceEvent serviceevent) |
long |
getBundleIdentifier(long serviceId)
Answer the bundle identifier of the bundle which registered the service
|
protected ExecutorService |
getEventDispatcher() |
MBeanNotificationInfo[] |
getNotificationInfo() |
String[] |
getObjectClass(long serviceId)
Answer the list of interfaces that this service implements
|
TabularData |
getProperties(long serviceId)
Answer the map of properties associated with this service
|
CompositeData |
getProperty(long serviceId,
String key) |
CompositeData |
getService(long serviceId) |
long[] |
getServiceIds() |
long[] |
getUsingBundles(long serviceId)
Answer the list of identifiers of the bundles that use the service
|
TabularData |
listServices()
Answer the service state of the system in tabular form.
|
TabularData |
listServices(String clazz,
String filter) |
TabularData |
listServices(String clazz,
String filter,
String... serviceTypeItems) |
void |
postDeregister() |
void |
postRegister(Boolean registrationDone) |
void |
preDeregister() |
ObjectName |
preRegister(MBeanServer server,
ObjectName name) |
protected void |
shutDownDispatcher() |
addNotificationListener, handleNotification, removeNotificationListener, removeNotificationListener, sendNotificationprotected Logger logger
protected ExecutorService eventDispatcher
protected org.osgi.framework.AllServiceListener serviceListener
public static String SERVICE_EVENT
public ServiceState(org.osgi.framework.BundleContext bundleContext,
Logger logger)
public long getBundleIdentifier(long serviceId)
throws IOException
ServiceStateMBeangetBundleIdentifier in interface ServiceStateMBeanserviceId - the identifier of the serviceIOException - if the operation failsServiceStateMBean.getBundleIdentifier(long)public String[] getObjectClass(long serviceId) throws IOException
ServiceStateMBeangetObjectClass in interface ServiceStateMBeanserviceId - the identifier of the serviceIOException - if the operation failsServiceStateMBean.getObjectClass(long)public TabularData getProperties(long serviceId) throws IOException
ServiceStateMBeangetProperties in interface ServiceStateMBeanserviceId - the identifier of the serviceorg.osgi.framework.Constants interfaceIOException - if the operation failsServiceStateMBean.getProperties(long)public CompositeData getProperty(long serviceId, String key) throws IOException
getProperty in interface ServiceStateMBeanIOExceptionServiceStateMBean.getProperty(long, java.lang.String)public long[] getUsingBundles(long serviceId)
throws IOException
ServiceStateMBeangetUsingBundles in interface ServiceStateMBeanserviceId - the identifier of the serviceIOException - if the operation failsServiceStateMBean.getUsingBundles(long)public CompositeData getService(long serviceId) throws IOException
getService in interface ServiceStateMBeanIOExceptionServiceStateMBean.getService(long)public TabularData listServices() throws IOException
ServiceStateMBeanlistServices in interface ServiceStateMBeanIOException - If the operation failsServiceStateMBean.listServices()public TabularData listServices(String clazz, String filter) throws IOException
listServices in interface ServiceStateMBeanIOExceptionServiceStateMBean.listServices(java.lang.String, java.lang.String)public TabularData listServices(String clazz, String filter, String... serviceTypeItems) throws IOException
listServices in interface ServiceStateMBeanIOExceptionServiceStateMBean.listServices(java.lang.String, java.lang.String, java.lang.String...)public MBeanNotificationInfo[] getNotificationInfo()
getNotificationInfo in interface NotificationBroadcastergetNotificationInfo in class NotificationBroadcasterSupportNotificationBroadcasterSupport.getNotificationInfo()public long[] getServiceIds()
throws IOException
getServiceIds in interface ServiceStateMBeanIOExceptionServiceStateMBean.getServiceIds()public void postDeregister()
postDeregister in interface MBeanRegistrationMBeanRegistration.postDeregister()public void postRegister(Boolean registrationDone)
postRegister in interface MBeanRegistrationMBeanRegistration.postRegister(java.lang.Boolean)public void preDeregister()
throws Exception
preDeregister in interface MBeanRegistrationExceptionpublic ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception
preRegister in interface MBeanRegistrationExceptionMBeanRegistration.preRegister(javax.management.MBeanServer, javax.management.ObjectName)protected AttributeChangeNotification getAttributeChangeNotification(org.osgi.framework.ServiceEvent serviceevent) throws IOException
IOExceptionprotected void shutDownDispatcher()
protected ExecutorService getEventDispatcher()
Copyright © 2009-2015 The Apache Software Foundation. All Rights Reserved.