Skip to content
This repository was archived by the owner on Dec 6, 2024. It is now read-only.

Commit df92187

Browse files
SynapticloopSynapticloop
authored andcommitted
updated logging, minor fixes
1 parent 96312f0 commit df92187

27 files changed

+301
-48
lines changed

src/main/java/synapticloop/b2/Action.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
package synapticloop.b2;
22

33
/**
4-
* The action for an associated file, either 'hide' or 'upload'
4+
* The action for an associated file, either 'hide' or 'upload', "upload" means
5+
* a file that was uploaded to B2 Cloud Storage. "hide" means a file version
6+
* marking the file as hidden, so that it will not show up in b2_list_file_names.
7+
*
8+
* The result of b2_list_file_names will contain only "upload". The result of
9+
* b2_list_file_versions may have both.
510
*
611
* @author synapticloop
712
*/

src/main/java/synapticloop/b2/request/B2AuthorizeAccountRequest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
import java.util.Base64;
44

5+
import org.slf4j.Logger;
6+
import org.slf4j.LoggerFactory;
7+
58
import synapticloop.b2.exception.B2ApiException;
69
import synapticloop.b2.response.B2AuthorizeAccountResponse;
710

@@ -20,6 +23,7 @@
2023
*/
2124

2225
public class B2AuthorizeAccountRequest extends BaseB2Request {
26+
private static final Logger LOGGER = LoggerFactory.getLogger(B2AuthorizeAccountRequest.class);
2327
private static final String B2_AUTHORIZE_ACCOUNT = BASE_API + "b2_authorize_account";
2428

2529
/**
@@ -42,6 +46,6 @@ public B2AuthorizeAccountRequest(String accountId, String applicationKey) {
4246
* @throws B2ApiException if there was an error with the call
4347
*/
4448
public B2AuthorizeAccountResponse getResponse() throws B2ApiException {
45-
return(new B2AuthorizeAccountResponse(executeGet()));
49+
return(new B2AuthorizeAccountResponse(executeGet(LOGGER)));
4650
}
4751
}

src/main/java/synapticloop/b2/request/B2CreateBucketRequest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package synapticloop.b2.request;
22

3+
import org.slf4j.Logger;
4+
import org.slf4j.LoggerFactory;
5+
36
import synapticloop.b2.BucketType;
47
import synapticloop.b2.exception.B2ApiException;
58
import synapticloop.b2.response.B2AuthorizeAccountResponse;
@@ -22,6 +25,7 @@
2225
*/
2326

2427
public class B2CreateBucketRequest extends BaseB2Request {
28+
private static final Logger LOGGER = LoggerFactory.getLogger(B2CreateBucketRequest.class);
2529
private static final String B2_CREATE_BUCKET = BASE_API_VERSION + "b2_create_bucket";
2630

2731
/**
@@ -54,6 +58,6 @@ public B2CreateBucketRequest(B2AuthorizeAccountResponse b2AuthorizeAccountRespon
5458
* @throws B2ApiException if there was an error with the call
5559
*/
5660
public B2BucketResponse getResponse() throws B2ApiException {
57-
return(new B2BucketResponse(executePost()));
61+
return(new B2BucketResponse(executePost(LOGGER)));
5862
}
5963
}

src/main/java/synapticloop/b2/request/B2DeleteBucketRequest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package synapticloop.b2.request;
22

3+
import org.slf4j.Logger;
4+
import org.slf4j.LoggerFactory;
5+
36
import synapticloop.b2.exception.B2ApiException;
47
import synapticloop.b2.response.B2AuthorizeAccountResponse;
58
import synapticloop.b2.response.B2BucketResponse;
@@ -17,6 +20,7 @@
1720
*/
1821

1922
public class B2DeleteBucketRequest extends BaseB2Request {
23+
private static final Logger LOGGER = LoggerFactory.getLogger(B2DeleteBucketRequest.class);
2024
private static final String B2_DELETE_BUCKET = BASE_API_VERSION + "b2_delete_bucket";
2125

2226
/**
@@ -43,6 +47,6 @@ public B2DeleteBucketRequest(B2AuthorizeAccountResponse b2AuthorizeAccountRespon
4347
* trying to delete a bucket which is not empty
4448
*/
4549
public B2BucketResponse getResponse() throws B2ApiException {
46-
return(new B2BucketResponse(executePost()));
50+
return(new B2BucketResponse(executePost(LOGGER)));
4751
}
4852
}

