summaryrefslogtreecommitdiffstats
path: root/idrop-web/grails-app/controllers/org/irods/mydrop/controller/HomeController.groovy
diff options
context:
space:
mode:
authormconway <michael_conway@unc.edu>2013-06-04 15:42:24 (GMT)
committer mconway <michael_conway@unc.edu>2013-06-04 15:42:24 (GMT)
commit2077b7e4db77a376b5d8f6b73b35eb09d6b7dfcb (patch)
tree1df22c04dedb90d15d4842a15951df6cdd57f037 /idrop-web/grails-app/controllers/org/irods/mydrop/controller/HomeController.groovy
parent0673508f8b69b709acc5d4db0f88784d8d55767a (diff)
downloadQCG-Data-2077b7e4db77a376b5d8f6b73b35eb09d6b7dfcb.zip
QCG-Data-2077b7e4db77a376b5d8f6b73b35eb09d6b7dfcb.tar.gz
QCG-Data-2077b7e4db77a376b5d8f6b73b35eb09d6b7dfcb.tar.bz2
[#1460] 3.3.1 small cleanups and fixes
Diffstat (limited to 'idrop-web/grails-app/controllers/org/irods/mydrop/controller/HomeController.groovy')
-rwxr-xr-xidrop-web/grails-app/controllers/org/irods/mydrop/controller/HomeController.groovy114
1 files changed, 61 insertions, 53 deletions
diff --git a/idrop-web/grails-app/controllers/org/irods/mydrop/controller/HomeController.groovy b/idrop-web/grails-app/controllers/org/irods/mydrop/controller/HomeController.groovy
index 49c7413..5e41842 100755
--- a/idrop-web/grails-app/controllers/org/irods/mydrop/controller/HomeController.groovy
+++ b/idrop-web/grails-app/controllers/org/irods/mydrop/controller/HomeController.groovy
@@ -1,6 +1,7 @@
package org.irods.mydrop.controller
import org.irods.jargon.core.connection.IRODSAccount
+import org.irods.jargon.core.exception.JargonException
import org.irods.jargon.core.exception.OperationNotSupportedByThisServerException
import org.irods.jargon.core.exception.SpecificQueryException
import org.irods.jargon.core.pub.IRODSAccessObjectFactory
@@ -13,7 +14,7 @@ class HomeController {
StarringService starringService
SharingService sharingService
IRODSAccessObjectFactory irodsAccessObjectFactory
-
+
/**
* Interceptor grabs IRODSAccount from the SecurityContextHolder
*/
@@ -28,10 +29,9 @@ class HomeController {
irodsAccount = session["SPRING_SECURITY_CONTEXT"]
}
- def afterInterceptor = {
+ def afterInterceptor = {
log.debug("closing the session")
irodsAccessObjectFactory.closeSession()
-
}
def index() {
@@ -74,52 +74,60 @@ class HomeController {
render(view:"link", model:[absPath:filePath])
}
-
+
def starredCollections() {
log.info "starredCollections()"
-
- def listing = starringService.listStarredCollections(irodsAccount, 0)
-
- if (listing.isEmpty()) {
- render(view:"noInfo")
- } else {
- render(view:"quickViewList",model:[listing:listing])
+
+ try {
+ def listing = starringService.listStarredCollections(irodsAccount, 0)
+
+ if (listing.isEmpty()) {
+ render(view:"noInfo")
+ } else {
+ render(view:"quickViewList",model:[listing:listing])
+ }
+ } catch (SpecificQueryException sqe) {
+ log.error("error in specific query", sqe)
+ render(view:"noSupport")
+ } catch (JargonException je) {
+ log.error("jargon exception", je)
+ response.sendError(500,je.message)
}
}
-
+
def starredDataObjects() {
log.info "starredDataObjects()"
- def listing = starringService.listStarredDataObjects(irodsAccount, 0)
- if (listing.isEmpty()) {
- render(view:"noInfo")
- } else {
- render(view:"quickViewList",model:[listing:listing])
+ try {
+ def listing = starringService.listStarredDataObjects(irodsAccount, 0)
+ if (listing.isEmpty()) {
+ render(view:"noInfo")
+ } else {
+ render(view:"quickViewList",model:[listing:listing])
+ }
+ } catch (SpecificQueryException sqe) {
+ log.error("error in specific query", sqe)
+ render(view:"noSupport")
+ } catch (JargonException je) {
+ log.error("jargon exception", je)
+ response.sendError(500,je.message)
}
}
-
+
/**
* Listing of collections shared by me with others
* @return
*/
def sharedCollectionsByMe() {
log.info "sharedCollectionsByMe"
-
+
boolean sharing = sharingService.isSharingSupported(irodsAccount)
if (!sharing) {
log.info("no sharing support on this grid")
- render(view:"noInfo")
+ render(view:"noSupport")
return
}
-
- /*
- * is sharing configured?
- */
- if (!sharing) {
- log.info("no sharing support on this grid")
- render(view:"noInfo")
- return
- }
-
+
+
try {
def listing = sharingService.listCollectionsSharedByMe(irodsAccount);
if (listing.isEmpty()) {
@@ -127,31 +135,32 @@ class HomeController {
} else {
render(view:"shareQuickViewList",model:[listing:listing])
}
- } catch (SpecificQueryException e) {
- log.error "speific query exception", e
- def message = message(code:"error.no.specific.query")
- response.sendError(500,message)
- } catch (OperationNotSupportedByThisServerException e) {
- log.error "speific query exception", e
- def message = message(code:"error.no.specific.query")
- response.sendError(500,message)
+ } catch (SpecificQueryException sqe) {
+ log.error("error in specific query", sqe)
+ render(view:"noSupport")
+ } catch (OperationNotSupportedByThisServerException sqe) {
+ log.error("error in specific query", sqe)
+ render(view:"noSupport")
+ } catch (JargonException je) {
+ log.error("jargon exception", je)
+ response.sendError(500,je.message)
}
}
-
+
/**
* Listing of collections shared by me with others
* @return
*/
def sharedCollectionsWithMe() {
log.info "sharedCollectionsByMe"
-
+
boolean sharing = sharingService.isSharingSupported(irodsAccount)
if (!sharing) {
log.info("no sharing support on this grid")
- render(view:"noInfo")
+ render(view:"noSupport")
return
}
-
+
try {
def listing = sharingService.listCollectionsSharedWithMe(irodsAccount)
if (listing.isEmpty()) {
@@ -159,19 +168,18 @@ class HomeController {
} else {
render(view:"shareWithMeQuickViewList",model:[listing:listing])
}
- } catch (SpecificQueryException e) {
- log.error "speific query exception", e
- def message = message(code:"error.no.specific.query")
- response.sendError(500,message)
- } catch (OperationNotSupportedByThisServerException e) {
- log.error "speific query exception", e
- def message = message(code:"error.no.specific.query")
- response.sendError(500,message)
+ } catch (SpecificQueryException sqe) {
+ log.error("error in specific query", sqe)
+ render(view:"noSupport")
+ } catch (OperationNotSupportedByThisServerException sqe) {
+ log.error("error in specific query", sqe)
+ render(view:"noSupport")
+ } catch (JargonException je) {
+ log.error("jargon exception", je)
+ response.sendError(500,je.message)
}
-
-
}
-
+
// FIXME: refactor into jargon-core
private IRODSAccount anonymousIrodsAccountForURIString(String uriString) {