metaglue
Class LocalLogManagerAgent

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--metaglue.AgentAgent
                          |
                          +--agentland.util.NotifierAgent
                                |
                                +--metaglue.LocalLogManagerAgent
All Implemented Interfaces:
Agent, LocalLogManager, MetagluePrimitives, Notifier, Remote, Serializable

public class LocalLogManagerAgent
extends NotifierAgent
implements LocalLogManager

Notification So this class makes extensive use of the NotifierAgent, which we hack slightly to make it work properly with log levels. Whenever an agent is monitored, the spy gets all messages with the signature "LOGLEVEL:AgentID", where LOGLEVEL is a string representation of the logging level at which the string was sent.

See Also:
Serialized Form

Inner classes inherited from class metaglue.AgentAgent
AgentAgent.Attribute
 
Field Summary
static int CRITICAL
           
static int DEBUG
           
static int ERROR
           
static int INFO
           
static String[] LOGLEVEL
           
static int WARNING
           
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Fields inherited from interface metaglue.Agent
ALIVE, DIED, NO_METAGLUE, NOT_RUNNING, STARTING
 
Constructor Summary
LocalLogManagerAgent(AgentID id)
           
 
Method Summary
 void addLevelListener(int lvl, AgentID monitor)
          Adds a listener to a specific level regardless of agent.
 void addLogListener(AgentID sender, AgentID monitor)
          Makes monitor listen to all levels for it
 void addLogListener(AgentID sender, int lvl, AgentID monitor)
          Adds a listener to a specific agent and log level
 void propagateMessage(int level, AgentID id, String s)
           
 void removeLogListener(AgentID monitor)
          Removes all of the notifications to lst
 void removeLogListener(AgentID sender, int lvl, AgentID monitor)
          Removes a specific notification
 
Methods inherited from class agentland.util.NotifierAgent
addSpy, addSpy, getNoteTypes, getNotifyTable, gossip, hack_notify, lookupSpy, notify, notify, passNotify, putNotifyTable, removeAllSpies, removeNotifyTable, removeSpy, removeSpy, removeSpy, removeSpy, removeSpy
 
Methods inherited from class metaglue.AgentAgent
addMonitor, alive, buildEHAFor, defrost, defrostAll, defrostBoolean, defrostInt, defrostString, fixAttribute, fixAttribute, freeze, freeze, freeze, freezeAll, freezeVar, getAgentID, getAttribute, getCatalog, getCatalogID, getDesignation, getFrozenVariables, getLogLevel, getMetaglueAgent, getMetaglueAgentID, getOccupation, getOldLogs, getProperties, getProxyHandlerClass, getSociety, installAPH, log, log, log, lookupClass, reliesOn, reliesOn, reliesOn, reliesOnSynch, removeAPHFromCatalog, removeFrozen, setFreezeName, setLogLevel, setLogName, shutdown, startAgent, startAgentOn, startAgentOn, startup, status, tiedTo, tiedTo, tiedTo, tiedTo, tieToDesignation, toString, whereAreYou
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface agentland.util.Notifier
addSpy, addSpy, gossip, notify, passNotify, removeAllSpies, removeSpy, removeSpy
 
Methods inherited from interface metaglue.Agent
addMonitor, alive, getAgentID, getMetaglueAgentID, getOldLogs, shutdown, startup, whereAreYou
 

Field Detail

DEBUG

public static final int DEBUG

INFO

public static final int INFO

WARNING

public static final int WARNING

ERROR

public static final int ERROR

CRITICAL

public static final int CRITICAL

LOGLEVEL

public static final String[] LOGLEVEL
Constructor Detail

LocalLogManagerAgent

public LocalLogManagerAgent(AgentID id)
                     throws RemoteException
Method Detail

propagateMessage

public void propagateMessage(int level,
                             AgentID id,
                             String s)
                      throws RemoteException
Specified by:
propagateMessage in interface LocalLogManager

addLogListener

public void addLogListener(AgentID sender,
                           int lvl,
                           AgentID monitor)
                    throws RemoteException
Adds a listener to a specific agent and log level
Specified by:
addLogListener in interface LocalLogManager
Parameters:
sender - The ID of the agent to watch
lvl - The level to listen to
monitor - The AgentID of the LogMonitor

addLogListener

public void addLogListener(AgentID sender,
                           AgentID monitor)
                    throws RemoteException
Makes monitor listen to all levels for it
Specified by:
addLogListener in interface LocalLogManager
Parameters:
sender - The AgentID of the agent generating log messages
monitor - The AgentID of the agent receiving log messages

addLevelListener

public void addLevelListener(int lvl,
                             AgentID monitor)
                      throws RemoteException
Adds a listener to a specific level regardless of agent. It should be noted that this only propagates a message to this particular JavaVM/machine. This will mostly be used for critical notifications
Specified by:
addLevelListener in interface LocalLogManager
Parameters:
lvl - The level to monitor
monitor - The AgentID of the monitor

removeLogListener

public void removeLogListener(AgentID sender,
                              int lvl,
                              AgentID monitor)
                       throws RemoteException
Removes a specific notification
Specified by:
removeLogListener in interface LocalLogManager

removeLogListener

public void removeLogListener(AgentID monitor)
                       throws RemoteException
Removes all of the notifications to lst
Specified by:
removeLogListener in interface LocalLogManager