Skip to content

Commit

Permalink
Merge pull request #170 from zzq996/master
Browse files Browse the repository at this point in the history
Version 3.24.12
  • Loading branch information
zzq996 authored Jan 8, 2025
2 parents c509f1d + 745159a commit 6f76962
Show file tree
Hide file tree
Showing 46 changed files with 1,246 additions and 54 deletions.
6 changes: 6 additions & 0 deletions README-Android.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Version 3.24.12
New features:
1. Added bpa feature
2. Added intelligent tiering feature
3. Added posix trash feature
-----------------------------------------------------------------------------------
Version 3.24.9
Resolved issues:
1. Fixed the issue that can't auto add ContentType webp
Expand Down
6 changes: 6 additions & 0 deletions README-Java.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Version 3.24.12
New features:
1. Added bpa feature
2. Added intelligent tiering feature
3. Added posix trash feature
-----------------------------------------------------------------------------------
Version 3.24.9
Resolved issues:
1. Fixed the issue that can't auto add ContentType webp
Expand Down
6 changes: 6 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Version 3.24.12
New features:
1. Added bpa feature
2. Added intelligent tiering feature
3. Added posix trash feature
-----------------------------------------------------------------------------------
Version 3.24.9
Resolved issues:
1. Fixed the issue that can't auto add ContentType webp
Expand Down
6 changes: 6 additions & 0 deletions README_CN.MD
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Version 3.24.12
New features:
1. 支持bpa特性
2. 支持智能分级特性
3. 支持并行文件系统trash特性
-----------------------------------------------------------------------------------
Version 3.24.9
Resolved issues:
1. 修复无法自动添加webp格式的ContentType的问题
Expand Down
145 changes: 145 additions & 0 deletions app/src/main/java/com/obs/services/AbstractBucketAdvanceClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@
import com.obs.services.exception.ObsException;
import com.obs.services.internal.ServiceException;
import com.obs.services.internal.utils.ServiceUtils;
import com.obs.services.model.bpa.DeleteBucketPublicAccessBlockRequest;
import com.obs.services.model.bpa.GetBucketPolicyPublicStatusRequest;
import com.obs.services.model.bpa.GetBucketPolicyPublicStatusResult;
import com.obs.services.model.bpa.GetBucketPublicAccessBlockRequest;
import com.obs.services.model.bpa.GetBucketPublicAccessBlockResult;
import com.obs.services.model.bpa.GetBucketPublicStatusRequest;
import com.obs.services.model.bpa.GetBucketPublicStatusResult;
import com.obs.services.model.bpa.PutBucketPublicAccessBlockRequest;
import com.obs.services.model.BaseBucketRequest;
import com.obs.services.model.BucketDirectColdAccess;
import com.obs.services.model.BucketEncryption;
Expand All @@ -42,6 +50,10 @@
import com.obs.services.model.fs.GetBucketFSStatusResult;
import com.obs.services.model.fs.SetBucketFSStatusRequest;
import com.obs.services.model.AuthTypeEnum;
import com.obs.services.model.trash.DeleteBucketTrashRequest;
import com.obs.services.model.trash.GetBucketTrashRequest;
import com.obs.services.model.trash.GetBucketTrashResult;
import com.obs.services.model.trash.SetBucketTrashRequest;

