• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java BeanEventBean类的典型用法和代码示例

java 1次浏览

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

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

示例1: getLastTick

点赞 3

import com.espertech.esper.event.bean.BeanEventBean; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
public Tick getLastTick() {

	List<Map> events = ServiceLocator.commonInstance().getRuleService().getAllEvents(StrategyUtil.getStartedStrategyName(), "GET_LAST_TICK");

	// try to see if the rule GET_LAST_TICK has the tick
	for (Map event : events) {
		Integer securityId = (Integer) event.get(SECURITY_ID);
		if (securityId.equals(getId())) {
			return (Tick) ((BeanEventBean) event.get("tick")).getUnderlying();
		}
	}

	// if we did not get the tick up to now go to the db an get the last tick
	Tick tick = ServiceLocator.commonInstance().getLookupService().getLastTick(getId());
	return tick;
}
 

开发者ID:curtiszimmerman,
项目名称:AlgoTrader,
代码行数:18,
代码来源:SecurityImpl.java

示例2: getShellForType

点赞 2

import com.espertech.esper.event.bean.BeanEventBean; //导入依赖的package包/类
public static EventBeanSPI getShellForType(EventType eventType) {
    if (eventType instanceof BeanEventType) {
        return new BeanEventBean(null, eventType);
    }
    if (eventType instanceof ObjectArrayEventType) {
        return new ObjectArrayEventBean(null, eventType);
    }
    if (eventType instanceof MapEventType) {
        return new MapEventBean(null, eventType);
    }
    if (eventType instanceof BaseXMLEventType) {
        return new XMLEventBean(null, eventType);
    }
    throw new EventAdapterException("Event type '" + eventType.getName() + "' is not an engine-native event type");
}
 

开发者ID:espertechinc,
项目名称:esper,
代码行数:16,
代码来源:EventAdapterServiceHelper.java

示例3: adapterForBean

点赞 2

import com.espertech.esper.event.bean.BeanEventBean; //导入依赖的package包/类
/**
 * Create an event bean given an event of object id.
 *
 * @param theEvent is the event class
 * @return event
 */
public EventBean adapterForBean(Object theEvent) {
    EventType eventType = typesPerJavaBean.get(theEvent.getClass());
    if (eventType == null) {
        // This will update the typesPerJavaBean mapping
        eventType = beanEventAdapter.createBeanType(theEvent.getClass().getName(), theEvent.getClass(), false, false, false);
    }
    return new BeanEventBean(theEvent, eventType);
}
 

开发者ID:espertechinc,
项目名称:esper,
代码行数:15,
代码来源:EventAdapterServiceImpl.java

示例4: getLastBar

点赞 2

import com.espertech.esper.event.bean.BeanEventBean; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
public Bar getLastBar() {
	Bar bar = null;

	List<Map> events = ServiceLocator.commonInstance().getRuleService().getAllEvents(StrategyUtil.getStartedStrategyName(), "GET_LAST_BAR");

	// try to see if the rule GET_LAST_BAR has the bar
	for (Map event : events) {
		Integer securityId = (Integer) event.get("securityId");
		if (securityId.equals(getId())) {
			bar = (Bar) ((BeanEventBean) event.get("bar")).getUnderlying();
		}
	}
	return bar; // TODO - Check database
}
 

开发者ID:curtiszimmerman,
项目名称:AlgoTrader,
代码行数:16,
代码来源:SecurityImpl.java

示例5: getLastBid

点赞 2

import com.espertech.esper.event.bean.BeanEventBean; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
public Bid getLastBid() {
	Bid bid = null;

	List<Map> events = ServiceLocator.commonInstance().getRuleService().getAllEvents(StrategyUtil.getStartedStrategyName(), "GET_LAST_BID");

	// try to see if the rule GET_LAST_BID has the bid
	for (Map event : events) {
		Integer securityId = (Integer) event.get(SECURITY_ID);
		if (securityId.equals(getId())) {
			return (Bid) ((BeanEventBean) event.get("bid")).getUnderlying();
		}
	}

	Tick tick = getLastTick();
	if (tick != null) {
		bid = Bid.Factory.newInstance();
		bid.setPrice(tick.getBid());
		bid.setDateTime(tick.getDateTime());
		bid.setSecurity(this);
		return bid;
	}

	Bar bar = getLastBar();
	if (bar != null) {
		bid = Bid.Factory.newInstance();
		bid.setPrice(bar.getClose());
		bid.setDateTime(bar.getDateTime());
		bid.setSecurity(this);
		return bid;
	}

	return bid; // TODO - Check database
}
 

