Search in sources :

Example 96 with RequestMessage

use of com.aliyun.oss.common.comm.RequestMessage in project aliyun-oss-java-sdk by aliyun.

the class OSSUdfOperation method getUdfImageInfo.

public List<UdfImageInfo> getUdfImageInfo(UdfGenericRequest genericRequest) throws OSSException, ClientException {
    assertParameterNotNull(genericRequest, "genericRequest");
    String udfName = genericRequest.getName();
    assertParameterNotNull(udfName, "udfName");
    ensureBucketNameValid(udfName);
    Map<String, String> params = new HashMap<String, String>();
    params.put(RequestParameters.SUBRESOURCE_UDF_IMAGE, null);
    params.put(RequestParameters.SUBRESOURCE_UDF_NAME, udfName);
    RequestMessage request = new OSSRequestMessageBuilder(getInnerClient()).setEndpoint(getEndpoint()).setMethod(HttpMethod.GET).setParameters(params).setOriginalRequest(genericRequest).build();
    return doOperation(request, ResponseParsers.getUdfImageInfoResponseParser, null, null, true);
}
Also used : HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) RequestMessage(com.aliyun.oss.common.comm.RequestMessage)

Example 97 with RequestMessage

use of com.aliyun.oss.common.comm.RequestMessage in project aliyun-oss-java-sdk by aliyun.

the class OSSUdfOperation method getUdfApplicationLog.

public UdfApplicationLog getUdfApplicationLog(GetUdfApplicationLogRequest getUdfApplicationLogRequest) throws OSSException, ClientException {
    assertParameterNotNull(getUdfApplicationLogRequest, "resizeUdfApplicationRequest");
    String udfName = getUdfApplicationLogRequest.getName();
    assertParameterNotNull(udfName, "udfName");
    ensureBucketNameValid(udfName);
    Map<String, String> params = new HashMap<String, String>();
    populateGetUdfApplicationLogParameters(params, getUdfApplicationLogRequest);
    RequestMessage request = new OSSRequestMessageBuilder(getInnerClient()).setEndpoint(getEndpoint()).setMethod(HttpMethod.GET).setParameters(params).setOriginalRequest(getUdfApplicationLogRequest).build();
    ProgressListener listener = getUdfApplicationLogRequest.getProgressListener();
    UdfApplicationLog udfApplicationLog = null;
    try {
        publishProgress(listener, ProgressEventType.TRANSFER_STARTED_EVENT);
        udfApplicationLog = doOperation(request, new GetUdfApplicationLogResponseParser(udfName), null, null, true);
        InputStream instream = udfApplicationLog.getLogContent();
        ProgressInputStream progressInputStream = new ProgressInputStream(instream, listener) {

            @Override
            protected void onEOF() {
                publishProgress(getListener(), ProgressEventType.TRANSFER_COMPLETED_EVENT);
            }
        };
        CRC64 crc = new CRC64();
        CheckedInputStream checkedInputstream = new CheckedInputStream(progressInputStream, crc);
        udfApplicationLog.setLogContent(checkedInputstream);
    } catch (RuntimeException e) {
        publishProgress(listener, ProgressEventType.TRANSFER_FAILED_EVENT);
        throw e;
    }
    return udfApplicationLog;
}
Also used : GetUdfApplicationLogResponseParser(com.aliyun.oss.internal.ResponseParsers.GetUdfApplicationLogResponseParser) CRC64(com.aliyun.oss.common.utils.CRC64) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) ProgressInputStream(com.aliyun.oss.event.ProgressInputStream) CheckedInputStream(java.util.zip.CheckedInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) ProgressInputStream(com.aliyun.oss.event.ProgressInputStream) IOUtils.newRepeatableInputStream(com.aliyun.oss.common.utils.IOUtils.newRepeatableInputStream) InputStream(java.io.InputStream) CheckedInputStream(java.util.zip.CheckedInputStream) UdfApplicationLog(com.aliyun.oss.model.UdfApplicationLog) ProgressListener(com.aliyun.oss.event.ProgressListener) RequestMessage(com.aliyun.oss.common.comm.RequestMessage)

Example 98 with RequestMessage

use of com.aliyun.oss.common.comm.RequestMessage in project aliyun-oss-java-sdk by aliyun.

the class OSSUdfOperation method getUdfApplicationInfo.

public UdfApplicationInfo getUdfApplicationInfo(UdfGenericRequest genericRequest) throws OSSException, ClientException {
    assertParameterNotNull(genericRequest, "genericRequest");
    String udfName = genericRequest.getName();
    assertParameterNotNull(udfName, "udfName");
    ensureBucketNameValid(udfName);
    Map<String, String> params = new HashMap<String, String>();
    params.put(RequestParameters.SUBRESOURCE_UDF_APPLICATION, null);
    params.put(RequestParameters.SUBRESOURCE_UDF_NAME, udfName);
    RequestMessage request = new OSSRequestMessageBuilder(getInnerClient()).setEndpoint(getEndpoint()).setMethod(HttpMethod.GET).setParameters(params).setOriginalRequest(genericRequest).build();
    return doOperation(request, ResponseParsers.getUdfApplicationInfoResponseParser, null, null, true);
}
Also used : HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) RequestMessage(com.aliyun.oss.common.comm.RequestMessage)

Aggregations

RequestMessage (com.aliyun.oss.common.comm.RequestMessage)98 LinkedHashMap (java.util.LinkedHashMap)88 HashMap (java.util.HashMap)78 ByteArrayInputStream (java.io.ByteArrayInputStream)23 ClientException (com.aliyun.oss.ClientException)9 ClientConfiguration (com.aliyun.oss.ClientConfiguration)6 ResponseHandler (com.aliyun.oss.common.comm.ResponseHandler)6 InputStream (java.io.InputStream)6 ResponseMessage (com.aliyun.oss.common.comm.ResponseMessage)5 IOUtils.newRepeatableInputStream (com.aliyun.oss.common.utils.IOUtils.newRepeatableInputStream)5 ProgressListener (com.aliyun.oss.event.ProgressListener)5 ArrayList (java.util.ArrayList)5 ExecutionContext (com.aliyun.oss.common.comm.ExecutionContext)4 ProgressInputStream (com.aliyun.oss.event.ProgressInputStream)4 URI (java.net.URI)4 CheckedInputStream (java.util.zip.CheckedInputStream)4 ServiceException (com.aliyun.oss.ServiceException)3 IOException (java.io.IOException)3 Test (org.junit.Test)3 Credentials (com.aliyun.oss.common.auth.Credentials)2