Package com.espertech.esper.client

Examples of com.espertech.esper.client.EventPropertyDescriptor


        }

        Class propertyType = streamType.getPropertyType(propertyName);
        if (propertyType == null)
        {
            EventPropertyDescriptor desc = streamType.getPropertyDescriptor(propertyName);
            if (desc == null) {
                Pair<Integer, String> possibleMatch = findLevMatch(propertyName, streamType);
                String message = "Property named '" + propertyName + "' is not valid in stream '" + streamName + "'";
                throw new PropertyNotFoundException(message, possibleMatch);
            }
            propertyType = desc.getPropertyType();
        }

        return new PropertyResolutionDescriptor(streamName, streamType, propertyName, index, propertyType);
    }
View Full Code Here


        for (int i = 0; i < assignments.size(); i++)
        {
            OnTriggerSetAssignment assignment = assignments.get(i);
            String propertyName = assignment.getVariableName();
            expressions[i] = assignment.getExpression().getExprEvaluator();
            EventPropertyDescriptor writableProperty = eventTypeSPI.getWritableProperty(propertyName);

            if (writableProperty == null)
            {
                int indexDot = propertyName.indexOf(".");
                if ((namedWindowAlias != null) && (indexDot != -1)) {
                    String prefix = propertyName.substring(0, indexDot);
                    String name = propertyName.substring(indexDot + 1);
                    if (prefix.equals(namedWindowAlias)) {
                        writableProperty = eventTypeSPI.getWritableProperty(name);
                        propertyName = name;
                    }
                }
                if (writableProperty == null) {
                    throw new ExprValidationException("Property '" + propertyName + "' is not available for write access");
                }
            }
            writers[i] = eventTypeSPI.getWriter(propertyName);
            notNullableField[i] = writableProperty.getPropertyType().isPrimitive();

            properties.add(propertyName);
            wideners[i] = TypeWidenerFactory.getCheckPropertyAssignType(assignment.getExpression().toExpressionString(), assignment.getExpression().getExprEvaluator().getType(),
                    writableProperty.getPropertyType(), propertyName);
        }
        String[] propertyNames = properties.toArray(new String[properties.size()]);

        // map expression index to property index
        List<String> propertiesUniqueList = new ArrayList<String>(new HashSet<String>(properties));
View Full Code Here

        TypeWidener[] wideners = new TypeWidener[desc.getAssignments().size()];
        List<String> properties = new ArrayList<String>();
        for (int i = 0; i < desc.getAssignments().size(); i++)
        {
            OnTriggerSetAssignment assignment = desc.getAssignments().get(i);
            EventPropertyDescriptor writableProperty = eventTypeSPI.getWritableProperty(assignment.getVariableName());

            if (writableProperty == null)
            {
                throw new ExprValidationException("Property '" + assignment.getVariableName() + "' is not available for write access");
            }

            wideners[i] = TypeWidenerFactory.getCheckPropertyAssignType(assignment.getExpression().toExpressionString(), assignment.getExpression().getExprEvaluator().getType(),
                    writableProperty.getPropertyType(), assignment.getVariableName());
            properties.add(assignment.getVariableName());
        }

        // check copy-able
        EventBeanCopyMethod copyMethod = eventTypeSPI.getCopyMethod(properties.toArray(new String[properties.size()]));
View Full Code Here

            OnTriggerSetAssignment xxx = desc.getAssignments().get(i);
            Pair<String, ExprNode> assignmentPair = ExprNodeUtility.checkGetAssignmentToProp(xxx.getExpression());
            if (assignmentPair == null) {
                throw new ExprValidationException("Missing property assignment expression in assignment number " + i);
            }
            EventPropertyDescriptor writableProperty = eventTypeSPI.getWritableProperty(assignmentPair.getFirst());

            if (writableProperty == null)
            {
                throw new ExprValidationException("Property '" + assignmentPair.getFirst() + "' is not available for write access");
            }

            wideners[i] = TypeWidenerFactory.getCheckPropertyAssignType(ExprNodeUtility.toExpressionStringMinPrecedence(assignmentPair.getSecond()), assignmentPair.getSecond().getExprEvaluator().getType(),
                    writableProperty.getPropertyType(), assignmentPair.getFirst());
            properties.add(assignmentPair.getFirst());
        }

        // check copy-able
        EventBeanCopyMethod copyMethod = eventTypeSPI.getCopyMethod(properties.toArray(new String[properties.size()]));
