Maybe support executing scripts via Bean Scripting Framework?
That would allow scripts to be written in any of the supported languages, as long as the appropriate interpreter is present.
e.g. BeanShell, Groovy, Jython, etc
See http://jakarta.apache.org/bsf/
If you define an interface for each hook, the scripts could implement the interface, and execute that way.
Here is an example, mishmashed from <http://www.beanshell.org/examples/actionhandler.html> and <http://jvm-languages.com/wiki/Bean_Scripting_Framework#Interacting_with_Complex_Objects>:
======8x===== Java code =========
public class BSFFileUtils
{
public Object evalFile (BSFManager manager, File file)
throws IOException
{
String fileName = file.getPath(); String language = manager.getLangFromFilename(fileName);
String code = extractFileContents(file); return manager.eval(language, fileName, 0, 0, code);
}
private String extractFileContents (File file)
throws IOException
{
StringBuffer buf = new StringBuffer(); BufferedReader r = new BufferedReader(new FileReader(file));
try {
int len;
char[] chars = new char[8192]; while ((len = r.read(chars, 0, chars.length)) != -1) {
buf.append(chars, 0, len);
} return buf.toString();
} finally {
r.close();
}
}
}public static void main (String[] args)
{
String directory = args[0];
File file = new File("actionHandler.bsh"); BSFManager manager = new BSFManager();
ActionListener listener = (ActionListener)
BSFFileUtils.evalFile(manager, file);
JButton button = new JButton("MyButton");
button.addActionListener(listener); JFrame f = new JFrame();
f.getContentPane().add( button );
f.show();
}
======8x===== BeanShell code ========= actionHandler.bsh
import java.awt.event.ActionListener;
actionPerformed( e ) {
print("Button Pressed: " + e);
}return (ActionListener)this;
======8x==============================
Having said all this, it is probably worth implementing update-server-info in Java, so as to avoid having to shell out to perform this action, and keep it all platform-independent.
Rogan