Java Doc for HistoryServlet.java in  » Science » Cougaar12_4 » org » cougaar » pizza » servlet » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Science » Cougaar12_4 » org.cougaar.pizza.servlet 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


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

Field Summary
final public static  intADDED
    
final public static  intASSET
    
final public static  intCHANGED
    
final public static  intDIRECT_OBJECT
    
final protected  intINITIAL_MAX_CHILD_TASKS
    
final protected  intINITIAL_MAX_ENTRIES
    
final protected  intINITIAL_MAX_ROLE_SCHEDULE_ELEMENTS
    
final public static  intPLAN_ELEMENT
    
final public static  intREMOVED
    
final public static  intTASK
    
final public static  intUNIQUE_OBJECT
    
protected  StringencAgentName
    
protected  SortedSetevents
    
protected static  SimpleDateFormatformat
    
protected  MessageAddresslocalAgent
    
protected  LoggingServicelogger
    
 booleanshowChangeReport
    
 booleanshowDetails
    
 booleansortByUID
    


Method Summary
protected  voidaddEvent(EventInfo newEvent)
    
protected  voidcheckAssets(long now)
    
protected  voidcheckPlanElements(long now)
    
protected  voidcheckRelays(long now)
    
protected  voidcheckTasks(long now)
    
protected  voidcheckUniqueObjects(long now)
    
protected  ServletcreateServlet()
    
protected  Stringencode(String s)
    
public  StringencodeAgentName(String name)
    
protected  StringencodeHTML(String s)
     Encodes a string that may contain HTML syntax-significant characters.
public  voidexecute()
     Whenever a BBoard item changes, it adds that event to the list of Events (trimming the set if we reach the MAX size).
protected  StringgetAddedAssetComment(Asset asset)
    
protected  StringgetAddedPEComment(PlanElement planElement)
     If it's an Allocation, show the Task Verb and the allocated Asset's Type and ItemID, RoleSchedule.
protected  StringgetAddedRelayComment(Relay relay)
     For a Source: show the target addresses, any community content or request, and the relay's Content.
protected  StringgetAddedTaskComment(Task task)
     description of an added Task shows the Verb, DirectObject, and Preferences.
protected  StringgetAddedUniqueObjectComment(UniqueObject unique)
    
protected  StringgetAspectValue(AspectValue avi)
    
protected  StringgetAspectValues(AspectValue[] values, String prefix)
    
protected  StringgetAspectValues2(AspectValue[] values)
    
protected  StringgetChangedAssetComment(Asset asset)
    
protected  StringgetChangedPEComment(PlanElement planElement)
    
protected  StringgetChangedRelayComment(Relay relay)
     For a Source, show any community specific information, the Content.
protected  StringgetChangedUniqueObjectComment(UniqueObject unique)
    
protected  StringgetClassName(Object obj)
    
protected  StringgetCommunityText(String prefix, Community community)
    
protected  StringgetPath()
    
protected  StringgetRemovedUniqueObjectComment(UniqueObject unique)
    
protected  StringgetRoleSchedule(Asset asset)
    
protected  StringgetTaskPreferences(Task task)
    
protected  StringgetTimeString(long time)
     Formats long millis time to Date Format String.
protected  StringgetTypeAndItemInfo(Asset asset)
    
protected  StringgetURL(UID uid, int which)
     Generate a link to the PlanView (/tasks) servlet for full details on the objet.
public  voidload()
    
protected  intnextEventNum()
    
protected  voidsetEvents(SortedSet events)
     Reset the stored event list -- used when we've resorted the list.
public  voidsetParameter(Object o)
     Only called if a plugin has parameters.
public  voidsetServletService(ServletService servletService)
    
protected  voidsetupSubscriptions()
    
protected  StringshowTargetAddresses(Relay.Source sourceRelay)
    
protected  voidsortByUIDThenTime()
     Sort the events collection by UID and then time.
public  voidunload()
    

Field Detail
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)



encAgentName
protected String encAgentName(Code)



events
protected SortedSet events(Code)
The actual Blackboard history we collect



format
protected static SimpleDateFormat format(Code)



localAgent
protected MessageAddress localAgent(Code)



logger
protected LoggingService logger(Code)



showChangeReport
boolean showChangeReport(Code)



showDetails
boolean showDetails(Code)



sortByUID
boolean sortByUID(Code)





Method Detail
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



encode
protected String encode(String s)(Code)



encodeAgentName
public String encodeAgentName(String name)(Code)



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



getChangedPEComment
protected String getChangedPEComment(PlanElement planElement)(Code)
Show the results on the PE



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



getCommunityText
protected String getCommunityText(String prefix, Community community)(Code)
Describe this Community by name, entities



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.



load
public void load()(Code)



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)



Methods inherited from org.cougaar.core.plugin.ComponentPlugin
abstract protected void execute()(Code)(Java Doc)
protected ConfigFinder getConfigFinder()(Code)(Java Doc)
abstract protected void setupSubscriptions()(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.