From 261564e59d660bc8f9bc3846e12c2373d8b81a97 Mon Sep 17 00:00:00 2001
From: cramakri <cramakri>
Date: Fri, 28 May 2010 09:39:27 +0000
Subject: [PATCH] LMS-1503 Getting the put command to connect to the server.

SVN: 16182
---
 .../dss/client/api/cli/CommandPut.java        |  4 ++--
 .../openbis/dss/client/api/cli/DssClient.java |  1 -
 .../dss/client/api/v1/impl/DssComponent.java  |  4 ++--
 .../openbis/generic/server/ETLService.java    | 19 ++++++++++++++++++-
 4 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/CommandPut.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/CommandPut.java
index 568adc01e66..0637607ec4b 100644
--- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/CommandPut.java
+++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/CommandPut.java
@@ -65,10 +65,10 @@ class CommandPut extends AbstractCommand
 
         private final IDssServiceRpcGeneric dssService;
 
-        CommandPutExecutor(IDssServiceRpcGeneric dataSet, CommandPutArguments arguments)
+        CommandPutExecutor(IDssServiceRpcGeneric dssService, CommandPutArguments arguments)
         {
             this.arguments = arguments;
-            this.dssService = dataSet;
+            this.dssService = dssService;
         }
 
         int execute()
diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/DssClient.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/DssClient.java
index 61dbaf648bc..ea3cc23dd30 100644
--- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/DssClient.java
+++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/DssClient.java
@@ -157,7 +157,6 @@ public class DssClient
         }
 
         String commandName = args[0];
-        System.out.println("Command " + commandName);
         ICommand command = commandFactory.tryCommandForName(commandName);
         if (null == command)
         {
diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/v1/impl/DssComponent.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/v1/impl/DssComponent.java
index 9022a921646..76ed7de5587 100644
--- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/v1/impl/DssComponent.java
+++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/v1/impl/DssComponent.java
@@ -342,8 +342,8 @@ class AuthenticatedState extends AbstractDssComponentState
     @Override
     public IDssServiceRpcGeneric getDefaultDssService()
     {
-        
-        return null;
+        String url = service.getDefaultDataStoreBaseURL(sessionToken);
+        return getDssServiceForUrl(url);
     }
 
     /**
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 54a1188815a..a5005f3f2f1 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
@@ -16,6 +16,8 @@
 
 package ch.systemsx.cisd.openbis.generic.server;
 
+import static ch.systemsx.cisd.openbis.generic.shared.GenericSharedConstants.DATA_STORE_SERVER_WEB_APPLICATION_NAME;
+
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -679,6 +681,21 @@ public class ETLService extends AbstractCommonServer<IETLService> implements IET
 
     public String getDefaultDataStoreBaseURL(String sessionToken)
     {
-        return getDataStoreBaseURL();
+        String url = getDataStoreBaseURL();
+        // Strip the web application name from the URL
+        if (url.endsWith("/" + DATA_STORE_SERVER_WEB_APPLICATION_NAME))
+        {
+            url =
+                    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))
+        {
+            url = url.substring(0, url.length() - dataStoreString.length());
+        }
+
+        return url;
     }
 }
-- 
GitLab