Package org.mozilla.javascript

Examples of org.mozilla.javascript.Context.initStandardObjects()


                    MessageContext.getCurrentMessageContext().getConfigurationContext();
            cx.putThreadLocal(MashupConstants.AXIS2_CONFIGURATION_CONTEXT, configurationContext);
            AxisService service = new AxisService();
            service.addParameter(MashupConstants.MASHUP_AUTHOR, CurrentSession.getUser());
            cx.putThreadLocal(MashupConstants.AXIS2_SERVICE, service);
            Scriptable scope = cx.initStandardObjects();
            ScriptableObject.defineClass(scope, ResourceHostObject.class);
            ScriptableObject.defineClass(scope, CollectionHostObject.class);
            ScriptableObject.defineClass(scope, RegistryHostObject.class);
            Object result = cx.evaluateString(scope, script, "<cmd>", 1, null);
            if (result != null && log.isInfoEnabled()) {
View Full Code Here


   
   
    public static void execuateJavaScript(String script, String methodName, Object[] args){
        Context cx = Context.enter();
        try {
            Scriptable scope = cx.initStandardObjects();
           
            Object wrappedOut = Context.javaToJS(System.out, scope);
          ScriptableObject.putProperty(scope, "out", wrappedOut);

            // Now evaluate the string we've collected. We'll ignore the result.
View Full Code Here

   
   
    public void execuateScript(String script, String methodName, Object[] args){
        Context cx = Context.enter();
        try {
            Scriptable scope = cx.initStandardObjects();
           
            Object wrappedOut = Context.javaToJS(System.out, scope);
            ScriptableObject.putProperty(scope, "out", wrappedOut);
           
            Object wrappedSystem = Context.javaToJS(systemWrapper, scope);
View Full Code Here

 
  public static void main(String[] args) throws Exception {
    File file = new File(args[0]);
   
    Context cx = Context.enter();
    Scriptable scope = cx.initStandardObjects();

    try {
      if(args.length > 1){
        for(int i=1; i<args.length; i++){
          File includeFile = new File(args[i]);
View Full Code Here

        this.optimizationLevel = componentSettings.getAsInt("optimization_level", 1);

        Context ctx = Context.enter();
        try {
            ctx.setWrapFactory(wrapFactory);
            globalScope = ctx.initStandardObjects(null, true);
        } finally {
            Context.exit();
        }
    }
View Full Code Here

  public void run(EncogScript script)
  {
    Context cx = Context.enter();
        try {
         
          Scriptable scope = cx.initStandardObjects();
         
         
          ScriptableObject.defineClass(scope, JSTrainingData.class);
          ScriptableObject.defineClass(scope, JSNeuralNetwork.class);
          ScriptableObject.defineClass(scope, JSTrainer.class);
View Full Code Here

      return null;

    Context context = ContextFactory.getGlobal().enterContext();
    context.setApplicationClassLoader( parentClassLoader );

    ScriptableObject scope = context.initStandardObjects();

    try
    {
      for( String name : properties.keySet() )
        ScriptableObject.putProperty( scope, name, Context.javaToJS( properties.get( name ), scope ) );
View Full Code Here

    public static Scriptable getRootScope() {
        if (_rootScope == null) {
            // Create it if never used up to now
            Context ctx = Context.enter();
            try {
                _rootScope = ctx.initStandardObjects(null);
            } finally {
                Context.exit();
            }
        }
        return _rootScope;
View Full Code Here

    public static Scriptable getRootScope() {
        if (_rootScope == null) {
            // Create it if never used up to now
            Context ctx = Context.enter();
            try {
                _rootScope = ctx.initStandardObjects(null);
            } finally {
                Context.exit();
            }
        }
        return _rootScope;
View Full Code Here

        String resultStr = "";

        Context cx = Context.enter();
        try {

            Scriptable scope = cx.initStandardObjects(null);

            // Set up some objects for the script to play with
            scope.put("log", scope, log); //$NON-NLS-1$
            scope.put("ctx", scope, jmctx); //$NON-NLS-1$
            scope.put("vars", scope, vars); //$NON-NLS-1$
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.