| org.cougaar.core.plugin.ComponentPlugin org.cougaar.pizza.servlet.HistoryServlet
HistoryServlet | public class HistoryServlet extends ComponentPlugin (Code) | | 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 of
HistoryServletFriendly .
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.
|
Inner Class :protected class HistoryWorker extends HttpServlet | |
Inner Class :protected class HistoryFormatter | |
Method Summary | |
protected void | addEvent(EventInfo newEvent) | protected void | checkAssets(long now) | protected void | checkPlanElements(long now) | protected void | checkRelays(long now) | protected void | checkTasks(long now) | protected void | checkUniqueObjects(long now) | protected Servlet | createServlet() | protected String | encode(String s) | public String | encodeAgentName(String name) | protected String | encodeHTML(String s) Encodes a string that may contain HTML syntax-significant
characters. | public 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 String | getAddedAssetComment(Asset asset) | protected String | getAddedPEComment(PlanElement planElement) If it's an Allocation, show the Task Verb and the allocated Asset's Type
and ItemID, RoleSchedule. | protected String | getAddedRelayComment(Relay relay) For a Source: show the target addresses, any community content or request, and the
relay's Content. | protected String | getAddedTaskComment(Task task) description of an added Task shows the Verb, DirectObject, and Preferences. | protected String | getAddedUniqueObjectComment(UniqueObject unique) | protected String | getAspectValue(AspectValue avi) | protected String | getAspectValues(AspectValue[] values, String prefix) | protected String | getAspectValues2(AspectValue[] values) | protected String | getChangedAssetComment(Asset asset) | protected String | getChangedPEComment(PlanElement planElement) | protected String | getChangedRelayComment(Relay relay) For a Source, show any community specific information, the Content. | protected String | getChangedUniqueObjectComment(UniqueObject unique) | protected String | getClassName(Object obj) | protected String | getCommunityText(String prefix, Community community) | protected String | getPath() | protected String | getRemovedUniqueObjectComment(UniqueObject unique) | protected String | getRoleSchedule(Asset asset) | protected String | getTaskPreferences(Task task) | protected String | getTimeString(long time) Formats long millis time to Date Format String. | protected String | getTypeAndItemInfo(Asset asset) | protected String | getURL(UID uid, int which) Generate a link to the PlanView (/tasks) servlet
for full details on the objet. | public void | load() | protected int | nextEventNum() | protected void | setEvents(SortedSet events) Reset the stored event list -- used when we've resorted the list. | public void | setParameter(Object o) Only called if a plugin has parameters. | public void | setServletService(ServletService servletService) | protected void | setupSubscriptions() | protected String | showTargetAddresses(Relay.Source sourceRelay) | protected void | sortByUIDThenTime() Sort the events collection by UID and then time. | public void | unload() |
ADDED | final public static int ADDED(Code) | | |
ASSET | final public static int ASSET(Code) | | |
CHANGED | final public static int CHANGED(Code) | | |
DIRECT_OBJECT | final public static int DIRECT_OBJECT(Code) | | |
INITIAL_MAX_CHILD_TASKS | final protected int INITIAL_MAX_CHILD_TASKS(Code) | | |
INITIAL_MAX_ENTRIES | final protected int INITIAL_MAX_ENTRIES(Code) | | |
INITIAL_MAX_ROLE_SCHEDULE_ELEMENTS | final protected int INITIAL_MAX_ROLE_SCHEDULE_ELEMENTS(Code) | | |
PLAN_ELEMENT | final public static int PLAN_ELEMENT(Code) | | |
REMOVED | final public static int REMOVED(Code) | | |
TASK | final public static int TASK(Code) | | |
UNIQUE_OBJECT | final public static int UNIQUE_OBJECT(Code) | | |
events | protected SortedSet events(Code) | | The actual Blackboard history we collect
|
showChangeReport | boolean showChangeReport(Code) | | |
showDetails | boolean showDetails(Code) | | |
sortByUID | boolean sortByUID(Code) | | |
addEvent | protected void addEvent(EventInfo newEvent)(Code) | | Add a new event to the list
|
checkAssets | protected void checkAssets(long now)(Code) | | Add any Asset events to the Set
|
checkPlanElements | protected void checkPlanElements(long now)(Code) | | Add any PlanElement events to the Set
|
checkRelays | protected void checkRelays(long now)(Code) | | Add any Relay events
|
checkTasks | protected void checkTasks(long now)(Code) | | Check the Tasks subscription, adding any new events to the list
|
checkUniqueObjects | protected void checkUniqueObjects(long now)(Code) | | Add any added/changed/removed UniqueObjects
|
createServlet | protected Servlet createServlet()(Code) | | Get a new
HistoryWorker to be the Servlet
|
encodeHTML | protected String encodeHTML(String s)(Code) | | Encodes a string that may contain HTML syntax-significant
characters.
|
execute | public void execute()(Code) | | Whenever a BBoard item changes, it adds that event to the list of Events
(trimming the set if we reach the MAX size). Then when a user invokes
the servlet, the set of events is ready for quick display.
|
getAddedAssetComment | protected String getAddedAssetComment(Asset asset)(Code) | | Get the ChangedAssetComment
|
getAddedPEComment | protected String getAddedPEComment(PlanElement planElement)(Code) | | If it's an Allocation, show the Task Verb and the allocated Asset's Type
and ItemID, RoleSchedule.
For an Expansion, show the child tasks (up to the MAX).
For an AssetTransfer, show the moving Asset and destination.
For an Aggregation, show just the count of parent tasks.
For a Disposition, show whether it succeed or failed.
Also show any Annotation, Estimated Result, and Reported Result.
|
getAddedRelayComment | protected String getAddedRelayComment(Relay relay)(Code) | | For a Source: show the target addresses, any community content or request, and the
relay's Content.
For a Target, show any community info, the relay Source, and any HistoryServletFriendly content.
|
getAddedTaskComment | protected String getAddedTaskComment(Task task)(Code) | | description of an added Task shows the Verb, DirectObject, and Preferences.
|
getAddedUniqueObjectComment | protected String getAddedUniqueObjectComment(UniqueObject unique)(Code) | | For an Added unique object, print it's name, and any
HistoryServletFriendly content
|
getAspectValue | protected String getAspectValue(AspectValue avi)(Code) | | Get a String representation of this AspectValue
|
getAspectValues | protected String getAspectValues(AspectValue[] values, String prefix)(Code) | | Get an HTML table of these Aspect Values (id'd by the prefix)
|
getAspectValues2 | protected String getAspectValues2(AspectValue[] values)(Code) | | Get String representation of these Aspect Values
|
getChangedAssetComment | protected String getChangedAssetComment(Asset asset)(Code) | | Show the asset class, typeID, ItemID, if an Entity then any Roles, Relationships, RoleSchedule, and the HistoryServletFriendly content
|
getChangedRelayComment | protected String getChangedRelayComment(Relay relay)(Code) | | For a Source, show any community specific information, the Content.
For a Target, show any community specific information, and the response, and
any HistoryServletFriendly content.
|
getChangedUniqueObjectComment | protected String getChangedUniqueObjectComment(UniqueObject unique)(Code) | | Changed/Removed unique objects use the same comment as for Add
|
getClassName | protected String getClassName(Object obj)(Code) | | Get the non-Package name of the Class
|
getPath | protected String getPath()(Code) | | Load this servlet at "/history"
|
getRemovedUniqueObjectComment | protected String getRemovedUniqueObjectComment(UniqueObject unique)(Code) | | Changed/Removed unique objects use the same comment as for Add
|
getRoleSchedule | protected String getRoleSchedule(Asset asset)(Code) | | Print the RoleSchedule of the Asset if any, up to the
maxRoleScheduleElements
|
getTaskPreferences | protected String getTaskPreferences(Task task)(Code) | | Get a String HTML table of the Task's preferences
|
getTimeString | protected String getTimeString(long time)(Code) | | Formats long millis time to Date Format String.
|
getTypeAndItemInfo | protected String getTypeAndItemInfo(Asset asset)(Code) | | Get the type & item ID of an Asset -- to ID it in the display
|
getURL | protected String getURL(UID uid, int which)(Code) | | Generate a link to the PlanView (/tasks) servlet
for full details on the objet.
|
nextEventNum | protected int nextEventNum()(Code) | | Get the next number for a new Event
|
setEvents | protected void setEvents(SortedSet events)(Code) | | Reset the stored event list -- used when we've resorted the list.
|
setParameter | public void setParameter(Object o)(Code) | | Only called if a plugin has parameters.
We over-ride this to use the Arguments utility, since all our
arguments are NAME=VALUE format.
|
setServletService | public void setServletService(ServletService servletService)(Code) | | Get the ServletService via reflection
|
setupSubscriptions | protected void setupSubscriptions()(Code) | | |
showTargetAddresses | protected String showTargetAddresses(Relay.Source sourceRelay)(Code) | | Show the target(s) of a relay, including ABAs
|
sortByUIDThenTime | protected void sortByUIDThenTime()(Code) | | Sort the events collection by UID and then time. Then type, then meaning.
Updates the single events collection Set
|
unload | public void unload()(Code) | | |
|
|