Interface Egg

All Known Implementing Classes:

public interface Egg

The interface that must be implemented by each egg.

The interface contains methods that the JEgg framework uses to configure the egg before the first application message is delivered to the egg. The interface also declares the minimum message interface handle method that the egg must implement in order to participate in a JEgg-based application. A typical concrete egg implementation will implement additional handle methods, one for each distinct message type that it recognizes. All handle methods take only a single argument, the message.

A convenience base class, jegg.impl.EggBase, may be used instead of directly implementing the jegg.Egg interface.

Method Summary
 void handle(java.lang.Object message)
          The default message handler method.
 void init()
          Initialize this egg.
 void setContext(EggContext myContext)
          Set the application context for this egg.

Method Detail


public void setContext(EggContext myContext)
Set the application context for this egg. This method will be used by the JEgg framework to configure this egg with its application context. The application context provides the egg with access the JEgg framework for use in sending messages, retrieving the message port of the currently handled message, retrieving configuration properties, etc.

myContext - this eggs application context.


public void init()
          throws UnableToInitializeException
Initialize this egg. This method will be invoked by the JEgg framework before the first application message is delivered to the egg, but after all of this egg's dependency ports have been delivered to this egg. A dependency port is a message port belonging to another egg that this egg needs for use during the processing of messages (i.e. to send messages to the other egg). The application descriptor is used to describe to the JEgg framework which other eggs a this egg will need to send messages to. The ports of those eggs will be delivered to this egg before the init() method is invoked.

UnableToInitializeException - if this egg cannot complete its initialization.


public void handle(java.lang.Object message)
The default message handler method. If any message delivered to this egg has a concrete type for which no other handler method on this egg can be found, then the message will be delivered to this handler.

The implementation class should implement additional handler methods, one for each message type that recognizes.

message - a message sent to this egg.

Copyright © 2004 . All Rights Reserved.