| Class | Description |
|---|---|
| Agent | This abstract implementation of the AgentInterface provides the base class for all components in the Neokernel. There is built-in support for routing agent output to Neokernel output and error streams, and masking output using hide_println, hide_debug, and hide_warningProps. This implementation of AgentInterface recognizes the following Props entries:
|
| AgentController | An implementation of AgentControllerInterface that is created by the neokernel to control the agents it creates. |
| AgentReplicator | Used to create multiple instances of the same kind of Agent.
|
| AgentRequest | This class is used to pass information to and from agents that implement the RequestAgentInterface. This information is stored in the AgentRequest's Props. An HTTPAgentRequest (which extends AgentRequest) is used when handling requests from the WebServer. |
| AgentStateException | This exception is thrown by AgentController when the requested operation is illegal from its Agent's current state. |
| NK |
This class is contains the public static void main() method for starting the Neokernel from a command line or other application bootstrapping mechanism. It supports the following command line parameters: [-show_println] [-show_debug] [-show_warning] [-dont_start_agents] [-dont_start_webserver] [-startup_dir <dir>] [-only_load_from_xml] [-startup_file <.xml startup file>|<classname>]...
|
| RequestAgent |
A RequestAgent is a ServiceAgent that implements RequestAgentInterface. Create agents that extend this class to inherit the basic functionality for registering them with the ServiceManager at startup and making it available to other agents as a request based service. RequestAgents are commonly used in conjunction with the WebServer and SecureWebServer classes to respond to HTTP requests. Here's an example of a simple RequestAgent written in Visual Basic: Imports com.neokernel.nk
Imports com.neokernel.util
Public Class SimpleVBPage
Inherits RequestAgent
Overrides Sub handleRequest(ByVal Request As AgentRequest)
Dim title, body As String
body = getString("body")
Request.println(body)
End Sub
Overrides Sub initProps()
setDefault("service_name", "/simple.agent")
setDefault("body", "This is output from the SimplePage agent!")
End Sub
End Class
If a browser requests http://localhost/simple.agent from a server that has started the above SimpleAgent, the browser will display the text This is output from the SimplePage agent! Here is the exact same agent written using C#: using System;
using com.neokernel.nk;
public class SimplePage : RequestAgent
{
public override void initProps()
{
setDefault("service_name", "/simple.agent");
setDefault("body", "This is output from the SimplePage agent!");
}
public override void handleRequest(HTTPAgentRequest request)
{
String body = getString("body");
request.println( body );
}
}
|
| ScheduledAgent |
Abstract implementation of a scheduled agent, or an ISchedulable agent that wakes up periodically at the dates and times specified by it's schedule prop. This agent implements ISchedulable; it creates and uses a Schedule using the value of it's schedule prop to initialize the Schedule. The schedule prop must be a valid Schedule string, for instance: starting 10/31/2003 every 2h until 10/20/2004 starting 10/31/2003 between 10:00:00 and 11:00:00 every 20s until 12/01/2003 between 0:0:0 and 23:59:59 every 5mSceduledAgents all have the following prop:
|
| Scheduler | This is a ServiceAgent that implements the IScheduler interface. It maintains a pool of threads that periodically wake up any ISchedulables that have been scheduled. Look at ISchedule and Schedule to learn about supported scheduling features. |
| ServiceAgent | Abstract agent that automatically registers with the ServiceManager using the service name specified in it's service_name prop.
|
| ServiceManager | The default implementation of ServiceManagerInterface. Agents use the ServiceManager to obtain references to other Agents and to register so that other Agents can access them. Agents register with the ServiceManager using a String to identify themselves; other Agents use that string to request a reference from the ServiceManager. |
| Interface | Description |
|---|---|
| AgentControllerInterface | An instance if this interface is created and managed by an implementation of NeokernelInterface as a proxy to the AgentInterface it represents. |
| AgentInterface | A standard interface for Agents. |
| NeokernelInterface | A standard neokernel interface. |
| RequestAgentInterface | A standard interface for inter-agent communication. Agents that implement this interface are "triggered" when other agents pass them AgentRequest and HTTPAgentRequest objects. |
| ServiceManagerInterface | A simple interface for registering, retrieving, and unregistering service implementations, typically ServiceAgents. The ServiceManager provides the reference implementation of this interface. |