[Embedlets-developer] Re: General event mechanism
Status: Alpha
Brought to you by:
tkosan
|
From: Ted K. <tk...@ya...> - 2003-01-13 21:15:46
|
Andrzej,
>Where is the info/discussions on these interfaces? I
wanted to review that
before I post some thoughts to the Embedlet list...
Well, after I realized that people were probably somewhat
busy getting into the new year I posted the 'Embedlet
Challenge' idea so that I could start exploring Embedlets
from the perspective of the wiring tool. I think that the
discussion about the interfaces we are looking for will
probably start right now.
I have been using the Elevator challenge to explore how
various interface ideas play inside of a graphical wiring
tool mockup that I threw together (for now I am just
focusing on the event mechanism). Over the weekend I came
to the conclusion that the SignalSender and SignalReceiver
interfaces would need to be made more general.
I looked through the Embedlet traffic we generated on the
JStamp list and actually I found a post or two from you
that talked about a very general Event mechanism. At that
time I did not have a good feel for why a general event
mechanism was superior to a more tailored Event mechanism
(like what is present in AWT) but after playing with the
wiring tool mockup for the past couple of weeks I think I
understand this better now.
So, here is what the SignalSender/SenderReceiver event idea
evolved into:
public interface EventSender
{
add(type of operation)Receiver(EventReceiver er);
remove(type of operation)Receiver(EventReceiver er);
EventReceiver[] get(type of operation)Receivers(); //get
the receivers for a specific type.
EventReceiver[] getAllReceivers(); //get a list of all
receivers
set(type of operation)Properties //Temporal
properties, etc.
get(type of operation)Properties
}
public interface EventReceiver //All Embedlets implement
this interface.
{
receiveEmbedletEvent(EmbedletEvent ee);
}
For the Elevator Embedlet the following EventReceiver
registration methods might be present:
addFloorReceiver(EmbedletReceiver er); //For receiving
Floor events like 'SetDirectionLights' and
'SetCurrentFloorDisplay'.
addShaftReceiver(EmbedletReciever er); //For receiving
Shaft events like 'MoveElevator'.
The main way that a general event mechanism seems to differ
from a more specific event mechanism like AWT's is that the
type of 'Listener' passed into an AWT addXXXListener method
is Listener type specific while the 'Listener' (Receiver)
in a more general mechanism uses a single type of listener
(in this case org.embedlet.EvenReceiver).
It also appears to me that, in a general event system, the
type of the Event is used to indicate what to do with the
event. For example, if all Embedlet events inherit from
EmbedletEvent then the Elevator Embedlet can send
FloorEvents through the general event mechanism to
controllers that are responsible for running each floor and
ShaftEvents to the controller's that are responsible for
running each elevator shaft, etc.
Different EmbedletEvent types are created to handle all
event needs.
Are these the kind of ideas you were referring to when you
talked about a 'general event mechanism'?
Ted
--- Andrzej Jan Taramina <an...@ch...> wrote:
> Ted:
>
> > So far the 6 interfaces I started with have been
> reduced to
> > the following 2:
> >
> > SignalSender and SignalReceiver
>
> Where is the info/discussions on these interfaces? I
> wanted to review that
> before I post some thoughts to the Embedlet list.....
>
>
> Andrzej Jan Taramina
> Chaeron Corporation: Enterprise System Solutions
> http://www.chaeron.com
>
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
|