Results 1 to 5 of 5

Thread: Dependencies injection between different scope

  1. #1
    Join Date
    May 2005
    Location
    France: Toulouse
    Posts
    7

    Default Dependencies injection between different scope

    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

  2. #2
    Join Date
    May 2005
    Location
    France: Toulouse
    Posts
    7

    Default

    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)
    Code:
    	<bean name="/prestation" class="fr.mipih.demo.prestation.presentation.PrestationAction">
    		<property name="contextManager"><ref bean="prestationCtx" /></property>
    	</bean>
    On my presentationLayer.xml, i declare my context manager like this :

    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>
    Struts manage formBean instances and keep references on session scope.

    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)

    Code:
            Presentation layer            *   Application layer      *     Enterprise layer     *   persistence layer
       web/struts    *     common         *                          *                          *
                     *                    *                          *                          *
     +----------+    * &#40;?&#41;                *                          *                          *
     ! FormBean !---------------+         *                          *                          *
     +-------SF-+    *          |         *                          *                          *
          |          * +----------------+ *   +--------------------+ *   +-------------------+  *  +-----+
          |          * ! ContextManager !---->! ApplicationService !---->! EnterpriseService !---->! Dao !----> Database
          |          * +-------------SF-+ *   +-----------------SL-+ *   +----------------SL-+  *  +--SL-+
      +--------+     *          |         *                          *                          *
      ! Action !----------------+         *                          *                          *
      +-----SL-+     * &#40;?&#41;                *                          *                          *
                     *                    *                          *                          *
      
      SL&#58; Stateless
      SF&#58; Statefull
    Q: Where and how put my dependencies between Action or FormBean to ContextManager

  3. #3
    Join Date
    Dec 2008
    Location
    pakistan
    Posts
    1

    Default Dependencies injection between different scope

    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.

  4. #4
    Join Date
    Jan 2009
    Location
    usa
    Posts
    2

    Default Dependencies injection between different scope

    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,

  5. #5
    Join Date
    Jan 2009
    Location
    usa
    Posts
    2

    Default Dependencies injection between different scope

    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

Similar Threads

  1. Dependency Injection for empty domain objects
    By assaf in forum Architecture
    Replies: 5
    Last Post: Jan 5th, 2008, 10:23 AM
  2. Hibernate Long Session Per Flow?
    By akw in forum Web Flow
    Replies: 21
    Last Post: Dec 12th, 2005, 08:06 PM
  3. Replies: 4
    Last Post: Aug 26th, 2005, 01:35 PM
  4. could not satisfy dependencies
    By springuser in forum Container
    Replies: 4
    Last Post: Apr 26th, 2005, 01:15 PM
  5. Replies: 1
    Last Post: Apr 25th, 2005, 07:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •