當前位置: 首頁>>代碼示例>>Java>>正文


Java TridentTuple.getValue方法代碼示例

本文整理匯總了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));
}
 
開發者ID:redBorder,項目名稱:rb-bi,代碼行數:22,代碼來源:GetRadiusClient.java

示例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;
}
 
開發者ID:zhangjunfang,項目名稱:jstorm-0.9.6.3-,代碼行數:17,代碼來源:Equals.java

示例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>()));
    }
}
 
開發者ID:redBorder,項目名稱:rb-bi,代碼行數:12,代碼來源:PostgreSQLocation.java

示例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));
    }

}
 
開發者ID:redBorder,項目名稱:rb-bi,代碼行數:15,代碼來源:CheckTimestampFunction.java

示例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));
}
 
開發者ID:redBorder,項目名稱:rb-bi,代碼行數:15,代碼來源:MacVendorFunction.java

示例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);
       }
   }
 
開發者ID:zhangjunfang,項目名稱:jstorm-0.9.6.3-,代碼行數:10,代碼來源:CombinerAggregatorCombineImpl.java

示例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);
    }
}
 
開發者ID:songtk,項目名稱:learn_jstorm,代碼行數:9,代碼來源:CombinerAggregatorCombineImpl.java

示例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));
    }
  }
}
 
開發者ID:luozhaoyu,項目名稱:big-data-system,代碼行數:10,代碼來源:TridentReach.java

示例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;
}
 
開發者ID:kkllwww007,項目名稱:jstrom,代碼行數:12,代碼來源:Equals.java

示例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);
    }
}
 
開發者ID:kkllwww007,項目名稱:jstrom,代碼行數:9,代碼來源:CombinerAggregatorCombineImpl.java

示例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;
}
 
開發者ID:greeenSY,項目名稱:Tstream,代碼行數:12,代碼來源:Equals.java

示例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));
		}
	}
}
 
開發者ID:desp0916,項目名稱:LearnStorm,代碼行數:9,代碼來源:TridentReach.java

示例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();
    }
}
 
開發者ID:redBorder,項目名稱:rb-bi,代碼行數:46,代碼來源:AnalizeHttpUrlFunction.java

示例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));
    }
}
 
開發者ID:redBorder,項目名稱:rb-bi,代碼行數:45,代碼來源:MobileBuilderFunction.java

示例15: init

import storm.trident.tuple.TridentTuple; //導入方法依賴的package包/類
@Override
public Number init(TridentTuple tuple) {
    return (Number) tuple.getValue(0);
}
 
開發者ID:zhangjunfang,項目名稱:jstorm-0.9.6.3-,代碼行數:5,代碼來源:Sum.java


注:本文中的storm.trident.tuple.TridentTuple.getValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。