summaryrefslogtreecommitdiffstats
path: root/idrop-lite
diff options
context:
space:
mode:
authorLISA STILLWELL <lisa@dhcp152-54-6-218.wireless.europa.renci.org>2011-10-07 20:52:15 (GMT)
committer LISA STILLWELL <lisa@dhcp152-54-6-218.wireless.europa.renci.org>2011-10-07 20:52:15 (GMT)
commitb9e6e8d4b21bd007ec3c625105a9d1e796e9a8ea (patch)
treeef0c6959b32ddd3893293ff3af9f52bc7284ddc1 /idrop-lite
parent31394e98dc6a81d8c3e47cc78a60b986ddcc3911 (diff)
parent6043b75e842d4e0fb67b225f0cfb2a194fd0a726 (diff)
downloadQCG-Data-b9e6e8d4b21bd007ec3c625105a9d1e796e9a8ea.zip
QCG-Data-b9e6e8d4b21bd007ec3c625105a9d1e796e9a8ea.tar.gz
QCG-Data-b9e6e8d4b21bd007ec3c625105a9d1e796e9a8ea.tar.bz2
[#427] merge with Mike's changes
Diffstat (limited to 'idrop-lite')
-rw-r--r--idrop-lite/pom.xml9
-rw-r--r--idrop-lite/src/main/java/org/irods/jargon/idrop/lite/IRODSOutlineModel.java2
-rw-r--r--idrop-lite/src/main/java/org/irods/jargon/idrop/lite/PutTransferRunner.java5
-rw-r--r--idrop-lite/src/main/java/org/irods/jargon/idrop/lite/iDropLiteApplet.java185
4 files changed, 116 insertions, 85 deletions
diff --git a/idrop-lite/pom.xml b/idrop-lite/pom.xml
index 2ef032b..47edb1f 100644
--- a/idrop-lite/pom.xml
+++ b/idrop-lite/pom.xml
@@ -1,17 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>idrop</artifactId>
<groupId>org.irods</groupId>
- <version>0.9.9-SNAPSHOT</version>
+ <version>1.0.0-beta2-SNAPSHOT</version>
</parent>
<groupId>org.irods.idrop</groupId>
<artifactId>idrop-lite</artifactId>
<packaging>jar</packaging>
<name>idrop-lite</name>
- <version>0.9.9-SNAPSHOT</version>
+ <version>1.0.0-beta2-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
@@ -87,4 +86,4 @@
</plugin>
</plugins>
</build>
-</project>
+</project>
diff --git a/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/IRODSOutlineModel.java b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/IRODSOutlineModel.java
index 0da117c..00ae76d 100644
--- a/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/IRODSOutlineModel.java
+++ b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/IRODSOutlineModel.java
@@ -27,7 +27,7 @@ import org.slf4j.LoggerFactory;
*/
public class IRODSOutlineModel extends DefaultOutlineModel {
- public static final org.slf4j.Logger log = LoggerFactory.getLogger(IRODSOutlineModel.class);
+ public static final org.slf4j.Logger log = LoggerFactory.getLogger(IRODSOutlineModel.class);
private final IRODSFileSystemModel treeModel;
public IRODSFileSystemModel getTreeModel() {
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 ca2e49e..8224ec4 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
@@ -62,9 +62,10 @@ public class PutTransferRunner implements Runnable {
java.util.logging.Logger.getLogger(LocalFileTree.class.getName()).log(
java.util.logging.Level.SEVERE, null, ex);
idropGui.showIdropException(ex);
+ } finally {
+ idropGui.getiDropCore().getIrodsFileSystem().closeAndEatExceptions();
}
}
-
- }
+ }
}
diff --git a/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/iDropLiteApplet.java b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/iDropLiteApplet.java
index 99a7ace..1692a49 100644
--- a/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/iDropLiteApplet.java
+++ b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/iDropLiteApplet.java
@@ -8,10 +8,11 @@
*
* Created on Jul 13, 2011, 11:52:59 AM
*/
-
package org.irods.jargon.idrop.lite;
+import java.awt.Cursor;
import java.awt.Rectangle;
+import java.awt.dnd.DropTarget;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
@@ -32,6 +33,9 @@ import javax.swing.table.DefaultTableModel;
import javax.swing.tree.TreePath;
import org.apache.commons.io.FileUtils;
+import org.irods.jargon.core.pub.domain.DataObject;
+import org.irods.jargon.core.pub.domain.Collection;
+import org.irods.jargon.core.pub.io.IRODSFileFactory;
import org.irods.jargon.core.query.CollectionAndDataObjectListingEntry;
import org.irods.jargon.core.transfer.DefaultTransferControlBlock;
import org.irods.jargon.core.transfer.TransferStatus;
@@ -45,6 +49,7 @@ import org.irods.jargon.core.pub.UserAO;
import org.irods.jargon.datautils.datacache.DataCacheServiceImpl;
import org.irods.jargon.idrop.lite.finder.IRODSFinderDialog;
import org.irods.jargon.core.transfer.TransferStatusCallbackListener;
+import org.irods.jargon.datautils.connection.TempPasswordCachingProtocolManager;
import org.netbeans.swing.outline.Outline;
import org.slf4j.LoggerFactory;
@@ -99,30 +104,30 @@ public class iDropLiteApplet extends javax.swing.JApplet implements TransferStat
protected void getAppletParams() {
- try {
- this.mode = Integer.parseInt(getParameter("mode"));
- } catch (Exception ex) {
+ try {
+ this.mode = Integer.parseInt(getParameter("mode"));
+ } catch (Exception ex) {
this.mode = defaultLoginMode;
}
- try {
- this.defaultStorageResource = getParameter("defaultStorageResource");
- } catch (Exception ex) {
- this.defaultStorageResource = "";
+ try {
+ this.defaultStorageResource = getParameter("defaultStorageResource");
+ } catch (Exception ex) {
+ this.defaultStorageResource = "";
}
- try {
- this.uploadDest = getParameter("uploadDest");
- } catch (Exception ex) {
- this.uploadDest = "";
+ try {
+ this.uploadDest = getParameter("uploadDest");
+ } catch (Exception ex) {
+ this.uploadDest = "";
}
- try {
- this.host = getParameter("host");
- this.port = Integer.parseInt(getParameter("port"));
- this.user = getParameter("user");
- this.zone = getParameter("zone");
- //this.defaultStorageResource = getParameter("defaultStorageResource");
- this.tempPswd = getParameter("password");
- this.absPath = getParameter("absPath");
+ try {
+ this.host = getParameter("host");
+ this.port = Integer.parseInt(getParameter("port"));
+ this.user = getParameter("user");
+ this.zone = getParameter("zone");
+ //this.defaultStorageResource = getParameter("defaultStorageResource");
+ this.tempPswd = getParameter("password");
+ this.absPath = getParameter("absPath");
log.debug("creating account with applet params");
log.info("mode:{}", mode);
@@ -140,64 +145,69 @@ public class iDropLiteApplet extends javax.swing.JApplet implements TransferStat
}
- private boolean retrievePermAccount()
- {
- String pswd = null;
+ private boolean retrievePermAccount() {
+ String pswd = null;
- DataCacheServiceImpl dataCache = new DataCacheServiceImpl();
- try {
- dataCache.setIrodsAccessObjectFactory(irodsFileSystem.getIRODSAccessObjectFactory());
- } catch (JargonException e1) {
- Logger.getLogger(iDropLiteApplet.class.getName()).log(Level.SEVERE, null, e1);
- }
- dataCache.setIrodsAccount(irodsAccount);
-
- try {
- log.info("sending user name and key user:{}", user);
- pswd = dataCache.retrieveStringValueFromCache(user, tempPswd);
- irodsFileSystem.closeAndEatExceptions();
- this.irodsAccount = new IRODSAccount(host, port, user, pswd, absPath, zone, defaultStorageResource);
- } catch (JargonException e2) {
- Logger.getLogger(iDropLiteApplet.class.getName()).log(Level.SEVERE, null, e2);
- return false;
- }
+ DataCacheServiceImpl dataCache = new DataCacheServiceImpl();
+ try {
+ dataCache.setIrodsAccessObjectFactory(irodsFileSystem.getIRODSAccessObjectFactory());
+ } catch (JargonException e1) {
+ Logger.getLogger(iDropLiteApplet.class.getName()).log(Level.SEVERE, null, e1);
+ }
+ dataCache.setIrodsAccount(irodsAccount);
+
+ try {
+ log.info("sending user name and key user:{}", user);
+ pswd = dataCache.retrieveStringValueFromCache(user, tempPswd);
+ irodsFileSystem.closeAndEatExceptions();
+ this.irodsAccount = new IRODSAccount(host, port, user, pswd, absPath, zone, defaultStorageResource);
+ } catch (JargonException e2) {
+ Logger.getLogger(iDropLiteApplet.class.getName()).log(Level.SEVERE, null, e2);
+ return false;
+ }
- return true;
+ return true;
}
- private boolean createPermAccount()
- {
- this.irodsAccount = new IRODSAccount(host, port, user, tempPswd, absPath, zone, defaultStorageResource);
+ private boolean createPermAccount() {
+ this.irodsAccount = new IRODSAccount(host, port, user, tempPswd, absPath, zone, defaultStorageResource);
- return true;
+ return true;
}
+ private boolean processLogin() {
+
+ // do different logins depending on which mode is used
+ // 0 - Hard-coded permanent password - just use this password to create and IRODS Account
+ // 1 - Temporary password supplied - use this password to retrieve permanent password from cache file in cacheServiceTempDir
- private boolean processLogin() {
-
- // do different logins depending on which mode is used
- // 0 - Hard-coded permanent password - just use this password to create and IRODS Account
- // 1 - Temporary password supplied - use this password to retrieve permanent password from cache file in cacheServiceTempDir
-
- switch(this.mode) {
-
- case 1:
- log.info("processLogin: retrieving permanent password...");
- if(!retrievePermAccount()) {
- showMessageFromOperation("Temporary Password Mode: login error - unable to log in, or invalid user id");
- return false;
- }
- break;
- case 0:
- log.info("processLogin: creating account with provided permanent password...");
- if(!createPermAccount()) {
- showMessageFromOperation("Permanent Password Mode: login error - unable to log in, or invalid user id");
- return false;
- }
- break;
- default:
- showMessageFromOperation("Unsupported Login Mode");
- return false;
+ switch (this.mode) {
+
+ case 1:
+ log.info("processLogin: retrieving permanent password...");
+ if (!retrievePermAccount()) {
+ showMessageFromOperation("Temporary Password Mode: login error - unable to log in, or invalid user id");
+ return false;
+ }
+ break;
+ case 0:
+ log.info("processLogin: creating account with provided permanent password...");
+ if (!createPermAccount()) {
+ showMessageFromOperation("Permanent Password Mode: login error - unable to log in, or invalid user id");
+ return false;
+ }
+ break;
+
+ case 2:
+ log.info("processLogin: using temp-only with cache");
+ if (!tempOnlyAccount()) {
+ showMessageFromOperation("Permanent Password Mode: login error - unable to log in, or invalid user id");
+ return false;
+ }
+ break;
+ default:
+ showMessageFromOperation("Unsupported Login Mode");
+ return false;
}
@@ -971,6 +981,27 @@ public class iDropLiteApplet extends javax.swing.JApplet implements TransferStat
// }
+ private boolean tempOnlyAccount() {
+ String pswd = null;
+
+
+
+ try {
+ log.info("creating a shared (cached) temp account connection");
+ this.irodsAccount = new IRODSAccount(host, port, user, tempPswd, absPath, zone, defaultStorageResource);
+ TempPasswordCachingProtocolManager manager = new TempPasswordCachingProtocolManager(
+ irodsAccount);
+ irodsFileSystem = new IRODSFileSystem(manager);
+ log.info("irodsFileSystem updated to utilize cache");
+
+ } catch (JargonException e2) {
+ Logger.getLogger(iDropLiteApplet.class.getName()).log(Level.SEVERE, null, e2);
+ return false;
+ }
+
+ return true;
+ }
+
/** This method is called from within the init() method to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
@@ -1821,18 +1852,18 @@ public class iDropLiteApplet extends javax.swing.JApplet implements TransferStat
currentTransferRunner = new PutTransferRunner(applet, targetPath, sourceFiles, iDropCore.getTransferControlBlock());
final Thread transferThread = new Thread(currentTransferRunner);
log.info("launching transfer thread");
+ // close so that transfer thread can grab account
+ irodsFileSystem.closeAndEatExceptions();
transferThread.start();
+ transferThread.join();
} catch (Exception e) {
- log.error("exception choosings iRODS file");
+ log.error("exception choosings iRODS file");
throw new IdropRuntimeException("exception choosing irods file", e);
} finally {
- iDropCore.getIrodsFileSystem().closeAndEatExceptions();
+ iDropCore.getIrodsFileSystem().closeAndEatExceptions();
}
- }
- else {
- // message??
- }
-
+ // }
+
}//GEN-LAST:event_btnUploadBeginImportActionPerformed
private void btnUploadCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUploadCancelActionPerformed