Java源码示例:sun.jvm.hotspot.utilities.soql.JSJavaFactoryImpl

示例1
private void postAttach() {
    // create JavaScript engine and start it
    jsengine = new JSJavaScriptEngine() {
                    private ObjectReader reader = new ObjectReader();
                    private JSJavaFactory factory = new JSJavaFactoryImpl();
                    public ObjectReader getObjectReader() {
                        return reader;
                    }
                    public JSJavaFactory getJSJavaFactory() {
                        return factory;
                    }
                    protected void quit() {
                        debugger.detach();
                        quit = true;
                    }
                    protected BufferedReader getInputReader() {
                        return in;
                    }
                    protected PrintStream getOutputStream() {
                        return out;
                    }
                    protected PrintStream getErrorStream() {
                        return err;
                    }
               };
    try {
        jsengine.defineFunction(this,
                 this.getClass().getMethod("registerCommand",
                            new Class[] {
                                 String.class, String.class, String.class
                            }));
    } catch (NoSuchMethodException exp) {
        // should not happen, see below...!!
        exp.printStackTrace();
    }
    jsengine.start();
}
 
示例2
private void postAttach() {
    // create JavaScript engine and start it
    jsengine = new JSJavaScriptEngine() {
                    private ObjectReader reader = new ObjectReader();
                    private JSJavaFactory factory = new JSJavaFactoryImpl();
                    public ObjectReader getObjectReader() {
                        return reader;
                    }
                    public JSJavaFactory getJSJavaFactory() {
                        return factory;
                    }
                    protected void quit() {
                        debugger.detach();
                        quit = true;
                    }
                    protected BufferedReader getInputReader() {
                        return in;
                    }
                    protected PrintStream getOutputStream() {
                        return out;
                    }
                    protected PrintStream getErrorStream() {
                        return err;
                    }
               };
    try {
        jsengine.defineFunction(this,
                 this.getClass().getMethod("registerCommand",
                            new Class[] {
                                 String.class, String.class, String.class
                            }));
    } catch (NoSuchMethodException exp) {
        // should not happen, see below...!!
        exp.printStackTrace();
    }
    jsengine.start();
}
 
示例3
private void postAttach() {
    // create JavaScript engine and start it
    jsengine = new JSJavaScriptEngine() {
                    private ObjectReader reader = new ObjectReader();
                    private JSJavaFactory factory = new JSJavaFactoryImpl();
                    public ObjectReader getObjectReader() {
                        return reader;
                    }
                    public JSJavaFactory getJSJavaFactory() {
                        return factory;
                    }
                    protected void quit() {
                        debugger.detach();
                        quit = true;
                    }
                    protected BufferedReader getInputReader() {
                        return in;
                    }
                    protected PrintStream getOutputStream() {
                        return out;
                    }
                    protected PrintStream getErrorStream() {
                        return err;
                    }
               };
    try {
        jsengine.defineFunction(this,
                 this.getClass().getMethod("registerCommand",
                            new Class[] {
                                 String.class, String.class, String.class
                            }));
    } catch (NoSuchMethodException exp) {
        // should not happen, see below...!!
        exp.printStackTrace();
    }
    jsengine.start();
}
 
示例4
private void postAttach() {
    // create JavaScript engine and start it
    jsengine = new JSJavaScriptEngine() {
                    private ObjectReader reader = new ObjectReader();
                    private JSJavaFactory factory = new JSJavaFactoryImpl();
                    public ObjectReader getObjectReader() {
                        return reader;
                    }
                    public JSJavaFactory getJSJavaFactory() {
                        return factory;
                    }
                    protected void quit() {
                        debugger.detach();
                        quit = true;
                    }
                    protected BufferedReader getInputReader() {
                        return in;
                    }
                    protected PrintStream getOutputStream() {
                        return out;
                    }
                    protected PrintStream getErrorStream() {
                        return err;
                    }
               };
    try {
        jsengine.defineFunction(this,
                 this.getClass().getMethod("registerCommand",
                            new Class[] {
                                 String.class, String.class, String.class
                            }));
    } catch (NoSuchMethodException exp) {
        // should not happen, see below...!!
        exp.printStackTrace();
    }
    jsengine.start();
}
 
