本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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);
}
示例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);
}
示例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());
}
}