Commit 384182fc by huangfusuper

增加文件系统灵活配置功能

parent 3f6a13a8
...@@ -4,6 +4,8 @@ import cn.hutool.core.collection.CollectionUtil; ...@@ -4,6 +4,8 @@ import cn.hutool.core.collection.CollectionUtil;
import org.csource.common.MyException; import org.csource.common.MyException;
import org.csource.common.NameValuePair; import org.csource.common.NameValuePair;
import org.csource.fastdfs.*; import org.csource.fastdfs.*;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.stereotype.Component;
import java.io.IOException; import java.io.IOException;
...@@ -15,16 +17,17 @@ import java.util.Set; ...@@ -15,16 +17,17 @@ import java.util.Set;
* FastDFS设计模式 * FastDFS设计模式
* @author huangfu * @author huangfu
*/ */
@Component
@ConditionalOnExpression("'${myth-job.filestystem}'.equals('FASTDFS')")
public class FastDfsFileSystem implements FileSystem { public class FastDfsFileSystem implements FileSystem {
static { public FastDfsFileSystem() {
try { try {
ClientGlobal.init("fdfs_client.conf"); ClientGlobal.init("fdfs_client.conf");
} catch (IOException | MyException e) { } catch (IOException | MyException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
@Override @Override
public String uploadFile(byte[] fileBuffer, String fileExtName, Map<String, String> mateDaTa) throws IOException, MyException { public String uploadFile(byte[] fileBuffer, String fileExtName, Map<String, String> mateDaTa) throws IOException, MyException {
TrackerClient trackerClient = new TrackerClient(); TrackerClient trackerClient = new TrackerClient();
......
...@@ -3,4 +3,11 @@ myth-rpc.remoting.port=7776 ...@@ -3,4 +3,11 @@ myth-rpc.remoting.port=7776
myth-rpc.registry.address=http://localhost:8080/myth-register myth-rpc.registry.address=http://localhost:8080/myth-register
myth-rpc.registry.env=huangfu myth-rpc.registry.env=huangfu
myth-rpc.registry.biz=byit-myth-job myth-rpc.registry.biz=byit-myth-job
myth-job.filestystem=FASTDFS
myth-job.log.root.path=/mythjob/log/
myth-job.script.root.path=/mythjob/script/
logging.config=classpath:logback.xml logging.config=classpath:logback.xml
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment