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


Java EventStream类代码示例

本文整理汇总了Java中com.espertech.esper.view.EventStream的典型用法代码示例。如果您正苦于以下问题:Java EventStream类的具体用法?Java EventStream怎么用?Java EventStream使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getAuditProxy

import com.espertech.esper.view.EventStream; //导入依赖的package包/类
public static EventStream getAuditProxy(String engineURI, String statementName, Annotation[] annotations, FilterSpecCompiled filterSpec, EventStream designated) {
    Audit audit = AuditEnum.STREAM.getAudit(annotations);
    if (audit == null) {
        return designated;
    }

    StringWriter writer = new StringWriter();
    writer.write(filterSpec.getFilterForEventType().getName());
    if (filterSpec.getParameters() != null && filterSpec.getParameters().length > 0) {
        writer.write('(');
        String delimiter = "";
        for (FilterSpecParam[] paramLine : filterSpec.getParameters()) {
            writer.write(delimiter);
            writeFilter(writer, paramLine);
            delimiter = " or ";
        }
        writer.write(')');
    }

    return (EventStream) EventStreamProxy.newInstance(engineURI, statementName, writer.toString(), designated);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:22,代码来源:EventStreamProxy.java

示例2: activate

import com.espertech.esper.view.EventStream; //导入依赖的package包/类
public ViewableActivationResult activate(AgentInstanceContext agentInstanceContext, boolean isSubselect, boolean isRecoveringResilient) {
    PatternAgentInstanceContext patternAgentInstanceContext = agentInstanceContext.getStatementContext().getPatternContextFactory().createPatternAgentContext(patternContext, agentInstanceContext, hasConsumingFilter, null);
    EvalRootNode rootNode = EvalNodeUtil.makeRootNodeFromFactory(rootFactoryNode, patternAgentInstanceContext);

    final EventStream sourceEventStream = isCanIterate ? new ZeroDepthStreamIterable(eventType) : new ZeroDepthStreamNoIterate(eventType);
    final StatementContext statementContext = patternContext.getStatementContext();
    final PatternMatchCallback callback = new PatternMatchCallback() {
        public void matchFound(Map<String, Object> matchEvent, EventBean optionalTriggeringEvent) {
            EventBean compositeEvent = statementContext.getEventAdapterService().adapterForTypedMap(matchEvent, eventType);
            sourceEventStream.insert(compositeEvent);
        }
    };

    EvalRootState rootState = rootNode.start(callback, patternContext, isRecoveringResilient);
    return new ViewableActivationResult(sourceEventStream, rootState, null, rootState, rootState, suppressSameEventMatches, discardPartialsOnMatch, null);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:17,代码来源:ViewableActivatorPattern.java

示例3: testCreateJoin

import com.espertech.esper.view.EventStream; //导入依赖的package包/类
public void testCreateJoin() {
    streams = new EventStream[3];
    streams[0] = streamFactoryService.createStream(1, filterSpecs[0], supportFilterService, agentHandle, true, null, false, false, null, false, 0, false).getFirst();
    streams[1] = streamFactoryService.createStream(1, filterSpecs[1], supportFilterService, agentHandle, true, null, false, false, null, false, 0, false).getFirst();
    streams[2] = streamFactoryService.createStream(1, filterSpecs[2], supportFilterService, agentHandle, true, null, false, false, null, false, 0, false).getFirst();

    // Streams are reused
    assertNotSame(streams[0], streams[1]);
    assertNotSame(streams[0], streams[2]);
    assertNotSame(streams[1], streams[2]);

    // Type is ok
    assertEquals(SupportBean.class, streams[0].getEventType().getUnderlyingType());

    // 2 filters are active now
    assertEquals(3, supportFilterService.getAdded().size());
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:18,代码来源:TestStreamFactorySvcImpl.java

示例4: testDropJoin

import com.espertech.esper.view.EventStream; //导入依赖的package包/类
public void testDropJoin() {
    streams = new EventStream[3];
    streams[0] = streamFactoryService.createStream(1, filterSpecs[0], supportFilterService, agentHandle, true, null, false, false, null, false, 0, false).getFirst();
    streams[1] = streamFactoryService.createStream(2, filterSpecs[1], supportFilterService, agentHandle, true, null, false, false, null, false, 0, false).getFirst();
    streams[2] = streamFactoryService.createStream(3, filterSpecs[2], supportFilterService, agentHandle, true, null, false, false, null, false, 0, false).getFirst();

    streamFactoryService.dropStream(filterSpecs[0], supportFilterService, true, false, false, false);
    streamFactoryService.dropStream(filterSpecs[1], supportFilterService, true, false, false, false);
    assertEquals(2, supportFilterService.getRemoved().size());

    // Filter removed
    streamFactoryService.dropStream(filterSpecs[2], supportFilterService, true, false, false, false);
    assertEquals(3, supportFilterService.getRemoved().size());

    // Something already removed
    try {
        streamFactoryService.dropStream(filterSpecs[2], supportFilterService, true, false, false, false);
        TestCase.fail();
    } catch (IllegalStateException ex) {
        // Expected
    }
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:23,代码来源:TestStreamFactorySvcImpl.java

示例5: testCreateNoJoin

import com.espertech.esper.view.EventStream; //导入依赖的package包/类
public void testCreateNoJoin() {
    EPStatementHandle stmtHande = new EPStatementHandle(1, "id", null, StatementType.SELECT, "text", false, null, 1, false, false, new MultiMatchHandlerFactoryImpl().getDefaultHandler());
    EPStatementAgentInstanceHandle stmtAgentHandle = new EPStatementAgentInstanceHandle(stmtHande, new StatementAgentInstanceRWLockImpl(false), -1, null, null);

    streams = new EventStream[4];
    streams[0] = streamFactoryService.createStream(1, filterSpecs[0], supportFilterService, stmtAgentHandle, false, null, false, false, null, false, 0, false).getFirst();
    streams[1] = streamFactoryService.createStream(2, filterSpecs[0], supportFilterService, stmtAgentHandle, false, null, false, false, null, false, 0, false).getFirst();
    streams[2] = streamFactoryService.createStream(3, filterSpecs[1], supportFilterService, stmtAgentHandle, false, null, false, false, null, false, 0, false).getFirst();
    streams[3] = streamFactoryService.createStream(4, filterSpecs[2], supportFilterService, stmtAgentHandle, false, null, false, false, null, false, 0, false).getFirst();

    // Streams are reused
    assertSame(streams[0], streams[1]);
    assertSame(streams[0], streams[2]);
    assertNotSame(streams[0], streams[3]);

    // Type is ok
    assertEquals(SupportBean.class, streams[0].getEventType().getUnderlyingType());

    // 2 filters are active now
    assertEquals(2, supportFilterService.getAdded().size());
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:22,代码来源:TestStreamFactorySvcImpl.java

示例6: getAuditProxy

import com.espertech.esper.view.EventStream; //导入依赖的package包/类
public static EventStream getAuditProxy(String engineURI, String statementName, Annotation[] annotations, FilterSpecCompiled filterSpec, EventStream designated) {
    Audit audit = AuditEnum.STREAM.getAudit(annotations);
    if (audit == null) {
        return designated;
    }

    StringWriter filterAndParams = new StringWriter();
    filterAndParams.write(filterSpec.getFilterForEventType().getName());
    if (filterSpec.getParameters() != null && !filterSpec.getParameters().isEmpty()) {
        filterAndParams.write('(');
        String delimiter = "";
        for (FilterSpecParam param : filterSpec.getParameters()) {
            filterAndParams.write(delimiter);
            filterAndParams.write(param.getLookupable().getExpression());
            filterAndParams.write(param.getFilterOperator().getTextualOp());
            filterAndParams.write("...");
            delimiter = ",";
        }
        filterAndParams.write(')');
    }

    return (EventStream) EventStreamProxy.newInstance(engineURI, statementName, filterAndParams.toString(), designated);
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:24,代码来源:EventStreamProxy.java

示例7: dropStream

import com.espertech.esper.view.EventStream; //导入依赖的package包/类
/**
 * See the method of the same name in {@link com.espertech.esper.view.stream.StreamFactoryService}.
 * @param filterSpec is the filter definition
 */
public void dropStream(FilterSpecCompiled filterSpec, FilterService filterService, boolean isJoin, boolean isSubSelect, boolean isNamedWindowTrigger, boolean filterWithSameTypeSubselect, boolean stateless)
{
    Pair<EventStream, EPStatementHandleCallback> pair;
    boolean forceNewStream = isJoin || (!isReuseViews) || isSubSelect || isNamedWindowTrigger || filterWithSameTypeSubselect || stateless;

    if (forceNewStream)
    {
        pair = eventStreamsIdentity.get(filterSpec);
        if (pair == null)
        {
            throw new IllegalStateException("Filter spec object not in collection");
        }
        eventStreamsIdentity.remove(filterSpec);
        filterService.remove(pair.getSecond());
    }
    else
    {
        pair = eventStreamsRefCounted.get(filterSpec);
        boolean isLast = eventStreamsRefCounted.dereference(filterSpec);
        if (isLast)
        {
            filterService.remove(pair.getSecond());
        }
    }
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:30,代码来源:StreamFactorySvcImpl.java

示例8: activate

import com.espertech.esper.view.EventStream; //导入依赖的package包/类
public ViewableActivationResult activate(AgentInstanceContext agentInstanceContext, boolean isSubselect, boolean isRecoveringResilient) {
    PatternAgentInstanceContext patternAgentInstanceContext = agentInstanceContext.getStatementContext().getPatternContextFactory().createPatternAgentContext(patternContext, agentInstanceContext, hasConsumingFilter);
    EvalRootNode rootNode = EvalNodeUtil.makeRootNodeFromFactory(rootFactoryNode, patternAgentInstanceContext);

    final EventStream sourceEventStream = new ZeroDepthStream(eventType);
    final StatementContext statementContext = patternContext.getStatementContext();
    final PatternMatchCallback callback = new PatternMatchCallback() {
        public void matchFound(Map<String, Object> matchEvent)
        {
            EventBean compositeEvent = statementContext.getEventAdapterService().adapterForTypedMap(matchEvent, eventType);
            sourceEventStream.insert(compositeEvent);
        }
    };

    EvalRootState rootState = rootNode.start(callback, patternContext, isRecoveringResilient);
    return new ViewableActivationResult(sourceEventStream, rootState, null, rootState);
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:18,代码来源:ViewableActivatorPattern.java

示例9: testInvalidJoin

import com.espertech.esper.view.EventStream; //导入依赖的package包/类
public void testInvalidJoin()
{
    streams = new EventStream[3];
    streams[0] = streamFactoryService.createStream("id1", filterSpecs[0], supportFilterService, agentHandle, true, false, null, false, false, null, false).getFirst();

    try
    {
        // try to reuse the same filter spec object, should fail
        streamFactoryService.createStream("id1", filterSpecs[0], supportFilterService, agentHandle, true, false, null, false, false, null, false);
        fail();
    }
    catch (IllegalStateException ex)
    {
        // expected
    }
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:17,代码来源:TestStreamFactorySvcImpl.java

示例10: testCreateJoin

import com.espertech.esper.view.EventStream; //导入依赖的package包/类
public void testCreateJoin()
{
    streams = new EventStream[3];
    streams[0] = streamFactoryService.createStream("id1", filterSpecs[0], supportFilterService, agentHandle, true, false, null, false, false, null, false).getFirst();
    streams[1] = streamFactoryService.createStream("id1", filterSpecs[1], supportFilterService, agentHandle, true, false, null, false, false, null, false).getFirst();
    streams[2] = streamFactoryService.createStream("id1", filterSpecs[2], supportFilterService, agentHandle, true, false, null, false, false, null, false).getFirst();

    // Streams are reused
    assertNotSame(streams[0], streams[1]);
    assertNotSame(streams[0], streams[2]);
    assertNotSame(streams[1], streams[2]);

    // Type is ok
    assertEquals(SupportBean.class, streams[0].getEventType().getUnderlyingType());

    // 2 filters are active now
    assertEquals(3, supportFilterService.getAdded().size());
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:19,代码来源:TestStreamFactorySvcImpl.java

示例11: testDropJoin

import com.espertech.esper.view.EventStream; //导入依赖的package包/类
public void testDropJoin()
{
    streams = new EventStream[3];
    streams[0] = streamFactoryService.createStream("id1", filterSpecs[0], supportFilterService, agentHandle, true, false, null, false, false, null, false).getFirst();
    streams[1] = streamFactoryService.createStream("id2", filterSpecs[1], supportFilterService, agentHandle, true, false, null, false, false, null, false).getFirst();
    streams[2] = streamFactoryService.createStream("id3", filterSpecs[2], supportFilterService, agentHandle, true, false, null, false, false, null, false).getFirst();

    streamFactoryService.dropStream(filterSpecs[0], supportFilterService, true, false, false, false, false);
    streamFactoryService.dropStream(filterSpecs[1], supportFilterService, true, false, false, false, false);
    assertEquals(2, supportFilterService.getRemoved().size());

    // Filter removed
    streamFactoryService.dropStream(filterSpecs[2], supportFilterService, true, false, false, false, false);
    assertEquals(3, supportFilterService.getRemoved().size());

    // Something already removed
    try
    {
        streamFactoryService.dropStream(filterSpecs[2], supportFilterService, true, false, false, false, false);
        TestCase.fail();
    }
    catch (IllegalStateException ex)
    {
        // Expected
    }
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:27,代码来源:TestStreamFactorySvcImpl.java

示例12: testCreateNoJoin

import com.espertech.esper.view.EventStream; //导入依赖的package包/类
public void testCreateNoJoin()
{
    EPStatementHandle stmtHande = new EPStatementHandle("id", "id", null, "text", false, null, 1, false);
    EPStatementAgentInstanceHandle stmtAgentHandle = new EPStatementAgentInstanceHandle(stmtHande, new StatementAgentInstanceRWLockImpl("abc", false), -1, null);

    streams = new EventStream[4];
    streams[0] = streamFactoryService.createStream("id1", filterSpecs[0], supportFilterService, stmtAgentHandle, false, false, null, false, false, null, false).getFirst();
    streams[1] = streamFactoryService.createStream("id2", filterSpecs[0], supportFilterService, stmtAgentHandle, false, false, null, false, false, null, false).getFirst();
    streams[2] = streamFactoryService.createStream("id3", filterSpecs[1], supportFilterService, stmtAgentHandle, false, false, null, false, false, null, false).getFirst();
    streams[3] = streamFactoryService.createStream("id4", filterSpecs[2], supportFilterService, stmtAgentHandle, false, false, null, false, false, null, false).getFirst();

    // Streams are reused
    assertSame(streams[0], streams[1]);
    assertSame(streams[0], streams[2]);
    assertNotSame(streams[0], streams[3]);

    // Type is ok
    assertEquals(SupportBean.class, streams[0].getEventType().getUnderlyingType());

    // 2 filters are active now
    assertEquals(2, supportFilterService.getAdded().size());
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:23,代码来源:TestStreamFactorySvcImpl.java

示例13: newInstance

import com.espertech.esper.view.EventStream; //导入依赖的package包/类
public static Object newInstance(String engineURI, String statementName, String eventTypeAndFilter, EventStream eventStream) {
    return java.lang.reflect.Proxy.newProxyInstance(
            eventStream.getClass().getClassLoader(),
            JavaClassHelper.getSuperInterfaces(eventStream.getClass()),
            new EventStreamProxy(engineURI, statementName, eventTypeAndFilter, eventStream));
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:7,代码来源:EventStreamProxy.java

示例14: activate

import com.espertech.esper.view.EventStream; //导入依赖的package包/类
public ViewableActivationResult activate(AgentInstanceContext agentInstanceContext, boolean isSubselect, boolean isRecoveringResilient) {
    Pair<EventStream, StatementAgentInstanceLock> pair = services.getStreamService().createStream(statementContext.getStatementId(), filterStreamSpec.getFilterSpec(),
            statementContext.getFilterService(),
            agentInstanceContext.getEpStatementAgentInstanceHandle(),
            join,
            agentInstanceContext,
            statementSpec.getOrderByList().length > 0,
            filterSubselectSameStream,
            statementContext.getAnnotations(),
            statementContext.isStatelessSelect(),
            streamNum,
            isCanIterateUnbound);
    return new ViewableActivationResult(pair.getFirst(), this, pair.getSecond(), null, null, false, false, null);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:15,代码来源:ViewableActivatorStreamReuseView.java

示例15: testInvalidJoin

import com.espertech.esper.view.EventStream; //导入依赖的package包/类
public void testInvalidJoin() {
    streams = new EventStream[3];
    streams[0] = streamFactoryService.createStream(1, filterSpecs[0], supportFilterService, agentHandle, true, null, false, false, null, false, 0, false).getFirst();

    try {
        // try to reuse the same filter spec object, should fail
        streamFactoryService.createStream(1, filterSpecs[0], supportFilterService, agentHandle, true, null, false, false, null, false, 0, false);
        fail();
    } catch (IllegalStateException ex) {
        // expected
    }
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:13,代码来源:TestStreamFactorySvcImpl.java


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