Package helma.framework.core

Examples of helma.framework.core.RequestEvaluator


     * @param node the node to register
     * @return the newly registered node, or the one that was already registered with the node's key
     */
    private Node registerNewNode(Node node, Key secondaryKey) {
        Key key = node.getKey();
        RequestEvaluator reval = app.getCurrentRequestEvaluator();
        // if no request evaluator is associated with current thread, do not cache node
        // as we cannot invoke onInit() on it.
        if (reval == null) {
            Node old = (Node) cache.get(key);
            if (old != null && !old.isNullNode() && old.getState() != INode.INVALID) {
                return old;
            }
            return node;
        }

        synchronized(cache) {
            Node old = (Node) cache.put(key, node);

            if (old != null && !old.isNullNode() && old.getState() != INode.INVALID) {
                cache.put(key, old);
                if (secondaryKey != null) {
                    cache.put(secondaryKey, old);
                }
                return old;
            } else if (secondaryKey != null) {
                cache.put(secondaryKey, node);
            }
        }
        // New node is going ot be used, invoke onInit() on it
        // Invoke onInit() if it is defined by this Node's prototype
        try {
            // We need to reach deap into helma.framework.core to invoke onInit(),
            // but the functionality is really worth it.
            reval.invokeDirectFunction(node, "onInit", RequestEvaluator.EMPTY_ARGS);
        } catch (Exception x) {
            app.logError("Error invoking onInit()", x);
        }
        return node;
    }
View Full Code Here


     */
    private void invokeOnPersist(Node node) {
        try {
            // We need to reach deap into helma.framework.core to invoke onPersist(),
            // but the functionality is really worth it.
            RequestEvaluator reval = app.getCurrentRequestEvaluator();
            if (reval != null) {
                reval.invokeDirectFunction(node, "onPersist", RequestEvaluator.EMPTY_ARGS);
            }
        } catch (Exception x) {
            app.logError("Error invoking onPersist()", x);
        }
    }
View Full Code Here

     */
    public String toString() {
        try {
            // We need to reach deap into helma.framework.core to invoke toString(),
            // but the functionality is really worth it.
            RequestEvaluator reval = getApp().getCurrentRequestEvaluator();
            if (reval != null) {
                Object str = reval.invokeDirectFunction(this, "toString", RequestEvaluator.EMPTY_ARGS);
                if (str instanceof String)
                    return (String) str;
            }
        } catch (Exception x) {
            // fall back to default representation
View Full Code Here

TOP

Related Classes of helma.framework.core.RequestEvaluator

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.