summaryrefslogtreecommitdiff
path: root/bkucommon/src/main/java/at/gv/egiz/bku/accesscontroller/RuleChecker.java
diff options
context:
space:
mode:
authorwbauer <wbauer@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2008-09-03 12:59:26 +0000
committerwbauer <wbauer@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2008-09-03 12:59:26 +0000
commit03d4206918ca3db9554e78bf8070a11503f083d9 (patch)
tree4ca483cfa96bb7808aeb0ecdf08e9eb2211e5d0c /bkucommon/src/main/java/at/gv/egiz/bku/accesscontroller/RuleChecker.java
parentc88d1b43311a2dd4636088d9cdef988bce3f611b (diff)
downloadmocca-03d4206918ca3db9554e78bf8070a11503f083d9.tar.gz
mocca-03d4206918ca3db9554e78bf8070a11503f083d9.tar.bz2
mocca-03d4206918ca3db9554e78bf8070a11503f083d9.zip
Added skeleton for the access controller classes.
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@8 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'bkucommon/src/main/java/at/gv/egiz/bku/accesscontroller/RuleChecker.java')
-rw-r--r--bkucommon/src/main/java/at/gv/egiz/bku/accesscontroller/RuleChecker.java69
1 files changed, 69 insertions, 0 deletions
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/accesscontroller/RuleChecker.java b/bkucommon/src/main/java/at/gv/egiz/bku/accesscontroller/RuleChecker.java
new file mode 100644
index 00000000..bf46034d
--- /dev/null
+++ b/bkucommon/src/main/java/at/gv/egiz/bku/accesscontroller/RuleChecker.java
@@ -0,0 +1,69 @@
+package at.gv.egiz.bku.accesscontroller;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import at.gv.egiz.bku.slexceptions.SLRuntimeException;
+
+public class RuleChecker implements AccessChecker {
+
+ private static Log log = LogFactory.getLog(RuleChecker.class);
+
+ public static enum PEER_TYPE {HOST, IP, URL};
+
+ protected String id;
+ protected AuthenticationClass authenticationClass;
+ protected String commandName;
+ protected String peerId;
+ protected PEER_TYPE peerType;
+ protected Action action;
+ protected UserAction userAction;
+
+ public RuleChecker(String id) {
+ if (id == null) {
+ throw new NullPointerException("Id argument must not be null");
+ }
+ this.id = id;
+ }
+
+ public void setAuthenticationClass(String ac) {
+ AuthenticationClass tmp = AuthenticationClass.fromString(ac);
+ if (tmp == null) {
+ throw new SLRuntimeException("Unknown authentication class "+ac);
+ }
+ authenticationClass = tmp;
+ }
+
+ public void setAction(String ac) {
+ Action tmp = Action.fromString(ac);
+ if (tmp == null) {
+ throw new SLRuntimeException("Unknown action "+ac);
+ }
+ action = tmp;
+ }
+
+ public void setUserAction(String uac) {
+ UserAction tmp = UserAction.fromString(uac);
+ if (tmp == null) {
+ throw new SLRuntimeException("Unknown user action "+uac);
+ }
+ userAction = tmp;
+ }
+
+ public void setPeerId(String peerId, PEER_TYPE type) {
+ this.peerType = type;
+ this.peerId = peerId;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ @Override
+ public RuleResult check(AccessCheckerContext checkCtx) {
+ log.debug("Processing rule: "+id);
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}