src/main/java/synapticloop/b2/request/B2DeleteFileVersionRequest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package synapticloop.b2.request;
22

3+
import org.slf4j.Logger;
4+
import org.slf4j.LoggerFactory;
5+
36
import synapticloop.b2.exception.B2ApiException;
47
import synapticloop.b2.response.B2AuthorizeAccountResponse;
58
import synapticloop.b2.response.B2DeleteFileVersionResponse;
@@ -18,6 +21,7 @@
1821
*/
1922

2023
public class B2DeleteFileVersionRequest extends BaseB2Request {
24+
private static final Logger LOGGER = LoggerFactory.getLogger(B2DeleteFileVersionRequest.class);
2125
private static final String B2_DELETE_FILE_VERSION = BASE_API_VERSION + "b2_delete_file_version";
2226

2327
/**
@@ -44,6 +48,6 @@ public B2DeleteFileVersionRequest(B2AuthorizeAccountResponse b2AuthorizeAccountR
4448
* @throws B2ApiException if there was an error with the call
4549
*/
4650
public B2DeleteFileVersionResponse getResponse() throws B2ApiException {
47-
return(new B2DeleteFileVersionResponse(executePost()));
51+
return(new B2DeleteFileVersionResponse(executePost(LOGGER)));
4852
}
4953
}

src/main/java/synapticloop/b2/request/B2DownloadFileByIdRequest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package synapticloop.b2.request;
22

3+
import org.slf4j.Logger;
4+
import org.slf4j.LoggerFactory;
5+
36
import synapticloop.b2.exception.B2ApiException;
47
import synapticloop.b2.response.B2AuthorizeAccountResponse;
58
import synapticloop.b2.response.B2DownloadFileResponse;
@@ -18,6 +21,7 @@
1821
*/
1922

2023
public class B2DownloadFileByIdRequest extends BaseB2Request {
24+
private static final Logger LOGGER = LoggerFactory.getLogger(B2DownloadFileByIdRequest.class);
2125
private static final String B2_DOWNLOAD_FILE_BY_ID = BASE_API_VERSION + "b2_download_file_by_id";
2226

2327
/**
@@ -64,6 +68,6 @@ public B2DownloadFileByIdRequest(B2AuthorizeAccountResponse b2AuthorizeAccountRe
6468
* @throws B2ApiException If there was an error with the call
6569
*/
6670
public B2DownloadFileResponse getResponse() throws B2ApiException {
67-
return(new B2DownloadFileResponse(executeGetWithData()));
71+
return(new B2DownloadFileResponse(executeGetWithData(LOGGER)));
6872
}
6973
}

src/main/java/synapticloop/b2/request/B2DownloadFileByNameRequest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package synapticloop.b2.request;
22

3+
import org.slf4j.Logger;
4+
import org.slf4j.LoggerFactory;
5+
36
import synapticloop.b2.exception.B2ApiException;
47
import synapticloop.b2.response.B2AuthorizeAccountResponse;
58
import synapticloop.b2.response.B2DownloadFileResponse;
@@ -20,6 +23,7 @@
2023
*/
2124

