Hi all,
I try to use IoC between Singleton and Session bean but i dont know how to proceed.
May i write my own BeanFactory for store bean in web session context ?
ps: i use Spring 1.2 and Struts
Hi all,
I try to use IoC between Singleton and Session bean but i dont know how to proceed.
May i write my own BeanFactory for store bean in web session context ?
ps: i use Spring 1.2 and Struts
Ok, i try to explain my problem.
I need to inject dependencies between different layer like this :
A/ persistence layer (dao)
B/ enterprise layer (dto -> dom + business validation )
C/ application layer ( business dom -> application dom if necessary + application validation + transaction )
D/ presentation layer ( context manager )
E/ web layer ( struts form bean and action )
layers A,B & C can be acceded by à remote presentation layer.
In my web layer (E) i use struts Action declared in action-servlet.xml descriptor including dependence on the presentation layer (D)
On my presentationLayer.xml, i declare my context manager like this :Code:<bean name="/prestation" class="fr.mipih.demo.prestation.presentation.PrestationAction"> <property name="contextManager"><ref bean="prestationCtx" /></property> </bean>
Struts manage formBean instances and keep references on session scope.Code:<bean id="prestationCtx" class="fr.mipih.demo.prestation.presentation.PrestationGC"> <constructor-arg> <ref bean="prestationService" /> </constructor-arg> <property name="managedBean"> <value>fr.mipih.demo.prestation.data.Prestation</value> </property> </bean>
So..
My ContextManager is a layer adapter between application layer and presentation layer. This component keep reference on application layer ans wrap all "standard" access on this application layer.
It also keep reference on all result from application service ( collections get from finder for example ) so, il must be statefull and stored in session web context.
My question is how can i inject dependence between statefull and stateless bean in my architecture ?
I would not reference my ContextMagager in my FormBean but i need the same association and life-cycle.
(sorry for my poor english)
Q: Where and how put my dependencies between Action or FormBean to ContextManagerCode:Presentation layer * Application layer * Enterprise layer * persistence layer web/struts * common * * * * * * * +----------+ * (?) * * * ! FormBean !---------------+ * * * +-------SF-+ * | * * * | * +----------------+ * +--------------------+ * +-------------------+ * +-----+ | * ! ContextManager !---->! ApplicationService !---->! EnterpriseService !---->! Dao !----> Database | * +-------------SF-+ * +-----------------SL-+ * +----------------SL-+ * +--SL-+ +--------+ * | * * * ! Action !----------------+ * * * +-----SL-+ * (?) * * * * * * * SL: Stateless SF: Statefull
A module is a top-level class, that is, a class defined directly within a namespace. Newspeak classes can nest arbitrarily, so a module can contain an entire class library or framework, which can in turn be subdivided into subsystems to any depth. Nested classes can freely access the lexical scope of their enclosing class.Modules, like all classes, are reified as objects that support constructor methods. Recall that in Newspeak, a constructor invocation is indistinguishable from an ordinary method invocation. Objects are constructed by sending messages to (invoking virtual methods on) another object. That object may or may not be a class; it makes no difference. Hence all the usual abstraction mechanisms in the language apply to classes - in particular, parameterization.
I can’t construct the presenter without giving it both the view it is working with and the service layer it makes requests of. This poses a problem for me because the code-behind for the Web page needs to instantiate the presenter that will work with it (there are other solutions to this that are outside the scope of this article):This would be fine if the presenter only had a dependency on the view. Unfortunately, it does not. The presenter has to have both of its dependencies satisfied at the time of creation. A quick way to solve this problem would be to add a reference from the Web project to the service layer project,
I can’t construct the presenter without giving it both the view it is working with and the service layer it makes requests of. This poses a problem for me because the code-behind for the Web page needs to instantiate the presenter that will work with it (there are other solutions to this that are outside the scope of this article):This would be fine if the presenter only had a dependency on the view. Unfortunately, it does not. The presenter has to have both of its dependencies satisfied at the time of creation. A quick way to solve this problem would be to add a reference from the Web project to the service layer project,
Internet Casino