Examples of VariableMetaData


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

            {
                // expected
            }
        }

        VariableMetaData variableMetadata = validationContext.getVariableService().getVariableMetaData(variableName);
        if (variableMetadata == null) {
            throw new ExprValidationException("Failed to find variable by name '" + variableName + "'");
        }
        isPrimitive = variableMetadata.getEventType() == null;
        variableType = variableMetadata.getType();
        if (optSubPropName != null) {
            if (variableMetadata.getEventType() == null) {
                throw new ExprValidationException("Property '" + optSubPropName + "' is not valid for variable '" + variableName + "'");
            }
            eventTypeGetter = variableMetadata.getEventType().getGetter(optSubPropName);
            if (eventTypeGetter == null) {
                throw new ExprValidationException("Property '" + optSubPropName + "' is not valid for variable '" + variableName + "'");
            }
            variableType = variableMetadata.getEventType().getPropertyType(optSubPropName);
        }

        readersPerCp = validationContext.getVariableService().getReadersPerCP(variableName);
        if (variableMetadata.getContextPartitionName() == null) {
            readerNonCP = readersPerCp.get(VariableService.NOCONTEXT_AGENTINSTANCEID);
        }
    }
View Full Code Here

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

            if (indexDot != -1)
            {
                String stream = prop.getPropertyName().substring(0, indexDot);
                String property = prop.getPropertyName().substring(indexDot + 1, prop.getPropertyName().length());

                VariableMetaData variableMetaData = mapContext.getVariableService().getVariableMetaData(stream);
                if (variableMetaData != null)
                {
                    mapContext.setHasVariables(true);
                    ExprVariableNodeImpl node = new ExprVariableNodeImpl(variableMetaData, property);
                    mapContext.getVariableNames().add(variableMetaData.getVariableName());
                    String message = VariableServiceUtil.checkVariableContextName(mapContext.getContextName(), variableMetaData);
                    if (message != null) {
                        throw new EPException(message);
                    }
                    return node;
                }

                if (mapContext.getContextName() != null) {
                    com.espertech.esper.core.context.util.ContextDescriptor contextDescriptor = mapContext.getContextManagementService().getContextDescriptor(mapContext.getContextName());
                    if (contextDescriptor != null && contextDescriptor.getContextPropertyRegistry().isContextPropertyPrefix(stream)) {
                        return new ExprContextPropertyNode(property);
                    }
                }

                return new ExprIdentNodeImpl(property, stream);
            }

            VariableMetaData variableMetaData = mapContext.getVariableService().getVariableMetaData(prop.getPropertyName());
            if (variableMetaData != null)
            {
                mapContext.setHasVariables(true);
                ExprVariableNodeImpl node = new ExprVariableNodeImpl(variableMetaData, null);
                mapContext.getVariableNames().add(variableMetaData.getVariableName());
                String message = VariableServiceUtil.checkVariableContextName(mapContext.getContextName(), variableMetaData);
                if (message != null) {
                    throw new EPException(message);
                }
                return node;
View Full Code Here

Examples of org.jboss.metadata.web.spec.VariableMetaData

* @author Remy Maucherat
*/
public class VariableMetaDataParser extends MetaDataElementParser {

    public static VariableMetaData parse(XMLStreamReader reader) throws XMLStreamException {
        VariableMetaData variable = new VariableMetaData();

        // Handle attributes
        final int count = reader.getAttributeCount();
        for (int i = 0; i < count; i ++) {
            final String value = reader.getAttributeValue(i);
            if (reader.getAttributeNamespace(i) != null) {
                continue;
            }
            final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
            switch (attribute) {
                case ID: {
                    variable.setId(value);
                    break;
                }
                default: throw unexpectedAttribute(reader, i);
            }
        }

        DescriptionsImpl descriptions = new DescriptionsImpl();
        // Handle elements
        while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
            if (DescriptionsMetaDataParser.parse(reader, descriptions)) {
                if (variable.getDescriptions() == null) {
                    variable.setDescriptions(descriptions);
                }
                continue;
            }
            final Element element = Element.forName(reader.getLocalName());
            switch (element) {
                case NAME_GIVEN:
                    variable.setNameGiven(reader.getElementText());
                    break;
                case NAME_FROM_ATTRIBUTE:
                    variable.setNameFromAttribute(reader.getElementText());
                    break;
                case VARIABLE_CLASS:
                    variable.setVariableClass(reader.getElementText());
                    break;
                case DECLARE:
                    variable.setDeclare(reader.getElementText());
                    break;
                case SCOPE:
                    variable.setScope(VariableScopeType.valueOf(reader.getElementText()));
                    break;
                default: throw unexpectedElement(reader);
            }
        }

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.