|
@@ -1,7 +1,5 @@
|
|
package com.diagbot.client.fastdfs;
|
|
package com.diagbot.client.fastdfs;
|
|
|
|
|
|
-import com.diagbot.util.StringUtil;
|
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.csource.common.NameValuePair;
|
|
import org.csource.common.NameValuePair;
|
|
import org.csource.fastdfs.ClientGlobal;
|
|
import org.csource.fastdfs.ClientGlobal;
|
|
import org.csource.fastdfs.FileInfo;
|
|
import org.csource.fastdfs.FileInfo;
|
|
@@ -11,7 +9,6 @@ import org.csource.fastdfs.StorageServer;
|
|
import org.csource.fastdfs.TrackerClient;
|
|
import org.csource.fastdfs.TrackerClient;
|
|
import org.csource.fastdfs.TrackerServer;
|
|
import org.csource.fastdfs.TrackerServer;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
-import org.springframework.core.io.ClassPathResource;
|
|
|
|
|
|
|
|
import java.io.ByteArrayInputStream;
|
|
import java.io.ByteArrayInputStream;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
@@ -25,15 +22,6 @@ import java.io.InputStream;
|
|
public class FastDFSClient {
|
|
public class FastDFSClient {
|
|
private static org.slf4j.Logger logger = LoggerFactory.getLogger(FastDFSClient.class);
|
|
private static org.slf4j.Logger logger = LoggerFactory.getLogger(FastDFSClient.class);
|
|
|
|
|
|
- static {
|
|
|
|
- try {
|
|
|
|
- String filePath = new ClassPathResource("fdfs_client.conf").getFile().getAbsolutePath();
|
|
|
|
- ClientGlobal.init(filePath);
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- logger.error("FastDFS Client Init Fail!", e);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
public static String[] upload(FastDFSFile file) {
|
|
public static String[] upload(FastDFSFile file) {
|
|
logger.info("File Name: " + file.getName() + "File Length:" + file.getContent().length);
|
|
logger.info("File Name: " + file.getName() + "File Length:" + file.getContent().length);
|
|
|
|
|
|
@@ -46,8 +34,6 @@ public class FastDFSClient {
|
|
try {
|
|
try {
|
|
storageClient = getTrackerClient();
|
|
storageClient = getTrackerClient();
|
|
uploadResults = storageClient.upload_file(file.getContent(), file.getExt(), meta_list);
|
|
uploadResults = storageClient.upload_file(file.getContent(), file.getExt(), meta_list);
|
|
- logger.info("storageClient:"+storageClient.toString());
|
|
|
|
- logger.info("uploadResults:"+ StringUtils.join(uploadResults,','));
|
|
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|
|
logger.error("IO Exception when uploadind the file:" + file.getName(), e);
|
|
logger.error("IO Exception when uploadind the file:" + file.getName(), e);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|