本文整理汇总了Java中org.wso2.siddhi.core.event.in.InEvent.getData方法的典型用法代码示例。如果您正苦于以下问题:Java InEvent.getData方法的具体用法?Java InEvent.getData怎么用?Java InEvent.getData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.wso2.siddhi.core.event.in.InEvent
的用法示例。
在下文中一共展示了InEvent.getData方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addDataToMap
import org.wso2.siddhi.core.event.in.InEvent; //导入方法依赖的package包/类
/**
* Add new entry to time stamp map from the received event.
*
* @param event Event received by Siddhi.
*/
private void addDataToMap(InEvent event) {
if (!isActive) {
log.info("Received first event. Marking fault handling window processor as active");
isActive = true;
}
String id = (String) event.getData()[memberIdAttrIndex];
//checking whether this member is the topology.
//sometimes there can be a delay between publishing member terminated events
//and actually terminating instances. Hence CEP might get events for already terminated members
//so we are checking the topology for the member existence
Member member = getMemberFromId(id);
if (null == member) {
log.warn("Member not found in the topology. Event rejected");
return;
}
if (StringUtils.isNotEmpty(id)) {
memberTimeStampMap.put(id, event.getTimeStamp());
} else {
log.warn("NULL member id found in the event received. Event rejected.");
}
if (log.isDebugEnabled()) {
log.debug("Event received from [member-id] " + id + " [time-stamp] " + event.getTimeStamp());
}
}
示例2: addDataToMap
import org.wso2.siddhi.core.event.in.InEvent; //导入方法依赖的package包/类
/**
* Add new entry to time stamp map from the received event.
*
* @param event Event received by Siddhi.
*/
private void addDataToMap(InEvent event) {
if (!isActive) {
log.info("Received first event. Marking fault handling window processor as active");
isActive = true;
}
String id = (String) event.getData()[memberIdAttrIndex];
//checking whether this member is the topology.
//sometimes there can be a delay between publishing member terminated events
//and actually terminating instances. Hence CEP might get events for already terminated members
//so we are checking the topology for the member existence
Member member = getMemberFromId(id);
if (null == member) {
log.warn(String.format("Member with [id] %s not found in the topology. Event rejected", id));
return;
}
if (StringUtils.isNotEmpty(id)) {
memberTimeStampMap.put(id, event.getTimeStamp());
} else {
log.warn("NULL member id found in the event received. Event rejected.");
}
if (log.isDebugEnabled()) {
log.debug("Event received from [member-id] " + id + " [time-stamp] " + event.getTimeStamp());
}
}
示例3: processEvent
import org.wso2.siddhi.core.event.in.InEvent; //导入方法依赖的package包/类
@Override
protected InStream processEvent(InEvent inEvent) {
if (log.isDebugEnabled()) {
log.debug("processEvent");
}
// Capture all data elements in the input stream
Object [] inStreamData = inEvent.getData();
Object [] outStreamData;
// Perform Regression and get regression results
Object [] temp = regressionCalculator.calculateLinearRegression(inEvent, paramPositions);
// Send null until the first regression calculation
if(regResult==null && temp==null){
outStreamData = null;
} else {
// For each calculation, get new regression coefficients, otherwise send previous coefficients
if(temp!=null) {
regResult = temp;
}
// Combine Regression Results and Input Stream Data and send to OutputStream
outStreamData = new Object[regResult.length + inStreamData.length];
System.arraycopy(regResult, 0, outStreamData, 0, regResult.length);
System.arraycopy(inStreamData, 0, outStreamData, regResult.length, inStreamData.length);
}
return new InEvent(inEvent.getStreamId(), System.currentTimeMillis(), outStreamData);
}
示例4: processEvent
import org.wso2.siddhi.core.event.in.InEvent; //导入方法依赖的package包/类
@Override
protected InStream processEvent(InEvent inEvent) {
if (log.isDebugEnabled()) {
log.debug("processEvent");
}
Object [] inStreamData = inEvent.getData();
Object[] outStreamData;
Object[] temp = regressionCalculator.calculateLinearRegression(inEvent, paramPositions);
if(regResult==null && temp==null){ // When calculation interval > 1, send null until the first regression calculation
outStreamData = null;
} else {
double xDash = ((Number) exp.execute(inEvent)).doubleValue();
// For each calculation, get new regression coefficients, otherwise use previous coefficients
if(temp!=null) {
// Calculating forecast Y based on regression equation and given X
outStreamData = new Object[temp.length + inStreamData.length+1];
outStreamData[0] = ((Number) temp[1]).doubleValue()+ xDash * ((Number) temp[2]).doubleValue();
regResult = temp;
} else {
outStreamData = new Object[regResult.length + inStreamData.length+1];
outStreamData[0] = ((Number) regResult[1]).doubleValue()+ xDash * ((Number) regResult[2]).doubleValue();
}
// Combining Regression Results and the Input Stream Data
System.arraycopy(regResult, 0, outStreamData, 1, regResult.length);
System.arraycopy(inStreamData, 0, outStreamData, regResult.length+1, inStreamData.length);
}
return new InEvent(inEvent.getStreamId(), System.currentTimeMillis(), outStreamData);
}
示例5: generateKey
import org.wso2.siddhi.core.event.in.InEvent; //导入方法依赖的package包/类
private String generateKey(InEvent event) { // for performance reason if its all attribute we don't do the attribute list check
StringBuilder stringBuilder = new StringBuilder();
if (attributeIndexes.size() == 0) {
for(Object data: event.getData()) {
stringBuilder.append(data);
}
} else {
for (int i = 0; i < event.getData().length; i++) {
if (attributeIndexes.contains(i))
stringBuilder.append(event.getData()[i]);
}
}
return stringBuilder.toString();
}
示例6: generateKey
import org.wso2.siddhi.core.event.in.InEvent; //导入方法依赖的package包/类
private String generateKey(InEvent event) {
StringBuilder stringBuilder = new StringBuilder();
if (attributeIndexes.size() == 0) {
for (Object data : event.getData()) {
stringBuilder.append(data);
}
} else {
for (int i = 0; i < event.getData().length; i++) {
if (attributeIndexes.contains(i))
stringBuilder.append(event.getData()[i]);
}
}
return stringBuilder.toString();
}
示例7: processEvent
import org.wso2.siddhi.core.event.in.InEvent; //导入方法依赖的package包/类
@Override
public void processEvent(InEvent event) {
acquireLock();
try {
long currentTime = (Long) event.getData(timeStampAttributePosition);
removeExpiredEvent(currentTime);
window.put(new RemoveEvent(event, currentTime + timeToKeep));
nextProcessor.process(event);
} finally {
releaseLock();
}
}
示例8: processEvent
import org.wso2.siddhi.core.event.in.InEvent; //导入方法依赖的package包/类
@Override
protected InStream processEvent(InEvent inEvent) {
if (log.isDebugEnabled()) {
log.debug("processEvent");
}
Object [] outStreamData;
Object [] temp;
Object [] inStreamData = inEvent.getData();
Boolean result = false; // Becomes true if its an outlier
eventCount++;
if(eventCount <= 3 || eventCount <= calcInterval) { // Need atleast 3 events to build the regression equation. Forecasting can be done after that.
regResult = regressionCalculator.calculateLinearRegression(inEvent, paramPositions);
outStreamData = null;
} else {
// Get the current X value
Iterator<Map.Entry<Integer, String>> it = paramPositions.entrySet().iterator();
it.next();
double nextX = ((Number) inEvent.getData(it.next().getKey())).doubleValue();
// Calculate the upper limit and the lower limit based on standard error and regression equation
double forecastY = (Double) regResult[1] + nextX * (Double) regResult[2];
double upLimit = (Double) regResult[0] * range + forecastY;
double downLimit = - (Double) regResult[0] * range + forecastY;
// Check whether next Y value is an outlier based on the next X value and the current regression equation
double nextY = ((Number)inEvent.getData0()).doubleValue();
if(nextY < downLimit || nextY > upLimit) {
result = true;
}
temp = regressionCalculator.calculateLinearRegression(inEvent, paramPositions);
if (temp!=null) {
regResult = temp;
}
outStreamData = new Object[inStreamData.length + 4];
outStreamData[0] = result;
System.arraycopy(regResult,0,outStreamData, 1, regResult.length);
System.arraycopy(inStreamData, 0, outStreamData, regResult.length+1, inStreamData.length);
}
return new InEvent(inEvent.getStreamId(), System.currentTimeMillis(), outStreamData);
}