PammSkeletonCode

	// Agent imports
	import Agent.KQML.*;
	import Agent.Engine.*;
	import Agent.CORBA.*;

// Generic CORBA/KQML/JESS based agent startup class

public class AgentStartup? { protected JESSSystem m_jessSystem; // JESS system protected CORBA_KQMLEventDispatcher m_kqmlDispatcher; // Communications (KQML)

public AgentStartup?( String id, String sInitFile, String sDefaultPath, boolean bShowKBDialogs ) { // Create JESS system object m_jessSystem = new JESSSystem();

/* START: Display Dialogs */ if ( bShowKBDialogs ) { // Create dialog to updates of KB (DEBUG) FactsDialog fd = new FactsDialog( id ); RulesDialog? rd = new RulesDialog?( id );

// Pass system object to dialogs for updates fd.setJESSSystem( m_jessSystem ); rd.setJESSSystem( m_jessSystem );

// Add notification objects m_jessSystem.addNotificationSink( fd ); m_jessSystem.addNotificationSink( rd ); }

/* END: Display Dialogs */

// Create KQML dispatcher m_kqmlDispatcher = new CORBA_KQMLEventDispatcher(new KQML_JESSMessageHandler( m_jessSystem ), id );

// Set up default path in JESS m_jessSystem.executeCommand( "(defglobal ?*home-dir* = \"" + StringEx?.makeSafeString(sDefaultPath) + "\")" );

// Load JESS extensions m_jessSystem.executeFile( sDefaultPath + "extensions.jess" );

// Register name of this agent in KB m_jessSystem.executeCommand( "(defglobal ?*this-agent* = " + id + ")" );

// Initialize with appropriate file (if given) if ( sInitFile != null ) m_jessSystem.executeFile( sInitFile ); } }


		[NrcPammAgents | JessAndAgents | END]

(last edited November 3, 1999)
Find Page by browsing or searching