示例5
private void postAttach() {
    // create JavaScript engine and start it
    jsengine = new JSJavaScriptEngine() {
                    private ObjectReader reader = new ObjectReader();
                    private JSJavaFactory factory = new JSJavaFactoryImpl();
                    public ObjectReader getObjectReader() {
                        return reader;
                    }
                    public JSJavaFactory getJSJavaFactory() {
                        return factory;
                    }
                    protected void quit() {
                        debugger.detach();
                        quit = true;
                    }
                    protected BufferedReader getInputReader() {
                        return in;
                    }
                    protected PrintStream getOutputStream() {
                        return out;
                    }
                    protected PrintStream getErrorStream() {
                        return err;
                    }
               };
    try {
        jsengine.defineFunction(this,
                 this.getClass().getMethod("registerCommand",
                            new Class[] {
                                 String.class, String.class, String.class
                            }));
    } catch (NoSuchMethodException exp) {
        // should not happen, see below...!!
        exp.printStackTrace();
    }
    jsengine.start();
}
 
示例6
private void postAttach() {
    // create JavaScript engine and start it
    jsengine = new JSJavaScriptEngine() {
                    private ObjectReader reader = new ObjectReader();
                    private JSJavaFactory factory = new JSJavaFactoryImpl();
                    public ObjectReader getObjectReader() {
                        return reader;
                    }
                    public JSJavaFactory getJSJavaFactory() {
                        return factory;
                    }
                    protected void quit() {
                        debugger.detach();
                        quit = true;
                    }
                    protected BufferedReader getInputReader() {
                        return in;
                    }
                    protected PrintStream getOutputStream() {
                        return out;
                    }
                    protected PrintStream getErrorStream() {
                        return err;
                    }
               };
    try {
        jsengine.defineFunction(this,
                 this.getClass().getMethod("registerCommand",
                            new Class[] {
                                 String.class, String.class, String.class
                            }));
    } catch (NoSuchMethodException exp) {
        // should not happen, see below...!!
        exp.printStackTrace();
    }
    jsengine.start();
}
 
示例7
private void postAttach() {
    // create JavaScript engine and start it
    jsengine = new JSJavaScriptEngine() {
                    private ObjectReader reader = new ObjectReader();
                    private JSJavaFactory factory = new JSJavaFactoryImpl();
                    public ObjectReader getObjectReader() {
                        return reader;
                    }
                    public JSJavaFactory getJSJavaFactory() {
                        return factory;
                    }
                    protected void quit() {
                        debugger.detach();
                        quit = true;
                    }
                    protected BufferedReader getInputReader() {
                        return in;
                    }
                    protected PrintStream getOutputStream() {
                        return out;
                    }
                    protected PrintStream getErrorStream() {
                        return err;
                    }
               };
    try {
        jsengine.defineFunction(this,
                 this.getClass().getMethod("registerCommand",
                            new Class[] {
                                 String.class, String.class, String.class
                            }));
    } catch (NoSuchMethodException exp) {
        // should not happen, see below...!!
        exp.printStackTrace();
    }
    jsengine.start();
}
 
示例8
private void postAttach() {
    // create JavaScript engine and start it
    try {
        jsengine = new JSJavaScriptEngine() {
                    private ObjectReader reader = new ObjectReader();
                    private JSJavaFactory factory = new JSJavaFactoryImpl();
                    public ObjectReader getObjectReader() {
                        return reader;
                    }
                    public JSJavaFactory getJSJavaFactory() {
                        return factory;
                    }
                    protected void quit() {
                        debugger.detach();
                        quit = true;
                    }
                    protected BufferedReader getInputReader() {
                        return in;
                    }
                    protected PrintStream getOutputStream() {
                        return out;
                    }
                    protected PrintStream getErrorStream() {
                        return err;
                    }
               };
        try {
            jsengine.defineFunction(this,
                 this.getClass().getMethod("registerCommand",
                            new Class[] {
                                 String.class, String.class, String.class
                            }));
        } catch (NoSuchMethodException exp) {
              // should not happen, see below...!!
              exp.printStackTrace();
        }
        jsengine.start();
    }
    catch (Exception ex) {
        System.out.println("Warning! JS Engine can't start, some commands will not be available.");
        if (verboseExceptions) {
            ex.printStackTrace(out);
        }
    }
}