org.apache.aries.jmx.framework
Class ServiceState

java.lang.Object
  extended by javax.management.NotificationBroadcasterSupport
      extended by org.apache.aries.jmx.framework.ServiceState
All Implemented Interfaces:
MBeanRegistration, NotificationBroadcaster, NotificationEmitter, ServiceStateMBean

public class ServiceState
extends NotificationBroadcasterSupport
implements ServiceStateMBean, MBeanRegistration

Implementation of ServiceStateMBean which emits JMX Notification for framework ServiceEvent events

Version:
$Rev: 943553 $ $Date: 2010-05-12 16:29:16 +0100 (Wed, 12 May 2010) $

Field Summary
protected  ExecutorService eventDispatcher
           
protected  Logger logger
           
static String SERVICE_EVENT
           
protected  org.osgi.framework.AllServiceListener serviceListener
           
 
Fields inherited from interface org.osgi.jmx.framework.ServiceStateMBean
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, SERVICE_EVENT_TYPE, SERVICE_TYPE, SERVICES_TYPE, USING_BUNDLES, USING_BUNDLES_ITEM
 
Constructor Summary
ServiceState(org.osgi.framework.BundleContext bundleContext, Logger logger)
           
 
Method Summary
 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
 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.
 void postDeregister()
           
 void postRegister(Boolean registrationDone)
           
 void preDeregister()
           
 ObjectName preRegister(MBeanServer server, ObjectName name)
           
protected  void shutDownDispatcher()
           
 
Methods inherited from class javax.management.NotificationBroadcasterSupport
addNotificationListener, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected Logger logger

eventDispatcher

protected ExecutorService eventDispatcher

serviceListener

protected org.osgi.framework.AllServiceListener serviceListener

SERVICE_EVENT

public static String SERVICE_EVENT
Constructor Detail

ServiceState

public ServiceState(org.osgi.framework.BundleContext bundleContext,
                    Logger logger)
Method Detail

getBundleIdentifier

public long getBundleIdentifier(long serviceId)
                         throws IOException
Description copied from interface: ServiceStateMBean
Answer the bundle identifier of the bundle which registered the service

Specified by:
getBundleIdentifier in interface ServiceStateMBean
Parameters:
serviceId - the identifier of the service
Returns:
the identifier for the bundle
Throws:
IOException - if the operation fails
See Also:
ServiceStateMBean.getBundleIdentifier(long)

getObjectClass

public String[] getObjectClass(long serviceId)
                        throws IOException
Description copied from interface: ServiceStateMBean
Answer the list of interfaces that this service implements

Specified by:
getObjectClass in interface ServiceStateMBean
Parameters:
serviceId - the identifier of the service
Returns:
the list of interfaces
Throws:
IOException - if the operation fails
See Also:
ServiceStateMBean.getObjectClass(long)

getProperties

public TabularData getProperties(long serviceId)
                          throws IOException
Description copied from interface: ServiceStateMBean
Answer the map of properties associated with this service

Specified by:
getProperties in interface ServiceStateMBean
Parameters:
serviceId - the identifier of the service
Returns:
the table of properties. These include the standard mandatory service.id and objectClass properties as defined in the org.osgi.framework.Constants interface
Throws:
IOException - if the operation fails
See Also:
ServiceStateMBean.getProperties(long)

getUsingBundles

public long[] getUsingBundles(long serviceId)
                       throws IOException
Description copied from interface: ServiceStateMBean
Answer the list of identifiers of the bundles that use the service

Specified by:
getUsingBundles in interface ServiceStateMBean
Parameters:
serviceId - the identifier of the service
Returns:
the list of bundle identifiers
Throws:
IOException - if the operation fails
See Also:
ServiceStateMBean.getUsingBundles(long)

listServices

public TabularData listServices()
                         throws IOException
Description copied from interface: ServiceStateMBean
Answer the service state of the system in tabular form.

Specified by:
listServices in interface ServiceStateMBean
Returns:
the tabular representation of the service state
Throws:
IOException - If the operation fails
See Also:
ServiceStateMBean.listServices()

getNotificationInfo

public MBeanNotificationInfo[] getNotificationInfo()
Specified by:
getNotificationInfo in interface NotificationBroadcaster
Overrides:
getNotificationInfo in class NotificationBroadcasterSupport
See Also:
NotificationBroadcasterSupport.getNotificationInfo()

postDeregister

public void postDeregister()
Specified by:
postDeregister in interface MBeanRegistration
See Also:
MBeanRegistration.postDeregister()

postRegister

public void postRegister(Boolean registrationDone)
Specified by:
postRegister in interface MBeanRegistration
See Also:
MBeanRegistration.postRegister(java.lang.Boolean)

preDeregister

public void preDeregister()
                   throws Exception
Specified by:
preDeregister in interface MBeanRegistration
Throws:
Exception

preRegister

public ObjectName preRegister(MBeanServer server,
                              ObjectName name)
                       throws Exception
Specified by:
preRegister in interface MBeanRegistration
Throws:
Exception
See Also:
MBeanRegistration.preRegister(javax.management.MBeanServer, javax.management.ObjectName)

shutDownDispatcher

protected void shutDownDispatcher()

getEventDispatcher

protected ExecutorService getEventDispatcher()


Copyright © 2009-2013 The Apache Software Foundation. All Rights Reserved.