开发者ID:curtiszimmerman,
项目名称:AlgoTrader,
代码行数:35,
代码来源:SecurityImpl.java

示例6: getLastAsk

点赞 2

import com.espertech.esper.event.bean.BeanEventBean; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
public Ask getLastAsk() {
	Ask ask = null;

	List<Map> events = ServiceLocator.commonInstance().getRuleService().getAllEvents(StrategyUtil.getStartedStrategyName(), "GET_LAST_ASK");

	// try to see if the rule GET_LAST_ASK has the ask
	for (Map event : events) {
		Integer securityId = (Integer) event.get(SECURITY_ID);
		if (securityId.equals(getId())) {
			return (Ask) ((BeanEventBean) event.get("ask")).getUnderlying();
		}
	}

	Tick tick = getLastTick();
	if (tick != null) {
		ask = Ask.Factory.newInstance();
		ask.setPrice(tick.getAsk());
		ask.setDateTime(tick.getDateTime());
		ask.setSecurity(this);
		return ask;
	}

	Bar bar = getLastBar();
	if (bar != null) {
		ask = Ask.Factory.newInstance();
		ask.setPrice(bar.getClose());
		ask.setDateTime(bar.getDateTime());
		ask.setSecurity(this);
		return ask;
	}

	return ask; // TODO - Check database
}
 

开发者ID:curtiszimmerman,
项目名称:AlgoTrader,
代码行数:35,
代码来源:SecurityImpl.java

示例7: getLastTrade

点赞 2

import com.espertech.esper.event.bean.BeanEventBean; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
public Trade getLastTrade() {
	Trade trade = null;

	List<Map> events = ServiceLocator.commonInstance().getRuleService().getAllEvents(StrategyUtil.getStartedStrategyName(), "GET_LAST_TRADE");

	// try to see if the rule GET_LAST_TRADE has the trade
	for (Map event : events) {
		Integer securityId = (Integer) event.get(SECURITY_ID);
		if (securityId.equals(getId())) {
			return (Trade) ((BeanEventBean) event.get("trade")).getUnderlying();
		}
	}

	Tick tick = getLastTick();
	if (tick != null) {
		trade = Trade.Factory.newInstance();
		trade.setPrice(tick.getLast());
		trade.setSize(tick.getVol());
		trade.setDateTime(tick.getLastDateTime());
		trade.setSecurity(this);
		return trade;
	}

	Bar bar = getLastBar();
	if (bar != null) {
		trade = Trade.Factory.newInstance();
		trade.setPrice(bar.getClose());
		trade.setDateTime(bar.getDateTime());
		trade.setSecurity(this);
		return trade;
	}

	return trade; // TODO - Check database
}
 

开发者ID:curtiszimmerman,
项目名称:AlgoTrader,
代码行数:36,
代码来源:SecurityImpl.java

示例8: adapterForBean

点赞 2

import com.espertech.esper.event.bean.BeanEventBean; //导入依赖的package包/类
/**
 * Create an event bean given an event of object id.
 * @param theEvent is the event class
 * @return event
 */
public EventBean adapterForBean(Object theEvent)
{
    EventType eventType = typesPerJavaBean.get(theEvent.getClass());
    if (eventType == null)
    {
        // This will update the typesPerJavaBean mapping
        eventType = beanEventAdapter.createBeanType(theEvent.getClass().getName(), theEvent.getClass(), false, false, false);
    }
    return new BeanEventBean(theEvent, eventType);
}
 

开发者ID:mobile-event-processing,
项目名称:Asper,
代码行数:16,
代码来源:EventAdapterServiceImpl.java

示例9: testVariantOneWildcard

点赞 2

