Package com.espertech.esper.client

Examples of com.espertech.esper.client.EventType


        ExprNodeUtilResolveExceptionHandler exceptionHandler = new ExprNodeUtilResolveExceptionHandler() {
            public ExprValidationException handle(Exception e) {
                return new ExprValidationException("Failed to resolve method '" + methodName + "': " + e.getMessage(), e);
            }
        };
        EventType wildcardType = validationContext.getStreamTypeService().getEventTypes().length != 1 ? null : validationContext.getStreamTypeService().getEventTypes()[0];
        return ExprNodeUtility.resolveMethodAllowWildcardAndStream(methodTarget.getName(), methodTarget, methodName, parameters, validationContext.getMethodResolutionService(), validationContext.getEventAdapterService(), validationContext.getStatementId(), wildcardType != null, wildcardType, exceptionHandler, methodName);
    }
View Full Code Here


            }
            istreamOnly = getIstreamOnly(streamTypeService, streamNum);
            if ((stateType == AggregationStateType.WINDOW) && istreamOnly && !streamTypeService.isOnDemandStreams()) {
                throw new ExprValidationException(getErrorPrefix() + " requires that the aggregated events provide a remove stream; Defined a data window onto the stream or use 'firstever', 'lastever' or 'nth' instead");
            }
            EventType type = streamTypeService.getEventTypes()[streamNum];
            containedType = type;
            resultType = type.getUnderlyingType();
            final int streamNumUsed = streamNum;
            final Class returnType = resultType;
            evaluator = new ExprEvaluator() {
                public Object evaluate(EventBean[] eventsPerStream, boolean isNewData, ExprEvaluatorContext context)
                {
View Full Code Here

        if (streamNum == -1)
        {
            throw new ExprValidationException("Stream by name '" + streamName + "' could not be found among all streams");
        }

        EventType eventType = validationContext.getStreamTypeService().getEventTypes()[streamNum];
        type = eventType.getUnderlyingType();
    }
View Full Code Here

            log.error("Unexpected exception encountered sending event " + input + " service '" + serviceName + "' :" + t.getMessage(), t);
        }
    }
    private WriterCacheEntry makeCacheEntry(String eventTypeName) {

        EventType eventType = engine.getEventAdapterService().getExistsTypeByName(eventTypeName);
        if (eventType == null) {
            log.info("Event type by name '" + eventTypeName + "' not found.");
            return null;
        }
View Full Code Here

   * @return
   */
  public static synchronized String createInsertQuery(
      VirtualDataWindowContext context) {
    final String table = context.getNamedWindowName();
    final EventType eventType = context.getEventType();

    final StringBuffer queryBuffer = new StringBuffer();

    queryBuffer.append(String.format("INSERT INTO %s ", table));
    queryBuffer.append("( ");
    boolean firstColumn = true;
    final String[] propertyNames = eventType.getPropertyNames();
    for (String propertyName : propertyNames) {
      if (firstColumn) {
        firstColumn = false;
      } else {
        queryBuffer.append(", ");
View Full Code Here

   * @return
   */
  public static synchronized String createCreateTableQuery(
      VirtualDataWindowContext context) {
    final String table = context.getNamedWindowName();
    final EventType eventType = context.getEventType();

    final StringBuffer queryBuffer = new StringBuffer();

    queryBuffer.append(String.format("CREATE TABLE %s ", table));
    queryBuffer.append("( ");
    // queryBuffer.append(String.format("%s uuid, ", TABLE_ID));
    boolean firstColumn = true;
    final DatatypeRegistry registry = DatatypeRegistry.newInstance();

    final String[] propertyNames = eventType.getPropertyNames();
    for (String propertyName : propertyNames) {
      // final EventPropertyDescriptor propertyDescriptor = eventType
      // .getPropertyDescriptor(propertyName);
      if (firstColumn) {
        firstColumn = false;
      } else {
        queryBuffer.append(", ");
      }
      Class<?> esperPropertyType = eventType
          .getPropertyType(propertyName);
      String propertyType = registry.get(esperPropertyType).getName()
          .name();
      queryBuffer.append(String.format("%s %s", propertyName,
          propertyType));
View Full Code Here

            }
            istreamOnly = getIstreamOnly(streamTypeService, streamNum);
            if ((accessType == AggregationAccessType.WINDOW) && istreamOnly && !streamTypeService.isOnDemandStreams()) {
                throw new ExprValidationException(getErrorPrefix() + " requires that the aggregated events provide a remove stream; Defined a data window onto the stream or use 'firstever', 'lastever' or 'nth' instead");
            }
            EventType type = streamTypeService.getEventTypes()[streamNum];
            resultType = type.getUnderlyingType();
            final int streamNumUsed = streamNum;
            final Class returnType = resultType;
            evaluator = new ExprEvaluator() {
                public Object evaluate(EventBean[] eventsPerStream, boolean isNewData, ExprEvaluatorContext context)
                {
View Full Code Here

            throws ExprValidationException
    {
        int length = spec.getAtoms().size();
        EventPropertyGetter[] getters = new EventPropertyGetter[length];
        FragmentEventType types[] = new FragmentEventType[length];
        EventType currentEventType = sourceEventType;
        ExprEvaluator whereClauses[] = new ExprEvaluator[length];

        List<EventType> streamEventTypes = new ArrayList<EventType>();
        List<String> streamNames = new ArrayList<String>();
        Map<String, Integer> streamNameAndNumber = new HashMap<String,Integer>();
        List<String> propertyNames = new ArrayList<String>();
        ExprEvaluatorContext validateContext = new ExprEvaluatorContext()
        {
            public TimeProvider getTimeProvider()
            {
                return timeProvider;
            }

            public ExpressionResultCacheService getExpressionResultCacheService() {
                return null;
            }
        };

        streamEventTypes.add(sourceEventType);
        streamNames.add(optionalSourceStreamName);
        streamNameAndNumber.put(optionalSourceStreamName, 0);
        propertyNames.add(sourceEventType.getName());

        List<SelectClauseElementCompiled> cumulativeSelectClause = new ArrayList<SelectClauseElementCompiled>();
        for (int i = 0; i < length; i++)
        {
            PropertyEvalAtom atom = spec.getAtoms().get(i);

            // obtain property info
            String propertyName = atom.getPropertyName();
            FragmentEventType fragmentEventType = currentEventType.getFragmentType(propertyName);
            if (fragmentEventType == null)
            {
                throw new ExprValidationException("Property expression '" + propertyName + "' against type '" + currentEventType.getName() + "' does not return a fragmentable property value");
            }
            EventPropertyGetter getter = currentEventType.getGetter(propertyName);
            if (getter == null)
            {
                throw new ExprValidationException("Property expression '" + propertyName + "' against type '" + currentEventType.getName() + "' does not return a fragmentable property value");
            }

            // validate where clause, if any
            streamEventTypes.add(fragmentEventType.getFragmentType());
            streamNames.add(atom.getOptionalAsName());
View Full Code Here

import java.util.*;

public class ExprDotEvalWhere extends ExprDotEvalEnumMethodBase {

    public EventType[] getAddStreamTypes(String enumMethodUsedName, List<String> goesToNames, EventType inputEventType, Class collectionComponentType, List<ExprDotEvalParam> bodiesAndParameters) {
        EventType firstParamType;
        if (inputEventType == null) {
            firstParamType = ExprDotNodeUtility.makeTransientMapType(enumMethodUsedName, goesToNames.get(0), collectionComponentType);
        }
        else {
            firstParamType = inputEventType;
View Full Code Here

    public void createNewVariable(String variableName, String variableType, Object value, StatementExtensionSvcContext extensionServicesContext) throws VariableExistsException, VariableTypeException
    {
        // Determime the variable type
        Class type = JavaClassHelper.getClassForSimpleName(variableType);
        EventType eventType = null;
        if (type == null) {
            if (variableType.toLowerCase().equals("object")) {
                type = Object.class;
            }
            if (type == null) {
                eventType = eventAdapterService.getExistsTypeByName(variableType);
                if (eventType != null) {
                    type = eventType.getUnderlyingType();
                }
            }
            if (type == null) {
                throw new VariableTypeException("Cannot create variable '" + variableName + "', type '" +
                    variableType + "' is not a recognized type");
View Full Code Here

TOP

Related Classes of com.espertech.esper.client.EventType

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.