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


Java TridentTuple.get方法代碼示例

本文整理匯總了Java中storm.trident.tuple.TridentTuple.get方法的典型用法代碼示例。如果您正苦於以下問題:Java TridentTuple.get方法的具體用法?Java TridentTuple.get怎麽用?Java TridentTuple.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在storm.trident.tuple.TridentTuple的用法示例。


在下文中一共展示了TridentTuple.get方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: execute

import storm.trident.tuple.TridentTuple; //導入方法依賴的package包/類
@Override
public void execute(TridentTuple tuple, TridentCollector collector) {
    Map<String , Object> mseData = (Map<String, Object>) tuple.get(0);
    List<Map<String, Object>> notifications = (List<Map<String, Object>>) mseData.get("notifications");

    for (Map<String, Object> notification : notifications){
        if(notification.get("notificationType").equals("association")){
            logger.fine("Mse10 event this event is a association, emitting: [" + notification.size() + ", " + "null]");
            collector.emit(new Values(notification, null));
        }else if(notification.get("notificationType").equals("locationupdate")){
            logger.fine("Mse10 event this event is a locationupdate, emitting: [null" + ", " + notification.size() + "]");
            collector.emit(new Values(null, notification));
        }else{
            Logger.getLogger(SplitMSE10Data.class.getName()).log(Level.WARNING, "MSE version 10 notificationType is unknown: " + notification.get("notificationType"));
        }
    }
}
 
開發者ID:redBorder,項目名稱:rb-bi,代碼行數:18,代碼來源:SplitMSE10Data.java

示例2: isKeep

import storm.trident.tuple.TridentTuple; //導入方法依賴的package包/類
@Override
public boolean isKeep(TridentTuple tridentTuple) {
    String hrefList = tridentTuple.getString(0);
    Integer depth = (Integer)tridentTuple.get(1);

    if(hrefList == null || hrefList.trim().length() == 0 || depth == 0)
        return true;//Always pass tuple downstream. However skip recursively adding this Href URL to kafka.
    depth--;

    String[] hrefArray = hrefList.split(" ");
    for(String href : hrefArray) {
        producer.send(new KeyedMessage<String, String>(kafkaTopic, href+" "+depth.toString()));
    }

    return true;
}
 
開發者ID:skalmadka,項目名稱:web-crawler,代碼行數:17,代碼來源:KafkaProducerFilter.java

示例3: execute

import storm.trident.tuple.TridentTuple; //導入方法依賴的package包/類
@Override
public void execute(TridentTuple tuple, TridentCollector tridentCollector) {
    Map<String, Object> mseEvent = (Map<String, Object>) tuple.get(0);
    mseEventContent = (Map<String, Object>) mseEvent.get("StreamingNotification");
    location = (Map<String, Object>) mseEventContent.get("location");
    String macAddress = (String) location.get("macAddress");

    Map<String, Object> map = new HashMap<>();
    map.put("client_mac", macAddress);
    tridentCollector.emit(new Values(map));
}
 
開發者ID:redBorder,項目名稱:rb-bi,代碼行數:12,代碼來源:GetLocationClient.java

示例4: execute

import storm.trident.tuple.TridentTuple; //導入方法依賴的package包/類
@Override
public void execute(TridentTuple tuple, TridentCollector collector) {
    Map<String, Object> map = (Map<String, Object>) tuple.get(0);

    if (map != null) {
        Map<String, Object> data = new HashMap<>();
        data.putAll(map);
        data.remove("client_mac");

        Map<String, Object> druid = new HashMap<>();
        druid.put("bytes", 0);
        druid.put("pkts", 0);
        druid.put("timestamp", System.currentTimeMillis() / 1000);
        druid.putAll(map);
        druid.put("type", "nmsp-info");

        Object vlan = map.get("vlan_id");

        if (vlan != null) {
            druid.put("src_vlan", vlan);
            data.put("src_vlan", vlan);
            data.remove("vlan_id");
            druid.remove("vlan_id");
        }

        // logger.severe("Processed NMSP data info, emitting  [" + map.get("client_mac") + ", " + data.size() + ", " + druid.size() + "]");

        collector.emit(new Values(map.get("client_mac"), data, druid));
    }
}
 
開發者ID:redBorder,項目名稱:rb-bi,代碼行數:31,代碼來源:GetNMSPInfoData.java

