当前位置: 首页>>代码示例>>Java>>正文


Java StreamDefinition.attribute方法代码示例

本文整理汇总了Java中org.wso2.siddhi.query.api.definition.StreamDefinition.attribute方法的典型用法代码示例。如果您正苦于以下问题:Java StreamDefinition.attribute方法的具体用法?Java StreamDefinition.attribute怎么用?Java StreamDefinition.attribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.wso2.siddhi.query.api.definition.StreamDefinition的用法示例。


在下文中一共展示了StreamDefinition.attribute方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: visitDefinitionStream

import org.wso2.siddhi.query.api.definition.StreamDefinition; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 * <p/>
 * <p>The default implementation returns the result of calling
 * {@link #visitChildren} on {@code ctx}.</p>
 *
 * @param ctx
 */
@Override
public Object visitDefinitionStream(@NotNull SiddhiQLGrammarParser.DefinitionStreamContext ctx) {

    StreamDefinition streamDefinition = QueryFactory.createStreamDefinition();
    streamDefinition.name(ctx.source().getText());

    List<Attribute> attributeList = (List<Attribute>) visitDefinition(ctx.definition());
    if (attributeList != null) {
        for (Attribute attribute : attributeList) {
            streamDefinition.attribute(attribute.getName(), attribute.getType());
        }
    } else {
        throw new SiddhiParserException("Operation not supported :fromSource and likeSource");
    }
    return streamDefinition;
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:25,代码来源:SiddhiQLGrammarBasedVisitorImpl.java

示例2: createNewMetaStreamEventWithStartEnd

import org.wso2.siddhi.query.api.definition.StreamDefinition; //导入方法依赖的package包/类
private static MetaStreamEvent createNewMetaStreamEventWithStartEnd(MatchingMetaInfoHolder matchingMetaInfoHolder,
                                                                    List<Attribute> additionalAttributes) {
    MetaStreamEvent metaStreamEventWithStartEnd;
    StreamDefinition streamDefinitionWithStartEnd = new StreamDefinition();

    if (matchingMetaInfoHolder.getMetaStateEvent().getMetaStreamEvents().length == 1) {
        metaStreamEventWithStartEnd = new MetaStreamEvent();
    } else {
        metaStreamEventWithStartEnd = matchingMetaInfoHolder.getMetaStateEvent()
                .getMetaStreamEvent(matchingMetaInfoHolder.getMatchingStreamEventIndex());
        cloneStreamDefinition((StreamDefinition) metaStreamEventWithStartEnd.getLastInputDefinition(),
                streamDefinitionWithStartEnd);
    }

    streamDefinitionWithStartEnd.attribute(additionalAttributes.get(0).getName(),
            additionalAttributes.get(0).getType());
    streamDefinitionWithStartEnd.attribute(additionalAttributes.get(1).getName(),
            additionalAttributes.get(1).getType());
    initMetaStreamEvent(metaStreamEventWithStartEnd, streamDefinitionWithStartEnd);
    return metaStreamEventWithStartEnd;
}
 
开发者ID:wso2,项目名称:siddhi,代码行数:22,代码来源:AggregationRuntime.java

示例3: enlargeStream

import org.wso2.siddhi.query.api.definition.StreamDefinition; //导入方法依赖的package包/类
public int enlargeStream(String streamName, List<ColumnNameTypeValue> columns, Boolean raiseException) throws
        ServiceException {
    int addedColumns = 0;
    StreamDefinition streamMetaData = siddhiManager.getStreamDefinition(streamName);
    for (ColumnNameTypeValue columnNameTypeValue : columns) {
        if (!SiddhiUtils.columnAlreadyExistsInStream(columnNameTypeValue.getColumn(), streamMetaData)) {
            addedColumns++;
            // JPFM -- Updating the columns in streamStatusDao
            streamStatusDao.addColumn(streamName, columnNameTypeValue);
            streamMetaData.attribute(columnNameTypeValue.getColumn(), getSiddhiType(columnNameTypeValue.getType()));
        } else {
            if (raiseException) {
                throw new ServiceException(String.format("Alter stream error, Column %s already "
                                + "exists.",
                        columnNameTypeValue.getColumn()));
            }
        }
    }

    return addedColumns;
}
 
开发者ID:Stratio,项目名称:Decision,代码行数:22,代码来源:StreamOperationServiceWithoutMetrics.java

示例4: visitDefinition_stream

import org.wso2.siddhi.query.api.definition.StreamDefinition; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 * <p/>
 * <p>The default implementation returns the result of calling
 * {@link #visitChildren} on {@code ctx}.</p>
 *
 * @param ctx
 */
@Override
public StreamDefinition visitDefinition_stream(@NotNull SiddhiQLParser.Definition_streamContext ctx) {
    Source source = (Source) visit(ctx.source());
    if (source.isInnerStream) {
        throw newSiddhiParserException(ctx, " InnerStreams cannot be defined!");
    }
    StreamDefinition streamDefinition = StreamDefinition.id(source.streamId);
    List<SiddhiQLParser.Attribute_nameContext> attribute_names = ctx.attribute_name();
    List<SiddhiQLParser.Attribute_typeContext> attribute_types = ctx.attribute_type();
    for (int i = 0; i < attribute_names.size(); i++) {
        SiddhiQLParser.Attribute_nameContext attributeNameContext = attribute_names.get(i);
        SiddhiQLParser.Attribute_typeContext attributeTypeContext = attribute_types.get(i);
        streamDefinition.attribute((String) visit(attributeNameContext), (Attribute.Type) visit(attributeTypeContext));

    }
    for (SiddhiQLParser.AnnotationContext annotationContext : ctx.annotation()) {
        streamDefinition.annotation((Annotation) visit(annotationContext));
    }
    return streamDefinition;
}
 
开发者ID:sacjaya,项目名称:siddhi-3,代码行数:29,代码来源:SiddhiQLBaseVisitorImpl.java

示例5: getStreamDefinition

import org.wso2.siddhi.query.api.definition.StreamDefinition; //导入方法依赖的package包/类
public StreamDefinition getStreamDefinition(String streamId) {
	StreamDefinition streamDefinition = StreamDefinition.id(streamId);
	for (int i = 0; i < getFieldNames().length; i++) {
		streamDefinition.attribute(getFieldNames()[i], SiddhiTypeFactory.getAttributeType(getFieldTypes()[i]));
	}
	return streamDefinition;
}
 
开发者ID:haoch,项目名称:flink-siddhi,代码行数:8,代码来源:SiddhiStreamSchema.java

示例6: getStreamDefinition

import org.wso2.siddhi.query.api.definition.StreamDefinition; //导入方法依赖的package包/类
public StreamDefinition getStreamDefinition(String streamId) {
    StreamDefinition streamDefinition = StreamDefinition.id(streamId);
    for (int i = 0; i < getFieldNames().length; i++) {
        streamDefinition.attribute(getFieldNames()[i], SiddhiTypeFactory.getAttributeType(getFieldTypes()[i]));
    }
    return streamDefinition;
}
 
开发者ID:apache,项目名称:bahir-flink,代码行数:8,代码来源:SiddhiStreamSchema.java

示例7: visitDefinition_stream

import org.wso2.siddhi.query.api.definition.StreamDefinition; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 * <p>The default implementation returns the result of calling
 * {@link #visitChildren} on {@code ctx}.</p>
 *
 * @param ctx
 */
@Override
public StreamDefinition visitDefinition_stream(@NotNull SiddhiQLParser.Definition_streamContext ctx) {
    Source source = (Source) visit(ctx.source());
    if (source.isInnerStream) {
        throw newSiddhiParserException(ctx, " InnerStreams cannot be defined!");
    }
    try {
        StreamDefinition streamDefinition = StreamDefinition.id(source.streamId);
        populateQueryContext(streamDefinition, ctx);
        List<SiddhiQLParser.Attribute_nameContext> attribute_names = ctx.attribute_name();
        List<SiddhiQLParser.Attribute_typeContext> attribute_types = ctx.attribute_type();
        for (int i = 0; i < attribute_names.size(); i++) {
            SiddhiQLParser.Attribute_nameContext attributeNameContext = attribute_names.get(i);
            SiddhiQLParser.Attribute_typeContext attributeTypeContext = attribute_types.get(i);
            streamDefinition.attribute((String) visit(attributeNameContext), (Attribute.Type) visit
                    (attributeTypeContext));

        }
        for (SiddhiQLParser.AnnotationContext annotationContext : ctx.annotation()) {
            streamDefinition.annotation((Annotation) visit(annotationContext));
        }
        return streamDefinition;
    } catch (Throwable t) {
        throw newSiddhiParserException(ctx, t.getMessage(), t);
    }
}
 
开发者ID:wso2,项目名称:siddhi,代码行数:34,代码来源:SiddhiQLBaseVisitorImpl.java

示例8: createInternalStream

import org.wso2.siddhi.query.api.definition.StreamDefinition; //导入方法依赖的package包/类
public void createInternalStream(String streamName, List<ColumnNameTypeValue> columns) {
   StreamDefinition newStream = QueryFactory.createStreamDefinition().name(streamName);
   for (ColumnNameTypeValue column : columns) {
       newStream.attribute(column.getColumn(), getSiddhiType(column.getType()));
   }
   siddhiManager.defineStream(newStream);
   streamStatusDao.createInferredStream(streamName, columns);
}
 
开发者ID:Stratio,项目名称:Decision,代码行数:9,代码来源:StreamOperationServiceWithoutMetrics.java

示例9: createStream

import org.wso2.siddhi.query.api.definition.StreamDefinition; //导入方法依赖的package包/类
public void createStream(String streamName, List<ColumnNameTypeValue> columns) {
    StreamDefinition newStream = QueryFactory.createStreamDefinition().name(streamName);
    if (columns!=null) {
        for (ColumnNameTypeValue column : columns) {
            newStream.attribute(column.getColumn(), getSiddhiType(column.getType()));
        }
    }
    siddhiManager.defineStream(newStream);
    streamStatusDao.create(streamName, columns);
}
 
开发者ID:Stratio,项目名称:Decision,代码行数:11,代码来源:StreamOperationServiceWithoutMetrics.java

示例10: cloneStreamDefinition

import org.wso2.siddhi.query.api.definition.StreamDefinition; //导入方法依赖的package包/类
private static void cloneStreamDefinition(StreamDefinition originalStreamDefinition,
                                          StreamDefinition newStreamDefinition) {
    for (Attribute attribute : originalStreamDefinition.getAttributeList()) {
        newStreamDefinition.attribute(attribute.getName(), attribute.getType());
    }
}
 
开发者ID:wso2,项目名称:siddhi,代码行数:7,代码来源:AggregationRuntime.java


注:本文中的org.wso2.siddhi.query.api.definition.StreamDefinition.attribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。