提交 | 用户 | 时间
|
e7c126
|
1 |
package com.iailab.module.infra.framework.file.core.enums; |
H |
2 |
|
|
3 |
import cn.hutool.core.util.ArrayUtil; |
|
4 |
import com.iailab.module.infra.framework.file.core.client.FileClient; |
|
5 |
import com.iailab.module.infra.framework.file.core.client.FileClientConfig; |
|
6 |
import com.iailab.module.infra.framework.file.core.client.db.DBFileClient; |
|
7 |
import com.iailab.module.infra.framework.file.core.client.db.DBFileClientConfig; |
|
8 |
import com.iailab.module.infra.framework.file.core.client.ftp.FtpFileClient; |
|
9 |
import com.iailab.module.infra.framework.file.core.client.ftp.FtpFileClientConfig; |
|
10 |
import com.iailab.module.infra.framework.file.core.client.local.LocalFileClient; |
|
11 |
import com.iailab.module.infra.framework.file.core.client.local.LocalFileClientConfig; |
|
12 |
import com.iailab.module.infra.framework.file.core.client.s3.S3FileClient; |
|
13 |
import com.iailab.module.infra.framework.file.core.client.s3.S3FileClientConfig; |
|
14 |
import com.iailab.module.infra.framework.file.core.client.sftp.SftpFileClient; |
|
15 |
import com.iailab.module.infra.framework.file.core.client.sftp.SftpFileClientConfig; |
|
16 |
import lombok.AllArgsConstructor; |
|
17 |
import lombok.Getter; |
|
18 |
|
|
19 |
/** |
|
20 |
* 文件存储器枚举 |
|
21 |
* |
|
22 |
* @author iailab |
|
23 |
*/ |
|
24 |
@AllArgsConstructor |
|
25 |
@Getter |
|
26 |
public enum FileStorageEnum { |
|
27 |
|
|
28 |
DB(1, DBFileClientConfig.class, DBFileClient.class), |
|
29 |
|
|
30 |
LOCAL(10, LocalFileClientConfig.class, LocalFileClient.class), |
|
31 |
FTP(11, FtpFileClientConfig.class, FtpFileClient.class), |
|
32 |
SFTP(12, SftpFileClientConfig.class, SftpFileClient.class), |
|
33 |
|
|
34 |
S3(20, S3FileClientConfig.class, S3FileClient.class), |
|
35 |
; |
|
36 |
|
|
37 |
/** |
|
38 |
* 存储器 |
|
39 |
*/ |
|
40 |
private final Integer storage; |
|
41 |
|
|
42 |
/** |
|
43 |
* 配置类 |
|
44 |
*/ |
|
45 |
private final Class<? extends FileClientConfig> configClass; |
|
46 |
/** |
|
47 |
* 客户端类 |
|
48 |
*/ |
|
49 |
private final Class<? extends FileClient> clientClass; |
|
50 |
|
|
51 |
public static FileStorageEnum getByStorage(Integer storage) { |
|
52 |
return ArrayUtil.firstMatch(o -> o.getStorage().equals(storage), values()); |
|
53 |
} |
|
54 |
|
|
55 |
} |