public KnowledgeAgent execute( Context context ) {
KnowledgeBase kbase = ( (KnowledgeCommandContext) context ).getKnowledgeBase();
KnowledgeAgentConfiguration kaConfig = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
kaConfig.setProperty( NewInstanceOption.PROPERTY_NAME, "false" );
kaConfig.setProperty( UseKnowledgeBaseClassloaderOption.PROPERTY_NAME, "true" );
KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent( this.kAgentId, kbase, kaConfig );
SystemEventListener systemEventListener = new SystemEventListener() {
public void info(String string) {
System.out.println("INFO: "+string);
}
public void info(String string, Object o) {
System.out.println("INFO: "+string +", "+o);
}
public void warning(String string) {
System.out.println("WARN: "+string );
}
public void warning(String string, Object o) {
System.out.println("WARN: "+string +", "+o);
}
public void exception(String string, Throwable thrwbl) {
System.out.println("EXCEPTION: "+string +", "+thrwbl);
}
public void exception(Throwable thrwbl) {
System.out.println("EXCEPTION: "+thrwbl);
}
public void debug(String string) {
System.out.println("DEBUG: "+string );
}
public void debug(String string, Object o) {
System.out.println("DEBUG: "+string +", "+o);
}
};
kagent.setSystemEventListener( systemEventListener );
GridNode gn = (GridNode) context.get("grid_node");
gn.set( this.kAgentId + "_kAgent", kagent );
return kagent;