2225
public class B2DownloadFileByNameRequest extends BaseB2Request {
26+
private static final Logger LOGGER = LoggerFactory.getLogger(B2DownloadFileByNameRequest.class);
2327

2428
public B2DownloadFileByNameRequest(B2AuthorizeAccountResponse b2AuthorizeAccountResponse, String bucketName, String fileName) {
2529
super(b2AuthorizeAccountResponse);
@@ -32,6 +36,6 @@ public B2DownloadFileByNameRequest(B2AuthorizeAccountResponse b2AuthorizeAccount
3236
}
3337

3438
public B2DownloadFileResponse getResponse() throws B2ApiException {
35-
return(new B2DownloadFileResponse(executeGetWithData()));
39+
return(new B2DownloadFileResponse(executeGetWithData(LOGGER)));
3640
}
3741
}

src/main/java/synapticloop/b2/request/B2GetFileInfoRequest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package synapticloop.b2.request;
22

3+
import org.slf4j.Logger;
4+
import org.slf4j.LoggerFactory;
5+
36
import synapticloop.b2.exception.B2ApiException;
47
import synapticloop.b2.response.B2AuthorizeAccountResponse;
58
import synapticloop.b2.response.B2FileResponse;
@@ -16,6 +19,7 @@
1619
*/
1720

1821
public class B2GetFileInfoRequest extends BaseB2Request {
22+
private static final Logger LOGGER = LoggerFactory.getLogger(B2GetFileInfoRequest.class);
1923
private static final String B2_GET_FILE_INFO = BASE_API_VERSION + "b2_get_file_info";
2024

2125
/**
@@ -39,6 +43,6 @@ public B2GetFileInfoRequest(B2AuthorizeAccountResponse b2AuthorizeAccountRespons
3943
* @throws B2ApiException if there was an error with the call
4044
*/
4145
public B2FileResponse getResponse() throws B2ApiException {
42-
return(new B2FileResponse(executePost()));
46+
return(new B2FileResponse(executePost(LOGGER)));
4347
}
4448
}

src/main/java/synapticloop/b2/request/B2GetUploadUrlRequest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
import java.util.Iterator;
44
import java.util.Map;
55

6+
import org.slf4j.Logger;
7+
import org.slf4j.LoggerFactory;
8+
69
import synapticloop.b2.exception.B2ApiException;
710
import synapticloop.b2.response.B2AuthorizeAccountResponse;
811
import synapticloop.b2.response.B2GetUploadUrlResponse;
@@ -22,6 +25,7 @@
2225
*/
2326

2427
public class B2GetUploadUrlRequest extends BaseB2Request {
28+
private static final Logger LOGGER = LoggerFactory.getLogger(B2GetUploadUrlRequest.class);
2529
private static final String B2_GET_UPLOAD_URL = BASE_API_VERSION + "b2_get_upload_url";
2630

2731
public B2GetUploadUrlRequest(B2AuthorizeAccountResponse b2AuthorizeAccountResponse, String bucketId) {
@@ -47,6 +51,6 @@ public B2GetUploadUrlRequest(B2AuthorizeAccountResponse b2AuthorizeAccountRespon
4751
}
4852

4953
public B2GetUploadUrlResponse getResponse() throws B2ApiException {
50-
return(new B2GetUploadUrlResponse(executePost()));
54+
return(new B2GetUploadUrlResponse(executePost(LOGGER)));
5155
}
5256
}

src/main/java/synapticloop/b2/request/B2HeadFileByIdRequest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package synapticloop.b2.request;
22

3+
import org.slf4j.Logger;
4+
import org.slf4j.LoggerFactory;
5+
36
import synapticloop.b2.exception.B2ApiException;
47
import synapticloop.b2.response.B2AuthorizeAccountResponse;
58
import synapticloop.b2.response.B2DownloadFileResponse;
@@ -20,6 +23,7 @@
2023
*/
2124

2225
public class B2HeadFileByIdRequest extends BaseB2Request {
26+
private static final Logger LOGGER = LoggerFactory.getLogger(B2HeadFileByIdRequest.class);
2327
private static final String B2_DOWNLOAD_FILE_BY_ID = BASE_API_VERSION + "b2_download_file_by_id";
2428

2529
public B2HeadFileByIdRequest(B2AuthorizeAccountResponse b2AuthorizeAccountResponse, String fileId) {
@@ -36,6 +40,6 @@ public B2HeadFileByIdRequest(B2AuthorizeAccountResponse b2AuthorizeAccountRespon
3640
* @throws B2ApiException if something went wrong
3741
*/
3842
public B2DownloadFileResponse getResponse() throws B2ApiException {
39-
return(new B2DownloadFileResponse(executeHead()));
43+
return(new B2DownloadFileResponse(executeHead(LOGGER)));
4044
}
4145
}

0 commit comments

Comments
 (0)