|
|
@@ -1,7 +1,6 @@
|
|
|
package cn.reghao.oss.console.app.rpc;
|
|
|
|
|
|
import cn.reghao.oss.console.app.model.dto.ObjectsScopeDto;
|
|
|
-import cn.reghao.oss.console.app.model.dto.SetScopeDto;
|
|
|
import cn.reghao.oss.console.app.model.po.StoreNode;
|
|
|
import cn.reghao.oss.console.app.service.UploadChannelService;
|
|
|
import cn.reghao.oss.console.util.AuthKeyContext;
|
|
|
@@ -18,16 +17,12 @@ import java.util.List;
|
|
|
*/
|
|
|
@Service
|
|
|
public class OssObjectService {
|
|
|
- private ObjectService objectService;
|
|
|
private final UploadChannelService uploadChannelService;
|
|
|
|
|
|
public OssObjectService(UploadChannelService uploadChannelService) {
|
|
|
this.uploadChannelService = uploadChannelService;
|
|
|
}
|
|
|
|
|
|
- public void setObjectScope(SetScopeDto setScopeDto) {
|
|
|
- }
|
|
|
-
|
|
|
public void setObjectsScope(ObjectsScopeDto objectsScopeDto) throws Exception {
|
|
|
int channelId = objectsScopeDto.getChannelId();
|
|
|
ObjectService objectService = getObjectService(channelId);
|
|
|
@@ -36,28 +31,23 @@ public class OssObjectService {
|
|
|
objectService.setObjectsScope(scope, objectNames);
|
|
|
}
|
|
|
|
|
|
- public void deleteByObjectNames(List<String> objectNames) {
|
|
|
- RemoteService<ObjectService> remoteService = new RemoteService<>();
|
|
|
- String host = "";
|
|
|
- int port = -1;
|
|
|
- ObjectService objectService = remoteService.getService(host, port, ObjectService.class);
|
|
|
+ public void deleteByObjectNames(int channelId, List<String> objectNames) throws Exception {
|
|
|
+ ObjectService objectService = getObjectService(channelId);
|
|
|
objectService.deleteByObjectNames(objectNames);
|
|
|
}
|
|
|
|
|
|
- public ObjectInfo getObjectInfo(int channelId, String objectId) throws Exception {
|
|
|
+ public DownloadUrl getDownloadUrl(int channelId, String objectId) throws Exception {
|
|
|
ObjectService objectService = getObjectService(channelId);
|
|
|
int loginUser = AuthKeyContext.getUser();
|
|
|
int expireSecond = 3600;
|
|
|
- return objectService.getObjectInfo(loginUser, objectId, expireSecond);
|
|
|
+ return objectService.getDownloadUrl(loginUser, objectId, expireSecond);
|
|
|
}
|
|
|
|
|
|
- public DownloadUrl getDownloadUrl(String objectId) {
|
|
|
+ public ObjectInfo getObjectInfo(int channelId, String objectId) throws Exception {
|
|
|
+ ObjectService objectService = getObjectService(channelId);
|
|
|
+ int loginUser = AuthKeyContext.getUser();
|
|
|
int expireSecond = 3600;
|
|
|
- RemoteService<ObjectService> remoteService = new RemoteService<>();
|
|
|
- String host = "";
|
|
|
- int port = -1;
|
|
|
- ObjectService objectService = remoteService.getService(host, port, ObjectService.class);
|
|
|
- return objectService.getDownloadUrl(objectId, expireSecond);
|
|
|
+ return objectService.getObjectInfo(loginUser, objectId, expireSecond);
|
|
|
}
|
|
|
|
|
|
private ObjectService getObjectService(int channelId) throws Exception {
|