import com.espertech.esper.event.bean.BeanEventBean; //导入依赖的package包/类
public void testVariantOneWildcard()
{
    String stmtText = "insert into Event_1 (delta, product) " +
    "select * from " + SupportBean.class.getName() + ".win:length(100)";

    try{
    	epService.getEPAdministrator().createEPL(stmtText);
    	fail();
    }
    catch(EPStatementException ex)
    {
    	// Expected
    }

    // assert statement-type reference
    EPServiceProviderSPI spi = (EPServiceProviderSPI) epService;
    assertFalse(spi.getStatementEventTypeRef().isInUse("Event_1"));

    // test insert wildcard to wildcard
    epService.getEPAdministrator().getConfiguration().addEventType(SupportBean.class);
    SupportUpdateListener listener = new SupportUpdateListener();

    String stmtSelectText = "insert into ABCStream select * from SupportBean";
    EPStatement stmtSelect = epService.getEPAdministrator().createEPL(stmtSelectText, "resilient i0");
    stmtSelect.addListener(listener);
    assertTrue(stmtSelect.getEventType() instanceof BeanEventType);

    epService.getEPRuntime().sendEvent(new SupportBean("E1", 1));
    assertEquals("E1", listener.assertOneGetNew().get("theString"));
    assertTrue(listener.assertOneGetNew() instanceof BeanEventBean);
}
 

开发者ID:mobile-event-processing,
项目名称:Asper,
代码行数:32,
代码来源:TestInsertInto.java

示例10: updateOpsEvtListnerTest

点赞 2

import com.espertech.esper.event.bean.BeanEventBean; //导入依赖的package包/类
@Test
public void updateOpsEvtListnerTest(){

	EventBean[] newEvents = new EventBean[1];
	EventBean[] oldEvents = null; //keeping null;
	
	OpsEvent underlyingEvent = new OpsEvent();
	underlyingEvent.setType("heartbeat");
	underlyingEvent.setBucket("bucket");
	underlyingEvent.setChecksum(1357888);
	underlyingEvent.setCiId(12);
	underlyingEvent.setCiState("open");
	underlyingEvent.setCount(3);
	underlyingEvent.setGrouping("group-a");
	underlyingEvent.setManifestId(5);
	underlyingEvent.setName("fire");
	underlyingEvent.setSource("computeY");
	underlyingEvent.setCiId(14144);
	underlyingEvent.setTimestamp(123111555);
	underlyingEvent.setCiState("pending");
	
	BeanEventBean eventBean = new BeanEventBean(underlyingEvent, null);
	
	newEvents[0] = eventBean;
			
	CiOpsProcessor coProcessor = mock(CiOpsProcessor.class);
	when(coProcessor.getCIstate(anyLong())).thenReturn("open");
	listener.setCoProcessor(coProcessor);
	listener.update(newEvents, oldEvents);
	
	//no mutation
	assert(newEvents.length==1);
	
	//attempt again, this time the sensSorHeartBeat will appear up to date
	SensorHeartBeat sensorHeartBeatMockTimeStamper = mock(SensorHeartBeat.class);
	when(sensorHeartBeatMockTimeStamper.getLatestHearBeatTime("metrics")).thenReturn(Long.MIN_VALUE);
	listener.setSensorHeartBeat(sensorHeartBeatMockTimeStamper);
	
	when(coProcessor.getCIstate(anyLong())).thenReturn("not-open");

	listener.update(newEvents, oldEvents);
	
	//no mutation
	assert(newEvents.length==1);

}
 

开发者ID:oneops,
项目名称:oneops,
代码行数:47,
代码来源:OpsEventListenerTest.java

示例11: makeAdapter

点赞 2

import com.espertech.esper.event.bean.BeanEventBean; //导入依赖的package包/类
public EventBean makeAdapter(Object underlying) {
    return new BeanEventBean(underlying, eventType);
}
 

开发者ID:espertechinc,
项目名称:esper,
代码行数:4,
代码来源:EventAdapterServiceHelper.java

示例12: adapterForTypedBean

点赞 2

import com.espertech.esper.event.bean.BeanEventBean; //导入依赖的package包/类
public final EventBean adapterForTypedBean(Object bean, EventType eventType) {
    return new BeanEventBean(bean, eventType);
}
 

开发者ID:espertechinc,
项目名称:esper,
代码行数:4,
代码来源:EventAdapterServiceImpl.java

示例13: adapterForTypedBean

点赞 2

import com.espertech.esper.event.bean.BeanEventBean; //导入依赖的package包/类
public final EventBean adapterForTypedBean(Object bean, EventType eventType)
{
    return new BeanEventBean(bean, eventType);
}
 

开发者ID:mobile-event-processing,
项目名称:Asper,
代码行数:5,
代码来源:EventAdapterServiceImpl.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)