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


Java StreamDefinition.getAttributeList方法代码示例

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


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

示例1: constructProcessExpressionExecutors

import org.wso2.siddhi.query.api.definition.StreamDefinition; //导入方法依赖的package包/类
private static List<ExpressionExecutor> constructProcessExpressionExecutors(
        SiddhiAppContext siddhiAppContext, Map<String, Table> tableMap,
        String aggregatorName, int baseAggregatorBeginIndex,
        List<Expression> finalBaseAggregators,
        StreamDefinition incomingOutputStreamDefinition,
        MetaStreamEvent processedMetaStreamEvent,
        List<VariableExpressionExecutor> processVariableExpressionExecutors, boolean groupBy) {
    List<ExpressionExecutor> processExpressionExecutors = new ArrayList<>();
    List<Attribute> attributeList = incomingOutputStreamDefinition.getAttributeList();
    for (int i = 0; i < baseAggregatorBeginIndex; i++) {
        Attribute attribute = attributeList.get(i);
        VariableExpressionExecutor variableExpressionExecutor = (VariableExpressionExecutor) ExpressionParser
                .parseExpression(new Variable(attribute.getName()), processedMetaStreamEvent, 0,
                        tableMap, processVariableExpressionExecutors, siddhiAppContext, groupBy,
                        0, aggregatorName);
        processExpressionExecutors.add(variableExpressionExecutor);
    }

    for (Expression expression : finalBaseAggregators) {
        ExpressionExecutor expressionExecutor = ExpressionParser.parseExpression(expression,
                processedMetaStreamEvent, 0, tableMap, processVariableExpressionExecutors,
                siddhiAppContext, groupBy, 0, aggregatorName);
        processExpressionExecutors.add(expressionExecutor);
    }
    return processExpressionExecutors;
}
 
开发者ID:wso2,项目名称:siddhi,代码行数:27,代码来源:AggregationParser.java

示例2: initDefaultTables

import org.wso2.siddhi.query.api.definition.StreamDefinition; //导入方法依赖的package包/类
private static HashMap<TimePeriod.Duration, Table> initDefaultTables(
        String aggregatorName, List<TimePeriod.Duration> durations,
        StreamDefinition streamDefinition, SiddhiAppRuntimeBuilder siddhiAppRuntimeBuilder,
        List<Annotation> annotations, List<Variable> groupByVariableList) {
    HashMap<TimePeriod.Duration, Table> aggregationTableMap = new HashMap<>();
    // Create annotations for primary key
    Annotation primaryKeyAnnotation = new Annotation(SiddhiConstants.ANNOTATION_PRIMARY_KEY);
    primaryKeyAnnotation.element(null, "AGG_TIMESTAMP");
    for (Variable groupByVariable : groupByVariableList) {
        primaryKeyAnnotation.element(null, groupByVariable.getAttributeName());
    }
    annotations.add(primaryKeyAnnotation);
    for (TimePeriod.Duration duration : durations) {
        String tableId = aggregatorName + "_" + duration.toString();
        TableDefinition tableDefinition = TableDefinition.id(tableId);
        for (Attribute attribute : streamDefinition.getAttributeList()) {
            tableDefinition.attribute(attribute.getName(), attribute.getType());
        }
        annotations.forEach(tableDefinition::annotation);
        siddhiAppRuntimeBuilder.defineTable(tableDefinition);
        aggregationTableMap.put(duration, siddhiAppRuntimeBuilder.getTableMap().get(tableId));
    }
    return aggregationTableMap;
}
 
开发者ID:wso2,项目名称:siddhi,代码行数:25,代码来源:AggregationParser.java

示例3: getStreamDefinitionExpression

import org.wso2.siddhi.query.api.definition.StreamDefinition; //导入方法依赖的package包/类
public String getStreamDefinitionExpression(StreamDefinition streamDefinition) {
	List<String> columns = new ArrayList<>();
	Preconditions.checkNotNull(streamDefinition, "StreamDefinition is null");
	for (Attribute attribute : streamDefinition.getAttributeList()) {
		columns.add(String.format("%s %s", attribute.getName(), attribute.getType().toString().toLowerCase()));
	}
	return String.format(DEFINE_STREAM_TEMPLATE, streamDefinition.getId(), StringUtils.join(columns, ","));
}
 
开发者ID:haoch,项目名称:flink-siddhi,代码行数:9,代码来源:SiddhiStreamSchema.java

示例4: getStreamDefinitionExpression

import org.wso2.siddhi.query.api.definition.StreamDefinition; //导入方法依赖的package包/类
public String getStreamDefinitionExpression(StreamDefinition streamDefinition) {
    List<String> columns = new ArrayList<>();
    Preconditions.checkNotNull(streamDefinition, "StreamDefinition is null");
    for (Attribute attribute : streamDefinition.getAttributeList()) {
        columns.add(String.format("%s %s", attribute.getName(), attribute.getType().toString().toLowerCase()));
    }
    return String.format(DEFINE_STREAM_TEMPLATE, streamDefinition.getId(), StringUtils.join(columns, ","));
}
 
