DocUrlService.java
878 Bytes
package com.peony.netty.service;
import com.peony.netty.util.HbaseFileSystem;
import com.peony.util.StringUtils;
import org.apache.hadoop.hbase.TableName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class DocUrlService {
private static DocUrlService instance = new DocUrlService();
private final TableName tableUrl = TableName.valueOf("doc_url");
private Logger logger = LoggerFactory.getLogger(DocUrlService.class);
private HbaseFileSystem fileSystem = HbaseFileSystem.getInstance();
public static DocUrlService getInstance() {
return instance;
}
public String get(String id) {
String url = null;
try {
url = new String(fileSystem.get(id, tableUrl), StringUtils.CHARSET);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return url;
}
}