Package de.innovationgate.ext.org.mozilla.javascript

Examples of de.innovationgate.ext.org.mozilla.javascript.EvaluatorException


        }
        else if (args[0] instanceof NativeObject) {
            design = new Design((NativeObject) args[0]);
        }
        else {
            throw new EvaluatorException("Global function localDB() needs either no or a custom TMLScript object as parameter");
        }
       
        return Design.db(cx, design, args, funObj);
    }
View Full Code Here


        throw runtimeError(message, sourceName, line, lineSource, lineOffset);

    }

    public EvaluatorException runtimeError(String message, String sourceName, int line, String lineSource, int lineOffset) {
        return new EvaluatorException(message, sourceName, line, lineSource, lineOffset);
    }
View Full Code Here

            // Go down packages from top level scope
            Iterator packages = WGUtils.deserializeCollection("Packages." + global.getRef(), ".").iterator();
            while (packages.hasNext()) {
                scope = (Scriptable) scope.get((String) packages.next(), scope);
                if (scope == null) {
                    throw new EvaluatorException("Unknown class or package in TMLScript global: " + global.getRef());
                }
            }

            return scope;

        }
        else if (global.getType() == TMLScriptGlobal.TYPE_OBJECT) {
            return global.getRef();
        }

        throw new EvaluatorException("Unknown TMLScript global type: " + global.getType());

    }
View Full Code Here

        // the action to perform in it's database
        TMLAction.Locator actionLocator = determineActionLocator(cx, thisObj, context, actionID);

        TMLAction action = context.getActionByID(actionLocator.getId(), actionLocator.getDbkey());
        if (action == null) {
            throw new EvaluatorException("Could not retrieve action for ID '" + actionID + "'");
        }

        TMLScriptRootScope rootScope = fetchRootScope(cx);

        // Call action
View Full Code Here

        TMLAction action;
        try {
            action = context.getModuleActionByID(actionLocator.getId(), actionLocator.getDbkey());
        }
        catch (TMLActionException e) {
            throw new EvaluatorException("Could not retrieve TMLScript module '" + args[0] + "': " + e.getMessage());
        }
        if (action == null) {
            throw new EvaluatorException("Could not retrieve TMLScript module '" + args[0] + "'");
        }

        // Fetch runtime and return function object
        RhinoExpressionEngineImpl runtime = fetchRuntime(cx);
       
View Full Code Here

    }

    public static TMLContext fetchInitialContext(Context cx) throws JavaScriptException {
        Object obj = cx.getThreadLocal(RhinoExpressionEngine.TL_INITIALCONTEXT);
        if (!(obj instanceof TMLContext)) {
            throw new EvaluatorException("Initial context not available");
        }
        TMLContext context = (TMLContext) obj;
        return context;
    }
View Full Code Here

    public static List getLookupKeys(Context cx, Scriptable thisObj, java.lang.Object[] args, Function funObj) throws JavaScriptException {

        VarArgParser.Arguments varArgs = _getLookupKeysVarargs.parse(args);

        if (!varArgs.has("table")) {
            throw new EvaluatorException("Function getLookupKeys() needs a lookup table as argument");
        }

        Map table = (Map) varArgs.get("table");
        return new ArrayList(table.keySet());
View Full Code Here

    public static String serializeObject(Context cx, Scriptable thisObj, java.lang.Object[] args, Function funObj) {

        Object obj = args[0];
        if (!(obj instanceof NativeJavaObject)) {
            throw new EvaluatorException("Object to serialize must be a java object");
        }
       
        obj = ((NativeJavaObject) obj).unwrap();
       
        try {
View Full Code Here

    }
   
    public static Plugin plugin(Context cx, Scriptable thisObj, java.lang.Object[] args, Function funObj) throws WGException {
       
        if (args.length != 1) {
            throw new EvaluatorException("Method WGA.plugin() needs a single parameter, either string or database");
        }
       
        Object arg1 = args[0];
        if (arg1 instanceof Wrapper) {
            arg1 = ((Wrapper) arg1).unwrap();
        }
       
        if (arg1 instanceof String) {
            TMLContext con = fetchInitialContext(Context.getCurrentContext());
            WGAPlugin plugin = con.getwgacore().getPluginSet().getPluginByUniqueName((String) arg1);
            if (plugin == null || !plugin.isActive() || !plugin.isValid()) {
                return null;
            }
            WGDatabase db = con.db(plugin.buildDatabaseKey());
            if (db != null) {
                return new Plugin(db);
            }
            else {
                return null;
            }
        }
        else if (arg1 instanceof WGDatabase) {
            return new Plugin((WGDatabase) arg1);
        }
        else {
            throw new EvaluatorException("Parameter of method WGA.plugin() must be either a plugin unique name (type String) or a database (type WGDatabase)");
        }
       
       
    }
View Full Code Here

            if (arg instanceof Wrapper) {
                arg = ((Wrapper) arg).unwrap();
            }
           
            if (!(arg instanceof TMLContext)) {
                throw new EvaluatorException("Method WGA.lucene() needs either no or a single TMLContext parameter");
            }
           
            tmlCx = (TMLContext) arg;
        }
        else {
            throw new EvaluatorException("Method WGA.lucene() needs either no or a single TMLContext parameter");
        }
       
        return new Lucene(tmlCx);       
       
    }
View Full Code Here

TOP

Related Classes of de.innovationgate.ext.org.mozilla.javascript.EvaluatorException

Copyright © 2018 www.massapicom. 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.