示例5: execute

import storm.trident.tuple.TridentTuple; //導入方法依賴的package包/類
@Override
public void execute(TridentTuple tuple, TridentCollector collector) {
    Map<String, Object> association = (Map<String, Object>) tuple.get(0);
    try {
        // logger.severe("Processing mse10Association");
        Map<String, Object> dataToSave = new HashMap<>();
        Map<String, Object> dataToDruid = new HashMap<>();
        String client_mac = (String) association.get("deviceId");

        if (association.get("ssid") != null)
            dataToSave.put("wireless_id", association.get("ssid"));

        if (association.get("band") != null)
            dataToSave.put("dot11_protocol", association.get("band"));

        if (association.get("status") != null)
            dataToSave.put("dot11_status", cache.get(association.get("status")));

        if (association.get("apMacAddress") != null)
            dataToSave.put("wireless_station", association.get("apMacAddress"));

        if (!association.get("username").equals(""))
            dataToSave.put("client_id", association.get("username"));


        dataToDruid.putAll(dataToSave);
        dataToDruid.put("sensor_name", association.get("subscriptionName"));
        dataToDruid.put("client_mac", client_mac);
        dataToDruid.put("timestamp", ((Long) association.get("timestamp")) / 1000L);
        dataToDruid.put("bytes", 0);
        dataToDruid.put("pkts", 0);
        dataToDruid.put("type", "mse10");

        // logger.severe("Emitting  [" + client_mac + ", " + dataToSave.size() + ", " + dataToDruid.size());

        collector.emit(new Values(client_mac, dataToSave, dataToDruid));
    } catch (Exception ex) {
        if (association != null)
            System.out.println("MSE10 association event dropped: " + association.toString());
        ex.printStackTrace();
    }
}
 
開發者ID:redBorder,項目名稱:rb-bi,代碼行數:43,代碼來源:ProcessMse10Association.java

示例6: execute

import storm.trident.tuple.TridentTuple; //導入方法依賴的package包/類
@Override
public void execute(TridentTuple tuple, TridentCollector collector) {
    Map<String, Object> locationUpdate = (Map<String, Object>) tuple.get(0);
    try {
        // logger.severe("Processing mse10LocationUpdate");

        Map<String, Object> dataToSave = new HashMap<>();
        Map<String, Object> dataToDruid = new HashMap<>();

        String client_mac = (String) locationUpdate.get("deviceId");

        String locationMapHierarchy = (String) locationUpdate.get("locationMapHierarchy");

        if (locationMapHierarchy != null) {
            String[] locations = locationMapHierarchy.split(">");

            if (locations.length >= 1)
                dataToSave.put("client_campus", locations[0]);
            if (locations.length >= 2)
                dataToSave.put("client_building", locations[1]);
            if (locations.length >= 3)
                dataToSave.put("client_floor", locations[2]);
            if (locations.length >= 4)
                dataToSave.put("client_zone", locations[3]);
        }

        dataToDruid.putAll(dataToSave);
        dataToDruid.put("sensor_name", locationUpdate.get("subscriptionName"));

        if (locationUpdate.get("timestamp") instanceof Integer)
            dataToDruid.put("timestamp", ((Integer) locationUpdate.get("timestamp")) / 1000L);
        else if (locationUpdate.get("timestamp") instanceof Long)
            dataToDruid.put("timestamp", ((Long) locationUpdate.get("timestamp")) / 1000L);
        else
            dataToDruid.put("timestamp", System.currentTimeMillis() / 1000L);


        dataToDruid.put("bytes", 0);
        dataToDruid.put("pkts", 0);
        dataToDruid.put("type", "mse10");

        // logger.severe("Emitting  [" + client_mac + ", " + dataToSave.size() + ", " + dataToDruid.size());

        collector.emit(new Values(client_mac, dataToSave, dataToDruid));
    } catch (Exception ex) {
        if (locationUpdate != null)
            logger.info("MSE10 locationUpdate event dropped: " + locationUpdate.toString());
        ex.printStackTrace();
    }
}
 
開發者ID:redBorder,項目名稱:rb-bi,代碼行數:51,代碼來源:ProcessMse10LocationUpdate.java

示例7: execute

