Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## drm.agentbase
Interface IBase

All Known Implementing Classes:
  Base, Base.Firewall

public interface IBase

This is the functionality the base offers to its agents.

Method Summary
`void` | `destroyAgent(java.lang.String name)` Destroys an agent with all necessary clean up.
`IRequest` | `dispatchAgent(java.lang.String name, Address destination)` Dispatches an agent with all necessary clean up.
`IRequest` | `fireMessage(Message m)` Fires the given message.
`java.util.Set` | `getNames()` Gets the names of all agents on this base.
`java.lang.String` | `getProperty(java.lang.String prop)` Retuns a base property.
`boolean` | `isOnline()` Returns the online status of the base.
`IRequest` | `launch(java.lang.String method, IAgent agent, java.lang.Object parameter)` Launches an agent to a specified destination.

Method Detail

### getProperty

    public java.lang.String getProperty(java.lang.String prop)

  Retuns a base property. Properties are mostly set and documented at construction time of implementor classes (see also the constructors of the extending classes). The following properties must be defined in every case:
  - `drm.baseName` The name of the base.
  Parameters:
    `prop` - Name of the property.
  Returns:
    As in java.util.Properties.
  See Also:
    `Base.Base(java.util.Properties)`

### getNames

    public java.util.Set getNames()

  Gets the names of all agents on this base. Returns a newly allocated Set of Strings. This is the only solution that is guaranteed to be thread safe.

### destroyAgent

    public void destroyAgent(java.lang.String name)

  Destroys an agent with all necessary clean up. The method `IAgent.onDestruction()` will be called before removing the agent from the base. The agent has to stop all its threads (java offers no possibility at the moment (version 1.4) to stop threads). The agent will be cut off of the outside world, even if it fails to stop its threads.
  Parameters:
    `name` - Name of the agent.

### dispatchAgent

    public IRequest dispatchAgent(java.lang.String name,
                                  Address destination)

  Dispatches an agent with all necessary clean up. The succesful operation means sending the agent to the address, then destroying the local copy. Permission to send an agent implies destroying it so it is not possible that sending is succesful but destruction is not. If succesful then the local agent is destroyed after sending by calling `destroyAgent`. The operation is assynchronous.
  Parameters:
    `name` - Name of the agent.
    `destination` - Where to send the agent.
  Returns:
    Returns a request so that the user can check the status of the operation.
  See Also:
    `destroyAgent(String)`

### launch

    public IRequest launch(java.lang.String method,
                           IAgent agent,
                           java.lang.Object parameter)

  Launches an agent to a specified destination. It is assumed that the agent to be launched is not in the base. The operation is assynchronous.
  Parameters:
    `method` - The algorithm used for launching the agent. At least "DIRECT" has to be implemented. Other algorithms have to be documented in the implementing class.
    `agent` - Agent to launch.
    `parameter` - An arbitrary parameter (list) of the selected launching algorithm. In the case of "DIRECT" the address of the recipient base of type Address. If null then the local base is the destination.
  Returns:
    Returns a request so that the user can check the status of the operation.
  Throws:
    `java.lang.IllegalArgumentException` - if the arguments are not of the right type or inconsistent.

### fireMessage

    public IRequest fireMessage(Message m)

  Fires the given message. The recipient can be local or global. From the sender address only the name is used the rest is filled in by the base and the recipient base. The message is sent by a separate thread in case of a remote destination.
  Returns:
    Returns a request so that the user can check the status of the operation. The method call `IRequest.getInfo("reply")` returns the reply object to the message (after it arrives of course).
  See Also:
    `IRequest.getInfo(String)`

### isOnline

    public boolean isOnline()

  Returns the online status of the base. If the base is not online, communication with the outside world is not possible.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD