summaryrefslogtreecommitdiffstats
path: root/idrop-lite
diff options
context:
space:
mode:
authorLISA STILLWELL <lisa@dhcp152-54-6-218.wireless.europa.renci.org>2012-03-06 15:00:48 (GMT)
committer LISA STILLWELL <lisa@dhcp152-54-6-218.wireless.europa.renci.org>2012-03-06 15:00:48 (GMT)
commit912fb98af8ac32ba3525bc4a21d9804e9c90325e (patch)
treed273df3f910926da5db727cc26681f71699cf90f /idrop-lite
parent2049c3835aecf9e37542ac26fe64bb8b929c68da (diff)
downloadQCG-Data-912fb98af8ac32ba3525bc4a21d9804e9c90325e.zip
QCG-Data-912fb98af8ac32ba3525bc4a21d9804e9c90325e.tar.gz
QCG-Data-912fb98af8ac32ba3525bc4a21d9804e9c90325e.tar.bz2
[#634] change Upload from URL to use HttpStreamingService
Diffstat (limited to 'idrop-lite')
-rw-r--r--idrop-lite/pom.xml10
-rw-r--r--idrop-lite/src/main/java/org/irods/jargon/idrop/lite/PutTransferRunner.java26
2 files changed, 32 insertions, 4 deletions
diff --git a/idrop-lite/pom.xml b/idrop-lite/pom.xml
index 5813a4c..587d0bb 100644
--- a/idrop-lite/pom.xml
+++ b/idrop-lite/pom.xml
@@ -11,6 +11,9 @@
<packaging>jar</packaging>
<name>idrop-lite</name>
<version>1.0.0-SNAPSHOT</version>
+ <properties>
+ <jargon.version>3.0.0.2-SNAPSHOT</jargon.version>
+ </properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
@@ -24,10 +27,17 @@
<dependency>
<groupId>org.irods.jargon</groupId>
<artifactId>jargon-core</artifactId>
+ <version>${jargon.version}</version>
</dependency>
<dependency>
<groupId>org.irods.jargon</groupId>
<artifactId>jargon-data-utils</artifactId>
+ <version>${jargon.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.irods.jargon</groupId>
+ <artifactId>jargon-httpstream</artifactId>
+ <version>${jargon.version}</version>
</dependency>
<dependency>
<groupId>org.netbeans.api</groupId>
diff --git a/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/PutTransferRunner.java b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/PutTransferRunner.java
index 5ab508f..d14d91c 100644
--- a/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/PutTransferRunner.java
+++ b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/PutTransferRunner.java
@@ -2,7 +2,11 @@ package org.irods.jargon.idrop.lite;
import java.util.List;
import org.irods.jargon.core.exception.JargonException;
+import org.irods.jargon.core.pub.io.IRODSFile;
+import org.irods.jargon.core.pub.io.IRODSFileFactory;
import org.irods.jargon.core.transfer.TransferControlBlock;
+import org.irods.jargon.httpstream.HttpStreamingException;
+import org.irods.jargon.httpstream.HttpStreamingServiceImpl;
import org.slf4j.LoggerFactory;
public class PutTransferRunner implements Runnable {
@@ -92,21 +96,35 @@ public class PutTransferRunner implements Runnable {
log.info("process a put from an url: {}", uploadData.getFileName());
String localSourceAbsolutePath = uploadData.getFileName();
- String sourceResource = idropGui.getIrodsAccount().getDefaultStorageResource();
// need to create new Transfer Control Block for each transfer since it needs to be reset
// on how many files there are to transfer and how many have been transferred so far
log.info("initiating put transfer");
try {
- this.transferControlBlock = idropGui.getiDropCore().getIrodsFileSystem().getIRODSAccessObjectFactory().buildDefaultTransferControlBlockBasedOnJargonProperties();
+ this.transferControlBlock = idropGui.getiDropCore().getIrodsFileSystem()
+ .getIRODSAccessObjectFactory().buildDefaultTransferControlBlockBasedOnJargonProperties();
transferControlBlock.getTransferOptions().setIntraFileStatusCallbacks(true);
idropGui.getiDropCore().setTransferControlBlock(transferControlBlock);
- idropGui.getiDropCore().getTransferManager().putOperationURL(localSourceAbsolutePath,
- targetIrodsFileAbsolutePath, sourceResource, idropGui, transferControlBlock);
+
+ IRODSFileFactory irodsFileFactory = idropGui.getiDropCore().getIrodsFileSystem()
+ .getIRODSFileFactory(idropGui.getiDropCore().getIrodsAccount());
+
+ IRODSFile destFile = irodsFileFactory.instanceIRODSFile(targetIrodsFileAbsolutePath);
+
+ HttpStreamingServiceImpl httpStreamingService = new HttpStreamingServiceImpl(
+ idropGui.getiDropCore().getIrodsFileSystem().getIRODSAccessObjectFactory(),
+ idropGui.getiDropCore().getIrodsAccount());
+ httpStreamingService.streamHttpUrlContentsToIRODSFile(localSourceAbsolutePath, destFile,
+ idropGui, transferControlBlock);
+
} catch (JargonException ex) {
java.util.logging.Logger.getLogger(LocalFileTree.class.getName()).log(
java.util.logging.Level.SEVERE, null, ex);
idropGui.showIdropException(ex);
+ } catch (HttpStreamingException e) {
+ java.util.logging.Logger.getLogger(LocalFileTree.class.getName()).log(
+ java.util.logging.Level.SEVERE, null, e);
+ idropGui.showIdropException(e);
} finally {
idropGui.getiDropCore().getIrodsFileSystem().closeAndEatExceptions();
}