summaryrefslogtreecommitdiffstats
path: root/idrop-lite
diff options
context:
space:
mode:
authorLISA STILLWELL <lisa@simon.local>2011-08-17 13:54:58 (GMT)
committer LISA STILLWELL <lisa@simon.local>2011-08-17 13:54:58 (GMT)
commitf7a4db673a9c59dbbaaf9cd539d8bcc62e8f84f3 (patch)
tree5bebc224ce52630bc8ed39b4bb36229d28b6cac4 /idrop-lite
parentce5974ec32f4b716270e277b068a385905141d38 (diff)
downloadQCG-Data-f7a4db673a9c59dbbaaf9cd539d8bcc62e8f84f3.zip
QCG-Data-f7a4db673a9c59dbbaaf9cd539d8bcc62e8f84f3.tar.gz
QCG-Data-f7a4db673a9c59dbbaaf9cd539d8bcc62e8f84f3.tar.bz2
[#427] Add Local Tree to main mode and add functionality for Upload mode
Diffstat (limited to 'idrop-lite')
-rw-r--r--idrop-lite/src/main/java/org/irods/jargon/idrop/lite/IRODSNode.java74
1 files changed, 40 insertions, 34 deletions
diff --git a/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/IRODSNode.java b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/IRODSNode.java
index 53f4e1c..33ab135 100644
--- a/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/IRODSNode.java
+++ b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/IRODSNode.java
@@ -5,6 +5,7 @@
package org.irods.jargon.idrop.lite;
+import java.awt.Cursor;
import java.util.List;
import java.util.Vector;
import java.util.logging.Level;
@@ -16,6 +17,8 @@ import org.irods.jargon.core.connection.IRODSAccount;
import org.irods.jargon.core.pub.CollectionAndDataObjectListAndSearchAO;
import org.irods.jargon.core.pub.IRODSFileSystem;
import org.irods.jargon.core.query.CollectionAndDataObjectListingEntry;
+import org.irods.jargon.idrop.lite.finder.IRODSTreeContainingComponent;
+
import org.slf4j.LoggerFactory;
/**
@@ -24,23 +27,18 @@ import org.slf4j.LoggerFactory;
* @author Mike Conway - DICE (www.irods.org)
*/
public class IRODSNode extends DefaultMutableTreeNode {
-
- private boolean cached = false;
-
+
+ private boolean cached = false;
public static org.slf4j.Logger log = LoggerFactory.getLogger(IRODSNode.class);
-
public final IRODSAccount irodsAccount;
-
public final IRODSFileSystem irodsFileSystem;
-
public boolean hasMore = true;
-
public boolean continuation = false;
+ private final IRODSTreeContainingComponent irodsTree;
- private final IRODSTree irodsTree;
-
- public IRODSNode(final CollectionAndDataObjectListingEntry entry, final IRODSAccount irodsAccount,
- final IRODSFileSystem irodsFileSystem, final IRODSTree irodsTree) {
+ public IRODSNode(final CollectionAndDataObjectListingEntry entry,
+ final IRODSAccount irodsAccount,
+ final IRODSFileSystem irodsFileSystem, final IRODSTreeContainingComponent irodsTree) {
super(entry);
if (irodsAccount == null) {
throw new IdropRuntimeException("null irodsAccount");
@@ -57,8 +55,9 @@ public class IRODSNode extends DefaultMutableTreeNode {
}
/**
- * Load children of this node, and then close the connection (appropriate for the user expanding a node).
- *
+ * Load children of this node, and then close the connection (appropriate
+ * for the user expanding a node).
+ *
* @throws IdropException
*/
public void lazyLoadOfChildrenOfThisNode() throws IdropException {
@@ -71,34 +70,38 @@ public class IRODSNode extends DefaultMutableTreeNode {
}
/**
- * Load children of this node by accessing iRODS. Note that in a refresh situation, you do not want to continuously
- * open and close the connection, so there is an option to defer closing the connection to the caller.
- *
+ * Load children of this node by accessing iRODS. Note that in a refresh
+ * situation, you do not want to continuously open and close the connection,
+ * so there is an option to defer closing the connection to the caller.
+ *
* @param closeTheConnectionAfterLoad
- * <code>boolean</code> that indicates that the connection will be closed by this method. If
- * <code>true</code> is passed, then this method will close the connection. If <code>false</code> is
- * passed, then the caller must close the connection.
+ * <code>boolean</code> that indicates that the connection will
+ * be closed by this method. If <code>true</code> is passed, then
+ * this method will close the connection. If <code>false</code>
+ * is passed, then the caller must close the connection.
* @throws IdropException
*/
- public void lazyLoadOfChildrenOfThisNode(final boolean closeTheConnectionAfterLoad) throws IdropException {
+ public void lazyLoadOfChildrenOfThisNode(
+ final boolean closeTheConnectionAfterLoad) throws IdropException {
if (cached) {
return;
}
log.debug("lazily loading children of:{}", this);
- log.debug("will I close this connection:{}", closeTheConnectionAfterLoad);
+ log.debug("will I close this connection:{}",
+ closeTheConnectionAfterLoad);
CollectionAndDataObjectListingEntry parentObject = (CollectionAndDataObjectListingEntry) this.getUserObject();
try {
+ irodsTree.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
- CollectionAndDataObjectListAndSearchAO collectionAO = irodsFileSystem.getIRODSAccessObjectFactory()
- .getCollectionAndDataObjectListAndSearchAO(irodsAccount);
- List<CollectionAndDataObjectListingEntry> childCache = collectionAO
- .listDataObjectsAndCollectionsUnderPath(parentObject.getPathOrName());
+ CollectionAndDataObjectListAndSearchAO collectionAO = irodsFileSystem.getIRODSAccessObjectFactory().getCollectionAndDataObjectListAndSearchAO(irodsAccount);
+ List<CollectionAndDataObjectListingEntry> childCache = collectionAO.listDataObjectsAndCollectionsUnderPath(parentObject.getPathOrName());
for (CollectionAndDataObjectListingEntry childEntry : childCache) {
- insert(new IRODSNode(childEntry, irodsAccount, irodsFileSystem, irodsTree), getChildCount());
+ insert(new IRODSNode(childEntry, irodsAccount, irodsFileSystem,
+ irodsTree), getChildCount());
}
if (children == null) {
@@ -108,12 +111,15 @@ public class IRODSNode extends DefaultMutableTreeNode {
cached = true;
} catch (Exception ex) {
- Logger.getLogger(IRODSNode.class.getName()).log(Level.SEVERE, null, ex);
- throw new IdropException("error occurred accessing collection data", ex);
+ Logger.getLogger(IRODSNode.class.getName()).log(Level.SEVERE, null,
+ ex);
+ throw new IdropException(
+ "error occurred accessing collection data", ex);
} finally {
if (closeTheConnectionAfterLoad) {
irodsFileSystem.closeAndEatExceptions(irodsAccount);
}
+ irodsTree.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
}
@@ -141,7 +147,7 @@ public class IRODSNode extends DefaultMutableTreeNode {
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (!(obj instanceof IRODSNode)) {
return false;
@@ -150,8 +156,7 @@ public class IRODSNode extends DefaultMutableTreeNode {
IRODSNode comparableAsNode = (IRODSNode) obj;
CollectionAndDataObjectListingEntry thisFile = (CollectionAndDataObjectListingEntry) getUserObject();
- CollectionAndDataObjectListingEntry thatFile = (CollectionAndDataObjectListingEntry) comparableAsNode
- .getUserObject();
+ CollectionAndDataObjectListingEntry thatFile = (CollectionAndDataObjectListingEntry) comparableAsNode.getUserObject();
return thisFile.equals(thatFile);
}
@@ -162,7 +167,7 @@ public class IRODSNode extends DefaultMutableTreeNode {
/**
* Have the children nodes been cached?
- *
+ *
* @return <code>boolean</code> if children nodes have been cached.
*/
public boolean isCached() {
@@ -171,7 +176,7 @@ public class IRODSNode extends DefaultMutableTreeNode {
/**
* Is this node a continuation of a previous query
- *
+ *
* @return <code>boolean<code>
*/
public boolean isContinuation() {
@@ -180,11 +185,12 @@ public class IRODSNode extends DefaultMutableTreeNode {
/**
* Are there more records (children) to be retrieved from iRODS?
- *
+ *
* @return <code>boolean</code> if more records are available.
*/
public boolean isHasMore() {
return hasMore;
}
+
}