File tree Expand file tree Collapse file tree 6 files changed +45
-13
lines changed
src/main/java/com/spectralogic/ds3client Expand file tree Collapse file tree 6 files changed +45
-13
lines changed Original file line number Diff line number Diff line change 11package com .spectralogic .ds3client ;
22
3- import com .spectralogic .ds3client .commands .AbstractRequest ;
3+ import com .spectralogic .ds3client .commands .Ds3Request ;
44import com .spectralogic .ds3client .models .SignatureDetails ;
55import com .spectralogic .ds3client .networking .ConnectionDetails ;
66import com .spectralogic .ds3client .networking .NetUtils ;
@@ -43,7 +43,7 @@ public ConnectionDetails getConnectionDetails() {
4343 return connectionDetails ;
4444 }
4545
46- public CloseableHttpResponse getResponse (final AbstractRequest request ) throws IOException , SignatureException {
46+ public CloseableHttpResponse getResponse (final Ds3Request request ) throws IOException , SignatureException {
4747 final HttpHost host = getHost (connectionDetails );
4848 final HttpRequest httpRequest = getHttpRequest (request );
4949 final String date = DateFormatter .dateToRfc882 ();
@@ -94,7 +94,7 @@ private int getPort(final URL url) {
9494 return port ;
9595 }
9696
97- private HttpRequest getHttpRequest (final AbstractRequest request ) {
97+ private HttpRequest getHttpRequest (final Ds3Request request ) {
9898 final String verb = request .getVerb ().toString ();
9999 final InputStream stream = request .getStream ();
100100 final Map <String , String > queryParams = request .getQueryParams ();
Original file line number Diff line number Diff line change 11package com .spectralogic .ds3client .commands ;
22
3- import com .spectralogic .ds3client .HttpVerb ;
43import org .apache .http .entity .ContentType ;
54
65import java .io .InputStream ;
76import java .util .HashMap ;
87import java .util .Map ;
98
10- public abstract class AbstractRequest {
9+ abstract class AbstractRequest implements Ds3Request {
1110
1211 private final Map <String , String > headers = new HashMap <>();
1312 private final Map <String , String > queryParams = new HashMap <>();
1413
15- public abstract String getPath ();
16- public abstract HttpVerb getVerb ();
17-
14+ @ Override
1815 public ContentType getContentType () {
1916 return ContentType .APPLICATION_XML ;
2017 }
2118
19+ @ Override
2220 public InputStream getStream () {
2321 return null ;
2422 }
2523
24+ @ Override
2625 public long getSize () {
2726 return 0 ;
2827 }
2928
29+ @ Override
3030 public String getMd5 () {
3131 return "" ;
3232 }
3333
34+ @ Override
3435 public final Map <String , String > getQueryParams () {
3536 return queryParams ;
3637 }
3738
39+ @ Override
3840 public final Map <String , String > getHeaders () {
3941 return headers ;
4042 }
Original file line number Diff line number Diff line change 11package com .spectralogic .ds3client .commands ;
22
3- import java .io .Closeable ;
43import java .io .IOException ;
54import java .io .InputStream ;
65import java .io .StringWriter ;
1211import com .spectralogic .ds3client .serializer .XmlOutput ;
1312import com .spectralogic .ds3client .models .Error ;
1413
15- abstract class AbstractResponse implements Closeable {
14+ abstract class AbstractResponse implements Ds3Response {
1615 final static String UTF8 = "UTF-8" ;
1716
1817 final private CloseableHttpResponse response ;
@@ -62,4 +61,4 @@ private String readResponseString() throws IOException {
6261 public void close () throws IOException {
6362 response .close ();
6463 }
65- }
64+ }
Original file line number Diff line number Diff line change 1+ package com .spectralogic .ds3client .commands ;
2+
3+ import com .spectralogic .ds3client .HttpVerb ;
4+ import org .apache .http .entity .ContentType ;
5+
6+ import java .io .InputStream ;
7+ import java .util .Map ;
8+
9+ public interface Ds3Request {
10+
11+ public String getPath ();
12+ public HttpVerb getVerb ();
13+
14+ public ContentType getContentType ();
15+
16+ public InputStream getStream ();
17+
18+ public long getSize ();
19+
20+ public String getMd5 ();
21+
22+ public Map <String , String > getQueryParams ();
23+
24+ public Map <String , String > getHeaders ();
25+ }
Original file line number Diff line number Diff line change 1+ package com .spectralogic .ds3client .commands ;
2+
3+ import java .io .Closeable ;
4+
5+ public interface Ds3Response extends Closeable {
6+ }
Original file line number Diff line number Diff line change 11package com .spectralogic .ds3client .networking ;
22
3- import com .spectralogic .ds3client .commands .AbstractRequest ;
3+ import com .spectralogic .ds3client .commands .Ds3Request ;
44import org .apache .http .client .methods .CloseableHttpResponse ;
55
66import java .io .IOException ;
77import java .security .SignatureException ;
88
99public interface NetworkClient {
10- public CloseableHttpResponse getResponse (final AbstractRequest request ) throws IOException , SignatureException ;
10+ public CloseableHttpResponse getResponse (final Ds3Request request ) throws IOException , SignatureException ;
1111 public ConnectionDetails getConnectionDetails ();
1212}
You can’t perform that action at this time.
0 commit comments