批量执行命令.

This commit is contained in:
lijiahang
2024-03-12 17:18:15 +08:00
parent 779a84ae25
commit 2c025c800f
28 changed files with 569 additions and 53 deletions

View File

@@ -120,4 +120,20 @@ public interface FileClient {
*/
OutputStream getContentOutputStream(String path, boolean append) throws Exception;
/**
* 获取返回路径 用于客户端返回
*
* @param path path
* @return returnPath
*/
String getReturnPath(String path);
/**
* 获取实际存储路径 用于服务端的存储
*
* @param returnPath returnPath
* @return absolutePath
*/
String getAbsolutePath(String returnPath);
}

View File

@@ -152,6 +152,26 @@ public class FileClientUtils {
return delegate.getContentOutputStream(path, append);
}
/**
* 获取返回路径 用于客户端返回
*
* @param path path
* @return returnPath
*/
public static String getReturnPath(String path) {
return delegate.getReturnPath(path);
}
/**
* 获取实际存储路径 用于服务端的存储
*
* @param returnPath returnPath
* @return absolutePath
*/
public static String getAbsolutePath(String returnPath) {
return delegate.getAbsolutePath(returnPath);
}
public static void setDelegate(FileClient delegate) {
if (FileClientUtils.delegate != null) {
// unmodified

View File

@@ -80,22 +80,6 @@ public abstract class AbstractFileClient<Config extends FileClientConfig> implem
*/
protected abstract String doUpload(String path, InputStream in, boolean autoClose, boolean overrideIfExist) throws Exception;
/**
* 获取返回路径 用于客户端返回
*
* @param path path
* @return returnPath
*/
protected abstract String getReturnPath(String path);
/**
* 获取实际存储路径 用于服务端的存储
*
* @param returnPath returnPath
* @return absolutePath
*/
protected abstract String getAbsolutePath(String returnPath);
/**
* 获取文件路径 拼接前缀
*

View File

@@ -72,6 +72,16 @@ public class PrimaryFileClient implements FileClient {
return delegate.getContentOutputStream(path, append);
}
@Override
public String getReturnPath(String path) {
return delegate.getReturnPath(path);
}
@Override
public String getAbsolutePath(String returnPath) {
return delegate.getAbsolutePath(returnPath);
}
public static void setDelegate(FileClient delegate) {
if (PrimaryFileClient.delegate != null) {
// unmodified

View File

@@ -57,13 +57,13 @@ public class LocalFileClient extends AbstractFileClient<LocalFileClientConfig> {
}
@Override
protected String getReturnPath(String path) {
public String getReturnPath(String path) {
// 拼接公共路径
return Files1.getPath(config.getBasePath() + Const.SLASH + this.getFilePath(path));
}
@Override
protected String getAbsolutePath(String returnPath) {
public String getAbsolutePath(String returnPath) {
// 拼接存储路径
return Files1.getPath(config.getStoragePath() + Const.SLASH + returnPath);
}