import storm.trident.tuple.TridentTuple; //導入方法依賴的package包/類
@Override
public void execute(TridentTuple tuple, TridentCollector collector) {
    Map<String, Object> mseUpdate = (Map<String, Object>) tuple.get(0);
    collector.emit(new Values(mseUpdate.get("deviceId")));
}
 
開發者ID:redBorder,項目名稱:rb-bi,代碼行數:6,代碼來源:GetLocationUpdateClientMac.java

示例8: execute

import storm.trident.tuple.TridentTuple; //導入方法依賴的package包/類
@Override
public void execute(TridentTuple tuple, Map<String, Object> result, TridentCollector collector) {
    Map<String, Object> nmspEvent = (Map<String, Object>) tuple.get(0);

    if (nmspEvent != null) {

        List<String> apMacs = (List<String>) nmspEvent.get("ap_mac");
        List<Integer> clientRssis = (List<Integer>) nmspEvent.get("rssi");

        if (clientRssis != null && apMacs != null && !apMacs.isEmpty() && !clientRssis.isEmpty()) {
            String client_mac = (String) nmspEvent.get("client_mac");
            String sensor_name = (String) nmspEvent.get("sensor_name");
            Integer rssi = Collections.max(clientRssis);
            String apMac = apMacs.get(clientRssis.indexOf(rssi));
            Map<String, Object> enrichment = (Map<String, Object>) nmspEvent.get("enrichment");

            Map<String, Object> map = new HashMap<>();


            if (rssi == 0)
                map.put("client_rssi", "unknown");
            else if (rssi <= -85)
                map.put("client_rssi", "bad");
            else if (rssi <= -80)
                map.put("client_rssi", "low");
            else if (rssi <= -70)
                map.put("client_rssi", "medium");
            else if (rssi <= -60)
                map.put("client_rssi", "good");
            else
                map.put("client_rssi", "excelent");

            if (result == null) {
                map.put("client_rssi_num", rssi);
                map.put("wireless_station", apMac);
                map.put("dot11_status", "PROBING");
            } else {
                if (apMacs.contains(result.get("wireless_station"))) {
                    map.put("client_rssi_num", rssi);
                    map.putAll(result);
                } else {
                    map.put("client_rssi_num", rssi);
                    map.put("wireless_station", apMac);
                    map.put("dot11_status", "PROBING");
                }
            }
            Map<String, Object> druid = new HashMap<>();

            if (enrichment != null)
                druid.putAll(enrichment);

            druid.put("bytes", 0);
            druid.put("pkts", 0);
            druid.put("sensor_name", sensor_name);
            druid.put("type", "nmsp-measure");
            druid.put("client_mac", client_mac);
            druid.put("timestamp", System.currentTimeMillis() / 1000);
            druid.putAll(map);
            collector.emit(new Values(client_mac, map, druid));
        }
    }
}
 
開發者ID:redBorder,項目名稱:rb-bi,代碼行數:63,代碼來源:MemcachedNmspMeasureQuery.java

示例9: execute

import storm.trident.tuple.TridentTuple; //導入方法依賴的package包/類
@Override
public void execute(TridentTuple tuple, Map<String, Object> result, TridentCollector collector) {
    Map<String, Object> nmspEvent = (Map<String, Object>) tuple.get(0);

    if (nmspEvent != null) {
        String client_mac = (String) nmspEvent.get("client_mac");
        String sensor_name = (String) nmspEvent.get("sensor_name");
        List<String> apMacs = (List<String>) nmspEvent.get("ap_mac");
        List<Integer> clientRssis = (List<Integer>) nmspEvent.get("rssi");
        Integer rssi = Collections.max(clientRssis);
        String apMac = apMacs.get(clientRssis.indexOf(rssi));
        Map<String, Object> enrichment = (Map<String, Object>) nmspEvent.get("enrichment");

        Map<String, Object> map = new HashMap<>();

        if (rssi == 0)
            map.put("client_rssi", "unknown");
        else if (rssi <= -85)
            map.put("client_rssi", "bad");
        else if (rssi <= -80)
            map.put("client_rssi", "low");
        else if (rssi <= -70)
            map.put("client_rssi", "medium");
        else if (rssi <= -60)
            map.put("client_rssi", "good");
        else
            map.put("client_rssi", "excelent");

        if (result == null) {
            map.put("client_rssi_num", rssi);
            map.put("wireless_station", apMac);
            map.put("dot11_status", "PROBING");
        } else {
            if (apMacs.contains(result.get("wireless_station"))) {
                map.put("client_rssi_num", rssi);
                map.putAll(result);
            } else {
                map.put("client_rssi_num", rssi);
                map.put("wireless_station", apMac);
                map.put("dot11_status", "PROBING");
            }
        }
        Map<String, Object> druid = new HashMap<>();

        if (enrichment != null)
            druid.putAll(enrichment);

        druid.put("bytes", 0);
        druid.put("pkts", 0);
        druid.put("sensor_name", sensor_name);
        druid.put("type", "nmsp-measure");
        druid.put("client_mac", client_mac);
        druid.put("timestamp", System.currentTimeMillis() / 1000);
        druid.putAll(map);
        collector.emit(new Values(client_mac, map, druid));
    }
}
 
