Java Doc for ServletPlugin.java in  » Science » Cougaar12_4 » org » cougaar » core » plugin » 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.core.plugin 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.cougaar.core.plugin.ComponentPlugin
   org.cougaar.core.plugin.ServletPlugin

All known Subclasses:   org.cougaar.demo.mandelbrot.v3.FractalServlet,
ServletPlugin
abstract public class ServletPlugin extends ComponentPlugin (Code)
This plugin is a base class for servlets that either modify or subscribe to the blackboard.

If a servlet only requires blackboard queries and no subscriptions or add/change/remove modifications, then ComponentServlet is recommended.

If ServletPlugin.isTransactional is true then all servlet processing work is done single-threaded in the "execute()" method, where it can access subscriptions and modify the blackboard using the standard "blackboard.publish*" methods. org.cougaar.core.servlet.ServletPlugin.timeout=60000Default timeout for ServletPlugin requests, which are processedin the plugin's "execute()" thread.


Inner Class :final protected static class HttpJob


Constructor Summary
public  ServletPlugin()
    

Method Summary
protected  HttpServletcreateServlet()
     Create our servlet, which by default calls our doGet/doPost/doPost methods.

A subclass can override this method if it's designed to create a separate servlet.

protected  Stringdecode(String s)
    
protected  voiddoGet(HttpServletRequest req, HttpServletResponse resp)
    
protected  voiddoPost(HttpServletRequest req, HttpServletResponse resp)
    
protected  voiddoPut(HttpServletRequest req, HttpServletResponse resp)
    
protected  Stringencode(String s)
    
protected  voidexecute()
    
protected  StringgetEncodedAgentName()
    
protected  StringgetPath()
     Get the path for the Servlet's registration.
protected  booleanisTransactional()
     Return true (the default) if all servlet requests should run single-threaded in the "execute()" method, otherwise false if they should run in the servlet engine's threads (and possibly in parallel with other servlet requests and the "execute()" thread).

If a servlet requires a cross-transaction result, e.g.:

  1. publishAdd object X
  2. wait another plugin to react to object X, e.g.
public  voidload()
    
protected  voidnotSupported(HttpServletRequest req, HttpServletResponse resp)
    
protected  voidpublishAdd(Object o)
    
protected  voidpublishChange(Object o)
    
protected  voidpublishChange(Object o, Collection changes)
    
protected  voidpublishRemove(Object o)
    
protected  Collectionquery(UnaryPredicate pred)
    
protected  voidservice(HttpServletRequest req, HttpServletResponse resp)
    
protected  voidserviceLater(HttpServletRequest req, HttpServletResponse resp)
    
protected  voidsetupSubscriptions()
    
protected  Subscriptionsubscribe(UnaryPredicate pred)
    
public  voidunload()
    


Constructor Detail
ServletPlugin
public ServletPlugin()(Code)




Method Detail
createServlet
protected HttpServlet createServlet()(Code)
Create our servlet, which by default calls our doGet/doPost/doPost methods.

A subclass can override this method if it's designed to create a separate servlet. However, if ServletPlugin.isTransactional is true then it should use ServletPlugin.serviceLater to do all blackboard work in the "execute()" method instead of the servlet callback thread.

Even though we switch to the "execute()" thread, we must still block the servlet callback until we finish the work, otherwise the servlet engine will close our response stream.




decode
protected String decode(String s)(Code)
the UTF-8 decoded string



doGet
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException(Code)



doPost
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException(Code)



doPut
protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException(Code)



encode
protected String encode(String s)(Code)
the UTF-8 encoded string



execute
protected void execute()(Code)



getEncodedAgentName
protected String getEncodedAgentName()(Code)
Get the URL-encoded name of the local agent



getPath
protected String getPath()(Code)
Get the path for the Servlet's registration.

Typically the path is supplied by a "path=" plugin argument, but a subclass can hard-code the path by overriding this method.




isTransactional
protected boolean isTransactional()(Code)
Return true (the default) if all servlet requests should run single-threaded in the "execute()" method, otherwise false if they should run in the servlet engine's threads (and possibly in parallel with other servlet requests and the "execute()" thread).

If a servlet requires a cross-transaction result, e.g.:

  1. publishAdd object X
  2. wait another plugin to react to object X, e.g. via a "notify()" callback or published response
  3. finish the servlet call
then "isTransactional()" must return false.

Also, if a servlet has no subscriptions or private state, then it's slightly more efficient to have this method return false. This will allow requests to run in parallel.

In all other cases, this method should return true. This allows the "doGet(...)" method to access subscriptions and other internal state without a synchronization lock, since the "execute()" method is always single-threaded and runs in a blackboard transaction.




load
public void load()(Code)



notSupported
protected void notSupported(HttpServletRequest req, HttpServletResponse resp) throws IOException(Code)



publishAdd
protected void publishAdd(Object o)(Code)



publishChange
protected void publishChange(Object o)(Code)



publishChange
protected void publishChange(Object o, Collection changes)(Code)



publishRemove
protected void publishRemove(Object o)(Code)



query
protected Collection query(UnaryPredicate pred)(Code)



service
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException(Code)
Basic servlet methods



serviceLater
protected void serviceLater(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException(Code)



setupSubscriptions
protected void setupSubscriptions()(Code)



subscribe
protected Subscription subscribe(UnaryPredicate pred)(Code)



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.