Search in sources :

Example 6 with InMemoryTable

use of io.siddhi.core.table.InMemoryTable in project siddhi by wso2.

the class TestStoreContainingInMemoryTable method init.

@Override
protected void init(TableDefinition tableDefinition, ConfigReader configReader) {
    inMemoryTable = new InMemoryTable();
    MetaStreamEvent cacheTableMetaStreamEvent = new MetaStreamEvent();
    cacheTableMetaStreamEvent.addInputDefinition(tableDefinition);
    for (Attribute attribute : tableDefinition.getAttributeList()) {
        cacheTableMetaStreamEvent.addOutputData(attribute);
    }
    StreamEventCloner testTableStreamEventCloner = new StreamEventCloner(cacheTableMetaStreamEvent, storeEventPool);
    TableDefinition testStoreContainingIMTableDefinition = TableDefinition.id(tableDefinition.getId());
    for (Attribute attribute : tableDefinition.getAttributeList()) {
        testStoreContainingIMTableDefinition.attribute(attribute.getName(), attribute.getType());
    }
    for (Annotation annotation : tableDefinition.getAnnotations()) {
        if (!annotation.getName().equalsIgnoreCase("Store")) {
            testStoreContainingIMTableDefinition.annotation(annotation);
        }
    }
    inMemoryTable.init(testStoreContainingIMTableDefinition, storeEventPool, testTableStreamEventCloner, configReader, siddhiAppContext, recordTableHandler);
}
Also used : InMemoryTable(io.siddhi.core.table.InMemoryTable) Attribute(io.siddhi.query.api.definition.Attribute) StreamEventCloner(io.siddhi.core.event.stream.StreamEventCloner) TableDefinition(io.siddhi.query.api.definition.TableDefinition) MetaStreamEvent(io.siddhi.core.event.stream.MetaStreamEvent) Annotation(io.siddhi.query.api.annotation.Annotation)

Aggregations

InMemoryTable (io.siddhi.core.table.InMemoryTable)6 MetaStreamEvent (io.siddhi.core.event.stream.MetaStreamEvent)4 StreamEventCloner (io.siddhi.core.event.stream.StreamEventCloner)4 Annotation (io.siddhi.query.api.annotation.Annotation)4 Attribute (io.siddhi.query.api.definition.Attribute)4 Table (io.siddhi.core.table.Table)3 TableDefinition (io.siddhi.query.api.definition.TableDefinition)3 SiddhiAppRuntime (io.siddhi.core.SiddhiAppRuntime)2 SiddhiManager (io.siddhi.core.SiddhiManager)2 Event (io.siddhi.core.event.Event)2 InputHandler (io.siddhi.core.stream.input.InputHandler)2 Source (io.siddhi.core.stream.input.source.Source)2 StreamCallback (io.siddhi.core.stream.output.StreamCallback)2 Sink (io.siddhi.core.stream.output.sink.Sink)2 Test (org.testng.annotations.Test)2 ComplexEventChunk (io.siddhi.core.event.ComplexEventChunk)1 StreamEvent (io.siddhi.core.event.stream.StreamEvent)1 StreamEventFactory (io.siddhi.core.event.stream.StreamEventFactory)1 SiddhiAppCreationException (io.siddhi.core.exception.SiddhiAppCreationException)1 RecordTableHandler (io.siddhi.core.table.record.RecordTableHandler)1