Examples of OgnlContext


Examples of ognl.OgnlContext

        if (debug) {
            log.debug("Evaluating expression: " + expression);
        }

        // Object root;
        OgnlContext context = new OgnlContext(vars);

        Object expr = Ognl.parseExpression(expression);
        Object result = Ognl.getValue(expr, context);
       
        if (debug) {
View Full Code Here

Examples of ognl.OgnlContext

    HiveMindExpressionCompiler _compiler = new HiveMindExpressionCompiler(new ClassFactoryImpl());

    public void test_Duplicate_Class_Compiler()
    throws Exception
    {
        OgnlContext context = (OgnlContext) Ognl.createDefaultContext(null);
        BasicObject root = new BasicObject();
        String expr = "name";
        Node expression = (Node) Ognl.parseExpression(expr);

        _compiler.compileExpression(context, expression, root);
View Full Code Here

Examples of ognl.OgnlContext

    }

    public void test_Divide_By_Zero()
    throws Exception
    {
        OgnlContext context = (OgnlContext) Ognl.createDefaultContext(null);
        String expr = "true ? 1 : 1/0";

        Node expression = (Node) Ognl.parseExpression(expr);
        _compiler.compileExpression(context, expression, expr);
       
View Full Code Here

Examples of ognl.OgnlContext

    }

    public <T> T evaluate(Exchange exchange, Class<T> tClass) {
        // TODO we could use caching here but then we'd have possible
        // concurrency issues so lets assume that the provider caches
        OgnlContext oglContext = new OgnlContext();
        try {
            Object value = Ognl.getValue(expression, oglContext, new RootObject(exchange));
            return exchange.getContext().getTypeConverter().convertTo(tClass, value);
        } catch (OgnlException e) {
            throw new ExpressionEvaluationException(this, exchange, e);
View Full Code Here

Examples of ognl.OgnlContext

            throw new NullPointerException("sessions");
        }
       
        Set<IoSession> answer = new LinkedHashSet<IoSession>();
        for (IoSession s: sessions) {
            OgnlContext context = (OgnlContext) Ognl.createDefaultContext(s);
            context.setTypeConverter(typeConverter);
            context.put(AbstractPropertyAccessor.READ_ONLY_MODE, true);
            context.put(AbstractPropertyAccessor.QUERY, query);
            Object result = Ognl.getValue(expression, context, s);
            if (result instanceof Boolean) {
                if (((Boolean) result).booleanValue()) {
                    answer.add(s);
                }
View Full Code Here

Examples of ognl.OgnlContext

        try {
            PropertyEditor e = getPropertyEditor(
                    getParent(aname).getClass(),
                    pdesc.getName(), pdesc.getPropertyType());
            e.setAsText((String) avalue);
            OgnlContext ctx = (OgnlContext) Ognl.createDefaultContext(source);
            ctx.setTypeConverter(typeConverter);
            Ognl.setValue(aname, ctx, source, e.getValue());
        } catch (Throwable e) {
            throwMBeanException(e);
        }
    }
View Full Code Here

Examples of ognl.OgnlContext

        return Class.forName(signature);
    }

    private Object getAttribute(Object object, String fqan, Class<?> attrType) throws OgnlException {
        Object property;
        OgnlContext ctx = (OgnlContext) Ognl.createDefaultContext(object);
        ctx.setTypeConverter(new OgnlTypeConverter());
        if (attrType == null) {
            property = Ognl.getValue(fqan, ctx, object);
        } else {
            property = Ognl.getValue(fqan, ctx, object, attrType);
        }
View Full Code Here

Examples of ognl.OgnlContext

    }

    private boolean isEvalExpression(Object tree, Map<String, Object> context) throws OgnlException {
        if (tree instanceof SimpleNode) {
            SimpleNode node = (SimpleNode) tree;
            OgnlContext ognlContext = null;

            if (context!=null && context instanceof OgnlContext) {
                ognlContext = (OgnlContext) context;
            }
            return node.isEvalChain(ognlContext);
View Full Code Here

Examples of ognl.OgnlContext

        if (debug) {
            log.debug("Evaluating expression: " + expression);
        }

        // Object root;
        OgnlContext context = new OgnlContext(vars);

        Object expr = Ognl.parseExpression(expression);
        Object result = Ognl.getValue(expr, context);
       
        if (debug) {
View Full Code Here

Examples of ognl.OgnlContext

        try {
            PropertyEditor e = getPropertyEditor(
                    getParent(aname).getClass(),
                    pdesc.getName(), pdesc.getPropertyType());
            e.setAsText((String) avalue);
            OgnlContext ctx = (OgnlContext) Ognl.createDefaultContext(source);
            ctx.setTypeConverter(typeConverter);
            Ognl.setValue(aname, ctx, source, e.getValue());
        } catch (Throwable e) {
            throwMBeanException(e);
        }
    }
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.