当前位置: 首页>>代码示例>>Java>>正文


Java BasicTsKvEntry类代码示例

本文整理汇总了Java中org.iotp.infomgt.data.kv.BasicTsKvEntry的典型用法代码示例。如果您正苦于以下问题:Java BasicTsKvEntry类的具体用法?Java BasicTsKvEntry怎么用?Java BasicTsKvEntry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BasicTsKvEntry类属于org.iotp.infomgt.data.kv包,在下文中一共展示了BasicTsKvEntry类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parse

import org.iotp.infomgt.data.kv.BasicTsKvEntry; //导入依赖的package包/类
private List<DeviceData> parse(String topic, List<String> srcList) {
  List<DeviceData> result = new ArrayList<>(srcList.size());
  for (String src : srcList) {
    DocumentContext document = JsonPath.parse(src);
    long ts = System.currentTimeMillis();
    String deviceName;
    if (!StringUtils.isEmpty(deviceNameTopicExpression)) {
      deviceName = eval(topic);
    } else {
      deviceName = eval(document, deviceNameJsonExpression);
    }
    if (!StringUtils.isEmpty(deviceName)) {
      List<KvEntry> attrData = getKvEntries(document, attributes);
      List<TsKvEntry> tsData = getKvEntries(document, timeseries).stream().map(kv -> new BasicTsKvEntry(ts, kv))
          .collect(Collectors.toList());
      result.add(new DeviceData(deviceName, attrData, tsData, timeout));
    }
  }
  return result;
}
 
开发者ID:osswangxining,项目名称:iotgateway,代码行数:21,代码来源:MqttJsonConverter.java

示例2: getTsKvEntries

import org.iotp.infomgt.data.kv.BasicTsKvEntry; //导入依赖的package包/类
private List<TsKvEntry> getTsKvEntries(DocumentContext document, List<? extends TimeseriesMapping> mappings, long defaultTs) throws ParseException {
    List<TsKvEntry> result = new ArrayList<>();
    if (mappings != null) {
        for (TransformerKVMapping mapping : mappings) {
            String key = eval(document, mapping.getKey());
            String strVal = eval(document, mapping.getValue());
            long ts = defaultTs;
            if (!StringUtils.isEmpty(mapping.getTs())) {
                String tsVal = eval(document, mapping.getTs());
                if (!StringUtils.isEmpty(mapping.getTsFormat())) {
                    SimpleDateFormat formatter = formatters.computeIfAbsent(mapping.getTsFormat(), SimpleDateFormat::new);
                    ts = formatter.parse(tsVal).getTime();
                } else {
                    ts = Long.parseLong(tsVal);
                }
            }
            DataValueTransformer transformer = mapping.getTransformer();
            if (transformer != null && transformer.isApplicable(strVal)) {
                result.add(new BasicTsKvEntry(ts, getKvEntry(mapping, key, strVal, transformer)));
            } else if (transformer == null) {
                result.add(new BasicTsKvEntry(ts, getKvEntry(mapping, key, strVal)));
            }
        }
    }
    return result;
}
 
开发者ID:osswangxining,项目名称:iot-edge-greengrass,代码行数:27,代码来源:BasicJsonConverter.java

示例3: onAttributesUpdateFromServer

import org.iotp.infomgt.data.kv.BasicTsKvEntry; //导入依赖的package包/类
public void onAttributesUpdateFromServer(PluginContext ctx, EntityId entityId, String scope, List<AttributeKvEntry> attributes) {
    Optional<ServerAddress> serverAddress = ctx.resolve(entityId);
    if (!serverAddress.isPresent()) {
        onLocalSubscriptionUpdate(ctx, entityId, SubscriptionType.ATTRIBUTES, s -> {
            List<TsKvEntry> subscriptionUpdate = new ArrayList<TsKvEntry>();
            for (AttributeKvEntry kv : attributes) {
                if (s.isAllKeys() || s.getKeyStates().containsKey(kv.getKey())) {
                    subscriptionUpdate.add(new BasicTsKvEntry(kv.getLastUpdateTs(), kv));
                }
            }
            return subscriptionUpdate;
        });
    } else {
        rpcHandler.onAttributesUpdate(ctx, serverAddress.get(), entityId, scope, attributes);
    }
}
 
