diff src/main/java/de/mpiwg/itgroup/annotations/restlet/BaseRestlet.java @ 58:f5c0e6df7e88

made uri prefixes in store configurable.
author casties
date Tue, 20 Nov 2012 18:23:52 +0100
parents 4efb21cf0ce0
children e2f86ef9b871
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/itgroup/annotations/restlet/BaseRestlet.java	Tue Nov 20 17:56:35 2012 +0100
+++ b/src/main/java/de/mpiwg/itgroup/annotations/restlet/BaseRestlet.java	Tue Nov 20 18:23:52 2012 +0100
@@ -78,10 +78,28 @@
     /**
      * run in authorization mode i.e. with tokens.
      */
-    protected boolean authorizationMode = false; 
+    protected boolean authorizationMode = false;
     public static final String AUTHORIZATION_MODE_KEY = "annotationmanager.authorization";
     
     /**
+     * prefix to create uris for tags in store.
+     */
+    public static String TAGS_URI_PREFIX = "";
+    public static final String TAGS_URI_KEY = "annotationmanager.uris.tags";
+
+    /**
+     * prefix to create uris for persons in store.
+     */
+    public static String PERSONS_URI_PREFIX = "";
+    public static final String PERSONS_URI_KEY = "annotationmanager.uris.persons";
+
+    /**
+     * prefix to create uris for groups in store.
+     */
+    public static String GROUPS_URI_PREFIX = ""; 
+    public static final String GROUPS_URI_KEY = "annotationmanager.uris.groups";
+
+    /**
      * constructor
      * 
      * @param context
@@ -184,6 +202,21 @@
                 // store config
                 sc.setAttribute(CONSUMERKEYS_KEY, consumerKeys);
             }
+            /*
+             * read uri prefixes
+             */
+            String pup = (String) sc.getAttribute(PERSONS_URI_KEY);
+            if (pup != null) {
+                BaseRestlet.PERSONS_URI_PREFIX = pup;
+            }
+            String gup = (String) sc.getAttribute(GROUPS_URI_KEY);
+            if (gup != null) {
+                BaseRestlet.GROUPS_URI_PREFIX = gup;
+            }
+            String tup = (String) sc.getAttribute(TAGS_URI_KEY);
+            if (tup != null) {
+                BaseRestlet.TAGS_URI_PREFIX = tup;
+            }
         } else {
             logger.error("Unable to get ServletContext!");
         }