Skip to content
Snippets Groups Projects
Commit 3d8e34d8 authored by jakubs's avatar jakubs
Browse files

SSDM-1914 Improve error message in case when custom import plugin has incorrect data store id

SVN: 34000
parent 369dadf3
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,7 @@
package ch.systemsx.cisd.openbis.generic.server.business.bo;
import ch.systemsx.cisd.common.exceptions.ConfigurationFailureException;
import ch.systemsx.cisd.openbis.generic.server.business.IDataStoreServiceFactory;
import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory;
import ch.systemsx.cisd.openbis.generic.shared.IDataStoreService;
......@@ -36,6 +37,8 @@ public class DataStoreBO implements IDataStoreBO
private DataStorePE dataStore;
private String dataStoreCode;
public DataStoreBO(IDAOFactory daoFactory, Session session, IDataStoreServiceFactory dssFactory)
{
this.daoFactory = daoFactory;
......@@ -46,14 +49,18 @@ public class DataStoreBO implements IDataStoreBO
@Override
public void loadByCode(String dssCode)
{
this.dataStoreCode = dssCode;
this.dataStore = daoFactory.getDataStoreDAO().tryToFindDataStoreByCode(dssCode);
}
@Override
public void uploadFile(String dropboxName, CustomImportFile customImportFile)
{
assert dataStore != null : "data store not loaded.";
if (dataStore == null)
{
throw new ConfigurationFailureException("The data store " + this.dataStoreCode + " for custom import of a dropbox " + dropboxName
+ " doesn't exist.");
}
IDataStoreService service = dssFactory.create(dataStore.getRemoteUrl());
service.putDataSet(session.getSessionToken(), dropboxName, customImportFile);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment