JXTA

net.jxta.impl.meter
Class MonitorManager

java.lang.Object
  extended by net.jxta.impl.meter.MonitorManager
All Implemented Interfaces:
Module, Service

public class MonitorManager
extends Object
implements Service


Field Summary
static int NOT_PULSING
           
 
Fields inherited from interface net.jxta.platform.Module
START_AGAIN_PROGRESS, START_AGAIN_STALLED, START_DISABLED, START_OK
 
Constructor Summary
MonitorManager()
           
 
Method Summary
 long addMonitorListener(MonitorFilter monitorFilter, long reportRate, boolean includeCumulative, MonitorListener monitorListener)
           
 MonitorFilter createSupportedCumulativeMonitorFilter(MonitorFilter monitorFilter)
           
 MonitorFilter createSupportedMonitorFilter(MonitorFilter monitorFilter, long reportRate)
           
 void destroy()
           
 long getBestReportRate(long desiredReportRate)
           
 MonitorReport getCumulativeMonitorReport(MonitorFilter monitorFilter)
           
 Advertisement getImplAdvertisement()
          Returns the advertisement for this service.
 Service getInterface()
          Service objects are not manipulated directly to protect usage of the service.
 ModuleClassID[] getMonitorableServiceTypes()
           
 PeerGroup getPeerGroup()
           
 PeerMonitorInfo getPeerMonitorInfo()
           
 long getPulseRate()
           
 long getPulseRate(ServiceMonitor serviceMonitor)
           
 int getPulseRateIndex()
           
 long getPulseRateIndex(ServiceMonitor serviceMonitor)
           
 long getReportRate(int index)
           
 int getReportRateIndex(long reportRate)
           
static long[] getReportRates()
           
 int getReportRatesCount()
           
 ServiceMonitor getServiceMonitor(ModuleClassID moduleClassID)
           
static ServiceMonitor getServiceMonitor(PeerGroup peerGroup, ModuleClassID serviceClassID)
           
 void init(PeerGroup peerGroup, ID assignedID, Advertisement implAdvertisement)
          Initialize the module, passing it its peer group and advertisement.
(package private)  boolean isEvenPulseForRateIndex(int pulseRateIndex)
           
 boolean isLocalMonitoringAvailable(ModuleClassID moduleClassID)
           
 boolean isSupportedReportRate(long reportRate)
           
static MonitorManager registerMonitorManager(PeerGroup peerGroup)
          DO NOT USE THIS METHOD: It will be deprecated when MonitorManager becomes a FULL FLEDGED SERVICE
 int removeMonitorListener(MonitorListener monitorListener)
           
 int startApp(String[] args)
          Complete any remaining initialization of the module.
 void stopApp()
          Stop a module.
static void unregisterMonitorManager(PeerGroup peerGroup)
          DO NOT USE THIS METHOD: It will be deprecated when MonitorManager becomes a FULL FLEDGED SERVICE
 void validateCumulativeMonitorFilter(MonitorFilter monitorFilter)
           
 void validateMonitorFilter(MonitorFilter monitorFilter, long reportRate)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NOT_PULSING

public static final int NOT_PULSING
See Also:
Constant Field Values
Constructor Detail

MonitorManager

public MonitorManager()
Method Detail

getImplAdvertisement

public Advertisement getImplAdvertisement()
Description copied from interface: net.jxta.service.Service
Returns the advertisement for this service.

Specified by:
getImplAdvertisement in interface Service
Returns:
Advertisement the advertisement. This is always a ModuleImplAdvertisement.

getInterface

public Service getInterface()
Description copied from interface: net.jxta.service.Service
Service objects are not manipulated directly to protect usage of the service. A Service interface is returned to access the service methods.

Specified by:
getInterface in interface Service
Returns:
Service public interface of the service

init

public void init(PeerGroup peerGroup,
                 ID assignedID,
                 Advertisement implAdvertisement)
Description copied from interface: net.jxta.platform.Module
Initialize the module, passing it its peer group and advertisement.

Note: when subclassing one of the existing PeerGroup implementations (which implement Module), it may not be recommended to overload the init method. See the documentation of the PeerGroup class being subclassed.

Specified by:
init in interface Module
Parameters:
peerGroup - The PeerGroup from which this Module can obtain services. If this module is a Service, this is also the PeerGroup of which this module is a service.
assignedID - Identity of Module within group. modules can use it as a the root of their namespace to create names that are unique within the group but predictable by the same module on another peer. This is normally the ModuleClassID which is also the name under which the module is known by other modules. For a group it is the PeerGroupID itself. The parameters of a service, in the Peer configuration, are indexed by the assignedID of that service, and a Service must publish its run-time parameters in the Peer Advertisement under its assigned ID.
implAdvertisement - The implementation advertisement for this Module. It is permissible to pass null if no implementation advertisement is available. This may happen if the implementation was selected by explicit class name rather than by following an implementation advertisement. Modules are not required to support that style of loading, but if they do, then their documentation should mention it.

