Results 1 to 4 of 4

Thread: command pattern the easy way

  1. #1

    Default command pattern the easy way

    Please suggest the most harmonious way for me to implement a command pattern in spring.

    I want my tests/gui's to create a command. This could be on another machine, or not. Then I want the command to be instantiated on a server and receive the "execute()" command. This command may need to hae access to SpringManaged resources.

    If I define the command as a Spring managed bean and have it list its dependencies then if those are not available on the client (Say the web tier with no access to the services) then that is problematic.

    Please either advice of an approach, or better yet point me to an existing framework that has addressed these issues.

    Thanks, and please forgive my beginning Spring knowledge.

    -Bruce

  2. #2
    Join Date
    Nov 2004
    Location
    Hilversum - The Netherlands
    Posts
    1,054

    Default

    You could have a look at this topic:

    http://forum.springframework.org/showthread.php?t=18083

    Here the strategy is explained, but the command and the strategy aren`t that different.

    And to answer your question about access: well.. in some cases you need to access the applicationcontext and retrieve beans from it. You can retrieve the application context from the Servlet context (Spring places it there when the application context is loaded).
    Last edited by robyn; May 14th, 2006 at 07:20 PM.

  3. #3
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    6

    Default

    No idea will this be too late (As I only started using spring pass few months), I posted two article on how to deliver command design pattern using Spring base on "Head First Design Patterns" example. Do check it out from my blog at
    http://coolboykl.blogspot.com, cheers

  4. #4

    Default

    Quote Originally Posted by Bruce Gordon View Post
    Please suggest the most harmonious way for me to implement a command pattern in spring.

    I want my tests/gui's to create a command. This could be on another machine, or not. Then I want the command to be instantiated on a server and receive the "execute()" command. This command may need to hae access to SpringManaged resources.

    If I define the command as a Spring managed bean and have it list its dependencies then if those are not available on the client (Say the web tier with no access to the services) then that is problematic.

    Please either advice of an approach, or better yet point me to an existing framework that has addressed these issues.

    Thanks, and please forgive my beginning Spring knowledge.

    -Bruce
    Controllers and handlers in spring MVC are built on top of command pattern.

Similar Threads

  1. Replies: 7
    Last Post: Nov 16th, 2006, 05:28 PM
  2. Replies: 4
    Last Post: Sep 29th, 2005, 04:13 PM
  3. Easy way to achieve "finally"-like behaviour for f
    By Thomas Dudziak in forum Web Flow
    Replies: 14
    Last Post: Jul 20th, 2005, 08:24 AM
  4. Channel and message transformation question
    By Alarmnummer in forum Architecture
    Replies: 12
    Last Post: May 11th, 2005, 05:06 PM
  5. Replies: 2
    Last Post: Mar 24th, 2005, 02:59 AM

Posting Permissions

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