com.ucar.datalink.domain.media.parameter.zk.ZkMediaSrcParameter类的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(9.1k)|赞(0)|评价(0)|浏览(90)

本文整理了Java中com.ucar.datalink.domain.media.parameter.zk.ZkMediaSrcParameter类的一些代码示例,展示了ZkMediaSrcParameter类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZkMediaSrcParameter类的具体详情如下:
包路径:com.ucar.datalink.domain.media.parameter.zk.ZkMediaSrcParameter
类名称:ZkMediaSrcParameter

ZkMediaSrcParameter介绍

[英]Created by sqq on 2017/5/11.
[中]由sqq于2017年5月11日创建。

代码示例

代码示例来源:origin: ucarGroup/DataLink

@RequestMapping(value = "/initZk")
@ResponseBody
public Page<ZkMediaSourceView> initZk() {
  Set<MediaSourceType> setMediaSource = new HashSet<MediaSourceType>();
  setMediaSource.add(MediaSourceType.ZOOKEEPER);
  List<MediaSourceInfo> zkMediaSourceList = mediaSourceService.getListByType(setMediaSource);
  List<ZkMediaSourceView> taskView = zkMediaSourceList.stream().map(i -> {
    ZkMediaSourceView view = new ZkMediaSourceView();
    view.setId(i.getId());
    view.setName(i.getName());
    view.setDesc(i.getDesc());
    view.setCreateTime(i.getCreateTime());
    view.getZkMediaSrcParameter().setMediaSourceType(i.getType());
    view.getZkMediaSrcParameter().setServers(((ZkMediaSrcParameter) i.getParameterObj()).getServers());
    view.getZkMediaSrcParameter().setSessionTimeout(((ZkMediaSrcParameter) i.getParameterObj()).getSessionTimeout());
    view.getZkMediaSrcParameter().setConnectionTimeout(((ZkMediaSrcParameter) i.getParameterObj()).getConnectionTimeout());
    return view;
  }).collect(Collectors.toList());
  return new Page<ZkMediaSourceView>(taskView);
}

代码示例来源:origin: ucarGroup/DataLink

@Override
  public Configuration load(MediaSourceInfo mediaSourceInfo) throws Exception {
    HBaseMediaSrcParameter hbaseParameter = mediaSourceInfo.getParameterObj();
    MediaSourceInfo zkMediaSource = DataLinkFactory.getObject(MediaService.class).getMediaSourceById(hbaseParameter.getZkMediaSourceId());
    ZkMediaSrcParameter zkParameter = zkMediaSource.getParameterObj();
    String address = zkParameter.parseServersToString();
    String prot = zkParameter.parsePort() + "";
    String znode = hbaseParameter.getZnodeParent();
    Configuration conf = HBaseConfiguration.create();
    conf.set("hbase.zookeeper.quorum", address);
    conf.set("hbase.zookeeper.property.clientPort", prot);
    conf.set("zookeeper.znode.parent", znode);
    return conf;
  }
});

代码示例来源:origin: ucarGroup/DataLink

public static List<HBaseRange> generateHBaseSplitInfo(MediaSourceInfo info, String tableName, int splitCount) {
  checkHbase(info);
  HBaseMediaSrcParameter parameter = info.getParameterObj();
  long zkId = parameter.getZkMediaSourceId();
  String znode = parameter.getZnodeParent();
  MediaSourceInfo zkInfo = dao.findMediaSourceById(zkId);
  checkZookeepr(zkInfo);
  ZkMediaSrcParameter zkParameter = zkInfo.getParameterObj();
  HBaseParameterVO vo = new HBaseParameterVO();
  vo.setTableName(tableName);
  vo.setZkAddress(zkParameter.getServers());
  vo.setPort(zkParameter.parsePort()+"");
  vo.setZnode(parameter.getZnodeParent());
  vo.setSplitCount(splitCount);
  String json = execute(vo,GENERATE_SPLIT_INFO);
  Map<String,Object> map = JSONObject.parseObject(json,Map.class);
  JSONArray array = (JSONArray)map.get("range");
  Object[] obj_arr = array.toArray();
  List<HBaseRange> list = new ArrayList<>();
  for(Object o : obj_arr) {
    String str = JSONObject.toJSONString(o);
    HBaseRange hr = JSONObject.parseObject(str, HBaseRange.class);
    list.add(hr);
  }
  return list;
}

