You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
96 lines
2.6 KiB
96 lines
2.6 KiB
package com.fanruan.fs.s3.repository.core; |
|
|
|
import com.fanruan.api.conf.HolderKit; |
|
import com.fr.config.Identifier; |
|
import com.fr.config.holder.Conf; |
|
import com.fr.io.config.CommonRepoConfig; |
|
import com.fr.io.context.ResourceModuleContext; |
|
import com.fr.io.context.info.GetConfig; |
|
import com.fr.io.context.info.SetConfig; |
|
import com.fr.stable.StringUtils; |
|
|
|
/** |
|
* @author richie |
|
* @version 10.0 |
|
* Created by richie on 2020/6/15 |
|
*/ |
|
public class S3Config extends CommonRepoConfig { |
|
|
|
public S3Config() { |
|
super(S3RepositoryFactory.IDENTITY); |
|
} |
|
|
|
@Identifier("endPoint") |
|
private Conf<String> endPoint = HolderKit.simple(StringUtils.EMPTY); |
|
|
|
@Identifier("region") |
|
private Conf<String> region = HolderKit.simple(StringUtils.EMPTY); |
|
|
|
@Identifier("accessKeyId") |
|
private Conf<String> accessKeyId = HolderKit.simple(StringUtils.EMPTY); |
|
|
|
@Identifier("bucket") |
|
private Conf<String> bucket = HolderKit.simple(StringUtils.EMPTY); |
|
|
|
@GetConfig("endPoint") |
|
public String getEndPoint() { |
|
return endPoint.get(); |
|
} |
|
|
|
@SetConfig("endPoint") |
|
public void setEndPoint(String endPoint) { |
|
this.endPoint.set(endPoint); |
|
} |
|
|
|
@GetConfig("region") |
|
public String getRegion() { |
|
return region.get(); |
|
} |
|
|
|
@SetConfig("region") |
|
public void setRegion(String region) { |
|
this.region.set(region); |
|
} |
|
|
|
@GetConfig("accessKeyId") |
|
public String getAccessKeyId() { |
|
return accessKeyId.get(); |
|
} |
|
|
|
@SetConfig("accessKeyId") |
|
public void setAccessKeyId(String accessKeyId) { |
|
this.accessKeyId.set(accessKeyId); |
|
} |
|
|
|
@GetConfig("bucket") |
|
public String getBucket() { |
|
return bucket.get(); |
|
} |
|
|
|
@SetConfig("bucket") |
|
public void setBucket(String bucket) { |
|
this.bucket.set(bucket); |
|
} |
|
|
|
@Override |
|
public void update(String key) { |
|
super.update(key); |
|
S3Config newConfig = ResourceModuleContext.getRepoConfig(S3RepositoryFactory.IDENTITY, key); |
|
if (newConfig != null) { |
|
this.setEndPoint(newConfig.getEndPoint()); |
|
this.setRegion(newConfig.getRegion()); |
|
this.setAccessKeyId(newConfig.getAccessKeyId()); |
|
this.setBucket(newConfig.getBucket()); |
|
} |
|
} |
|
|
|
@Override |
|
public S3Config clone() throws CloneNotSupportedException { |
|
S3Config cloned = (S3Config) super.clone(); |
|
cloned.endPoint = (Conf<String>) endPoint.clone(); |
|
cloned.region = (Conf<String>) region.clone(); |
|
cloned.accessKeyId = (Conf<String>) accessKeyId.clone(); |
|
cloned.bucket = (Conf<String>) bucket.clone(); |
|
return cloned; |
|
} |
|
}
|
|
|