OssPipeline.java
1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package com.diligrp.assistant.dfs.pipeline;
import com.diligrp.assistant.dfs.client.FileRepositoryClient;
import com.diligrp.assistant.dfs.client.OssFileRepositoryClient;
import com.diligrp.assistant.dfs.domain.DfsFile;
import com.diligrp.assistant.dfs.type.PipelineType;
/**
* 阿里OSS文件存储服务通道
*/
// TODO: 数据库中进行通道配置
public class OssPipeline extends DfsPipeline {
private FileRepositoryClient fileRepositoryClient;
public OssPipeline(int code, String name, String uri, String accessKeyId, String accessKeySecret) {
super(code, name, PipelineType.DFS_OSS);
this.fileRepositoryClient = new OssFileRepositoryClient(uri, accessKeyId, accessKeySecret);
}
@Override
public String createFileRepository(String repositoryId) {
return fileRepositoryClient.createFileRepository(repositoryId);
}
@Override
public boolean deleteFileRepository(String repositoryId) {
return fileRepositoryClient.deleteFileRepository(repositoryId);
}
@Override
public void putFile(String repositoryId, DfsFile file) {
fileRepositoryClient.putFile(repositoryId, file);
}
@Override
public DfsFile getFile(String repositoryId, String fileId, String style) {
return fileRepositoryClient.getFile(repositoryId, fileId, style);
}
@Override
public boolean deleteFile(String repositoryId, String fileId) {
return fileRepositoryClient.deleteFile(repositoryId, fileId);
}
public void destroy() {
fileRepositoryClient.destroy();
}
}