diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/api/v1/DataStoreApiUrlUtilities.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/api/v1/DataStoreApiUrlUtilities.java new file mode 100644 index 0000000000000000000000000000000000000000..2ec7240120132abef958e21e80b066e786b4da46 --- /dev/null +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/api/v1/DataStoreApiUrlUtilities.java @@ -0,0 +1,50 @@ +/* + * Copyright 2010 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.openbis.dss.generic.shared.api.v1; + +import static ch.systemsx.cisd.openbis.generic.shared.GenericSharedConstants.DATA_STORE_SERVER_WEB_APPLICATION_NAME; + +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataStore; + +/** + * @author Chandrasekhar Ramakrishnan + */ +public class DataStoreApiUrlUtilities +{ + /** + * Converts the download url to a server url. + */ + public static String getDataStoreUrlFromDataStore(DataStore dataStore) + { + String datastoreUrl = dataStore.getDownloadUrl(); + System.out.println("Data store url : " + datastoreUrl); + // The url objained form a DataStore object is the *download* url. Convert this to the + // datastore URL + if (datastoreUrl.endsWith(DATA_STORE_SERVER_WEB_APPLICATION_NAME)) + { + datastoreUrl = + datastoreUrl.substring(0, datastoreUrl.length() + - DATA_STORE_SERVER_WEB_APPLICATION_NAME.length()); + } + if (datastoreUrl.endsWith("/")) + { + datastoreUrl = datastoreUrl.substring(0, datastoreUrl.length() - 1); + } + + return datastoreUrl; + } +} diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/PlateDatasetLoader.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/PlateDatasetLoader.java index 3629d4b483f020c633f3917513e4b2397eec99a4..e1223a008da360f3174419c90fd5311bb6604802 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/PlateDatasetLoader.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/PlateDatasetLoader.java @@ -1,12 +1,11 @@ package ch.systemsx.cisd.openbis.plugin.screening.server.logic; -import static ch.systemsx.cisd.openbis.generic.shared.GenericSharedConstants.DATA_STORE_SERVER_WEB_APPLICATION_NAME; - import java.util.ArrayList; import java.util.HashMap; import java.util.List; import ch.systemsx.cisd.common.exceptions.UserFailureException; +import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.DataStoreApiUrlUtilities; import ch.systemsx.cisd.openbis.generic.server.business.bo.datasetlister.IDatasetLister; import ch.systemsx.cisd.openbis.generic.server.business.bo.samplelister.ISampleLister; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataStore; @@ -230,21 +229,7 @@ class PlateDatasetLoader protected String getDataStoreUrlFromDataStore(DataStore dataStore) { - String datastoreUrl = dataStore.getDownloadUrl(); - // The url objained form a DataStore object is the *download* url. Convert this to the - // datastore URL - if (datastoreUrl.endsWith(DATA_STORE_SERVER_WEB_APPLICATION_NAME)) - { - datastoreUrl = - datastoreUrl.substring(0, datastoreUrl.length() - - DATA_STORE_SERVER_WEB_APPLICATION_NAME.length()); - } - if (datastoreUrl.endsWith("/")) - { - datastoreUrl = datastoreUrl.substring(0, datastoreUrl.length() - 1); - } - - return datastoreUrl; + return DataStoreApiUrlUtilities.getDataStoreUrlFromDataStore(dataStore); } protected static SampleIdentifier createSampleIdentifier(PlateIdentifier plate)