Global concept
"Malcolm Edgar" <[email protected]> Mon, 30 Dec 2002 18:59:29 +0800
| Newsgroups | gmane.comp.java.tapestry.contrib |
|---|---|
| Message-ID | <[email protected]> |
After Howards email about Visit object names including Global, I started thinking it would be really good to have a shared global object in Tapestry. I want to kick off a discussion before putting in a Feature Request. Regards Malcolm Global ====== Aim --- Provide a shared global object that can be used for globally accessed data or utility methods. Currently it is recommended that the SimpleEngine be subclassed to provide a point to hang shared data off, or access global data via the ServletContext accessed from the IRequestCycle. Conceptually it simpler to have a global object available throughout the framework. Design ------ A global bean object modelled on the access style of the Visit object. The global object would have an accessor method added to IPage interface: public Object getGlobal(); This object would be instantiated via a no args condtructor, with the class name specified in the Application.specification as is done with the visit object. This object should follow a singleton style design pattern, so their is only ever one instance available. This object should be stored in the ServletContext under the key 'net.sf.tapestry.global' so that it can potentially be shared with other Servlet components. Scope ----- Global object: shared application data Visit object: user specific data Persistent page properties: user page specific data Example Usage ------------- Application properties Application constants Cached data Connection DataSources _________________________________________________________________ MSN 8 with e-mail virus protection service: 3 months FREE*. http://join.msn.com/?page=features/virus&xAPID=42&PS=47575&PI=7324&DI=7474&SU= http://www.hotmail.msn.com/cgi-bin/getmsg&HL=1216hotmailtaglines_eliminateviruses_3mf ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf