|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.cougaar.util.GenericStateModelAdapter
org.cougaar.core.blackboard.BlackboardClientComponent
org.cougaar.core.plugin.ComponentPlugin
org.cougaar.pizza.servlet.HistoryServlet
Generic debugging servlet/plugin that displays all Adds/Changes/Removes on Blackboard objects, accessed at "/history".
Specifically tracks changes on Relays, Tasks, PlanElements, Assets, UniqueObjects, and implementations ofHistoryServletFriendly.
For every event, attempts to explain the event.
For instance, when a Relay is first published, it shows which Agent
the Relay is being sent to.
The Servlet lets the user sort events by time, then by uid, or by uid
only. Sorting by uid shows the complete lifecycle of a Blackboard
object; especially useful for transient objects that live on the
Blackboard only a short time. When sorting by time, each group of
changes that happens in the same execute cycle is drawn with
the same background color. When sorting by uid, each distinct
object is drawn with the same background color.
The servlet has a "show details" link which will show the toString for
the blackboard object at that time. This is a spot where developers
can tune how this servlet displays their objects.
The "Meaning" column uses the HistoryServletFriendly's toHTML() method
to fill in content when available.
Also shows which plugin initially published an object to the Blackboard
if that information is available (for Claimables).
Try it in any Cougaar Application! Simply add this as a Plugin
in any Agent!
Has a default limit of 1000 events, but this can be set by the
MAX_EVENTS_REMEMBERED component argument to the servlet.
E.g. :
<argument>MAX_EVENTS_REMEMBERED=5000</argument>
Another limit: 5 RoleSchedule elements displayed by default, set with MAX_ROLE_SCHEDULE_ELEMENTS argument. And a default of 5 child Tasks shown per Expansion, changed with the MAX_CHILD_TASKS argument.
Note that this Servlet is actually a Plugin, so that it can subscribe to all the blackboard changes, and keeps a SortedSet of these Events, ready for display. It then provides an inner Servlet to the ServletService, so a user can view the pre-collected Events Set. Note that this Servlet has heavy Planning dependencies. It has minor Community dependencies, to allow printing details in the Meaning column. By commenting out those items, this dependency could be removed.
| Nested Class Summary | |
protected class |
HistoryServlet.HistoryFormatter
The inner class used by the servlet to format the request results. |
protected class |
HistoryServlet.HistoryWorker
Inner-class that's registered as the servlet. |
| Nested classes inherited from class org.cougaar.core.blackboard.BlackboardClient |
org.cougaar.core.blackboard.BlackboardClient.Local |
| Field Summary | |
static int |
ADDED
|
static int |
ASSET
|
static int |
CHANGED
|
static int |
DIRECT_OBJECT
|
protected java.lang.String |
encAgentName
|
protected java.util.SortedSet |
events
The actual Blackboard history we collect |
protected static java.text.SimpleDateFormat |
format
|
protected int |
INITIAL_MAX_CHILD_TASKS
|
protected int |
INITIAL_MAX_ENTRIES
|
protected int |
INITIAL_MAX_ROLE_SCHEDULE_ELEMENTS
|
protected org.cougaar.core.mts.MessageAddress |
localAgent
|
protected org.cougaar.core.service.LoggingService |
logger
|
static int |
PLAN_ELEMENT
|
static int |
REMOVED
|
static int |
TASK
|
static int |
UNIQUE_OBJECT
|
| Fields inherited from class org.cougaar.core.blackboard.BlackboardClientComponent |
agentId, agentIdentificationService, alarmService, blackboard, blackboardClientName |
| Fields inherited from interface org.cougaar.core.plugin.PluginBase |
INSERTION_POINT |
| Fields inherited from interface org.cougaar.util.GenericStateModel |
ACTIVE, IDLE, LOADED, UNINITIALIZED, UNLOADED |
| Fields inherited from interface org.cougaar.core.blackboard.BlackboardClient |
current |
| Constructor Summary | |
HistoryServlet()
|
|
| Method Summary | |
protected void |
addEvent(org.cougaar.pizza.servlet.HistoryServlet.EventInfo newEvent)
Add a new event to the list |
protected void |
checkAssets(long now)
Add any Asset events to the Set |
protected void |
checkPlanElements(long now)
Add any PlanElement events to the Set |
protected void |
checkRelays(long now)
Add any Relay events |
protected void |
checkTasks(long now)
Check the Tasks subscription, adding any new events to the list |
protected void |
checkUniqueObjects(long now)
Add any added/changed/removed UniqueObjects |
protected javax.servlet.Servlet |
createServlet()
Get a new HistoryServlet.HistoryWorker to be the Servlet |
protected java.lang.String |
encode(java.lang.String s)
|
java.lang.String |
encodeAgentName(java.lang.String name)
|
protected java.lang.String |
encodeHTML(java.lang.String s)
Encodes a string that may contain HTML syntax-significant characters. |
void |
execute()
Whenever a BBoard item changes, it adds that event to the list of Events (trimming the set if we reach the MAX size). |
protected java.lang.String |
getAddedAssetComment(org.cougaar.planning.ldm.asset.Asset asset)
Get the ChangedAssetComment |
protected java.lang.String |
getAddedPEComment(org.cougaar.planning.ldm.plan.PlanElement planElement)
If it's an Allocation, show the Task Verb and the allocated Asset's Type and ItemID, RoleSchedule. |
protected java.lang.String |
getAddedRelayComment(org.cougaar.core.relay.Relay relay)
For a Source: show the target addresses, any community content or request, and the relay's Content. |
protected java.lang.String |
getAddedTaskComment(org.cougaar.planning.ldm.plan.Task task)
description of an added Task shows the Verb, DirectObject, and Preferences. |
protected java.lang.String |
getAddedUniqueObjectComment(org.cougaar.core.util.UniqueObject unique)
For an Added unique object, print it's name, and any HistoryServletFriendly content |
protected java.lang.String |
getAspectValue(org.cougaar.planning.ldm.plan.AspectValue avi)
Get a String representation of this AspectValue |
protected java.lang.String |
getAspectValues(org.cougaar.planning.ldm.plan.AspectValue[] values,
java.lang.String prefix)
Get an HTML table of these Aspect Values (id'd by the prefix) |
protected java.lang.String |
getAspectValues2(org.cougaar.planning.ldm.plan.AspectValue[] values)
Get String representation of these Aspect Values |
protected java.lang.String |
getChangedAssetComment(org.cougaar.planning.ldm.asset.Asset asset)
Show the asset class, typeID, ItemID, if an Entity then any Roles, Relationships, RoleSchedule, and the HistoryServletFriendly content |
protected java.lang.String |
getChangedPEComment(org.cougaar.planning.ldm.plan.PlanElement planElement)
Show the results on the PE |
protected java.lang.String |
getChangedRelayComment(org.cougaar.core.relay.Relay relay)
For a Source, show any community specific information, the Content. |
protected java.lang.String |
getChangedUniqueObjectComment(org.cougaar.core.util.UniqueObject unique)
Changed/Removed unique objects use the same comment as for Add |
protected java.lang.String |
getClassName(java.lang.Object obj)
Get the non-Package name of the Class |
protected java.lang.String |
getCommunityText(java.lang.String prefix,
org.cougaar.core.service.community.Community community)
Describe this Community by name, entities |
protected java.lang.String |
getPath()
Load this servlet at "/history" |
protected java.lang.String |
getRemovedUniqueObjectComment(org.cougaar.core.util.UniqueObject unique)
Changed/Removed unique objects use the same comment as for Add |
protected java.lang.String |
getRoleSchedule(org.cougaar.planning.ldm.asset.Asset asset)
Print the RoleSchedule of the Asset if any, up to the maxRoleScheduleElements |
protected java.lang.String |
getTaskPreferences(org.cougaar.planning.ldm.plan.Task task)
Get a String HTML table of the Task's preferences |
protected java.lang.String |
getTimeString(long time)
Formats long millis time to Date Format String. |
protected java.lang.String |
getTypeAndItemInfo(org.cougaar.planning.ldm.asset.Asset asset)
Get the type & item ID of an Asset -- to ID it in the display |
protected java.lang.String |
getURL(org.cougaar.core.util.UID uid,
int which)
Generate a link to the PlanView (/tasks) servlet for full details on the objet. |
void |
load()
|
protected int |
nextEventNum()
Get the next number for a new Event |
protected void |
setEvents(java.util.SortedSet events)
Reset the stored event list -- used when we've resorted the list. |
void |
setParameter(java.lang.Object o)
Only called if a plugin has parameters. |
void |
setServletService(org.cougaar.core.service.ServletService servletService)
Get the ServletService via reflection |
protected void |
setupSubscriptions()
|
protected java.lang.String |
showTargetAddresses(org.cougaar.core.relay.Relay.Source sourceRelay)
Show the target(s) of a relay, including ABAs |
protected void |
sortByUIDThenTime()
Sort the events collection by UID and then time. |
void |
unload()
|
| Methods inherited from class org.cougaar.core.plugin.ComponentPlugin |
getConfigFinder |
| Methods inherited from class org.cougaar.core.blackboard.BlackboardClientComponent |
currentTimeMillis, cycle, getAgentIdentifier, getAlarmService, getBindingSite, getBlackboardClientName, getBlackboardService, getMessageAddress, getParameter, getParameters, getServiceBroker, halt, precycle, requestCycle, resume, setAgentIdentificationService, setAlarmService, setBindingSite, setBlackboardService, setSchedulerService, setServiceBroker, setSuicideService, shouldExecute, start, stop, suspend, toString, wasAwakened |
| Methods inherited from class org.cougaar.util.GenericStateModelAdapter |
getModelState, initialize, transitState |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.cougaar.util.GenericStateModel |
getModelState, halt, initialize, resume, start, stop, suspend |
| Field Detail |
protected final int INITIAL_MAX_ENTRIES
protected final int INITIAL_MAX_ROLE_SCHEDULE_ELEMENTS
protected final int INITIAL_MAX_CHILD_TASKS
protected org.cougaar.core.mts.MessageAddress localAgent
protected org.cougaar.core.service.LoggingService logger
protected static java.text.SimpleDateFormat format
protected java.lang.String encAgentName
protected java.util.SortedSet events
public static final int TASK
public static final int PLAN_ELEMENT
public static final int ASSET
public static final int UNIQUE_OBJECT
public static final int DIRECT_OBJECT
public static final int ADDED
public static final int CHANGED
public static final int REMOVED
| Constructor Detail |
public HistoryServlet()
| Method Detail |
public void setParameter(java.lang.Object o)
public void setServletService(org.cougaar.core.service.ServletService servletService)
public void load()
public void unload()
protected void setupSubscriptions()
protected java.lang.String getPath()
protected javax.servlet.Servlet createServlet()
HistoryServlet.HistoryWorker to be the Servlet
public void execute()
public java.lang.String encodeAgentName(java.lang.String name)
protected java.lang.String encode(java.lang.String s)
protected java.lang.String getURL(org.cougaar.core.util.UID uid,
int which)
protected int nextEventNum()
protected void checkTasks(long now)
protected java.lang.String getAddedTaskComment(org.cougaar.planning.ldm.plan.Task task)
protected void checkPlanElements(long now)
protected void checkRelays(long now)
protected void checkAssets(long now)
protected java.lang.String getAddedAssetComment(org.cougaar.planning.ldm.asset.Asset asset)
protected java.lang.String getChangedAssetComment(org.cougaar.planning.ldm.asset.Asset asset)
protected java.lang.String getRoleSchedule(org.cougaar.planning.ldm.asset.Asset asset)
protected void checkUniqueObjects(long now)
protected java.lang.String getAddedUniqueObjectComment(org.cougaar.core.util.UniqueObject unique)
protected java.lang.String getChangedUniqueObjectComment(org.cougaar.core.util.UniqueObject unique)
protected java.lang.String getRemovedUniqueObjectComment(org.cougaar.core.util.UniqueObject unique)
protected java.lang.String getClassName(java.lang.Object obj)
protected java.lang.String getAddedRelayComment(org.cougaar.core.relay.Relay relay)
protected java.lang.String showTargetAddresses(org.cougaar.core.relay.Relay.Source sourceRelay)
protected java.lang.String getChangedRelayComment(org.cougaar.core.relay.Relay relay)
protected java.lang.String getCommunityText(java.lang.String prefix,
org.cougaar.core.service.community.Community community)
protected java.lang.String getChangedPEComment(org.cougaar.planning.ldm.plan.PlanElement planElement)
protected java.lang.String getAspectValues(org.cougaar.planning.ldm.plan.AspectValue[] values,
java.lang.String prefix)
protected java.lang.String getAspectValues2(org.cougaar.planning.ldm.plan.AspectValue[] values)
protected java.lang.String getAspectValue(org.cougaar.planning.ldm.plan.AspectValue avi)
protected java.lang.String getTimeString(long time)
protected java.lang.String getTaskPreferences(org.cougaar.planning.ldm.plan.Task task)
protected java.lang.String getAddedPEComment(org.cougaar.planning.ldm.plan.PlanElement planElement)
protected java.lang.String getTypeAndItemInfo(org.cougaar.planning.ldm.asset.Asset asset)
protected void addEvent(org.cougaar.pizza.servlet.HistoryServlet.EventInfo newEvent)
protected void setEvents(java.util.SortedSet events)
protected void sortByUIDThenTime()
protected java.lang.String encodeHTML(java.lang.String s)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||