开发者ID:apache,项目名称:bahir-flink,代码行数:9,代码来源:SiddhiStreamSchema.java

示例5: declareOutputFields

import org.wso2.siddhi.query.api.definition.StreamDefinition; //导入方法依赖的package包/类
@Override
public void declareOutputFields(OutputFieldsDeclarer declarer) {
	if(siddhiManager == null){
		init();
	}
	
	boolean useDefault = (exportedStreams.length == 1) && useDefaultAsStreamName;
	
	for(String streamId:  exportedStreams){
		StreamDefinition streamDefinition = siddhiManager.getStreamDefinition(streamId);
		if(streamDefinition == null){
			throw new RuntimeException("Cannot find stream "+ streamId + " "+ this); 
		}
		List<Attribute> attributeList = streamDefinition.getAttributeList();
		List<String> list = new ArrayList<String>();
		for(Attribute attribute: attributeList){
			list.add(attribute.getName());
		}
		Fields feilds = new Fields(list);
		if(useDefault){
			//this is so that most common Storm topologies would work with
			//Siddhi bolt.  See setUseDefaultAsStreamName(..)
			log.info(componentID + ">Siddhi: declaring stream as default");
			declarer.declare(feilds);
		}else{
			declarer.declareStream(streamId, feilds);
		}

	}
}
 
开发者ID:lasanthafdo,项目名称:siddhi-storm,代码行数:31,代码来源:SiddhiBolt.java

示例6: declareOutputFields

import org.wso2.siddhi.query.api.definition.StreamDefinition; //导入方法依赖的package包/类
@Override
public void declareOutputFields(OutputFieldsDeclarer declarer) {
    if (siddhiManager == null) {
        init();
    }

    boolean useDefault = (exportedStreams.length == 1) && useDefaultAsStreamName;

    for (String streamId : exportedStreams) {
        StreamDefinition streamDefinition = siddhiManager.getStreamDefinition(streamId);
        if (streamDefinition == null) {
            throw new RuntimeException("Cannot find stream " + streamId + " " + this);
        }
        List<Attribute> attributeList = streamDefinition.getAttributeList();
        List<String> list = new ArrayList<String>();
        for (Attribute attribute : attributeList) {
            list.add(attribute.getName());
        }
        Fields feilds = new Fields(list);
        if (useDefault) {
            //this is so that most common Storm topologies would work with
            //Siddhi bolt.  See setUseDefaultAsStreamName(..)
            log.info(componentID + ">Siddhi: declaring stream as default");
            declarer.declare(feilds);
        } else {
            declarer.declareStream(streamId, feilds);
        }

    }
}
 
开发者ID:lasanthafdo,项目名称:siddhi-storm,代码行数:31,代码来源:SiddhiTransactionalBolt.java

示例7: SiddhiSpout

import org.wso2.siddhi.query.api.definition.StreamDefinition; //导入方法依赖的package包/类
public SiddhiSpout(StreamDefinition siddhiStreamDefinition, QueuedEventSource inputEventSource) {
    this.inputEventSource = inputEventSource;
    this.exportedSiddhiStreamDef = siddhiStreamDefinition;
    List<Attribute> attributeList = siddhiStreamDefinition.getAttributeList();
    this.attributeNames = new ArrayList<String>(attributeList.size());
    for (Attribute attribute : attributeList) {
        attributeNames.add(attribute.getName());
    }
}
 
开发者ID:lasanthafdo,项目名称:siddhi-storm,代码行数:10,代码来源:SiddhiSpout.java

示例8: declareOutputFields

import org.wso2.siddhi.query.api.definition.StreamDefinition; //导入方法依赖的package包/类
@Override
public void declareOutputFields(OutputFieldsDeclarer declarer) {
    if (siddhiManager == null) {
        try {
            init();
        } catch (StormConfigurationException e) {
            log.error("Error trying to re-initialize this bolt: " + e.getMessage(), e);
        }
    }

    boolean useDefault = (outputSiddhiStreamIds.length == 1) && useDefaultAsStreamName;

    for (String streamId : outputSiddhiStreamIds) {
        StreamDefinition streamDefinition = siddhiManager.getStreamDefinition(streamId);
        if (streamDefinition == null) {
            throw new RuntimeException("Cannot find stream " + streamId + " " + this);
        }
        List<Attribute> attributeList = streamDefinition.getAttributeList();
        List<String> list = new ArrayList<String>();
        for (Attribute attribute : attributeList) {
            list.add(attribute.getName());
        }
        Fields feilds = new Fields(list);
        if (useDefault) {
            //this is so that most common Storm topologies would work with
            //Siddhi bolt.  See setUseDefaultAsStreamName(..)
            log.info(componentID + ">Siddhi: declaring stream as default");
            declarer.declare(feilds);
        } else {
            declarer.declareStream(streamId, feilds);
        }

    }
}
 