startApp

public int startApp(String[] args)
Description copied from interface: net.jxta.platform.Module
Complete any remaining initialization of the module. The module should be fully functional after startApp() is completed. That is also the opportunity to supply arbitrary arguments (mostly to applications).

If this module is a PeerGroup service, it may be invoked several times depending on its return value.

Specified by:
startApp in interface Module
Parameters:
args - An array of Strings forming the parameters for this Module.
Returns:
int A status indication which may be one of Module.START_OK, Module.START_AGAIN_PROGRESS, Module.START_AGAIN_STALLED, which indicates partial or complete success, or any other value (negative values are recommended for future compatibility), which indicates failure.

stopApp

public void stopApp()
Description copied from interface: net.jxta.platform.Module
Stop a module. This may be called any time after init() completes and should not assume that startApp() has been called or completed.

The Module cannot be forced to comply, but in the future we might be able to deny it access to anything after some timeout.

Specified by:
stopApp in interface Module

getReportRates

public static long[] getReportRates()

isLocalMonitoringAvailable

public boolean isLocalMonitoringAvailable(ModuleClassID moduleClassID)

getPeerGroup

public PeerGroup getPeerGroup()

getPeerMonitorInfo

public PeerMonitorInfo getPeerMonitorInfo()

getReportRatesCount

public int getReportRatesCount()

getReportRateIndex

public int getReportRateIndex(long reportRate)

isSupportedReportRate

public boolean isSupportedReportRate(long reportRate)

getReportRate

public long getReportRate(int index)

getBestReportRate

public long getBestReportRate(long desiredReportRate)

getServiceMonitor

public ServiceMonitor getServiceMonitor(ModuleClassID moduleClassID)

validateCumulativeMonitorFilter

public void validateCumulativeMonitorFilter(MonitorFilter monitorFilter)
                                     throws MonitorFilterException
Throws:
MonitorFilterException

validateMonitorFilter

public void validateMonitorFilter(MonitorFilter monitorFilter,
                                  long reportRate)
                           throws MonitorFilterException
Throws:
MonitorFilterException

createSupportedCumulativeMonitorFilter

public MonitorFilter createSupportedCumulativeMonitorFilter(MonitorFilter monitorFilter)
                                                     throws MonitorFilterException
Throws:
MonitorFilterException

createSupportedMonitorFilter

public MonitorFilter createSupportedMonitorFilter(MonitorFilter monitorFilter,
                                                  long reportRate)
                                           throws MonitorFilterException
Throws:
MonitorFilterException

addMonitorListener

public long addMonitorListener(MonitorFilter monitorFilter,
                               long reportRate,
                               boolean includeCumulative,
                               MonitorListener monitorListener)
                        throws MonitorException
Throws:
MonitorException

removeMonitorListener

public int removeMonitorListener(MonitorListener monitorListener)

getCumulativeMonitorReport

public MonitorReport getCumulativeMonitorReport(MonitorFilter monitorFilter)
                                         throws MonitorException
Throws:
MonitorException

getMonitorableServiceTypes

public ModuleClassID[] getMonitorableServiceTypes()

getPulseRate

public long getPulseRate()

getPulseRateIndex

public int getPulseRateIndex()

getPulseRate

public long getPulseRate(ServiceMonitor serviceMonitor)

getPulseRateIndex

public long getPulseRateIndex(ServiceMonitor serviceMonitor)

isEvenPulseForRateIndex

boolean isEvenPulseForRateIndex(int pulseRateIndex)

destroy

public void destroy()

registerMonitorManager

public static MonitorManager registerMonitorManager(PeerGroup peerGroup)
                                             throws JxtaException
DO NOT USE THIS METHOD: It will be deprecated when MonitorManager becomes a FULL FLEDGED SERVICE

Throws:
JxtaException

unregisterMonitorManager

public static void unregisterMonitorManager(PeerGroup peerGroup)
DO NOT USE THIS METHOD: It will be deprecated when MonitorManager becomes a FULL FLEDGED SERVICE


getServiceMonitor

public static ServiceMonitor getServiceMonitor(PeerGroup peerGroup,
                                               ModuleClassID serviceClassID)

JXSE