Skip to content
Snippets Groups Projects
Commit 0c889bd2 authored by felmer's avatar felmer
Browse files

SE-137 generalise StorageProcessorWithUploader from YeastX project

SVN: 12528
parent 7eb43e5e
No related branches found
No related tags found
No related merge requests found
...@@ -27,6 +27,7 @@ import ch.systemsx.cisd.common.exceptions.EnvironmentFailureException; ...@@ -27,6 +27,7 @@ import ch.systemsx.cisd.common.exceptions.EnvironmentFailureException;
import ch.systemsx.cisd.common.utilities.BeanUtils; import ch.systemsx.cisd.common.utilities.BeanUtils;
import ch.systemsx.cisd.common.utilities.ExtendedProperties; import ch.systemsx.cisd.common.utilities.ExtendedProperties;
import ch.systemsx.cisd.dbmigration.DatabaseConfigurationContext; import ch.systemsx.cisd.dbmigration.DatabaseConfigurationContext;
import ch.systemsx.cisd.etlserver.IDataSetUploader;
import ch.systemsx.cisd.openbis.dss.generic.shared.dto.DataSetInformation; import ch.systemsx.cisd.openbis.dss.generic.shared.dto.DataSetInformation;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Experiment; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Experiment;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty;
...@@ -42,7 +43,7 @@ import ch.systemsx.cisd.yeastx.fiaml.FIAML2Database; ...@@ -42,7 +43,7 @@ import ch.systemsx.cisd.yeastx.fiaml.FIAML2Database;
* *
* @author Tomasz Pylak * @author Tomasz Pylak
*/ */
public class ML2DatabaseUploader public class ML2DatabaseUploader implements IDataSetUploader
{ {
private static final String DATABASE_PROPERTIES_PREFIX = "database."; private static final String DATABASE_PROPERTIES_PREFIX = "database.";
......
...@@ -19,45 +19,22 @@ package ch.systemsx.cisd.yeastx.etl; ...@@ -19,45 +19,22 @@ package ch.systemsx.cisd.yeastx.etl;
import java.io.File; import java.io.File;
import java.util.Properties; import java.util.Properties;
import ch.systemsx.cisd.common.mail.IMailClient; import ch.systemsx.cisd.etlserver.AbstractStrorageProcessorWithUploader;
import ch.systemsx.cisd.etlserver.AbstractDelegatingStorageProcessor;
import ch.systemsx.cisd.etlserver.ITypeExtractor;
import ch.systemsx.cisd.openbis.dss.generic.shared.dto.DataSetInformation;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Sample;
/** /**
* @author Tomasz Pylak * @author Tomasz Pylak
*/ */
public final class StorageProcessorWithMLUploader extends AbstractDelegatingStorageProcessor public final class StorageProcessorWithMLUploader extends AbstractStrorageProcessorWithUploader
{ {
private final ML2DatabaseUploader uploader;
public StorageProcessorWithMLUploader(Properties properties) public StorageProcessorWithMLUploader(Properties properties)
{ {
super(properties); super(properties, new ML2DatabaseUploader(properties));
this.uploader = new ML2DatabaseUploader(properties);
}
@Override
public File storeData(final Sample sample, final DataSetInformation dataSetInformation,
final ITypeExtractor typeExtractor, final IMailClient mailClient,
final File incomingDataSetDirectory, final File rootDir)
{
File storeData =
super.storeData(sample, dataSetInformation, typeExtractor, mailClient,
incomingDataSetDirectory, rootDir);
File originalData = super.tryGetProprietaryData(storeData);
uploader.upload(originalData, dataSetInformation);
return storeData;
} }
@Override @Override
public UnstoreDataAction unstoreData(final File incomingDataSetDirectory, protected void logDataSetFileError(File incomingDataSetDirectory, Throwable exception)
final File storedDataDirectory, Throwable exception)
{ {
super.unstoreData(incomingDataSetDirectory, storedDataDirectory, exception);
LogUtils log = new LogUtils(incomingDataSetDirectory.getParentFile()); LogUtils log = new LogUtils(incomingDataSetDirectory.getParentFile());
log.datasetFileError(incomingDataSetDirectory, exception); log.datasetFileError(incomingDataSetDirectory, exception);
return UnstoreDataAction.LEAVE_UNTOUCHED;
} }
} }
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