Skip to content

Commit f337ef3

Browse files
committed
Merge pull request #72 from rpmoore/master
Adding additional Logging and Administration API calls
2 parents bd1a7d3 + 0e99fdc commit f337ef3

28 files changed

+1256
-33
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
allprojects {
1717
group = 'com.spectralogic.ds3'
18-
version = '1.1.0-RC4'
18+
version = '1.1.0-RC5'
1919
}
2020

2121
subprojects {

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,28 @@ NotificationResponse getTapeFailureNotification(GetTapeFailureNotificationReques
296296

297297
DeleteNotificationResponse deleteTapeFailureNotification(DeleteTapeFailureNotificationRequest request)
298298
throws IOException, SignatureException;
299+
300+
GetSystemHealthResponse getSystemHealth(GetSystemHealthRequest request)
301+
throws IOException, SignatureException;
302+
303+
GetSystemInformationResponse getSystemInformation(GetSystemInformationRequest request)
304+
throws IOException, SignatureException;
305+
306+
GetTapeLibrariesResponse getTapeLibraries(GetTapeLibrariesRequest request)
307+
throws IOException, SignatureException;
308+
309+
GetTapeLibraryResponse getTapeLibrary(GetTapeLibraryRequest request)
310+
throws IOException, SignatureException;
311+
312+
GetTapeDrivesResponse getTapeDrives(GetTapeDrivesRequest request)
313+
throws IOException, SignatureException;
314+
315+
GetTapeDriveResponse getTapeDrive(GetTapeDriveRequest request)
316+
throws IOException, SignatureException;
317+
318+
GetTapeFailureResponse getTapeFailure(GetTapeFailureRequest request)
319+
throws IOException, SignatureException;
320+
299321
/**
300322
* Creates a new Ds3Client instance for the system pointed to by Node.
301323
*/

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

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,41 @@ public DeleteNotificationResponse deleteTapeFailureNotification(DeleteTapeFailur
245245
return new DeleteNotificationResponse(this.netClient.getResponse(request));
246246
}
247247

248+
@Override
249+
public GetSystemHealthResponse getSystemHealth(final GetSystemHealthRequest request) throws IOException, SignatureException {
250+
return new GetSystemHealthResponse(this.netClient.getResponse(request));
251+
}
252+
253+
@Override
254+
public GetSystemInformationResponse getSystemInformation(final GetSystemInformationRequest request) throws IOException, SignatureException {
255+
return new GetSystemInformationResponse(this.netClient.getResponse(request));
256+
}
257+
258+
@Override
259+
public GetTapeLibrariesResponse getTapeLibraries(final GetTapeLibrariesRequest request) throws IOException, SignatureException {
260+
return new GetTapeLibrariesResponse(this.netClient.getResponse(request));
261+
}
262+
263+
@Override
264+
public GetTapeLibraryResponse getTapeLibrary(final GetTapeLibraryRequest request) throws IOException, SignatureException {
265+
return new GetTapeLibraryResponse(this.netClient.getResponse(request));
266+
}
267+
268+
@Override
269+
public GetTapeDrivesResponse getTapeDrives(final GetTapeDrivesRequest request) throws IOException, SignatureException {
270+
return new GetTapeDrivesResponse(this.netClient.getResponse(request));
271+
}
272+
273+
@Override
274+
public GetTapeDriveResponse getTapeDrive(final GetTapeDriveRequest request) throws IOException, SignatureException {
275+
return new GetTapeDriveResponse(this.netClient.getResponse(request));
276+
}
277+
278+
@Override
279+
public GetTapeFailureResponse getTapeFailure(final GetTapeFailureRequest request) throws IOException, SignatureException {
280+
return new GetTapeFailureResponse(this.netClient.getResponse(request));
281+
}
282+
248283
@Override
249284
public Ds3Client newForNode(final Node node) {
250285
final ConnectionDetails newConnectionDetails = ConnectionDetailsImpl.newForNode(node, this.getConnectionDetails());

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,10 @@ public WebResponse getResponse(final Ds3Request request) throws IOException, Sig
109109
final CloseableHttpResponse response = requestExecutor.execute();
110110
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_TEMPORARY_REDIRECT) {
111111
redirectCount++;
112+
LOG.debug("Performing retry - attempt: " + redirectCount);
112113
}
113114
else {
115+
LOG.info("Got response from server");
114116
return new WebResponseImpl(response);
115117
}
116118
} while (redirectCount < this.connectionDetails.getRetries());
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* ******************************************************************************
3+
* Copyright 2014-2015 Spectra Logic Corporation. All Rights Reserved.
4+
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
5+
* this file except in compliance with the License. A copy of the License is located at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* or in the "license" file accompanying this file.
10+
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
11+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
12+
* specific language governing permissions and limitations under the License.
13+
* ****************************************************************************
14+
*/
15+
16+
package com.spectralogic.ds3client.commands;
17+
18+
import com.spectralogic.ds3client.HttpVerb;
19+
20+
public class GetSystemHealthRequest extends AbstractRequest {
21+
@Override
22+
public String getPath() {
23+
return "/_rest_/system_health";
24+
}
25+
26+
@Override
27+
public HttpVerb getVerb() {
28+
return HttpVerb.GET;
29+
}
30+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* ******************************************************************************
3+
* Copyright 2014-2015 Spectra Logic Corporation. All Rights Reserved.
4+
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
5+
* this file except in compliance with the License. A copy of the License is located at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* or in the "license" file accompanying this file.
10+
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
11+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
12+
* specific language governing permissions and limitations under the License.
13+
* ****************************************************************************
14+
*/
15+
16+
package com.spectralogic.ds3client.commands;
17+
18+
import com.spectralogic.ds3client.models.SystemHealth;
19+
import com.spectralogic.ds3client.networking.WebResponse;
20+
import com.spectralogic.ds3client.serializer.XmlOutput;
21+
22+
import java.io.IOException;
23+
import java.io.InputStream;
24+
25+
public class GetSystemHealthResponse extends AbstractResponse {
26+
27+
private SystemHealth systemHealth;
28+
29+
public GetSystemHealthResponse(final WebResponse response) throws IOException {
30+
super(response);
31+
}
32+
33+
@Override
34+
protected void processResponse() throws IOException {
35+
try (final WebResponse response = getResponse()) {
36+
this.checkStatusCode(200);
37+
try (final InputStream inputStream = response.getResponseStream()) {
38+
this.systemHealth = XmlOutput.fromXml(inputStream, SystemHealth.class);
39+
}
40+
}
41+
}
42+
43+
public SystemHealth getSystemHealth() {
44+
return this.systemHealth;
45+
}
46+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* ******************************************************************************
3+
* Copyright 2014-2015 Spectra Logic Corporation. All Rights Reserved.
4+
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
5+
* this file except in compliance with the License. A copy of the License is located at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* or in the "license" file accompanying this file.
10+
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
11+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
12+
* specific language governing permissions and limitations under the License.
13+
* ****************************************************************************
14+
*/
15+
16+
package com.spectralogic.ds3client.commands;
17+
18+
import com.spectralogic.ds3client.HttpVerb;
19+
20+
public class GetSystemInformationRequest extends AbstractRequest {
21+
@Override
22+
public String getPath() {
23+
return "/_rest_/system_information";
24+
}
25+
26+
@Override
27+
public HttpVerb getVerb() {
28+
return HttpVerb.GET;
29+
}
30+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* ******************************************************************************
3+
* Copyright 2014-2015 Spectra Logic Corporation. All Rights Reserved.
4+
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
5+
* this file except in compliance with the License. A copy of the License is located at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* or in the "license" file accompanying this file.
10+
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
11+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
12+
* specific language governing permissions and limitations under the License.
13+
* ****************************************************************************
14+
*/
15+
16+
package com.spectralogic.ds3client.commands;
17+
18+
import com.spectralogic.ds3client.models.SystemInformation;
19+
import com.spectralogic.ds3client.networking.WebResponse;
20+
import com.spectralogic.ds3client.serializer.XmlOutput;
21+
22+
import java.io.IOException;
23+
import java.io.InputStream;
24+
25+
public class GetSystemInformationResponse extends AbstractResponse {
26+
27+
private SystemInformation systemInformation;
28+
29+
public GetSystemInformationResponse(final WebResponse response) throws IOException {
30+
super(response);
31+
}
32+
33+
@Override
34+
protected void processResponse() throws IOException {
35+
try (final WebResponse response = getResponse()) {
36+
this.checkStatusCode(200);
37+
try (final InputStream inputStream = response.getResponseStream()) {
38+
this.systemInformation = XmlOutput.fromXml(inputStream, SystemInformation.class);
39+
}
40+
}
41+
}
42+
43+
public SystemInformation getSystemInformation() {
44+
return this.systemInformation;
45+
}
46+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* ******************************************************************************
3+
* Copyright 2014-2015 Spectra Logic Corporation. All Rights Reserved.
4+
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
5+
* this file except in compliance with the License. A copy of the License is located at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* or in the "license" file accompanying this file.
10+
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
11+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
12+
* specific language governing permissions and limitations under the License.
13+
* ****************************************************************************
14+
*/
15+
16+
package com.spectralogic.ds3client.commands;
17+
18+
import com.spectralogic.ds3client.HttpVerb;
19+
20+
import java.util.UUID;
21+
22+
public class GetTapeDriveRequest extends AbstractRequest {
23+
24+
private final UUID id;
25+
26+
public GetTapeDriveRequest(final UUID id) {
27+
this.id = id;
28+
}
29+
30+
@Override
31+
public String getPath() {
32+
return "/_rest_/tape_drive/" + id.toString();
33+
}
34+
35+
@Override
36+
public HttpVerb getVerb() {
37+
return HttpVerb.GET;
38+
}
39+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* ******************************************************************************
3+
* Copyright 2014-2015 Spectra Logic Corporation. All Rights Reserved.
4+
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
5+
* this file except in compliance with the License. A copy of the License is located at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* or in the "license" file accompanying this file.
10+
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
11+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
12+
* specific language governing permissions and limitations under the License.
13+
* ****************************************************************************
14+
*/
15+
16+
package com.spectralogic.ds3client.commands;
17+
18+
import com.spectralogic.ds3client.models.tape.TapeDrive;
19+
import com.spectralogic.ds3client.networking.WebResponse;
20+
import com.spectralogic.ds3client.serializer.XmlOutput;
21+
22+
import java.io.IOException;
23+
import java.io.InputStream;
24+
25+
public class GetTapeDriveResponse extends AbstractResponse {
26+
27+
private TapeDrive tapeDrive;
28+
29+
public GetTapeDriveResponse(final WebResponse response) throws IOException {
30+
super(response);
31+
}
32+
33+
@Override
34+
protected void processResponse() throws IOException {
35+
try (final WebResponse response = getResponse()) {
36+
this.checkStatusCode(200);
37+
try (final InputStream inputStream = response.getResponseStream()) {
38+
this.tapeDrive = XmlOutput.fromXml(inputStream, TapeDrive.class);
39+
}
40+
}
41+
}
42+
43+
public TapeDrive getTapeDrive() {
44+
return tapeDrive;
45+
}
46+
}

0 commit comments

Comments
 (0)