From 4bfdbc7f0c5e053d220d335daa9bd58223d594d8 Mon Sep 17 00:00:00 2001
From: cramakri <cramakri>
Date: Tue, 8 Jun 2010 11:31:24 +0000
Subject: [PATCH] LMS-1564 Refactored the way the DSS API is presented.

SVN: 16331
---
 .../cisd/openbis/generic/server/ETLService.java     | 13 +++++++++----
 .../generic/shared/GenericSharedConstants.java      |  4 +++-
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/ETLService.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/ETLService.java
index 4dfbea3e51e..8a4b9624a36 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/ETLService.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/ETLService.java
@@ -17,6 +17,7 @@
 package ch.systemsx.cisd.openbis.generic.server;
 
 import static ch.systemsx.cisd.openbis.generic.shared.GenericSharedConstants.DATA_STORE_SERVER_WEB_APPLICATION_NAME;
+import static ch.systemsx.cisd.openbis.generic.shared.GenericSharedConstants.DATA_STORE_SERVER_APPLICATION_PATH;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -691,6 +692,7 @@ public class ETLService extends AbstractCommonServer<IETLService> implements IET
 
     public String getDefaultDataStoreBaseURL(String sessionToken)
     {
+        // See DataStoreApiUrlUtilities
         String url = getDataStoreBaseURL();
         // Strip the web application name from the URL
         if (url.endsWith("/" + DATA_STORE_SERVER_WEB_APPLICATION_NAME))
@@ -699,11 +701,14 @@ public class ETLService extends AbstractCommonServer<IETLService> implements IET
                     url.substring(0, url.length()
                             - (DATA_STORE_SERVER_WEB_APPLICATION_NAME.length() + 1));
         }
-        // Strip "/data_store" from the URL as well
-        final String dataStoreString = "/data_store";
-        if (url.endsWith(dataStoreString))
+        if (url.endsWith(DATA_STORE_SERVER_APPLICATION_PATH))
         {
-            url = url.substring(0, url.length() - dataStoreString.length());
+            url = url.substring(0, url.length() - DATA_STORE_SERVER_APPLICATION_PATH.length());
+        }
+
+        if (url.endsWith("/"))
+        {
+            url = url.substring(0, url.length() - 1);
         }
 
         return url;
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/GenericSharedConstants.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/GenericSharedConstants.java
index c7eae7c4e7c..1218d74ae27 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/GenericSharedConstants.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/GenericSharedConstants.java
@@ -19,7 +19,7 @@ package ch.systemsx.cisd.openbis.generic.shared;
 /**
  * Some public shared constants.
  * 
- * @author     Franz-Josef Elmer
+ * @author Franz-Josef Elmer
  */
 public final class GenericSharedConstants
 {
@@ -32,6 +32,8 @@ public final class GenericSharedConstants
     /** Part of the URL of the DSS server. */
     public static final String DATA_STORE_SERVER_WEB_APPLICATION_NAME = "datastore_server";
 
+    public static final String DATA_STORE_SERVER_APPLICATION_PATH = "data_store";
+
     /** Part of the URL of the DSS service. */
     public static final String DATA_STORE_SERVER_SERVICE_NAME =
             DATA_STORE_SERVER_WEB_APPLICATION_NAME + "/dss";
-- 
GitLab