ch.elca.el4j.services.debug
Class BshCommandLineLauncher

java.lang.Object
  extended by ch.elca.el4j.services.debug.BshCommandLineLauncher
All Implemented Interfaces:
InitializingBean, ApplicationContextAware

public class BshCommandLineLauncher
extends Object
implements ApplicationContextAware, InitializingBean

Class to evaluate a bsh string in a sub-shell of this JVM. Sample uses: java -Del4j.bsh.launchstr="server(2000);" anyClass makes the JVM accessible from remote (std bean shell) * bsh.show=true; // shows output * debug(); * see directory bsh.commands in the bsh.jar file for more ideas You can add scriptets in the directory /resources/mandatory: they are directly available as command. Scripts that could be added (ideas): * dump all cfg of spring app ctxt * regularly print mem and thread status (e.g. all 30'' to track issues) * status info about the JVM * save an object serialized to disk/ load it again * start a new spring bean

How to demo this module: (1) Add the following to your MAVEN_OPTS environment variable: -Del4j.bsh.launchstr=server(2000);
(2) Add a dependency to this module.
(3) Launch your application
(4) Open in a browser the following URL: http://localhost:2000/remote/jconsole.html
(5) type threadInfo(); ENTER

Limitation: cut and paste (with external info) is currently not supported.

Author:
Philipp H. Oser (POS)
File-location:
BshCommandLineLauncher
Last check-in date:
2009-08-04 13:59:45 +0200 (Di, 04. Aug 2009) by swismer for revision 3873

Field Summary
static String BSH_LAUNCH_STRING
           
static String BSH_SCRIPLET_CLASSPATH
           
protected  ApplicationContext m_ac
           
protected  ShellExecutorImpl shell
           
 
Constructor Summary
BshCommandLineLauncher()
           
 
Method Summary
 void addScriptletClasspath(String cp)
           
 void afterPropertiesSet()
           
 ShellExecutor getShellExecutor()
           
 void setApplicationContext(ApplicationContext applicationContext)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BSH_LAUNCH_STRING

public static final String BSH_LAUNCH_STRING
See Also:
Constant Field Values

BSH_SCRIPLET_CLASSPATH

public static final String BSH_SCRIPLET_CLASSPATH
See Also:
Constant Field Values

shell

protected ShellExecutorImpl shell

m_ac

protected ApplicationContext m_ac
Constructor Detail

BshCommandLineLauncher

public BshCommandLineLauncher()
Method Detail

getShellExecutor

public ShellExecutor getShellExecutor()

addScriptletClasspath

public void addScriptletClasspath(String cp)

setApplicationContext

public void setApplicationContext(ApplicationContext applicationContext)
                           throws BeansException
Specified by:
setApplicationContext in interface ApplicationContextAware
Throws:
BeansException

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception


Copyright © 2005-2011 ELCA. All Rights Reserved.