Freddy said: > In fact, theoretically, you *could* implement an interceptor that does > nothing and implements ConfigurableComponent so that your initializing > code will be executed by Stripes. But surely we don't want to > encourage such a practice. Thus the suggestion of a simple initializing > interface that extends ConfigurableComponent and is autodiscovered by > Stripes, for the purpose of having a place to put initializing code.
Yeah, abusing the Interceptor interface for the pick-up did cross my mind during this exercise, but a do-nothing interceptor really feels like a hack. I like Freddy's StartUpComponent (working title) extends ConfigurableComponent idea. It seems to subscribe to the "just drop it in the extensions package" philosophy, and it's one less thing in web.xml to boot. This is not to discount Oscar's note on an Interceptor for iBATIS transactional support. I'll look more closely at this idea, but it wouldn't address other applications of StartUpComponent for things like kicking off a small, in-memory Lucene index. I suppose the pick-up policy would be to load alphabetically by implementing class name, although I'd see myself defining only one implementation of StartUpComponent and invoking any sub-systems within to guarantee ordering (i.e. iBATIS, then Lucene since I'm indexing DB data). In the meantime, my ServletContextListener is working like a charm. Thanks again! Ted p.s. Again, Freddy, awesome job on the book. I let a very talented colleague borrow it. He read three chapters, then gave it back because he decided he had to have his own copy. I can't think of a bigger compliment than that! 2009/5/21 Freddy Daoud <[email protected]>: >> Especially if you also want to explicitly tell iBATIS how to handle >> transactions, it's a good idea to create a class that implements both >> Interceptor and ConfigurableComponent: the latter to initialize, and the >> former to handle the transactions. > > I agree. But if you need interceptor functionality, your problem is > solved: you put the initializing code in ConfigurableComponent's init > method and implement your interceptor, all in one class. > > In fact, theoretically, you *could* implement an interceptor that does > nothing and implements ConfigurableComponent so that your initializing > code will be executed by Stripes. But surely we don't want to > encourage such a practice. Thus the suggestion of a simple initializing > interface that extends ConfigurableComponent and is autodiscovered by > Stripes, for the purpose of having a place to put initializing code. > > Cheers, > Freddy > > ------------------------------------------------------------------------------ > Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT > is a gathering of tech-side developers & brand creativity professionals. Meet > the minds behind Google Creative Lab, Visual Complexity, Processing, & > iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian > Group, R/GA, & Big Spaceship. http://www.creativitycat.com > _______________________________________________ > Stripes-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/stripes-users > ------------------------------------------------------------------------------ Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers & brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, & iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian Group, R/GA, & Big Spaceship. http://www.creativitycat.com _______________________________________________ Stripes-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/stripes-users
