C:\cvs\SqlDeployerMbean\scripts\sqldeployer.bsh
import javax.management.*;
import org.jboss.system.ServiceMBeanSupport;
import com.redneck.tools.SqlFileScanner;

scanDir = "C:\\scanner\\scripts\\";

MBeanServer s;
svcName = "beanshell:service=SqlDeployer";
SqlFileScanner scanner;

public String objectName() {
   return svcName;
}

public void setCtx(ServiceMBeanSupport wrapper) {
   s = wrapper.getServer();
}

public void stop() {
        System.out.println (svcName + ": stop called.");
        scanner.setRunning(false);
}

public void start() { 
        System.out.println (svcName + ": start called."); 
        scanner = new SqlFileScanner();
        scanner.setScanDirectory(new java.io.File(scanDir));
        System.out.println (svcName + ": Scanner starting..."); 
        scanner.start();
        System.out.println (svcName + ": Scanner started."); 
}

/* tell Jboss what interfaces you intend to implement, even if it isn't true */
public Class[] getInterfaces () {
        Class[] interfaces = {};
        return interfaces;
}