Skip to content

Commit 3c45598

Browse files
committed
Merge pull request #41 from hansdude/master
Made SeekableByteChannelInputStream pkg private.
2 parents 7c7fcf4 + c10add7 commit 3c45598

File tree

10 files changed

+24
-23
lines changed

10 files changed

+24
-23
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
import com.spectralogic.ds3client.HttpVerb;
1919
import com.spectralogic.ds3client.models.Checksum;
20-
import com.spectralogic.ds3client.utils.SeekableByteChannelInputStream;
2120

2221
import java.io.InputStream;
2322
import java.nio.channels.SeekableByteChannel;

sdk/src/main/java/com/spectralogic/ds3client/utils/SeekableByteChannelInputStream.java renamed to sdk/src/main/java/com/spectralogic/ds3client/commands/SeekableByteChannelInputStream.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
* ****************************************************************************
1414
*/
1515

16-
package com.spectralogic.ds3client.utils;
16+
package com.spectralogic.ds3client.commands;
1717

1818
import java.io.IOException;
1919
import java.io.InputStream;
2020
import java.nio.ByteBuffer;
2121
import java.nio.channels.SeekableByteChannel;
2222

23-
public class SeekableByteChannelInputStream extends InputStream {
23+
class SeekableByteChannelInputStream extends InputStream {
2424
private final SeekableByteChannel seekableByteChannel;
2525
private long markPosition = 0L;
2626

sdk/src/main/java/com/spectralogic/ds3client/helpers/Ds3ClientHelpers.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
*/
3434
public abstract class Ds3ClientHelpers {
3535

36-
public interface ObjectTransferrer {
36+
public interface ObjectChannelBuilder {
3737
/**
3838
* Returns a channel for the given object key. Depending on whether the
3939
* job is a GET or PUT, the returned channel must support either writing
@@ -64,7 +64,7 @@ public interface Job {
6464
* @throws IOException
6565
* @throws XmlProcessingException
6666
*/
67-
public void transfer(final ObjectTransferrer transferrer)
67+
public void transfer(final ObjectChannelBuilder transferrer)
6868
throws SignatureException, IOException, XmlProcessingException;
6969
}
7070

sdk/src/main/java/com/spectralogic/ds3client/helpers/FileObjectGetter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
package com.spectralogic.ds3client.helpers;
1717

18-
import com.spectralogic.ds3client.helpers.Ds3ClientHelpers.ObjectTransferrer;
18+
import com.spectralogic.ds3client.helpers.Ds3ClientHelpers.ObjectChannelBuilder;
1919

2020
import java.io.IOException;
2121
import java.nio.channels.FileChannel;
@@ -27,7 +27,7 @@
2727
/**
2828
* Writes files to the local file system preserving the path.
2929
*/
30-
public class FileObjectGetter implements ObjectTransferrer {
30+
public class FileObjectGetter implements ObjectChannelBuilder {
3131
private final Path root;
3232

3333
/**

sdk/src/main/java/com/spectralogic/ds3client/helpers/FileObjectPutter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
package com.spectralogic.ds3client.helpers;
1717

18-
import com.spectralogic.ds3client.helpers.Ds3ClientHelpers.ObjectTransferrer;
18+
import com.spectralogic.ds3client.helpers.Ds3ClientHelpers.ObjectChannelBuilder;
1919

2020
import java.io.IOException;
2121
import java.nio.channels.FileChannel;
@@ -26,7 +26,7 @@
2626
/**
2727
* Writes files to a remote DS3 appliance from a directory in the local filesystem.
2828
*/
29-
public class FileObjectPutter implements ObjectTransferrer {
29+
public class FileObjectPutter implements ObjectChannelBuilder {
3030
private final Path root;
3131

3232
/**

sdk/src/main/java/com/spectralogic/ds3client/helpers/JobImpl.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import com.google.common.util.concurrent.MoreExecutors;
2222
import com.spectralogic.ds3client.Ds3Client;
2323
import com.spectralogic.ds3client.helpers.Ds3ClientHelpers.Job;
24-
import com.spectralogic.ds3client.helpers.Ds3ClientHelpers.ObjectTransferrer;
24+
import com.spectralogic.ds3client.helpers.Ds3ClientHelpers.ObjectChannelBuilder;
2525
import com.spectralogic.ds3client.models.bulk.BulkObject;
2626
import com.spectralogic.ds3client.models.bulk.Objects;
2727
import com.spectralogic.ds3client.serializer.XmlProcessingException;
@@ -71,7 +71,7 @@ public Job withMaxParallelRequests(final int maxParallelRequests) {
7171
}
7272

7373
@Override
74-
public void transfer(final ObjectTransferrer transferrer)
74+
public void transfer(final ObjectChannelBuilder transferrer)
7575
throws SignatureException, IOException, XmlProcessingException {
7676
for (final Objects chunk : this.objectLists) {
7777
this.transferChunk(transferrer, chunk);
@@ -83,9 +83,9 @@ protected abstract void transferItem(
8383
final UUID jobId,
8484
final String bucketName,
8585
final BulkObject ds3Object,
86-
final ObjectTransferrer transferrer) throws SignatureException, IOException;
86+
final ObjectChannelBuilder transferrer) throws SignatureException, IOException;
8787

88-
private void transferChunk(final ObjectTransferrer transferrer, final Objects objects)
88+
private void transferChunk(final ObjectChannelBuilder transferrer, final Objects objects)
8989
throws SignatureException, IOException, XmlProcessingException {
9090
final ListeningExecutorService service = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(this.maxParallelRequests));
9191
try {
@@ -101,7 +101,7 @@ private void transferChunk(final ObjectTransferrer transferrer, final Objects ob
101101
}
102102

103103
private ListenableFuture<?> createTransferTask(
104-
final ObjectTransferrer transferrer,
104+
final ObjectChannelBuilder transferrer,
105105
final ListeningExecutorService service,
106106
final Ds3Client client,
107107
final BulkObject ds3Object) {

sdk/src/main/java/com/spectralogic/ds3client/helpers/ReadJobImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
import com.spectralogic.ds3client.Ds3Client;
1919
import com.spectralogic.ds3client.commands.GetObjectRequest;
20-
import com.spectralogic.ds3client.helpers.Ds3ClientHelpers.ObjectTransferrer;
20+
import com.spectralogic.ds3client.helpers.Ds3ClientHelpers.ObjectChannelBuilder;
2121
import com.spectralogic.ds3client.models.bulk.BulkObject;
2222
import com.spectralogic.ds3client.models.bulk.Objects;
2323

@@ -40,7 +40,7 @@ protected void transferItem(
4040
final UUID jobId,
4141
final String bucketName,
4242
final BulkObject ds3Object,
43-
final ObjectTransferrer transferrer)
43+
final ObjectChannelBuilder transferrer)
4444
throws SignatureException, IOException {
4545
client
4646
.getObject(new GetObjectRequest(

sdk/src/main/java/com/spectralogic/ds3client/helpers/WriteJobImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
import com.spectralogic.ds3client.Ds3Client;
1919
import com.spectralogic.ds3client.commands.PutObjectRequest;
20-
import com.spectralogic.ds3client.helpers.Ds3ClientHelpers.ObjectTransferrer;
20+
import com.spectralogic.ds3client.helpers.Ds3ClientHelpers.ObjectChannelBuilder;
2121
import com.spectralogic.ds3client.models.bulk.BulkObject;
2222
import com.spectralogic.ds3client.models.bulk.Objects;
2323

@@ -40,7 +40,7 @@ protected void transferItem(
4040
final UUID jobId,
4141
final String bucketName,
4242
final BulkObject ds3Object,
43-
final ObjectTransferrer transferrer) throws SignatureException, IOException {
43+
final ObjectChannelBuilder transferrer) throws SignatureException, IOException {
4444
client
4545
.putObject(new PutObjectRequest(
4646
bucketName,
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
* ****************************************************************************
1414
*/
1515

16-
package com.spectralogic.ds3client.utils;
16+
package com.spectralogic.ds3client.commands;
17+
18+
import com.spectralogic.ds3client.utils.ResourceUtils;
1719

1820
import org.junit.Test;
1921
import org.mockito.Mockito;

sdk/src/test/java/com/spectralogic/ds3client/helpers/Ds3ClientHelpers_Test.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import com.spectralogic.ds3client.Ds3Client;
2020
import com.spectralogic.ds3client.commands.*;
2121
import com.spectralogic.ds3client.helpers.Ds3ClientHelpers.Job;
22-
import com.spectralogic.ds3client.helpers.Ds3ClientHelpers.ObjectTransferrer;
22+
import com.spectralogic.ds3client.helpers.Ds3ClientHelpers.ObjectChannelBuilder;
2323
import com.spectralogic.ds3client.models.Contents;
2424
import com.spectralogic.ds3client.models.ListBucketResult;
2525
import com.spectralogic.ds3client.models.Owner;
@@ -78,7 +78,7 @@ public void testReadObjects() throws SignatureException, IOException, XmlProcess
7878
channelMap.put("bar", new ByteArraySeekableByteChannel());
7979
channelMap.put("baz", new ByteArraySeekableByteChannel());
8080

81-
readJob.transfer(new ObjectTransferrer() {
81+
readJob.transfer(new ObjectChannelBuilder() {
8282
@Override
8383
public SeekableByteChannel buildChannel(final String key) throws IOException {
8484
return channelMap.get(key);
@@ -118,7 +118,7 @@ public void testWriteObjects() throws SignatureException, IOException, XmlProces
118118
channels.put("foo", mock(SeekableByteChannel.class));
119119
channels.put("bar", mock(SeekableByteChannel.class));
120120

121-
job.transfer(new ObjectTransferrer() {
121+
job.transfer(new ObjectChannelBuilder() {
122122
@Override
123123
public SeekableByteChannel buildChannel(final String key) throws IOException {
124124
return channels.get(key);
@@ -167,7 +167,7 @@ public void testReadObjectsWithFailedPut() throws SignatureException, IOExceptio
167167
final Job job = Ds3ClientHelpers.wrap(ds3Client).startReadJob(MYBUCKET, objectsToGet);
168168

169169
try {
170-
job.transfer(new ObjectTransferrer() {
170+
job.transfer(new ObjectChannelBuilder() {
171171
@Override
172172
public SeekableByteChannel buildChannel(final String key) throws IOException {
173173
// We don't care about the contents since we just want to know that the exception handling works correctly.

0 commit comments

Comments
 (0)