



 Learning Center Documentation Updates • Info FAQ

| AGEvalInServer.javapackage com.franz.ag.examples;
import com.franz.ag.*;
public class AGEvalInServer {
@param
@throws
public static void main(String[] args) throws AllegroGraphException {
AllegroGraphConnection ags = new AllegroGraphConnection();
try {
ags.enable();
} catch (Exception e) {
throw new AllegroGraphException("Server connection problem", e);
}
evalInServer("(+ 2 3)",ags);
evalInServer("(defun foo (x y) (+ x y))",ags);
evalInServer("(foo 4 5)",ags);
evalInServer("(progn (defun bar (x y) (+ x y)) (bar 6 7))",ags);
evalInServer("'a",ags);
ags.disable();
}
public static void evalInServer(String lispexpr, AllegroGraphConnection ags) throws AllegroGraphException {
Object[] result;
try {
result = ags.evalInServer(lispexpr);
AGUtils.printObjectArray("Server> "+ lispexpr, result);
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("eval not permitted")) {
throw new AllegroGraphException("evalInServer not permitted: Please ensure you have started the server with the --eval-in-server-file option.");
} else {
throw new AllegroGraphException(e.getMessage());
}
}
}
}
Up |
Next
© 2008 Franz Inc - Privacy Statement
[ Consulting Services
| Franz
| TopQuadrant
| Racer Systems
]
|