本文整理汇总了Java中com.espertech.esper.client.EventBean.getUnderlying方法的典型用法代码示例。如果您正苦于以下问题:Java EventBean.getUnderlying方法的具体用法?Java EventBean.getUnderlying怎么用?Java EventBean.getUnderlying使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.espertech.esper.client.EventBean
的用法示例。
在下文中一共展示了EventBean.getUnderlying方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: update
import com.espertech.esper.client.EventBean; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void update(EventBean[] newEvents, EventBean[] oldEvents) {
EventBean event = newEvents[0];
Integer id = (Integer) event.get("id");
ids.add(id);
LOGGER.info( "**Listener id " + id);
count++;
if (newEvents != null)
newCount += newEvents.length;
if (oldEvents != null)
oldCount += oldEvents.length;
HashMap<String, Object> hm = (HashMap<String, Object>) event.getUnderlying();
if (!(hm.get("field1") instanceof Double))
throw new IllegalStateException("expecting a Double");
}
示例2: update
import com.espertech.esper.client.EventBean; //导入方法依赖的package包/类
/**
* uses newEvents and logs them
*/
@SuppressWarnings("rawtypes")
public void update(EventBean[] newEvents, EventBean[] oldEvents) {
System.out.println("in " + BasicListener.class.getSimpleName());
System.out.println("size=" + newEvents.length);
for (EventBean eBean : newEvents) {
Map event = (Map) eBean.getUnderlying();
for (Object key : event.keySet()) {
logger.info(key + "=" + event.get(key));
}
}
}
示例3: update
import com.espertech.esper.client.EventBean; //导入方法依赖的package包/类
/**
* Event update callback.
*
* @param newEvents
* @param oldEvents
*/
public void update(EventBean[] newEvents, EventBean[] oldEvents) {
logger.debug("in " + CloseEventListener.class.getSimpleName());
for (EventBean eBean : newEvents) {
OpsCloseEvent event = (OpsCloseEvent) eBean.getUnderlying();
logger.info("close event for " + event.getCiId() + " :" + event.getName());
OpsEvent openEvent = event.getOpenEvent();
event.setOpenEvent(null);
event.setTimestamp(System.currentTimeMillis());
String payload = gson.toJson(EventConverter.convert(event));
logger.debug(payload);
opsEventDao.persistOpsEvent(event.getCiId(), event.getName(), event.getTimestamp(), payload);
long lastOpenId = opsEventDao.getCiOpenEventId(event.getCiId(), event.getName());
boolean publishedMessage = false;
if (lastOpenId > 0) {
EventContext eventContext = new EventContext(event);
eventContext.setPayload(payload);
handleEvent(eventContext);
publishedMessage = true;
}
else {
if (orphanEventEnabled) {
//if there was no open event to close, it could mean that the OpsEventListener is not executed yet.
//this may lead to an inconsistency between esper and cassandra states for this event.
//so save this event as orphan so that the OrphanEventHandler will process this later
logger.warn("no open event found to close - ciId : " + event.getCiId() +
", eventName : " + event.getName() + ", marking this as orphan close event");
OpenEvent opsOpenEvent = new OpenEvent();
opsOpenEvent.setOpsEvent(openEvent);
opsOpenEvent.setTimestamp(System.currentTimeMillis());
String openEventPayload = gson.toJson(opsOpenEvent);
opsEventDao.addOrphanCloseEventForCi(event.getCiId(), event.getName(), event.getManifestId(), openEventPayload);
}
}
logger.info("close event for " + event.getCiId() + " :" + event.getName() + " :lastOpenId: " + lastOpenId + " :publishedMessage: " + publishedMessage);
}
}
示例4: update
import com.espertech.esper.client.EventBean; //导入方法依赖的package包/类
@Override
public void update(EventBean[] newEvents, EventBean[] oldEvents) {
for (EventBean eBean : newEvents) {
ChannelDownEvent event = (ChannelDownEvent) eBean.getUnderlying();
logger.warn(">>>>>>>>>>>> CHANNEL " + event.getChannel() + "is down");
sensorHeartBeat.markDown(event.getChannel());
}
}
示例5: execute
import com.espertech.esper.client.EventBean; //导入方法依赖的package包/类
/**
* Executes the query and returns the result. This only works for on-demand
* queries. Live queries will return null
*
* @return
*/
public String execute() {
final StreamProcessingAdapter esper = StreamProcessingAdapter.getInstance();
if (this.isLiveQuery()) {
return null;
}
EPOnDemandQueryResult result = null;
// TODO evaluate semantic query part (if existent) for all events
// only query those events, that passed the semantic test
final EPStatementObjectModel statement = esper.getEsperAdministrator().compileEPL(this.esperQuery);
result = esper.getEsperRuntime().executeQuery(statement);
// print results
final StringBuffer buffer = new StringBuffer();
buffer.append("Number of events found: " + result.getArray().length);
final Iterator<EventBean> i = result.iterator();
while (i.hasNext()) {
buffer.append(System.getProperty("line.separator"));
final EventBean next = i.next();
if (next.getUnderlying() instanceof ElementImpl) {
final ElementImpl event = (ElementImpl) next.getUnderlying();
buffer.append("{");
for (int k = 0; k < event.getChildNodes().getLength(); k++) {
final Node node = event.getChildNodes().item(k);
buffer.append(node.getNodeName() + "=" + node.getFirstChild().getNodeValue());
if (k + 1 < event.getChildNodes().getLength()) {
buffer.append(", ");
}
}
buffer.append("}");
} else {
buffer.append(next.getUnderlying());
}
}
return buffer.toString();
}
示例6: update
import com.espertech.esper.client.EventBean; //导入方法依赖的package包/类
/**
* Normalizes the transformed events and sends them to the broker.
*
* @see UpdateListener#update(EventBean[], EventBean[])
*/
@Override
public void update(final EventBean[] newData, final EventBean[] oldData) {
this.uniqueEvents = new HashSet<Object>();
// create event/attribute values for event type
for (EventBean data : newData) {
//TODO: CHeck because this avoids UNICORN to match all events that fit to the query!
// final EventBean data = newData[newData.length - 1]; // [Integration Bug
// #416]
// System.out.println("Event received: " + data.getUnderlying());
if (data.getUnderlying() instanceof ElementImpl) {
this.addEvent((ElementImpl) data.getUnderlying());
} else if (data.getUnderlying() instanceof HashMap) {
final Map<String, Serializable> attributeExpressionsAndValues = (Map<String, Serializable>) data.getUnderlying();
for (final Object value : attributeExpressionsAndValues.values()) {
if (value instanceof XMLEventBean) {
final XMLEventBean bean = (XMLEventBean) value;
if (bean.getUnderlying() instanceof ElementImpl) {
this.addEvent((ElementImpl) bean.getUnderlying());
}
} else {
this.addEvent(attributeExpressionsAndValues);
}
}
}
}
this.uniqueEvents.clear();
}
示例7: getExprEvaluator
import com.espertech.esper.client.EventBean; //导入方法依赖的package包/类
public ExprEvaluator getExprEvaluator() {
final ExprEvaluator inner = innerForge.getExprEvaluator();
return new ExprEvaluator() {
public Object evaluate(EventBean[] eventsPerStream, boolean isNewData, ExprEvaluatorContext exprEvaluatorContext) {
EventBean event = (EventBean) inner.evaluate(eventsPerStream, isNewData, exprEvaluatorContext);
if (event != null) {
return event.getUnderlying();
}
return null;
}
};
}
示例8: get
import com.espertech.esper.client.EventBean; //导入方法依赖的package包/类
public Object get(EventBean obj) throws PropertyAccessException {
// The underlying is expected to be a map
if (!(obj.getUnderlying() instanceof Node)) {
throw new PropertyAccessException("Mismatched property getter to event bean type, " +
"the underlying data object is not of type Node");
}
Node node = (Node) obj.getUnderlying();
Node result = getter.getValueAsNode(node);
return getParseTextValue(result, parser);
}
示例9: getValue
import com.espertech.esper.client.EventBean; //导入方法依赖的package包/类
public Object getValue(AggregationState state, EventBean[] eventsPerStream, boolean isNewData, ExprEvaluatorContext exprEvaluatorContext) {
EventBean bean = ((AggregationStateLinear) state).getFirstValue();
if (bean == null) {
return null;
}
return bean.getUnderlying();
}
示例10: getFragment
import com.espertech.esper.client.EventBean; //导入方法依赖的package包/类
public Object getFragment(EventBean eventBean) throws PropertyAccessException {
GenericData.Record record = (GenericData.Record) eventBean.getUnderlying();
Collection values = (Collection) record.get(posTop);
Object value = getAvroIndexedValue(values, index);
if (value == null || !(value instanceof GenericData.Record)) {
return null;
}
return nested.getAvroFragment((GenericData.Record) value);
}
示例11: getFragment
import com.espertech.esper.client.EventBean; //导入方法依赖的package包/类
public Object getFragment(EventBean eventBean) {
if (fragmentFactory == null) {
return null;
}
Object und = eventBean.getUnderlying();
if (und == null) {
throw new PropertyAccessException("Unexpected null underlying event encountered, expecting org.w3c.dom.Node instance as underlying");
}
if (!(und instanceof Node)) {
throw new PropertyAccessException("Unexpected underlying event of type '" + und.getClass() + "' encountered, expecting org.w3c.dom.Node as underlying");
}
return evaluateXPathFragment(und, expression, expressionText, property, fragmentFactory, resultType);
}
示例12: get
import com.espertech.esper.client.EventBean; //导入方法依赖的package包/类
public Object get(EventBean obj) throws PropertyAccessException {
// The underlying is expected to be a map
if (!(obj.getUnderlying() instanceof Node)) {
throw new PropertyAccessException("Mismatched property getter to event bean type, " +
"the underlying data object is not of type Node");
}
Node node = (Node) obj.getUnderlying();
Node[] result = getter.getValueAsNodeArray(node);
if (result == null) {
return null;
}
return getDOMArrayFromNodes(result, componentType, parser);
}
示例13: getObjectArray
import com.espertech.esper.client.EventBean; //导入方法依赖的package包/类
public Object getObjectArray(Object[] array) throws PropertyAccessException {
Object eventBean = array[propertyIndex];
if (eventBean == null) {
return null;
}
EventBean theEvent = (EventBean) eventBean;
return theEvent.getUnderlying();
}
示例14: evaluate
import com.espertech.esper.client.EventBean; //导入方法依赖的package包/类
public Object evaluate(EventBean[] eventsPerStream, boolean isNewData, ExprEvaluatorContext exprEvaluatorContext) {
if (InstrumentationHelper.ENABLED) {
InstrumentationHelper.get().qExprStreamUndMethod(forge.getForgeRenderable());
}
// get underlying event
EventBean event = eventsPerStream[forge.getStreamNumber()];
if (event == null) {
if (InstrumentationHelper.ENABLED) {
InstrumentationHelper.get().aExprStreamUndMethod(null);
}
return null;
}
Object inner = event.getUnderlying();
if (InstrumentationHelper.ENABLED) {
InstrumentationHelper.get().qExprDotChain(EPTypeHelper.singleValue(event.getEventType().getUnderlyingType()), inner, evaluators);
}
inner = ExprDotNodeUtility.evaluateChain(forge.getEvaluators(), evaluators, inner, eventsPerStream, isNewData, exprEvaluatorContext);
if (InstrumentationHelper.ENABLED) {
InstrumentationHelper.get().aExprDotChain();
}
if (InstrumentationHelper.ENABLED) {
InstrumentationHelper.get().aExprStreamUndMethod(inner);
}
return inner;
}
示例15: evaluate
import com.espertech.esper.client.EventBean; //导入方法依赖的package包/类
public Object evaluate(EventBean[] eventsPerStream, boolean isNewData, ExprEvaluatorContext context) {
EventBean bean = eventsPerStream[streamNum];
if (bean == null) {
return null;
}
return bean.getUnderlying();
}