public static FunctionServer createServer(int port) {
return new FunctionServer(port, new DebugFunctionHandler(createHandler()));
}
public static IFunctionHandler createHandler() {
ReflectFunctionHandler rfh = new ReflectFunctionHandler();
LispFunctionHandler lfh = new LispFunctionHandler();
lfh.eval(new File("functions"), true); // evaluate any lisp files
ScriptRepository srep = new ScriptRepository(new File("functions"), "Script.");
rfh.addMethods("Math.", Math.class);
rfh.addMethods("Math.", Maths.class);
rfh.addMethods("Reflect.", Reflect.class);
rfh.addMethods("CSV.", CSV.class);
rfh.addMethods("Test.", Test.class);
rfh.addMethods("Fin.", Finance1.class);
rfh.addMethods("", AnnotationsTest.class);
CompositeFunctionHandler cfh = new CompositeFunctionHandler();
cfh.add(rfh);
cfh.add(srep);
cfh.add(lfh);
FunctionInformationHandler firh = new FunctionInformationHandler();
firh.add(rfh.getFunctions());
firh.add(lfh.getInformation());
firh.add(srep); // add script repository as a function provider
cfh.add(firh);
cfh.add(new MenuHandler(new TestMenu()));
cfh.add(new CompTest1());