当前位置: 首页>>代码示例>>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;未经允许,请勿转载。