madkit.kernel
Class AbstractMadkitBooter

java.lang.Object
  extended by madkit.kernel.AbstractMadkitBooter
All Implemented Interfaces:
GraphicShell
Direct Known Subclasses:
Booter, Booter, DesktopBooter

public class AbstractMadkitBooter
extends java.lang.Object
implements GraphicShell

The standard madkit booter. It starts the kernel, and then launch agents defined in a config file, with or without GUI.

Version:
1.1
Author:
Jacques Ferber, Olivier Gutknecht and Fabien Michel

Field Summary
static java.lang.String ALL_FILES
           
protected  boolean allowForPluginAgentification
           
static java.lang.String BEANSHELL_FILE
           
static java.lang.String CONFIG_FILE
           
static java.lang.String FORMALISM_FILE
           
protected static boolean graphics
           
protected  java.util.Hashtable guis
           
protected static java.lang.String initFile
           
protected  java.lang.String initialAgentClass
           
protected  java.lang.String initialAgentName
           
protected static java.lang.String ipaddress
           
protected static boolean ipnumeric
           
protected  boolean isGraphics
           
static java.lang.String JESS_FILE
           
static java.util.Hashtable labeltable
           
protected static boolean nativelf
           
protected static boolean network
           
protected static int port
           
static java.lang.String PYTHON_FILE
           
static java.lang.String SCHEME_FILE
           
static java.lang.String SEDIT_FILE
           
protected  Kernel theKernel
           
 
Constructor Summary
protected AbstractMadkitBooter(boolean isg, boolean ipnumeric, java.lang.String initFile, java.lang.String ipaddress, boolean network)
           
 
Method Summary
static void bootProcess(java.lang.String[] argv)
          Booting from command line
protected  java.awt.event.WindowListener createWindowHandler(Kernel k, AbstractAgent a)
           
 void disposeGUI(AbstractAgent a)
          This method is called by the MadKit kernel when a local agent is killed, so that the host graphical application can clean up the wrapper graphical interface
 void disposeGUIImmediatly(AbstractAgent a)
          This method is called by the MadKit kernel when a local agent request the host graphical application to remove its wrapper graphical interface
static java.lang.String getAgentLabel(java.lang.String lab)
          Gets a new agent label from the agentLabel table...
static java.lang.String getAgentLabelFromClassName(java.lang.String s)
          Gets a new agent label from its class, using the function getAgentLabel.
static AbstractMadkitBooter getBooter()
           
 java.lang.Object getDefaultGUIObject(AbstractAgent a)
          This method defines a default GUI object that will be instanciated when an agent does not define its initGUI() method.
protected  SplashScreen getSplashScreen()
           
