Thanks. The Hivemind article was really helpful. The property injection into an ASO thing looks as though it oly happens when the ASO is created, not on every request, so I can't use it, but it was helpful knowledge, nonetheless.
--sam On 7/16/06, Shing Hing Man <[EMAIL PROTECTED]> wrote:
There is a how-to in the Tapestry wiki which shows how to inject a property into an application state object (ASO). It does it by providing a custom StateObjectFactory which creates the ASO. http://wiki.apache.org/tapestry/InjectPropertyIntoASO If you have not seem James Carmen's article on HiveMind, you might like to check it out. http://www.theserverside.com/tt/articles/article.tss?l=HivemindBuzz Shing --- Sam Gendler <[EMAIL PROTECTED]> wrote: > I have a session state object which stores some > info, and I'd love to > put some logic in the object, too. However, the > logic requires access > to my business service objects. Is there any way to > inject the > service objects into the session state object on > every request? > > Or perhaps the following is better: > > if I create a logic object which requires the > session state object, > and inject that logic object into every page, how > would I go about > injecting the session state object into it before it > gets injected > into the page, and how would I inject my service > objects into it as > well. I mostly use spring for IoC, so I don't know > my way around > hivemind. > > Basically, my session state object stores primary > keys, and I want to > load the actual entities automatically. So if I > build > SessionObjectLoader as follows: > > public class SessionObjectLoader { > @InjectState("selectedObjects") > public SelectedObjects getSelectedObjects(); > > @InjectObject("spring: objectService") > public ObjectService getSelectedObjectService(); > > public MyEntity getEntity() { > return > getSelectedObjectService().loadEntity(getSelectedObjects.getEntityId()); > } > } > > I want those annotations to function (or have the > equivalent > functionality performed by hivemind via > hivemind.xml. I don't require > annotations, as such.) > > then I want hivemind to inject a new instance (i'd > like to know the > syntax for both a singleton and a new instance, > actually) of a > SessionObjectLoader into every page via an > annotation - presumably > @InjectObject() > > Thanks > > --sam > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > Home page : http://uk.geocities.com/matmsh/index.html ___________________________________________________________ All new Yahoo! Mail "The new Interface is stunning in its simplicity and ease of use." - PC Magazine http://uk.docs.yahoo.com/nowyoucan.html --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]