Wednesday, March 4, 2009
The Aglet class is the key class in the Aglet API. This is the abstract class that the aglet developer uses as a base class when he or she creates customized aglets. The Aglet class defines methods for controlling its own life cycle, namely, methods for cloning, dispatching, deactivating, and disposing of itself. It also defines methods that are supposed to be overridden in its subclasses by the aglet programmer, and provides the necessary "hooks" to customize the behavior of the aglet. These methods are systematically invoked by the system when certain events take place in the life cycle of an aglet. Some of the methods in the Aglet class are described as follows. The dispatch method causes an aglet to move from the local host to the destination given as the argument. The deactivate method allows an aglet to be stored in secondary storage, and the clone method spawns a new instance of the aglet, which has the state of the original aglet. The Aglet class is also used to access the attributes associated with an aglet. The AgletInfo object, which can be obtained by getAgletInfo(), contains an aglet's built-in attributes, such as its creation time and code base, as well as its dynamic attributes, such as its arrival time and the address of its current context.