commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig McClanahan <craig...@apache.org>
Subject Re: [chain] how to delegate to a command?
Date Tue, 13 Jul 2004 02:28:00 GMT
Vic Cekvenich wrote:

> thanks.
>
> I am trying to do dispatching  with CoR (for a SoA/RiA with JDNC UI 
> using Hessian).

I'm somewhat familiar with JDNC, but not with Hessian.  I'll do some 
reading up on that.

> And what I have works.
> So my use case is that one of the properties in a context is what 
> "DAO" class to go to. ( I could use reflection but seems CoR would work).
>
> So if my context is ("_dao", "MailDAOCmd") or ("_doa", "UserDAOCmd"), 
> 1st I call the DispatchCommand that looks at the parm. In order to 
> "send" it to the right DAO to invoke, I need a handle to the Catalog 
> (becuase that is where the String names of the CMD are).


>
> Then based on it, it calls the right DAO_CMD to process the request.
> Just a dispatcher I guess.
>

Doesn't doing things that way tie the DAO object to the commons-chain 
API, perhaps unnecessarily?  I would have thought the DAO was an 
abstraction of some persistence mechanism, and that you'd consider the 
issues of *how* persistence is implemented, and *what* operations to 
perform, would be orthogonal.  In other words, I would tend to store the 
DAO instance as a context attribute under a well-known attribute name 
(through some discovery mechanism -- perhaps that is the part of the 
system you're really talking about in the above example?), and then 
execute a Chain that performs the correct business logic in the correct 
order, no matter which DAO is actually used.  Would that work?

By the way, use of a Catalog is totally optional -- there's no 
requirement (from Commons Chain) that a Command or Chain be stored in a 
Catalog.  That's a convenience if you want to look them up, but nothing 
stops you from creating Command instances on the fly in some other 
manner, and assembling a Chain yourself.

> tia,
>
> .V
>
Craig

> Craig McClanahan wrote:
>
>>
>> Vic, it would be interesting to explore in more detail the use case 
>> you are thinking about, in order to determine whether Chain of 
>> Responsibility is the right pattern or not.  What did you have in mind?
>>
>> Craig
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message