开发者ID:osswangxining,项目名称:iotplatform,代码行数:17,代码来源:SubscriptionManager.java

示例4: getAffectedTimeseries

import org.iotp.infomgt.data.kv.BasicTsKvEntry; //导入依赖的package包/类
public List<TsKvEntry> getAffectedTimeseries(NodeId tagId, DataValue dataValue) {
    List<AttributesMapping> attributes = getAttributesMapping(tagId);
    if (attributes.size() > 0) {
        return getKvEntries(attributes).stream()
                .map(kv -> new BasicTsKvEntry(dataValue.getSourceTime().getJavaTime(), kv))
                .collect(Collectors.toList());
    } else {
        return Collections.emptyList();
    }
}
 
开发者ID:osswangxining,项目名称:iot-edge-greengrass,代码行数:11,代码来源:OpcUaDevice.java

示例5: parse

import org.iotp.infomgt.data.kv.BasicTsKvEntry; //导入依赖的package包/类
private List<DeviceData> parse(String topic, List<String> srcList) {
    List<DeviceData> result = new ArrayList<>(srcList.size());
    for (String src : srcList) {
        DocumentContext document = JsonPath.parse(src);
        long ts = System.currentTimeMillis();
        String deviceName;
        String deviceType = null;
        if (!StringUtils.isEmpty(deviceNameTopicExpression)) {
            deviceName = evalDeviceName(topic);
        } else {
            deviceName = eval(document, deviceNameJsonExpression);
        }
        if (!StringUtils.isEmpty(deviceTypeTopicExpression)) {
            deviceType = evalDeviceType(topic);
        } else if (!StringUtils.isEmpty(deviceTypeJsonExpression)) {
            deviceType = eval(document, deviceTypeJsonExpression);
        }

        if (!StringUtils.isEmpty(deviceName)) {
            List<KvEntry> attrData = getKvEntries(document, attributes);
            List<TsKvEntry> tsData = getKvEntries(document, timeseries).stream()
                    .map(kv -> new BasicTsKvEntry(ts, kv))
                    .collect(Collectors.toList());
            result.add(new DeviceData(deviceName, deviceType, attrData, tsData, timeout));
        }
    }
    return result;
}
 
开发者ID:osswangxining,项目名称:iot-edge-greengrass,代码行数:29,代码来源:MqttJsonConverter.java

示例6: pushTsEntries

import org.iotp.infomgt.data.kv.BasicTsKvEntry; //导入依赖的package包/类
private static void pushTsEntries(VelocityContext context, TelemetryUploadRequest payload) {
  payload.getData().forEach((k, vList) -> {
    vList.forEach(v -> {
      context.put(v.getKey(), new BasicTsKvEntry(k, v));
    });
  });
}
 
开发者ID:osswangxining,项目名称:iotplatform,代码行数:8,代码来源:VelocityUtils.java

示例7: convertResultToTsKvEntry

import org.iotp.infomgt.data.kv.BasicTsKvEntry; //导入依赖的package包/类
private TsKvEntry convertResultToTsKvEntry(String key, Row row) {
    if (row != null) {
        long ts = row.getLong(ModelConstants.TS_COLUMN);
        return new BasicTsKvEntry(ts, toKvEntry(row, key));
    } else {
        return new BasicTsKvEntry(System.currentTimeMillis(), new StringDataEntry(key, null));
    }
}
 
开发者ID:osswangxining,项目名称:iotplatform,代码行数:9,代码来源:CassandraBaseTimeseriesDao.java

示例8: toTimeseries

import org.iotp.infomgt.data.kv.BasicTsKvEntry; //导入依赖的package包/类
private TsKvEntry toTimeseries(KeyValueProto proto) {
  return new BasicTsKvEntry(proto.getTs(), getKvEntry(proto));
}
 
开发者ID:osswangxining,项目名称:iotplatform,代码行数:4,代码来源:TelemetryRpcMsgHandler.java


注:本文中的org.iotp.infomgt.data.kv.BasicTsKvEntry类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。