Examples of VariableReader


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

        this.agentInstanceContext = agentInstanceContext;

        if (variableNames != null && !variableNames.isEmpty()) {
            for (String variable : variableNames) {
                final VariableService variableService = agentInstanceContext.getStatementContext().getVariableService();
                final VariableReader reader = variableService.getReader(variable);
                agentInstanceContext.getStatementContext().getVariableService().registerCallback(reader.getVariableNumber(), this);
                agentInstanceContext.addTerminationCallback(new StopCallback() {
                    public void stop() {
                        variableService.unregisterCallback(reader.getVariableNumber(), ExpressionViewBase.this);
                    }
                });
            }

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

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

    }

    public void stopScheduleAndVar() {
        if (variableNames != null && !variableNames.isEmpty()) {
            for (String variable : variableNames) {
                VariableReader reader = agentInstanceContext.getStatementContext().getVariableService().getReader(variable);
                if (reader != null) {
                    agentInstanceContext.getStatementContext().getVariableService().unregisterCallback(reader.getVariableNumber(), this);
                }
            }

            if (agentInstanceContext.getStatementContext().getSchedulingService().isScheduled(scheduleHandle)) {
                agentInstanceContext.getStatementContext().getSchedulingService().remove(scheduleHandle, scheduleSlot);
View Full Code Here

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

        this.agentInstanceContext = agentInstanceContext;

        if (variableNames != null && !variableNames.isEmpty()) {
            for (String variable : variableNames) {
                final VariableService variableService = agentInstanceContext.getStatementContext().getVariableService();
                final VariableReader reader = variableService.getReader(variable);
                agentInstanceContext.getStatementContext().getVariableService().registerCallback(reader.getVariableNumber(), this);
                agentInstanceContext.getTerminationCallbacks().add(new StopCallback() {
                    public void stop() {
                        variableService.unregisterCallback(reader.getVariableNumber(), ExpressionWindowView.this);
                    }
                });
            }

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

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

    }

    public void stopScheduleAndVar() {
        if (variableNames != null && !variableNames.isEmpty()) {
            for (String variable : variableNames) {
                VariableReader reader = agentInstanceContext.getStatementContext().getVariableService().getReader(variable);
                if (reader != null) {
                    agentInstanceContext.getStatementContext().getVariableService().unregisterCallback(reader.getVariableNumber(), this);
                }
            }

            if (agentInstanceContext.getStatementContext().getSchedulingService().isScheduled(scheduleHandle)) {
                agentInstanceContext.getStatementContext().getSchedulingService().remove(scheduleHandle, scheduleSlot);
View Full Code Here

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

        if (parent.getVariableNames() != null)
        {
            // if using variables, register a callback on the change of the variable
            for (String variableName : parent.getVariableNames())
            {
                final VariableReader reader = agentInstanceContext.getStatementContext().getVariableService().getReader(variableName);
                agentInstanceContext.getStatementContext().getVariableService().registerCallback(reader.getVariableNumber(), this);
                agentInstanceContext.getTerminationCallbacks().add(new StopCallback() {
                    public void stop() {
                        agentInstanceContext.getStatementContext().getVariableService().unregisterCallback(reader.getVariableNumber(), OutputConditionExpression.this);
                    }
                });
            }
        }
    }
View Full Code Here

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

    {
      return new OutputConditionNullFactory();
    }

        // Check if a variable is present
        VariableReader reader = null;
        if (outputLimitSpec.getVariableName() != null)
        {
            reader = statementContext.getVariableService().getReader(outputLimitSpec.getVariableName());
            if (reader == null)
            {
                throw new IllegalArgumentException("Variable named '" + outputLimitSpec.getVariableName() + "' has not been declared");
            }
        }

        if(outputLimitSpec.getDisplayLimit() == OutputLimitLimitType.FIRST)
    {
            if (isGrouped) {
                return new OutputConditionNullFactory();
            }
            if (!isWithHavingClause) {
                return new OutputConditionFirstFactory(outputLimitSpec, statementContext, isGrouped, isWithHavingClause);
            }
    }

        if(outputLimitSpec.getRateType() == OutputLimitRateType.CRONTAB)
        {
            return new OutputConditionCrontabFactory(outputLimitSpec.getCrontabAtSchedule(), statementContext);
        }
        else if(outputLimitSpec.getRateType() == OutputLimitRateType.WHEN_EXPRESSION)
        {
            return new OutputConditionExpressionFactory(outputLimitSpec.getWhenExpressionNode(), outputLimitSpec.getThenExpressions(), statementContext);
        }
        else if(outputLimitSpec.getRateType() == OutputLimitRateType.EVENTS)
    {
            if (log.isDebugEnabled())
            {
          log.debug(".createCondition creating OutputConditionCount with event rate " + outputLimitSpec);
            }

            if ((reader != null) && (!JavaClassHelper.isNumericNonFP(reader.getType())))
            {
                throw new IllegalArgumentException("Variable named '" + outputLimitSpec.getVariableName() + "' must be type integer, long or short");
            }

            int rate = -1;
            if (outputLimitSpec.getRate() != null)
            {
                rate = outputLimitSpec.getRate().intValue();
            }
            return new OutputConditionCountFactory(rate, reader);
    }
    else if (outputLimitSpec.getRateType() == OutputLimitRateType.TERM)
    {
            return new OutputConditionTermFactory();
    }
        else {
            if (log.isDebugEnabled())
            {
                log.debug(".createCondition creating OutputConditionTime with interval length " + outputLimitSpec.getRate());
            }
            if ((reader != null) && (!JavaClassHelper.isNumeric(reader.getType())))
            {
                throw new IllegalArgumentException("Variable named '" + outputLimitSpec.getVariableName() + "' must be of numeric type");
            }

            return new OutputConditionTimeFactory(outputLimitSpec.getTimePeriodExpr(), statementContext);
View Full Code Here

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

    }

    private AggSvcGroupByReclaimAgedEvalFunc getEvaluationFunction(final VariableService variableService, 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");
            }

            return new AggSvcGroupByReclaimAgedEvalFuncVariable(variableReader);
        }
        else
View Full Code Here

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

        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

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

    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

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

    }

    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
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.