Skip to content

Commit a2c058d

Browse files
committed
Merge pull request #52 from rpmoore/master
Fixed the Helpers which were broken due to a change to try to create new ConnectionDetails objects from Node objects
2 parents 305b832 + 4b0401f commit a2c058d

File tree

8 files changed

+21
-151
lines changed

8 files changed

+21
-151
lines changed

ds3-sdk/src/main/java/com/spectralogic/ds3client/ConnectionDetailsImpl.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,14 @@ public ConnectionDetailsImpl build() {
7070
}
7171

7272
public static ConnectionDetails newForNode(final Node node, final ConnectionDetails connectionDetails) {
73-
final Builder connectionBuilder = builder(node.getEndpoint(), connectionDetails.getCredentials())
74-
.withRedirectRetries(connectionDetails.getRetries())
73+
final Builder connectionBuilder;
74+
if (node.getEndpoint() == null || node.getEndpoint().equals("FAILED_TO_DETERMINE_DATAPATH_IP_ADDRESS")) {
75+
connectionBuilder = builder(connectionDetails.getEndpoint(), connectionDetails.getCredentials());
76+
}
77+
else {
78+
connectionBuilder = builder(node.getEndpoint(), connectionDetails.getCredentials());
79+
}
80+
connectionBuilder.withRedirectRetries(connectionDetails.getRetries())
7581
.withHttps(connectionDetails.isHttps())
7682
.withCertificateVerification(connectionDetails.isCertificateVerification())
7783
.withBufferSize(connectionDetails.getBufferSize())
@@ -137,4 +143,8 @@ public boolean isCertificateVerification() {
137143
return certificateVerification;
138144
}
139145

146+
public String toString() {
147+
return "Endpoint: " + this.endpoint + " | Https?: " + this.https;
148+
}
149+
140150
}

ds3-sdk/src/main/java/com/spectralogic/ds3client/Ds3Client.java

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,9 @@
2323
import java.security.SignatureException;
2424

2525
/**
26-
* The main interface for communicating with a DS3 appliance. All communication with a DS3 appliance should start with
26+
* The main interface for communicating with a DS3 appliance. All communication with a DS3 appliance starts with
2727
* this class.
2828
*
29-
* Here is an example showing how the Ds3Client interface is used to get a list of buckets from a remote DS3 appliance.
30-
*
31-
* <pre>
32-
* {@code
33-
* final Ds3Client client = Ds3ClientBuilder.create("ds3Endpoint:8080",
34-
* new Credentials("accessKey", "secretKey")).build();
35-
*
36-
* final GetServiceResponse response = client.getService(new GetServiceRequest());
37-
*
38-
* for(final Bucket bucket: response.getResult().getBuckets()) {
39-
* System.out.println(bucket.getName());
40-
* }
41-
* }
42-
* </pre>
43-
*
4429
* See {@link Ds3ClientBuilder} on what options can be used to create a Ds3Client instance.
4530
*/
4631
public interface Ds3Client {
@@ -128,7 +113,7 @@ public abstract DeleteObjectResponse deleteObject(
128113
DeleteObjectRequest request) throws IOException, SignatureException;
129114

130115
/**
131-
* Get an object in a bucket from a DS3 endpoint
116+
* Retrieves an object from DS3
132117
* @param request The Get Object Request object used to customize the HTTP request. The get object request object
133118
* has some options for customizing the request. See {@link GetObjectRequest} for the full list of
134119
* options that can be configured.
@@ -141,10 +126,7 @@ public abstract GetObjectResponse getObject(GetObjectRequest request)
141126
throws IOException, SignatureException;
142127

143128
/**
144-
* Puts a new object to an existing bucket to a DS3 endpoint. If the InputStream passed into the PutObjectRequest
145-
* is not seekable, meaning if InputStream.markSupported() returns false, the request will fail and throw a
146-
* {@link com.spectralogic.ds3client.networking.RequiresMarkSupportedException}. If using a FileInputStream see
147-
* {@link com.spectralogic.ds3client.helpers.ResettableFileInputStream} to make seekable.
129+
* Puts a new object to an existing bucket. The call will fail if the bucket does not exist.
148130
* @param request The Put Object Request object used to customize the HTTP request. The put object request object
149131
* has some options for customizing the request. See {@link PutObjectRequest} for the full list of
150132
* options that can be configured.

ds3-sdk/src/main/java/com/spectralogic/ds3client/Ds3ClientImpl.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,7 @@ public ModifyJobResponse modifyJob(final ModifyJobRequest request) throws IOExce
127127
@Override
128128
public Ds3Client newForNode(final Node node) {
129129
final ConnectionDetails newConnectionDetails = ConnectionDetailsImpl.newForNode(node, this.getConnectionDetails());
130-
final NetworkClient netClient = new NetworkClientImpl(newConnectionDetails);
131-
132-
return new Ds3ClientImpl(netClient);
130+
final NetworkClient newNetClient = new NetworkClientImpl(newConnectionDetails);
131+
return new Ds3ClientImpl(newNetClient);
133132
}
134133
}

ds3-sdk/src/main/java/com/spectralogic/ds3client/NetworkClientImpl.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import java.io.Closeable;
4040
import java.io.IOException;
4141
import java.io.InputStream;
42+
import java.lang.AssertionError;
4243
import java.net.MalformedURLException;
4344
import java.net.URI;
4445
import java.net.URL;
@@ -57,6 +58,7 @@ class NetworkClientImpl implements NetworkClient {
5758
final private ConnectionDetails connectionDetails;
5859

5960
NetworkClientImpl(final ConnectionDetails connectionDetails) {
61+
if (connectionDetails == null) throw new AssertionError(connectionDetails);
6062
this.connectionDetails = connectionDetails;
6163
}
6264

ds3-sdk/src/main/java/com/spectralogic/ds3client/commands/PutObjectRequest.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@
2323
import java.util.UUID;
2424

2525
/**
26-
* Maps to a DS3 Single Object Put request. This request requires that the InputStream is seekable, that is the
27-
* InputStream.markSupported() method must return true. By default the Java FileInputStream does not do this. To
28-
* use a FileInputStream see {@link com.spectralogic.ds3client.helpers.ResettableFileInputStream} which wraps a
29-
* FileInputStream and makes it seekable.
26+
* Maps to a DS3 Single Object Put request.
3027
*/
3128
public class PutObjectRequest extends AbstractRequest {
3229

ds3-sdk/src/main/java/com/spectralogic/ds3client/helpers/ResettableFileInputStream.java

Lines changed: 0 additions & 77 deletions
This file was deleted.

ds3-sdk/src/main/java/com/spectralogic/ds3client/networking/ConnectionDetails.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@ public interface ConnectionDetails {
4040
* Returns true if the network layer should perform certificate authentication for SSL. False will disable
4141
* certificate authentication.
4242
*/
43-
boolean isCertificateVerification();
43+
public boolean isCertificateVerification();
4444
}

ds3-sdk/src/test/java/com/spectralogic/ds3client/helpers/ResettableFileInputStream_Test.java

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)