org.apache.aries.jmx
Class AbstractCompendiumHandler

java.lang.Object
  extended by org.osgi.util.tracker.ServiceTracker
      extended by org.apache.aries.jmx.AbstractCompendiumHandler
All Implemented Interfaces:
MBeanHandler, org.osgi.util.tracker.ServiceTrackerCustomizer
Direct Known Subclasses:
ConfigurationAdminMBeanHandler, PermissionAdminMBeanHandler, ProvisioningServiceMBeanHandler, UserAdminMBeanHandler

public abstract class AbstractCompendiumHandler
extends org.osgi.util.tracker.ServiceTracker
implements MBeanHandler

Abstract implementation of MBeanHandler that provides a template with basic tracking of an optional compendium service. MBeanHandler implementations that manage a StandardMBean that is backed by a single OSGi compendium service should extend this class and implement the constructInjectMBean(Object) and MBeanHandler.getName() methods

Version:
$Rev: 896239 $ $Date: 2010-01-05 22:02:23 +0000 (Tue, 05 Jan 2010) $
See Also:
MBeanHandler

Field Summary
protected  JMXAgentContext agentContext
           
protected  StandardMBean mbean
           
protected  Long trackedId
           
 
Fields inherited from class org.osgi.util.tracker.ServiceTracker
context, filter
 
Constructor Summary
protected AbstractCompendiumHandler(JMXAgentContext agentContext, org.osgi.framework.Filter filter)
           
protected AbstractCompendiumHandler(JMXAgentContext agentContext, String clazz)
           
 
Method Summary
 Object addingService(org.osgi.framework.ServiceReference reference)
           
protected abstract  StandardMBean constructInjectMBean(Object targetService)
          Implement this method to construct an appropriate StandardMBean instance which is backed by the supplied service tracked by this handler
 StandardMBean getMbean()
          Gets the StandardMBean managed by this handler when the backing service is available or null
 void removedService(org.osgi.framework.ServiceReference reference, Object service)
           
 
Methods inherited from class org.osgi.util.tracker.ServiceTracker
close, getService, getService, getServiceReference, getServiceReferences, getServices, getTrackingCount, modifiedService, open, open, remove, size, waitForService
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.aries.jmx.MBeanHandler
close, getName, open
 

Field Detail

agentContext

protected final JMXAgentContext agentContext

mbean

protected StandardMBean mbean

trackedId

protected Long trackedId
Constructor Detail

AbstractCompendiumHandler

protected AbstractCompendiumHandler(JMXAgentContext agentContext,
                                    org.osgi.framework.Filter filter)
Parameters:
agentContext -
filter -

AbstractCompendiumHandler

protected AbstractCompendiumHandler(JMXAgentContext agentContext,
                                    String clazz)
Parameters:
agentContext -
clazz -
Method Detail

addingService

public Object addingService(org.osgi.framework.ServiceReference reference)
Specified by:
addingService in interface org.osgi.util.tracker.ServiceTrackerCustomizer
Overrides:
addingService in class org.osgi.util.tracker.ServiceTracker

removedService

public void removedService(org.osgi.framework.ServiceReference reference,
                           Object service)
Specified by:
removedService in interface org.osgi.util.tracker.ServiceTrackerCustomizer
Overrides:
removedService in class org.osgi.util.tracker.ServiceTracker

getMbean

public StandardMBean getMbean()
Gets the StandardMBean managed by this handler when the backing service is available or null

Specified by:
getMbean in interface MBeanHandler
Returns:
MBean @see StandardMBean.
See Also:
MBeanHandler.getMbean()

constructInjectMBean

protected abstract StandardMBean constructInjectMBean(Object targetService)
Implement this method to construct an appropriate StandardMBean instance which is backed by the supplied service tracked by this handler

Parameters:
targetService - the compendium service tracked by this handler
Returns:
The StandardMBean instance whose registration lifecycle will be managed by this handler


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