代码示例来源:origin: ucarGroup/DataLink

@Override
public String toString() {
  return "zkAddress:"+zkParameter.getServers()+"    znode:"+hbaseParameter.getZnodeParent();
}

代码示例来源:origin: ucarGroup/DataLink

HBaseMediaSrcParameter hbaseParameter = new HBaseMediaSrcParameter();
hbaseParameter.setZnodeParent(vo.getZnode());
ZkMediaSrcParameter zkParameter = new ZkMediaSrcParameter();
zkParameter.setServers(vo.getZkAddress());

代码示例来源:origin: ucarGroup/DataLink

public static int getRegionCount(MediaSourceInfo info, String tableName) {
  checkHbase(info);
  HBaseMediaSrcParameter parameter = info.getParameterObj();
  long zkId = parameter.getZkMediaSourceId();
  String znode = parameter.getZnodeParent();
  MediaSourceInfo zkInfo = dao.findMediaSourceById(zkId);
  checkZookeepr(zkInfo);
  ZkMediaSrcParameter zkParameter = zkInfo.getParameterObj();
  HBaseParameterVO vo = new HBaseParameterVO();
  vo.setTableName(tableName);
  vo.setZkAddress(zkParameter.getServers());
  vo.setPort(zkParameter.parsePort()+"");
  vo.setZnode(parameter.getZnodeParent());
  String json = execute(vo,GET_REGION_COUNT);
  int result = -1;
  try {
    result = Integer.parseInt(json);
  } catch(Exception e) {
    logger.error(e.getMessage(),e);
  }
  return result;
}

代码示例来源:origin: ucarGroup/DataLink

@Override
public String toString() {
  return "zkAddress:"+zkParameter.getServers()+"    znode:"+hbaseParameter.getZnodeParent() + "    table name:"+tableName;
}

代码示例来源:origin: ucarGroup/DataLink

HBaseMediaSrcParameter hbaseParameter = new HBaseMediaSrcParameter();
hbaseParameter.setZnodeParent(vo.getZnode());
ZkMediaSrcParameter zkParameter = new ZkMediaSrcParameter();
zkParameter.setServers(vo.getZkAddress());
String tableName = vo.getTableName();
int splitCount = vo.getSplitCount();

代码示例来源:origin: ucarGroup/DataLink

/**
 * 根据传入的MediaSourceInfo 获取所有表的元信息
 * @param info
 * @return
 */
public static List<MediaMeta> getTables(MediaSourceInfo info) {
  checkHbase(info);
  HBaseMediaSrcParameter parameter = info.getParameterObj();
  long zkId = parameter.getZkMediaSourceId();
  String znode = parameter.getZnodeParent();
  MediaSourceInfo zkInfo = dao.findMediaSourceById(zkId);
  checkZookeepr(zkInfo);
  ZkMediaSrcParameter zkParameter = zkInfo.getParameterObj();
  HBaseParameterVO vo = new HBaseParameterVO();
  vo.setTableName("");
  vo.setZkAddress(zkParameter.getServers());
  vo.setPort(zkParameter.parsePort()+"");
  vo.setZnode(parameter.getZnodeParent());
  String json = execute(vo,GET_TABLES_URL);
  return JSONObject.parseArray(json, MediaMeta.class);
}

代码示例来源:origin: ucarGroup/DataLink

@Override
public String toString() {
  return "zkAddress:"+zkParameter.getServers()+"    znode:"+hbaseParameter.getZnodeParent() + "    table name:"+tableName;
}

代码示例来源:origin: ucarGroup/DataLink

conf.set("hbase.zookeeper.quorum", zkParameter.parseServersToString());
conf.set("hbase.zookeeper.property.clientPort", zkParameter.parsePort() + "");
conf.set("zookeeper.znode.parent", hbaseParameter.getZnodeParent());
logger.info("getHbaseColumnFamilies hbase admin begin connection.");

