本文整理匯總了Java中storm.trident.tuple.TridentTuple.getValue方法的典型用法代碼示例。如果您正苦於以下問題:Java TridentTuple.getValue方法的具體用法?Java TridentTuple.getValue怎麽用?Java TridentTuple.getValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類storm.trident.tuple.TridentTuple
的用法示例。
在下文中一共展示了TridentTuple.getValue方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: execute
import storm.trident.tuple.TridentTuple; //導入方法依賴的package包/類
/**
* <p>This function get the radius client from radius event.</p>
* @author Andres Gomez
*/
@Override
public void execute(TridentTuple tuple, TridentCollector collector) {
Map<String, Object> radiusData = (Map<String, Object>) tuple.getValue(0);
String clientMac = radiusData.get("Calling-Station-Id").toString();
clientMac = clientMac.replace("-", ":");
Map<String, Object> radiusMap = new HashMap<>();
radiusMap.put("client_mac", clientMac);
if (_debug) {
System.out.println(GetRadiusClient.class +" - Radius client to query: " + clientMac);
}
collector.emit(new Values(radiusMap));
}
示例2: isKeep
import storm.trident.tuple.TridentTuple; //導入方法依賴的package包/類
@Override
public boolean isKeep(TridentTuple tuple) {
for(int i=0; i<tuple.size()-1; i++) {
Object o1 = tuple.getValue(i);
Object o2 = tuple.getValue(i+1);
if (o1 == null) {
if (o2 != null) {
return false;
}
}else if (o1.equals(o2) == false){
return false;
}
}
return true;
}
示例3: execute
import storm.trident.tuple.TridentTuple; //導入方法依賴的package包/類
@Override
public void execute(TridentTuple tuple, TridentCollector collector) {
Map<String, Object> flow = (Map<String, Object>) tuple.getValue(0);
String wireless_station = (String) flow.get("wireless_station");
if (wireless_station != null) {
collector.emit(new Values(PostgresqlManager.get(wireless_station)));
} else {
collector.emit(new Values(new HashMap<String, Object>()));
}
}
示例4: execute
import storm.trident.tuple.TridentTuple; //導入方法依賴的package包/類
/**
* <p>This function check if the event contains the timestamp. If the event does not contain it creates it from the current time.</p>
*/
@Override
public void execute(TridentTuple tuple, TridentCollector collector) {
Map<String, Object> event = (Map<String, Object>) tuple.getValue(0);
if(!event.containsKey("timestamp")){
event.put("timestamp", System.currentTimeMillis()/1000);
collector.emit(new Values(event));
}else{
collector.emit(new Values(event));
}
}
示例5: execute
import storm.trident.tuple.TridentTuple; //導入方法依賴的package包/類
@Override
public void execute(TridentTuple tuple, TridentCollector collector) {
Map<String, Object> event = (Map<String, Object>) tuple.getValue(0);
Map<String, Object> vendorMap = new HashMap<>();
String clientMac = (String) event.get("client_mac");
if (clientMac != null) {
String oui = buildOui(clientMac);
if (_ouiMap.get(oui) != null)
vendorMap.put("client_mac_vendor", _ouiMap.get(oui));
}
collector.emit(new Values(vendorMap));
}
示例6: aggregate
import storm.trident.tuple.TridentTuple; //導入方法依賴的package包/類
@Override
public void aggregate(Result val, TridentTuple tuple, TridentCollector collector) {
Object v = tuple.getValue(0);
if(val.obj==null) {
val.obj = v;
} else {
val.obj = _agg.combine(val.obj, v);
}
}
示例7: aggregate
import storm.trident.tuple.TridentTuple; //導入方法依賴的package包/類
public void aggregate(Result val, TridentTuple tuple, TridentCollector collector) {
Object v = tuple.getValue(0);
if(val.obj==null) {
val.obj = v;
} else {
val.obj = _agg.combine(val.obj, v);
}
}
示例8: execute
import storm.trident.tuple.TridentTuple; //導入方法依賴的package包/類
@Override
public void execute(TridentTuple tuple, TridentCollector collector) {
List l = (List) tuple.getValue(0);
if (l != null) {
for (Object o : l) {
collector.emit(new Values(o));
}
}
}
示例9: isKeep
import storm.trident.tuple.TridentTuple; //導入方法依賴的package包/類
@Override
public boolean isKeep(TridentTuple tuple) {
for (int i = 0; i < tuple.size() - 1; i++) {
Object o1 = tuple.getValue(i);
Object o2 = tuple.getValue(i + 1);
if (o1 == null && o2 != null || o1 != null && o2 == null || !o1.equals(o2)) {
return false;
}
}
return true;
}
示例10: aggregate
import storm.trident.tuple.TridentTuple; //導入方法依賴的package包/類
public void aggregate(Result val, TridentTuple tuple, TridentCollector collector) {
Object v = tuple.getValue(0);
if (val.obj == null) {
val.obj = v;
} else {
val.obj = _agg.combine(val.obj, v);
}
}
示例11: isKeep
import storm.trident.tuple.TridentTuple; //導入方法依賴的package包/類
@Override
public boolean isKeep(TridentTuple tuple) {
for(int i=0; i<tuple.size()-1; i++) {
Object o1 = tuple.getValue(i);
Object o2 = tuple.getValue(i+1);
if(o1==null && o2!=null || o1!=null && o2==null || !o1.equals(o2)) {
return false;
}
}
return true;
}
示例12: execute
import storm.trident.tuple.TridentTuple; //導入方法依賴的package包/類
public void execute(TridentTuple tuple, TridentCollector collector) {
List l = (List) tuple.getValue(0);
if (l != null) {
for (Object o : l) {
collector.emit(new Values(o));
}
}
}
示例13: execute
import storm.trident.tuple.TridentTuple; //導入方法依賴的package包/類
/**
* <p> This enriching analyzes the http url, try looking for facebook users, dropboox users, twitter users, youtube users, google maps locations, linkedin shares, facebook likes, facebook shares and media data (jpg, png, avi, mp3 ...). </p>
*/
@Override
public void execute(TridentTuple tuple, TridentCollector collector) {
Map<String, Object> event = (Map<String, Object>) tuple.getValue(0);
result = new HashMap<>();
try {
this.event = event;
if (event.containsKey("http_host")) {
String httpHost = event.get("http_host").toString();
if (_debug)
System.out.println("HTTP_HOST: " + httpHost);
if (httpHost.contains("dropbox.com")) {
dropboxUser();
} else if (httpHost.contains("www.facebook.com")) {
facebookLikeShare();
} else if (httpHost.contains("akamaihd.net")
|| httpHost.contains("ak.fbcdn.net")) {
facebookUser();
} else if (httpHost.contains("maps.google.com")) {
locationGoogleMaps();
} else if (httpHost.contains("www.linkedin.com")) {
linkedinShare();
} else if (httpHost.contains("api.twitter.com")) {
twitterUser1();
} else if (httpHost.contains("twitter.com")) {
twitterUser2();
} else if (httpHost.contains("gdata.youtube.com")) {
youtubeUser();
} else {
mediaData();
}
}
collector.emit(new Values(result));
}catch (Exception ex){
result = new HashMap<>();
collector.emit(new Values(result));
System.out.println("Could not enrich with Http Analyzer function: " + event.toString() + "\n" + ex);
ex.printStackTrace();
}
}
示例14: execute
import storm.trident.tuple.TridentTuple; //導入方法依賴的package包/類
@Override
public void execute(TridentTuple tuple, TridentCollector collector) {
String type, tag, path;
DocumentBuilderFactory factory;
DocumentBuilder builder;
Document document;
String xml = (String) tuple.getValue(0);
Map<String, Object> event = null;
String key = null;
try {
factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
builder = factory.newDocumentBuilder();
document = builder.parse(new ByteArrayInputStream(xml.getBytes()));
document.getDocumentElement().normalize();
tag = document.getDocumentElement().getNodeName();
type = ((Attr) document.getDocumentElement().getAttributes().getNamedItem("type")).getValue();
path = ((Attr) document.getDocumentElement().getAttributes().getNamedItem("path")).getValue();
if (tag.equals("feed") && type.equals("add")) {
if (document.getElementsByTagName("hnbid").getLength() > 0) {
event = hnb_register(document);
key = path;
} else {
event = ue_ip_assign(document);
key = (String) event.remove("ip");
}
} else if (tag.equals("notify") && type.equals("add")) {
event = ue_register(document);
event.put("path", path);
key = (String) event.remove("client_id");
}
} catch (ParserConfigurationException | SAXException | IOException | NullPointerException ex) {
Logger.getLogger(MobileBuilderFunction.class.getName()).log(Level.SEVERE, "Failed reading a Mobile XML tuple", ex);
}
if (event != null && key != null) {
collector.emit(new Values(key, event));
}
}
示例15: init
import storm.trident.tuple.TridentTuple; //導入方法依賴的package包/類
@Override
public Number init(TridentTuple tuple) {
return (Number) tuple.getValue(0);
}