開發者ID:redBorder,項目名稱:rb-bi,代碼行數:58,代碼來源:RiakNmspMeasureQuery.java

示例10: execute

import storm.trident.tuple.TridentTuple; //導入方法依賴的package包/類
@Override
public void execute(TridentTuple tuple, Map<String, Object> result, TridentCollector collector) {
    Map<String, Object> nmspEvent = (Map<String, Object>) tuple.get(0);

    if (nmspEvent != null) {
        // if (result != null)
        //     logger.severe("Resulting NmspGridGainQuery " + result.size());
        // else
        //     logger.severe("Resulting NmspGridGainQuery " + null);

        List<String> apMacs = (List<String>) nmspEvent.get("ap_mac");
        List<Integer> clientRssis = (List<Integer>) nmspEvent.get("rssi");

        if (clientRssis != null && apMacs != null && !apMacs.isEmpty() && !clientRssis.isEmpty()) {
            String client_mac = (String) nmspEvent.get("client_mac");
            String sensor_name = (String) nmspEvent.get("sensor_name");
            Integer rssi = Collections.max(clientRssis);
            // logger.severe("Max RSSI is: " + rssi);
            String apMac = apMacs.get(clientRssis.indexOf(rssi));

            Map<String, Object> map = new HashMap<>();

            if (rssi == 0)
                map.put("client_rssi", "unknown");
            else if (rssi <= -85)
                map.put("client_rssi", "bad");
            else if (rssi <= -80)
                map.put("client_rssi", "low");
            else if (rssi <= -70)
                map.put("client_rssi", "medium");
            else if (rssi <= -60)
                map.put("client_rssi", "good");
            else
                map.put("client_rssi", "excelent");

            if (result == null) {
                map.put("client_rssi_num", rssi);
                map.put("wireless_station", apMac);
                map.put("dot11_status", "PROBING");
            } else {
                String apAssociated = (String) result.get("wireless_station");

                if (apMacs.contains(apAssociated)) {
                    Integer rssiAssociated = clientRssis.get(apMacs.indexOf(apAssociated));
                    map.put("client_rssi_num", rssiAssociated);
                    map.putAll(result);
                } else {
                    map.put("client_rssi_num", rssi);
                    map.put("wireless_station", apMac);
                    map.put("dot11_status", "PROBING");
                }
            }

            Map<String, Object> druid = new HashMap<>();

            druid.put("bytes", 0);
            druid.put("pkts", 0);
            druid.put("sensor_name", sensor_name);
            druid.put("type", "nmsp-measure");
            druid.put("client_mac", client_mac);
            druid.put("timestamp", System.currentTimeMillis() / 1000);
            druid.putAll(map);

            // logger.severe("Finished nmspGridGainQuery, emmiting [" + client_mac + ", " + map.size() + ", " + druid.size() + "]");
            collector.emit(new Values(client_mac, map, druid));
        }
    }
}
 
開發者ID:redBorder,項目名稱:rb-bi,代碼行數:69,代碼來源:GridGainNmspMeasureQuery.java

示例11: isKeep

import storm.trident.tuple.TridentTuple; //導入方法依賴的package包/類
@Override
public boolean isKeep(TridentTuple tuple) {
    Map<String, Object> tupleMap = (Map<String, Object>) tuple.get(0);
    String fieldStr = (String) tupleMap.get(_field);
    return (fieldStr != null && fieldStr.equals(_value));
}
 
開發者ID:redBorder,項目名稱:rb-bi,代碼行數:7,代碼來源:FieldFilter.java


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