Naplet system is centered around two basic concepts: naplet and naplet server. A naplet is an active object that behaves based on the current state of its attributes and in response to the change of its running environment. The primary attributes of a naplet include a system-wide unique identifier, an itinerary, and an NapletState object. The naplet identifier is in the form of creator:sequence.version. For example, email@example.com refers to the naplet that created by user "czxu" at server "mencius". Its reference number is 253. Cloned naplets are ditinguished by their versions. Naplets have their defining trait the ability to travel from server to server. The itinerary specifies a way the servers to be visited. The naplet system provides a structural navigation mechanism so that users can construct a sequence, parallel, alternative, or a composite itinerary easily. For example, SEQ(s1, s2, PAR(s3, s4)) represents a sequence of servers s1 and s2, followed by a parallel itinerary of s3 and s4.
The NapletState object keeps problem-specific intermediate results of the naplet. For example, a naplet for workload information collection records the collected workload in its NapletState object.To protect the NapletState object from unauthorized access by servers, we distinguish the object in three protective types: private, protected, and public. Private state refers to the object that private to naplet only, public state refers to the one that is accessible to any servers; protected state is the information accessible to specific servers.
Each naplet undergoes a series of stages, from creation through destroy. The behavior of a naplet is defined by methods onStart(), onStop(), onSuspend(), onResume(), and onDestroy(). They are performed in different stages of the life cycle. The naplet behavior can also be controled by defining a method onInterrupt(). A naplet on the route can be retreated or terminated via this generic method.
NapletServer is a dock of naplets. It provides a protected running context for each alien naplet. The context contains references to message handlers for inter-agent communication and dispatch handlers for naplet migration. It also contains handlers to local application services. We distiguish the serivces in two classes: non-priviledged and priviledged. The former refers to services that can be invoked by alien naplets directly without special permission grants. The priviledged services must be invoked by servers and they cann't be invoked by naplets. The naplet server provides channels for alien naplets to pass arguments to and get results from priviledged services.
Communication happens between naplets who know each other. Each naplet maintains an address book which records the IDs of accessible naplets. Messages can be addressed to NapletId. The message handler will check with a Naplet Directory, if exists, to locate the naplet and forward the message to the destination. If no NapletDirectory exists, the message handler will send the message to the server recorded in address book. The naplet server maintains a mailbox for each long-lived naplet for message passing.