开发者ID:lasanthafdo,项目名称:siddhi-storm,代码行数:35,代码来源:SiddhiProcessingBolt.java

示例9: columnAlreadyExistsInStream

import org.wso2.siddhi.query.api.definition.StreamDefinition; //导入方法依赖的package包/类
public static boolean columnAlreadyExistsInStream(String columnName, StreamDefinition streamMetaData) {

        for (Attribute column : streamMetaData.getAttributeList()) {
            if (column.getName().equalsIgnoreCase(columnName)) {
                return true;
            }
        }

        return false;
    }
 
开发者ID:Stratio,项目名称:Decision,代码行数:11,代码来源:SiddhiUtils.java

示例10: list

import org.wso2.siddhi.query.api.definition.StreamDefinition; //导入方法依赖的package包/类
public List<StratioStreamingMessage> list() {
    List<StratioStreamingMessage> result = new ArrayList<>();
    for (StreamDefinition streamDefinition : siddhiManager.getStreamDefinitions()) {
        if (suitableToList(streamDefinition.getStreamId())) {
            StratioStreamingMessage message = new StratioStreamingMessage();
            for (Attribute attribute : streamDefinition.getAttributeList()) {
                message.addColumn(new ColumnNameTypeValue(attribute.getName(), this.getStreamingType(attribute
                        .getType()), null));
            }
            StreamStatusDTO streamStatus = streamStatusDao.get(streamDefinition.getStreamId());

            if (streamStatus != null) {
                Map<String, QueryDTO> attachedQueries = streamStatus.getAddedQueries();

                for (Map.Entry<String, QueryDTO> entry : attachedQueries.entrySet()) {
                    message.addQuery(new StreamQuery(entry.getKey(), entry.getValue().getQueryRaw()));
                }
                message.setUserDefined(streamStatus.getUserDefined());
                message.setActiveActions(streamStatusDao.getEnabledActions(streamDefinition.getStreamId()));
            }

            message.setStreamName(streamDefinition.getStreamId());

            result.add(message);
        }
    }

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

示例11: build

import org.wso2.siddhi.query.api.definition.StreamDefinition; //导入方法依赖的package包/类
/**
 * Builds the execution plan from the input topics and the user-provided execution plan
 *
 * @return A string with the full siddhi-formatted execution plan
 * @throws ExecutionPlanException if any input specified is not found
 */

public String build() throws ExecutionPlanException {
    StringBuilder fullExecutionPlanBuilder = new StringBuilder();
    StringBuilder streamsWithFiltersBuilder = new StringBuilder();

    for (String topic : inputTopics) {
        StreamDefinition streamDefinition = streamDefinitions.get(topic);

        if (streamDefinition == null) {
            throw new InvalidExecutionPlanException("No stream definition found for topic " + topic + " on execution plan id " + id + "!");
        }

        List<Attribute> attributes = streamDefinition.getAttributeList();
        List<String> attributesWithType = new ArrayList<>();
        List<String> attributesNameList = new ArrayList<>();

        for (Attribute attribute : attributes) {
            attributesWithType.add(attribute.getName() + " " + attribute.getType());
            attributesNameList.add(attribute.getName());
        }

        String attributesWithTypeList = Joiner.on(", ").join(attributesWithType);

        fullExecutionPlanBuilder.append("define stream raw_")
                .append(topic)
                .append(" (")
                .append(attributesWithTypeList)
                .append(");");

        List<String> filtersList = new ArrayList<>();
        for (Map.Entry<String, String> entry : filters.entrySet()) {
            String field = entry.getKey();
            String value = entry.getValue();
            filtersList.add(field + " == '" + value + "'");
        }

        if (filtersList.isEmpty()) {
            streamsWithFiltersBuilder.append("from raw_")
                    .append(topic);
        } else {
            String filtersString = Joiner.on(" and ").join(filtersList);

            streamsWithFiltersBuilder.append("from raw_")
                    .append(topic)
                    .append("[")
                    .append(filtersString)
                    .append("]");
        }

        String attributesString = Joiner.on(", ").join(attributesNameList);

        streamsWithFiltersBuilder.append(" select ")
                .append(attributesString)
                .append(" insert into ")
                .append(topic)
                .append(";");
    }

    fullExecutionPlanBuilder.append(streamsWithFiltersBuilder);
    fullExecutionPlanBuilder.append(executionPlan);

    return fullExecutionPlanBuilder.toString();
}
 
开发者ID:redBorder,项目名称:cep,代码行数:70,代码来源:SiddhiPlan.java

示例12: 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.getAttributeList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。