summaryrefslogtreecommitdiffstats
path: root/idrop-web/grails-app/services
diff options
context:
space:
mode:
authormconway <michael_conway@unc.edu>2013-10-18 16:06:29 (GMT)
committer mconway <michael_conway@unc.edu>2013-10-18 16:06:29 (GMT)
commitd944a96bb744cba451a7530deb9ebfcde767407e (patch)
tree2f950122351e93bad12d53e2e1ffc90dc69d79f6 /idrop-web/grails-app/services
parent342c0ae8ff28b2f909b8b640a774a94c01afb20f (diff)
downloadQCG-Data-d944a96bb744cba451a7530deb9ebfcde767407e.zip
QCG-Data-d944a96bb744cba451a7530deb9ebfcde767407e.tar.gz
QCG-Data-d944a96bb744cba451a7530deb9ebfcde767407e.tar.bz2
[#1458] rule
Diffstat (limited to 'idrop-web/grails-app/services')
-rw-r--r--idrop-web/grails-app/services/org/irods/mydrop/service/RuleProcessingService.groovy42
1 files changed, 42 insertions, 0 deletions
diff --git a/idrop-web/grails-app/services/org/irods/mydrop/service/RuleProcessingService.groovy b/idrop-web/grails-app/services/org/irods/mydrop/service/RuleProcessingService.groovy
new file mode 100644
index 0000000..875e7b6
--- /dev/null
+++ b/idrop-web/grails-app/services/org/irods/mydrop/service/RuleProcessingService.groovy
@@ -0,0 +1,42 @@
+package org.irods.mydrop.service
+
+import org.irods.jargon.core.connection.IRODSAccount
+import org.irods.jargon.core.pub.IRODSAccessObjectFactory;
+import org.irods.jargon.ruleservice.composition.RuleCompositionService
+import org.irods.jargon.ruleservice.composition.RuleCompositionServiceImpl
+import org.irods.jargon.core.utils.MiscIRODSUtils
+import org.irods.jargon.core.utils.LocalFileUtils
+
+
+class RuleProcessingService {
+
+ static transactional = false
+ IRODSAccessObjectFactory irodsAccessObjectFactory
+
+ def loadRuleFromIrodsFile(IRODSAccount irodsAccount, String rulePath) {
+
+ RuleCompositionService ruleService = new RuleCompositionServiceImpl(irodsAccessObjectFactory, irodsAccount)
+ log.info("attempting to retrieve rule for ${rulePath}")
+
+ return ruleService.loadRuleFromIrods(rulePath)
+
+ }
+
+ def isRule(String rulePath) {
+ if (!rulePath) {
+ return false
+ }
+
+ def fileName = MiscIRODSUtils.getLastPathComponentForGiveAbsolutePath(rulePath)
+ def fileExtension = LocalFileUtils.getFileExtension(fileName)
+ log.info("extension is:${fileExtension}")
+
+ if (fileExtension && fileExtension == ".r") {
+ return true
+ } else {
+ return false
+ }
+
+ }
+
+}