View Full Code Here

                    }
                    found = true;
                }
                else {
                    // mapped(expression) or array(expression) are not property names but expressions against a property by name "mapped" or "array"
                    EventPropertyDescriptor descriptor = eventTypes[i].getPropertyDescriptor(propertyName);
                    if (descriptor != null) {
                        found = true;
                        propertyType = descriptor.getPropertyType();
                        if (descriptor.isFragment() && obtainFragment) {
                            fragmentEventType =  eventTypes[i].getFragmentType(propertyName);
                        }
                    }
                }
View Full Code Here

        if (!explicitPropertiesOnly) {
            propertyType = streamType.getPropertyType(propertyName);
            if (propertyType == null)
            {
                EventPropertyDescriptor desc = streamType.getPropertyDescriptor(propertyName);
                if (desc == null) {
                    throw handlePropertyNotFound(propertyName, streamName, streamType);
                }
                propertyType = desc.getPropertyType();
                if (obtainFragment && desc.isFragment()) {
                    fragmentEventType = streamType.getFragmentType(propertyName);
                }
            }
            else {
                if (obtainFragment) {
View Full Code Here

            EventPropertyWriter writer = getWriter(propertyName);
            if (writer == null) {
                return null;
            }
            MappedProperty mapProp = (MappedProperty) property;
            return new EventPropertyDescriptor(mapProp.getPropertyNameAtomic(), Object.class, null, false, true, false, true, false);
        }
        if (property instanceof IndexedProperty) {
            EventPropertyWriter writer = getWriter(propertyName);
            if (writer == null) {
                return null;
            }
            IndexedProperty indexedProp = (IndexedProperty) property;
            return new EventPropertyDescriptor(indexedProp.getPropertyNameAtomic(), Object.class, null, true, false, true, false, false);
        }
        return null;
    }
View Full Code Here

        // see if the stream or property name (the prefix) can be resolved by itself, without suffix
        // the property available may be indexed or mapped
        try {
            PropertyResolutionDescriptor desc = streamTypeService.resolveByPropertyName(streamOrPropertyName, false);
            if (desc != null) {
                EventPropertyDescriptor d2 = desc.getStreamEventType().getPropertyDescriptor(streamOrPropertyName);
                if (d2 != null) {
                    String text = null;
                    if (d2.isIndexed()) {
                        text = "an indexed property and requires an index or enumeration method to access values";
                    }
                    if (d2.isMapped()) {
                        text = "a mapped property and requires keyed access";
                    }
                    if (text != null) {
                        throw new ExprValidationPropertyException("Failed to resolve property '" + propertyNameCandidate + "' (property '" + streamOrPropertyName + "' is " + text + ")");
                    }
View Full Code Here

            EventPropertyWriter writer = getWriter(propertyName);
            if (writer == null) {
                return null;
            }
            MappedProperty mapProp = (MappedProperty) property;
            return new EventPropertyDescriptor(mapProp.getPropertyNameAtomic(), Object.class, null, false, true, false, true, false);
        }
        if (property instanceof IndexedProperty) {
            EventPropertyWriter writer = getWriter(propertyName);
            if (writer == null) {
                return null;
            }
            IndexedProperty indexedProp = (IndexedProperty) property;
            return new EventPropertyDescriptor(indexedProp.getPropertyNameAtomic(), Object.class, null, true, false, true, false, false);
        }
        return null;
    }
View Full Code Here

            // handle assignment "property = value"
            if (possibleAssignment != null) {

                String propertyName = possibleAssignment.getFirst();
                EventPropertyDescriptor writableProperty = eventTypeSPI.getWritableProperty(propertyName);

                if (writableProperty == null) {
                    Pair<String, EventPropertyDescriptor> nameWriteablePair = checkIndexedOrMappedProp(possibleAssignment.getFirst(), namedWindowName, namedWindowAlias, eventTypeSPI);
                    propertyName = nameWriteablePair.getFirst();
                    writableProperty = nameWriteablePair.getSecond();
                }

                ExprEvaluator evaluator = possibleAssignment.getSecond().getExprEvaluator();
                EventPropertyWriter writers = eventTypeSPI.getWriter(propertyName);
                boolean notNullableField = writableProperty.getPropertyType().isPrimitive();

                properties.add(propertyName);
                TypeWidener widener = TypeWidenerFactory.getCheckPropertyAssignType(possibleAssignment.getSecond().toExpressionString(), possibleAssignment.getSecond().getExprEvaluator().getType(),
                        writableProperty.getPropertyType(), propertyName);
                updateItem = new NamedWindowUpdateItem(evaluator, propertyName, writers, notNullableField, widener);
            }
            // handle non-assignment, i.e. UDF or other expression
            else {
                ExprEvaluator evaluator = assignment.getExpression().getExprEvaluator();
View Full Code Here

TOP

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

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.