org.apache.commons.monitoring.impl.repositories
Class AbstractRepository

java.lang.Object
  extended by org.apache.commons.monitoring.impl.repositories.AbstractRepository
All Implemented Interfaces:
Repository
Direct Known Subclasses:
ObservableRepository, SecondaryRepository

public abstract class AbstractRepository
extends java.lang.Object
implements Repository

Abstract implementation of Repository with support for base methods.

Author:
Nicolas De Loof

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.commons.monitoring.Repository
Repository.Listener, Repository.Observable
 
Constructor Summary
AbstractRepository()
           
 
Method Summary
 java.util.Set<java.lang.String> getCategories()
           
protected  Monitor getMonitor(Monitor.Key key)
           
 Monitor getMonitor(java.lang.String name)
           
 Monitor getMonitor(java.lang.String name, java.lang.String category)
           
 Monitor getMonitor(java.lang.String name, java.lang.String category, java.lang.String subsystem)
           
 java.util.Collection<Monitor> getMonitors()
           
 java.util.Collection<Monitor> getMonitorsFromCategory(java.lang.String category)
           
 java.util.Collection<Monitor> getMonitorsFromSubSystem(java.lang.String subsystem)
           
 java.util.Set<java.lang.String> getSubSystems()
           
protected  Monitor register(Monitor monitor)
          Register a new monitor in the repository
 void reset()
          Reset all monitors (don't remove them)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.commons.monitoring.Repository
start
 

Constructor Detail

AbstractRepository

public AbstractRepository()
Method Detail

getMonitor

public Monitor getMonitor(java.lang.String name)
Specified by:
getMonitor in interface Repository

getMonitor

public Monitor getMonitor(java.lang.String name,
                          java.lang.String category)
Specified by:
getMonitor in interface Repository

getMonitor

public Monitor getMonitor(java.lang.String name,
                          java.lang.String category,
                          java.lang.String subsystem)
Specified by:
getMonitor in interface Repository

getMonitor

protected Monitor getMonitor(Monitor.Key key)

register

protected Monitor register(Monitor monitor)
Register a new monitor in the repository

Parameters:
monitor - Monitor instance to get registered
Returns:
a previously registered monitor if existed, or null if monitor has been successfully registered

getCategories

public java.util.Set<java.lang.String> getCategories()
Specified by:
getCategories in interface Repository
Returns:
the categories declared by monitors in the repository

getSubSystems

public java.util.Set<java.lang.String> getSubSystems()
Specified by:
getSubSystems in interface Repository
Returns:
the subsystems declared by monitors in the repository

getMonitors

public java.util.Collection<Monitor> getMonitors()
Specified by:
getMonitors in interface Repository
Returns:
all monitors registered in the repository

getMonitorsFromCategory

public java.util.Collection<Monitor> getMonitorsFromCategory(java.lang.String category)
Specified by:
getMonitorsFromCategory in interface Repository
Parameters:
category - a category name
Returns:
all monitors in the repository that declare this category in there Key

getMonitorsFromSubSystem

public java.util.Collection<Monitor> getMonitorsFromSubSystem(java.lang.String subsystem)
Specified by:
getMonitorsFromSubSystem in interface Repository
Parameters:
subsystem - a subsystem name
Returns:
all monitors in the repository that declare this subsystem in there Key

reset

public void reset()
Description copied from interface: Repository
Reset all monitors (don't remove them)

Specified by:
reset in interface Repository


Copyright © 2008 The Apache Software Foundation. All Rights Reserved.