protected  void init(boolean isg, boolean ipnumeric, java.lang.String initFile, java.lang.String ipaddress, boolean network)
          Initialization method of the boot process.
 void launchAgent(Element elt)
          Launch an agent from a XML element
 void loadConfigFile(java.io.File f)
           
 void loadFile(AbstractAgent ag, java.io.File f)
           
 AbstractAgent makeJavaAgent(AbstractAgent ag, java.lang.String className, boolean gui)
           
 AbstractAgent makeScriptAgent(AbstractAgent ag, java.lang.String className, java.lang.String typeArg, java.lang.Object arg, boolean gui)
          Create a ScriptAgent (i.e.
static void setBooter(AbstractMadkitBooter boot)
           
 void setProgress(java.lang.String s)
           
protected  void setSplashScreen(SplashScreen splash)
           
 void setupGUI(AbstractAgent a)
          This method is called by the MadKit kernel when a new agent is launched, it is up to the graphical application to setup the appropriate widget in cooperation with the agent (i.e. with the getGUIObject() method in the Agent class)
 void setupGUI(AbstractAgent a, java.awt.Point p, java.awt.Dimension d)
          This method is identical to setupGUI(AbstractAgent a) except that location and dimension of the graphic interface are passed as arguments.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

port

protected static int port

graphics

protected static boolean graphics

ipnumeric

protected static boolean ipnumeric

nativelf

protected static boolean nativelf

initFile

protected static java.lang.String initFile

ipaddress

protected static java.lang.String ipaddress

network

protected static boolean network

CONFIG_FILE

public static java.lang.String CONFIG_FILE

SCHEME_FILE

public static java.lang.String SCHEME_FILE

PYTHON_FILE

public static java.lang.String PYTHON_FILE

BEANSHELL_FILE

public static java.lang.String BEANSHELL_FILE

JESS_FILE

public static java.lang.String JESS_FILE

SEDIT_FILE

public static java.lang.String SEDIT_FILE

FORMALISM_FILE

public static java.lang.String FORMALISM_FILE

ALL_FILES

public static java.lang.String ALL_FILES

theKernel

protected Kernel theKernel

isGraphics

protected boolean isGraphics

guis

protected java.util.Hashtable guis

initialAgentClass

protected java.lang.String initialAgentClass

initialAgentName

protected java.lang.String initialAgentName

allowForPluginAgentification

protected boolean allowForPluginAgentification

labeltable

public static java.util.Hashtable labeltable
Constructor Detail

AbstractMadkitBooter

protected AbstractMadkitBooter(boolean isg,
                               boolean ipnumeric,
                               java.lang.String initFile,
                               java.lang.String ipaddress,
                               boolean network)
Method Detail

setBooter

public static void setBooter(AbstractMadkitBooter boot)

getBooter

public static AbstractMadkitBooter getBooter()

setSplashScreen

protected void setSplashScreen(SplashScreen splash)

getSplashScreen

protected SplashScreen getSplashScreen()

setProgress

public void setProgress(java.lang.String s)

getAgentLabel

public static java.lang.String getAgentLabel(java.lang.String lab)
Gets a new agent label from the agentLabel table...


getAgentLabelFromClassName

public static java.lang.String getAgentLabelFromClassName(java.lang.String s)
Gets a new agent label from its class, using the function getAgentLabel. Useful to create agents with new names.


makeScriptAgent

public AbstractAgent makeScriptAgent(AbstractAgent ag,
                                     java.lang.String className,
                                     java.lang.String typeArg,
                                     java.lang.Object arg,
                                     boolean gui)
Create a ScriptAgent (i.e. Jess, Scheme, Python, etc..) from its className.. following the MadkitClassLoader... (so you don't have to take care of what classes are in the initial CLASSPATH Uses the Class.forName(..) instantiation if there is no ClassLoader associated to the booter... Exemple: makeScriptAgent(myLauncherAgent,"madkit.models.python.PythonAgent","java.lang.String",filePath,true)


makeJavaAgent

public AbstractAgent makeJavaAgent(AbstractAgent ag,
                                   java.lang.String className,
                                   boolean gui)

init

protected void init(boolean isg,
                    boolean ipnumeric,
                    java.lang.String initFile,
                    java.lang.String ipaddress,
                    boolean network)
Initialization method of the boot process. Normally called as 'super' from subclasses that overrid this method.

Parameters:
isg -
ipnumeric -
initFile -
ipaddress -
network -

getDefaultGUIObject

public java.lang.Object getDefaultGUIObject(AbstractAgent a)
Description copied from interface: GraphicShell
This method defines a default GUI object that will be instanciated when an agent does not define its initGUI() method. The agent is passed in reference so that the GraphicShell has an opportunity to handle different GUIs according to the agent type or redirect the output stream

Specified by:
getDefaultGUIObject in interface GraphicShell

setupGUI

public void setupGUI(AbstractAgent a)
Description copied from interface: GraphicShell
This method is called by the MadKit kernel when a new agent is launched, it is up to the graphical application to setup the appropriate widget in cooperation with the agent (i.e. with the getGUIObject() method in the Agent class)

Specified by:
setupGUI in interface GraphicShell

setupGUI

public void setupGUI(AbstractAgent a,
                     java.awt.Point p,
                     java.awt.Dimension d)
Description copied from interface: GraphicShell
This method is identical to setupGUI(AbstractAgent a) except that location and dimension of the graphic interface are passed as arguments. This method should not be called directly and is used only for restoring a configuration of agents

Specified by:
setupGUI in interface GraphicShell

createWindowHandler

protected java.awt.event.WindowListener createWindowHandler(Kernel k,
                                                            AbstractAgent a)

disposeGUI

public void disposeGUI(AbstractAgent a)
Description copied from interface: GraphicShell
This method is called by the MadKit kernel when a local agent is killed, so that the host graphical application can clean up the wrapper graphical interface

Specified by:
disposeGUI in interface GraphicShell

disposeGUIImmediatly

public void disposeGUIImmediatly(AbstractAgent a)
Description copied from interface: GraphicShell
This method is called by the MadKit kernel when a local agent request the host graphical application to remove its wrapper graphical interface

Specified by:
disposeGUIImmediatly in interface GraphicShell

launchAgent

public void launchAgent(Element elt)
Launch an agent from a XML element


loadConfigFile

public void loadConfigFile(java.io.File f)

loadFile

public void loadFile(AbstractAgent ag,
                     java.io.File f)

bootProcess

public static void bootProcess(java.lang.String[] argv)
Booting from command line



Copyright © Madkit Team (O. Gutknecht, J. Ferber, F. Michel et al.) All Rights Reserved.