Re: Event Flow?
"Diez B. Roggisch" <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.barracuda.general |
|---|---|
| Message-ID | <[email protected]> |
Hi Kirk,
> //Read parms fromt request..
> ....bla code here
>
> if ((param1 == null) && (param2 == null)) {
> newEvent = new DefaultValidationEvent();
>
> } else if ((param1 != null) && (param2 == null)) {
> newEvent = new ValidateAndPopulateXYZ();
>
> } else if ((param1 != null) && (param2 != null)) {
> newEvent = new ValidateAndPopulateBlaBla();
> }
>
> if (newEvent != null) {
> newEvent.setSource(event);
> DispatchQueue queue = context.getQueue();
> queue.addEvent(newEvent);
> }
Hmm. two thoughts:
1) Why don't you just call the code instead of loose-coupling it? It
might be less beautiful. But "perverting" the event system isn't
beautiful either. The ideas you had would complicate things a great
deal, I believe.
2) What about splitting your functionality - SomeEvent, and
SomeEventWorker. So SomeEvent-handler simply adds SomeEventWorker to the
queue. By the time that has been done, the ValidationAndPopulateEvent is
already in the queue and will be processed first.
Diez