public static Object createSim ( String script , boolean groovy , String ll ) throws Exception { setOMSProperties ( ) ; Level . parse ( ll ) ; // may throw IAE String prefix = groovy ? "" : "import static oms3.SimConst.*\n" + "def __sb__ = new oms3.SimBuilder(logging:'" + ll + "')\n" + "__sb__." ; ClassLoader parent = Thread . currentThread ( ) . getContextClassLoader ( ) ; Binding b = new Binding ( ) ; b . setVariable ( "oms_version" , System . getProperty ( "oms.version" ) ) ; b . setVariable ( "oms_home" , System . getProperty ( "oms.home" ) ) ; b . setVariable ( "oms_prj" , System . getProperty ( "oms.prj" ) ) ; GroovyShell shell = new GroovyShell ( new GroovyClassLoader ( parent ) , b ) ; return shell . evaluate ( prefix + script ) ; }
Create a simulation object .