public abstract class AbstractBucketAdvanceClient extends AbstractBucketClient {
/*
Expand Down Expand Up @@ -790,6 +802,44 @@ public HeaderResponse deleteBucketDirectColdAccess(final String bucketName) thro
return this.deleteBucketDirectColdAccess(new BaseBucketRequest(bucketName));
}

@Override
public HeaderResponse setBucketTrash(SetBucketTrashRequest setBucketTrashRequest) throws ObsException{
ServiceUtils.assertParameterNotNull(setBucketTrashRequest, "SetBucketTrashRequest is null");
ServiceUtils.assertParameterNotNull(setBucketTrashRequest.getBucketName(), "bucketName is null");
return this.doActionWithResult("setBucketTrash", setBucketTrashRequest.getBucketName(),
new ActionCallbackWithResult<HeaderResponse>() {
@Override
public HeaderResponse action() throws ServiceException {
return AbstractBucketAdvanceClient.this.setBucketTrashImpl(setBucketTrashRequest);
}
});
}

@Override
public GetBucketTrashResult getBucketTrash(GetBucketTrashRequest getBucketTrashRequest) throws ObsException{
ServiceUtils.assertParameterNotNull(getBucketTrashRequest, "GetBucketTrashRequest is null");
ServiceUtils.assertParameterNotNull(getBucketTrashRequest.getBucketName(), "bucketName is null");
return this.doActionWithResult("getBucketTrash", getBucketTrashRequest.getBucketName(),
new ActionCallbackWithResult<GetBucketTrashResult>() {
@Override
public GetBucketTrashResult action() throws ServiceException {
return AbstractBucketAdvanceClient.this.getBucketTrashImpl(getBucketTrashRequest);
}
});
}

@Override
public HeaderResponse deleteBucketTrash(DeleteBucketTrashRequest deleteBucketTrashRequest) throws ObsException{
ServiceUtils.assertParameterNotNull(deleteBucketTrashRequest, "DeleteBucketTrashRequest is null");
ServiceUtils.assertParameterNotNull(deleteBucketTrashRequest.getBucketName(), "bucketName is null");
return this.doActionWithResult("deleteBucketTrash", deleteBucketTrashRequest.getBucketName(),
new ActionCallbackWithResult<HeaderResponse>() {
@Override
public HeaderResponse action() throws ServiceException {
return AbstractBucketAdvanceClient.this.deleteBucketTrashImpl(deleteBucketTrashRequest);
}
});
}
/*
* (non-Javadoc)
*
Expand All @@ -807,4 +857,99 @@ public HeaderResponse action() throws ServiceException {
}
});
}

/**
*
* @param request
* @return
* @throws ObsException
*/
@Override
public HeaderResponse putBucketPublicAccessBlock(PutBucketPublicAccessBlockRequest request) throws ObsException {
ServiceUtils.assertParameterNotNull(request, "PutBucketPublicAccessBlockRequest is null");
ServiceUtils.assertParameterNotNull(request.getBucketName(), "bucketName is null");
return this.doActionWithResult("putBucketPublicAccessBlock", request.getBucketName(),
new ActionCallbackWithResult<HeaderResponse>() {
@Override
public HeaderResponse action() throws ServiceException {
return AbstractBucketAdvanceClient.this.putBucketPublicAccessBlockImpl(request);
}
});
}

/**
*
* @param request
* @return
* @throws ObsException
*/
@Override
public GetBucketPublicAccessBlockResult getBucketPublicAccessBlock(GetBucketPublicAccessBlockRequest request) throws ObsException {
ServiceUtils.assertParameterNotNull(request, "GetBucketPublicAccessBlockRequest is null");
ServiceUtils.assertParameterNotNull(request.getBucketName(), "bucketName is null");
return this.doActionWithResult("getBucketPublicAccessBlock", request.getBucketName(),
new ActionCallbackWithResult<GetBucketPublicAccessBlockResult>() {
@Override
public GetBucketPublicAccessBlockResult action() throws ServiceException {
return AbstractBucketAdvanceClient.this.getBucketPublicAccessBlockImpl(request);
}
});
}

/**
*
* @param request
* @return
* @throws ObsException
*/
@Override
public HeaderResponse deleteBucketPublicAccessBlock(DeleteBucketPublicAccessBlockRequest request) throws ObsException {
ServiceUtils.assertParameterNotNull(request, "DeleteBucketPublicAccessBlockRequest is null");
ServiceUtils.assertParameterNotNull(request.getBucketName(), "bucketName is null");
return this.doActionWithResult("deleteBucketPublicAccessBlock", request.getBucketName(),
new ActionCallbackWithResult<HeaderResponse>() {
@Override
public HeaderResponse action() throws ServiceException {
return AbstractBucketAdvanceClient.this.deleteBucketPublicAccessBlockImpl(request);
}
});
}

/**
*
* @param request
* @return
* @throws ObsException
*/
@Override
public GetBucketPolicyPublicStatusResult getBucketPolicyPublicStatus(GetBucketPolicyPublicStatusRequest request) throws ObsException {
ServiceUtils.assertParameterNotNull(request, "GetBucketPolicyPublicStatusRequest is null");
ServiceUtils.assertParameterNotNull(request.getBucketName(), "bucketName is null");
return this.doActionWithResult("getBucketPolicyPublicStatus", request.getBucketName(),
new ActionCallbackWithResult<GetBucketPolicyPublicStatusResult>() {
@Override
public GetBucketPolicyPublicStatusResult action() throws ServiceException {
return AbstractBucketAdvanceClient.this.getBucketPolicyPublicStatusImpl(request);
}
});
}

/**
*
* @param request
* @return
* @throws ObsException
*/
@Override
public GetBucketPublicStatusResult getBucketPublicStatus(GetBucketPublicStatusRequest request) throws ObsException {
ServiceUtils.assertParameterNotNull(request, "GetBucketPublicStatusRequest is null");
ServiceUtils.assertParameterNotNull(request.getBucketName(), "bucketName is null");
return this.doActionWithResult("getBucketPublicStatus", request.getBucketName(),
new ActionCallbackWithResult<GetBucketPublicStatusResult>() {
@Override
public GetBucketPublicStatusResult action() throws ServiceException {
return AbstractBucketAdvanceClient.this.getBucketPublicStatusImpl(request);
}
});
}
}
4 changes: 3 additions & 1 deletion app/src/main/java/com/obs/services/AbstractClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ protected void init(String accessKey, String secretKey, String securityToken, Ob
this.getProviderCredentials().setIsAuthTypeNegotiation(true);
}
this.initHttpClient(config.getHttpDispatcher(), config.getCustomizedDnsImpl(), config.getHostnameVerifier(),
config.getEventListenerFactory());
config.getEventListenerFactory(), config.getSslContext());
OBSXMLBuilder.setXmlDocumentBuilderFactoryClass(config.getXmlDocumentBuilderFactoryClass());
reqBean.setRespTime(new Date());
reqBean.setResultCode(Constants.RESULTCODE_SUCCESS);
Expand Down Expand Up @@ -497,6 +497,8 @@ private PostSignatureResponse createPostSignature(PostSignatureRequest request,
ILOG.error(reqBean);
}
throw new ObsException(e.getMessage(), e);
} finally {
AccessLoggerUtils.printLog();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ private void refresh(boolean ignoreException) {
do {
try {
securityKey = getNewSecurityKey();
break; // no need to retry if getNewSecurityKey succeeded
} catch (IOException | RuntimeException e) {
ILOG.warn("refresh new security key failed. times : " + times + "; maxRetryTimes is : " + maxRetryTimes
+ "; ignoreException : " + ignoreException, e);
Expand Down
28 changes: 28 additions & 0 deletions app/src/main/java/com/obs/services/IObsClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@
import com.obs.services.model.AccessControlList;
import com.obs.services.model.AppendObjectRequest;
import com.obs.services.model.AppendObjectResult;
import com.obs.services.model.bpa.DeleteBucketPublicAccessBlockRequest;
import com.obs.services.model.bpa.GetBucketPolicyPublicStatusRequest;
import com.obs.services.model.bpa.GetBucketPolicyPublicStatusResult;
import com.obs.services.model.bpa.GetBucketPublicAccessBlockRequest;
import com.obs.services.model.bpa.GetBucketPublicAccessBlockResult;
import com.obs.services.model.bpa.GetBucketPublicStatusRequest;
import com.obs.services.model.bpa.GetBucketPublicStatusResult;
import com.obs.services.model.bpa.PutBucketPublicAccessBlockRequest;
import com.obs.services.model.BaseBucketRequest;
import com.obs.services.model.BucketCors;
import com.obs.services.model.BucketDirectColdAccess;
Expand Down Expand Up @@ -135,6 +143,10 @@
import com.obs.services.model.select.SelectObjectResult;
import com.obs.services.model.ObjectTagResult;
import com.obs.services.model.ObjectTaggingRequest;
import com.obs.services.model.trash.DeleteBucketTrashRequest;
import com.obs.services.model.trash.GetBucketTrashRequest;
import com.obs.services.model.trash.GetBucketTrashResult;
import com.obs.services.model.trash.SetBucketTrashRequest;

/**
* Basic OBS interface
Expand Down Expand Up @@ -2299,6 +2311,12 @@ UploadPartResult uploadPart(String bucketName, String objectKey, String uploadId
*/
HeaderResponse deleteBucketDirectColdAccess(BaseBucketRequest request) throws ObsException;

HeaderResponse setBucketTrash(SetBucketTrashRequest setBucketTrashRequest) throws ObsException;

GetBucketTrashResult getBucketTrash(GetBucketTrashRequest getBucketTrashRequest) throws ObsException;

HeaderResponse deleteBucketTrash(DeleteBucketTrashRequest deleteBucketTrashRequest) throws ObsException;

HeaderResponse setInventoryConfiguration(SetInventoryConfigurationRequest request) throws ObsException;

GetInventoryConfigurationResult getInventoryConfiguration(GetInventoryConfigurationRequest request) throws ObsException;
Expand All @@ -2307,6 +2325,16 @@ UploadPartResult uploadPart(String bucketName, String objectKey, String uploadId

HeaderResponse deleteInventoryConfiguration(DeleteInventoryConfigurationRequest request) throws ObsException;

HeaderResponse putBucketPublicAccessBlock(PutBucketPublicAccessBlockRequest request) throws ObsException;

GetBucketPublicAccessBlockResult getBucketPublicAccessBlock(GetBucketPublicAccessBlockRequest request) throws ObsException;

HeaderResponse deleteBucketPublicAccessBlock(DeleteBucketPublicAccessBlockRequest request) throws ObsException;

GetBucketPolicyPublicStatusResult getBucketPolicyPublicStatus(GetBucketPolicyPublicStatusRequest request) throws ObsException;

GetBucketPublicStatusResult getBucketPublicStatus(GetBucketPublicStatusRequest request) throws ObsException;

/**
* Close ObsClient and release connection resources.
*
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/java/com/obs/services/ObsClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -290,4 +290,10 @@ private static Field getFieldFromClass(Class<?> clazz, String key) {
} while (clazz != null);
return null;
}

public void setProvider(IObsCredentialsProvider provider) {
ServiceUtils.assertParameterNotNull(provider, "ObsCredentialsProvider is null");
this.credentials.setObsCredentialsProvider(provider);
}

}
12 changes: 12 additions & 0 deletions app/src/main/java/com/obs/services/ObsConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManagerFactory;

import com.obs.services.internal.ObsConstraint;
Expand Down Expand Up @@ -109,6 +110,8 @@ public class ObsConfiguration implements Cloneable {
private EventListener.Factory eventListenerFactory;
private LocalTimeUtil localTimeUtil;

private SSLContext sslContext;

/**
* Constructor
*/
Expand Down Expand Up @@ -144,6 +147,7 @@ public ObsConfiguration() {
this.localAuthTypeCacheCapacity = ObsConstraint.DEFAULT_LOCAL_AUTH_TYPE_CACHE_CAPACITY;
this.secureRandom = new SecureRandom();
this.localTimeUtil = new LocalTimeUtil();
this.sslContext = null;
}

public String getDelimiter() {
Expand Down Expand Up @@ -961,5 +965,13 @@ public void setLocalTimeUtil(LocalTimeUtil localTimeUtil) {
this.localTimeUtil = localTimeUtil;
}

public SSLContext getSslContext() {
return sslContext;
}

public void setSslContext(SSLContext sslContext) {
this.sslContext = sslContext;
}


}
Loading

0 comments on commit 6f76962

Please sign in to comment.