Re: [T5]Global object?
On 7/11/07, Howard Lewis Ship <[EMAIL PROTECTED]> wrote: Side note: and that's why we need T5 IoC and not Guice or Spring. Those don't have a concept similar to Tapestry's service configuration / contribution system. Actually i really don't understand why they have not such a feature... -- Massimo http://meridio.blogspot.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T5]Global object?
Hi, So I created a singleton class with static field, created at the first session since the last server restart, but I didn't understand why I should use the ASO notation also. I don't need, I think, to store the object in the session, would be redundant, wouldn't be? The object is already available at the page level since I created services to get and update info from this object. Mainly, my UserList store a list of User objects with live fields online/offline, lastIP, lastTimeConnected I don't want to store in my DB (maybe only one of them, if really needed). When the server will restart, new sessions will be created and this creation will update the user status - something like a shared contact list. M. 2007/7/11, Howard Lewis Ship <[EMAIL PROTECTED]>: You can use the @ApplicationState annotation on a field to mark it as an application-wide state object. It will be stored in the HttpSession. Most of the infrastructure for storing such an object in the ServletContext is available; see the ApplicationStatePersistenceStrategySource service. What's missing is to define a "context" application state persistence strategy, contribute it to the service, and contribute a ApplicationStateContribution to the ApplicationStateManager service to defne that your ASO belongs in the context, not the (default) session. Again, these are things that will eventually be cooked right into Tapestry (hint: add a JIRA issue) but in the meantime, can be added on an ad-hoc basis. Now that's what I call Dependency Injection! Side note: and that's why we need T5 IoC and not Guice or Spring. Those don't have a concept similar to Tapestry's service configuration / contribution system. On 7/11/07, Michael Bernagou <[EMAIL PROTECTED]> wrote: > Hi, > > I search into the mailing list and didn't find how to declare an object such > as an ArrayList at the context level. > ASO is for session and @Persist for requests, but what about the > Application/Context level? > > My site needs to maintains a list of users with their status without having > to reload it from the database at each new session created. > > Thanks > > M. > -- Howard M. Lewis Ship TWD Consulting, Inc. Independent J2EE / Open-Source Java Consultant Creator and PMC Chair, Apache Tapestry Creator, Apache HiveMind Professional Tapestry training, mentoring, support and project work. http://howardlewisship.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Michael Bernagou Java Developper
Re: [T5]Global object?
You can use the @ApplicationState annotation on a field to mark it as an application-wide state object. It will be stored in the HttpSession. Most of the infrastructure for storing such an object in the ServletContext is available; see the ApplicationStatePersistenceStrategySource service. What's missing is to define a "context" application state persistence strategy, contribute it to the service, and contribute a ApplicationStateContribution to the ApplicationStateManager service to defne that your ASO belongs in the context, not the (default) session. Again, these are things that will eventually be cooked right into Tapestry (hint: add a JIRA issue) but in the meantime, can be added on an ad-hoc basis. Now that's what I call Dependency Injection! Side note: and that's why we need T5 IoC and not Guice or Spring. Those don't have a concept similar to Tapestry's service configuration / contribution system. On 7/11/07, Michael Bernagou <[EMAIL PROTECTED]> wrote: Hi, I search into the mailing list and didn't find how to declare an object such as an ArrayList at the context level. ASO is for session and @Persist for requests, but what about the Application/Context level? My site needs to maintains a list of users with their status without having to reload it from the database at each new session created. Thanks M. -- Howard M. Lewis Ship TWD Consulting, Inc. Independent J2EE / Open-Source Java Consultant Creator and PMC Chair, Apache Tapestry Creator, Apache HiveMind Professional Tapestry training, mentoring, support and project work. http://howardlewisship.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T5]Global object?
Try using a public class with static fields and methods. This is best for things that can be recreated programmatically, like a hardcoded list of months. Just remember that changes you make will disappear when you restart your app container, unless you migrate the data to a more persistant storage, like a DB or file. On 7/11/07, Michael Bernagou <[EMAIL PROTECTED]> wrote: Hi, I search into the mailing list and didn't find how to declare an object such as an ArrayList at the context level. ASO is for session and @Persist for requests, but what about the Application/Context level? My site needs to maintains a list of users with their status without having to reload it from the database at each new session created. Thanks M. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[T5]Global object?
Hi, I search into the mailing list and didn't find how to declare an object such as an ArrayList at the context level. ASO is for session and @Persist for requests, but what about the Application/Context level? My site needs to maintains a list of users with their status without having to reload it from the database at each new session created. Thanks M.