Package com.espertech.esper.epl.variable

Examples of com.espertech.esper.epl.variable.VariableReader


            if ((statements != null) && (!statements.isEmpty())) {
                throw new ConfigurationException("Variable '" + name + "' is in use by one or more statements");
            }
        }

        VariableReader reader = variableService.getReader(name);
        if (reader == null)
        {
            return false;
        }
View Full Code Here


        this.statementContext = statementContext;

        if (variableNames != null && !variableNames.isEmpty()) {
            for (String variable : variableNames) {
                final VariableService variableService = statementContext.getVariableService();
                final VariableReader reader = variableService.getReader(variable);
                statementContext.getVariableService().registerCallback(reader.getVariableNumber(), this);
                statementContext.getStatementStopService().addSubscriber(new StatementStopCallback() {
                    public void statementStopped()
                    {
                        variableService.unregisterCallback(reader.getVariableNumber(), ExpressionWindowView.this);
                    }
                });
            }

            ScheduleHandleCallback callback = new ScheduleHandleCallback() {
View Full Code Here

    }

    public void stop() {
        if (variableNames != null && !variableNames.isEmpty()) {
            for (String variable : variableNames) {
                VariableReader reader = statementContext.getVariableService().getReader(variable);
                if (reader != null) {
                    statementContext.getVariableService().unregisterCallback(reader.getVariableNumber(), this);
                }
            }
           
            if (statementContext.getSchedulingService().isScheduled(scheduleHandle)) {
                statementContext.getSchedulingService().remove(scheduleHandle, scheduleSlot);
View Full Code Here

    }

    private EvaluationFunction getEvaluationFunction(final VariableService variableService, StatementStopService statementStopService, String hintValue)
            throws ExprValidationException
    {
        final VariableReader variableReader = variableService.getReader(hintValue);
        if (variableReader != null)
        {
            if (!JavaClassHelper.isNumeric(variableReader.getType()))
            {
                throw new ExprValidationException("Variable type of variable '" + variableReader.getVariableName() + "' is not numeric");
            }

            final VariableChangeCallback changeCallback = new VariableChangeCallback()
            {
                public void update(Object newValue, Object oldValue)
                {
                    AggSvcGroupByReclaimAged.this.nextSweepTime = null;
                }
            };
            variableService.registerCallback(variableReader.getVariableNumber(), changeCallback);
            statementStopService.addSubscriber(new StatementStopCallback()
            {
                public void statementStopped()
                {
                    variableService.unregisterCallback(variableReader.getVariableNumber(), changeCallback);
                }
            });

            return new EvaluationFunctionVariable(variableReader);
        }
View Full Code Here

        this.unmatchedListener = listener;
    }

    public void setVariableValue(String variableName, Object variableValue) throws EPException
    {
        VariableReader reader = services.getVariableService().getReader(variableName);
        if (reader == null)
        {
            throw new VariableNotFoundException("Variable by name '" + variableName + "' has not been declared");
        }

        services.getVariableService().checkAndWrite(reader.getVariableNumber(), variableValue);
        services.getVariableService().commit();
    }
View Full Code Here

    public void setVariableValue(Map<String, Object> variableValues) throws EPException
    {
        for (Map.Entry<String, Object> entry : variableValues.entrySet())
        {
            String variableName = entry.getKey();
            VariableReader reader = services.getVariableService().getReader(variableName);
            if (reader == null)
            {
                services.getVariableService().rollback();
                throw new VariableNotFoundException("Variable by name '" + variableName + "' has not been declared");
            }

            try
            {
                services.getVariableService().checkAndWrite(reader.getVariableNumber(), entry.getValue());
            }
            catch (RuntimeException ex)
            {
                services.getVariableService().rollback();
                throw ex;
View Full Code Here

    }

    public Object getVariableValue(String variableName) throws EPException
    {
        services.getVariableService().setLocalVersion();
        VariableReader reader = services.getVariableService().getReader(variableName);
        if (reader == null)
        {
            throw new VariableNotFoundException("Variable by name '" + variableName + "' has not been declared");
        }
        Object value = reader.getValue();
        if (value == null || reader.getEventType() == null) {
            return value;
        }
        return ((EventBean) value).getUnderlying();
    }
View Full Code Here

    {
        services.getVariableService().setLocalVersion();
        Map<String, Object> values = new HashMap<String, Object>();
        for (String variableName : variableNames)
        {
            VariableReader reader = services.getVariableService().getReader(variableName);
            if (reader == null)
            {
                throw new VariableNotFoundException("Variable by name '" + variableName + "' has not been declared");
            }

            Object value = reader.getValue();
            if (value != null && reader.getEventType() != null) {
                value = ((EventBean) value).getUnderlying();
            }
            values.put(variableName, value);
        }
        return values;
View Full Code Here

        return values;
    }

    public Class getVariableType(String variableName)
    {
        VariableReader reader = services.getVariableService().getReader(variableName);
        if (reader == null)
        {
            return null;
        }
        return reader.getType();
    }
View Full Code Here

        this.eventRate = eventRate;
        this.variableMetaData = variableMetaData;
    }

    public OutputCondition make(AgentInstanceContext agentInstanceContext, OutputCallback outputCallback) {
        VariableReader variableReader = null;
        if (variableMetaData != null) {
            variableReader = agentInstanceContext.getStatementContext().getVariableService().getReader(variableMetaData.getVariableName(), agentInstanceContext.getAgentInstanceId());
        }
        return new OutputConditionCount(outputCallback, eventRate, variableReader);
    }
View Full Code Here

TOP

Related Classes of com.espertech.esper.epl.variable.VariableReader

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.