代码示例来源:origin: ucarGroup/DataLink

HBaseMediaSrcParameter hbaseParameter = new HBaseMediaSrcParameter();
hbaseParameter.setZnodeParent(vo.getZnode());
ZkMediaSrcParameter zkParameter = new ZkMediaSrcParameter();
zkParameter.setServers(vo.getZkAddress());
String tableName = vo.getTableName();
if(tableName==null) {

代码示例来源:origin: ucarGroup/DataLink

/**
 * 根据传入的MediaSourceInfo和表名,获取这个表下的所有列的元信息
 * @param info
 * @param tableName
 * @return
 */
public static List<ColumnMeta> getColumns(MediaSourceInfo info, String tableName) {
  checkHbase(info);
  HBaseMediaSrcParameter parameter = info.getParameterObj();
  long zkId = parameter.getZkMediaSourceId();
  String znode = parameter.getZnodeParent();
  MediaSourceInfo zkInfo = dao.findMediaSourceById(zkId);
  checkZookeepr(zkInfo);
  ZkMediaSrcParameter zkParameter = zkInfo.getParameterObj();
  HBaseParameterVO vo = new HBaseParameterVO();
  vo.setTableName(tableName);
  vo.setZkAddress(zkParameter.getServers());
  vo.setPort(zkParameter.parsePort()+"");
  vo.setZnode(parameter.getZnodeParent());
  String json = execute(vo,GET_COLUMNS_URL);
  return JSONObject.parseArray(json, ColumnMeta.class);
}

代码示例来源:origin: ucarGroup/DataLink

@Override
public String toString() {
  return "zkAddress:"+zkParameter.getServers()+"    znode:"+hbaseParameter.getZnodeParent();
}

代码示例来源:origin: ucarGroup/DataLink

ZkMediaSrcParameter zkParameter = event.getZkParameter();
String znode = hbaseParameter.getZnodeParent();
String address = zkParameter.parseServersToString();
String port = zkParameter.parsePort()+"";
org.apache.hadoop.conf.Configuration conf = HBaseConfiguration.create();
conf.set("hbase.zookeeper.quorum", address);

代码示例来源:origin: ucarGroup/DataLink

HBaseMediaSrcParameter hbaseParameter = new HBaseMediaSrcParameter();
hbaseParameter.setZnodeParent(vo.getZnode());
ZkMediaSrcParameter zkParameter = new ZkMediaSrcParameter();
zkParameter.setServers(vo.getZkAddress());
String tableName = vo.getTableName();

代码示例来源:origin: ucarGroup/DataLink

@Override
public String toString() {
  return "zkAddress:"+zkParameter.getServers()+"    znode:"+hbaseParameter.getZnodeParent() + "    table name:"+tableName;
}

代码示例来源:origin: ucarGroup/DataLink

String port = zkParameter.parsePort() + "";
String address = zkParameter.parseServersToString();
String znode = hbaseParameter.getZnodeParent();
org.apache.hadoop.conf.Configuration conf = HBaseConfiguration.create();

代码示例来源:origin: ucarGroup/DataLink

HBaseMediaSrcParameter hbaseParameter = new HBaseMediaSrcParameter();
hbaseParameter.setZnodeParent(vo.getZnode());
ZkMediaSrcParameter zkParameter = new ZkMediaSrcParameter();
zkParameter.setServers(vo.getZkAddress());
String tableName = vo.getTableName();

代码示例来源:origin: ucarGroup/DataLink

private List<MediaSourceInfo> buildZkMediaSources() {
  List<MediaSourceInfo> list = mediaService.getMediaSourcesByTypes(MediaSourceType.ZOOKEEPER);
  return list == null ?
      Lists.newArrayList() :
      list.stream().
          filter(i -> ((ZkMediaSrcParameter) i.getParameterObj()).getServers().equals(ManagerConfig.current().getZkServer()))
          .collect(Collectors.toList());
}

相关文章