Skip to content
Snippets Groups Projects
Commit baec4923 authored by kaloyane's avatar kaloyane
Browse files

[LMS-2087] Eager archiving (part 3 - fix serializable and dependency issues)

SVN: 20308
parent 8dd4220e
No related branches found
No related tags found
No related merge requests found
Showing
with 78 additions and 27 deletions
...@@ -37,8 +37,8 @@ import ch.systemsx.cisd.common.mail.MailClientParameters; ...@@ -37,8 +37,8 @@ import ch.systemsx.cisd.common.mail.MailClientParameters;
import ch.systemsx.cisd.common.spring.AbstractServiceWithLogger; import ch.systemsx.cisd.common.spring.AbstractServiceWithLogger;
import ch.systemsx.cisd.common.spring.IInvocationLoggerContext; import ch.systemsx.cisd.common.spring.IInvocationLoggerContext;
import ch.systemsx.cisd.common.utilities.IInitializable; import ch.systemsx.cisd.common.utilities.IInitializable;
import ch.systemsx.cisd.openbis.dss.generic.server.plugins.tasks.ArchiverTaskContext;
import ch.systemsx.cisd.openbis.dss.generic.server.plugins.tasks.ArchiverPluginFactory; import ch.systemsx.cisd.openbis.dss.generic.server.plugins.tasks.ArchiverPluginFactory;
import ch.systemsx.cisd.openbis.dss.generic.server.plugins.tasks.ArchiverTaskContext;
import ch.systemsx.cisd.openbis.dss.generic.server.plugins.tasks.IArchiverPlugin; import ch.systemsx.cisd.openbis.dss.generic.server.plugins.tasks.IArchiverPlugin;
import ch.systemsx.cisd.openbis.dss.generic.server.plugins.tasks.IProcessingPluginTask; import ch.systemsx.cisd.openbis.dss.generic.server.plugins.tasks.IProcessingPluginTask;
import ch.systemsx.cisd.openbis.dss.generic.server.plugins.tasks.IReportingPluginTask; import ch.systemsx.cisd.openbis.dss.generic.server.plugins.tasks.IReportingPluginTask;
...@@ -352,7 +352,7 @@ public class DataStoreService extends AbstractServiceWithLogger<IDataStoreServic ...@@ -352,7 +352,7 @@ public class DataStoreService extends AbstractServiceWithLogger<IDataStoreServic
private IArchiverPlugin createArchiver() private IArchiverPlugin createArchiver()
{ {
ArchiverPluginFactory factory = pluginTaskParameters.getArchiverTaskFactory(); ArchiverPluginFactory factory = pluginTaskParameters.getArchiverTaskFactory();
return factory.createInstance(storeRoot, commandExecutor); return factory.createInstance(storeRoot);
} }
private void scheduleTask(String sessionToken, String description, private void scheduleTask(String sessionToken, String description,
...@@ -424,6 +424,11 @@ public class DataStoreService extends AbstractServiceWithLogger<IDataStoreServic ...@@ -424,6 +424,11 @@ public class DataStoreService extends AbstractServiceWithLogger<IDataStoreServic
return task.createLink(dataSet); return task.createLink(dataSet);
} }
public IDataSetCommandExecutor getDataSetCommandExecutor()
{
return commandExecutor;
}
private IShareIdManager getShareIdManager() private IShareIdManager getShareIdManager()
{ {
if (shareIdManager == null) if (shareIdManager == null)
......
...@@ -21,6 +21,7 @@ import java.util.Map; ...@@ -21,6 +21,7 @@ import java.util.Map;
import ch.systemsx.cisd.common.mail.MailClientParameters; import ch.systemsx.cisd.common.mail.MailClientParameters;
import ch.systemsx.cisd.openbis.dss.generic.server.plugins.tasks.IProcessingPluginTask; import ch.systemsx.cisd.openbis.dss.generic.server.plugins.tasks.IProcessingPluginTask;
import ch.systemsx.cisd.openbis.dss.generic.shared.IDataSetDeleter;
import ch.systemsx.cisd.openbis.generic.shared.Constants; import ch.systemsx.cisd.openbis.generic.shared.Constants;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatastoreServiceDescription; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatastoreServiceDescription;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData;
...@@ -33,7 +34,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.DatasetDescription; ...@@ -33,7 +34,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.DatasetDescription;
* *
* @author Franz-Josef Elmer * @author Franz-Josef Elmer
*/ */
public interface IDataSetCommandExecutor public interface IDataSetCommandExecutor extends IDataSetDeleter
{ {
/** /**
* Starts up executor. * Starts up executor.
......
...@@ -25,7 +25,6 @@ import java.util.Set; ...@@ -25,7 +25,6 @@ import java.util.Set;
import ch.systemsx.cisd.common.exceptions.Status; import ch.systemsx.cisd.common.exceptions.Status;
import ch.systemsx.cisd.common.exceptions.UserFailureException; import ch.systemsx.cisd.common.exceptions.UserFailureException;
import ch.systemsx.cisd.common.filesystem.BooleanStatus; import ch.systemsx.cisd.common.filesystem.BooleanStatus;
import ch.systemsx.cisd.openbis.dss.generic.server.IDataSetCommandExecutor;
import ch.systemsx.cisd.openbis.dss.generic.server.plugins.standard.AbstractArchiverProcessingPlugin; import ch.systemsx.cisd.openbis.dss.generic.server.plugins.standard.AbstractArchiverProcessingPlugin;
import ch.systemsx.cisd.openbis.dss.generic.server.plugins.tasks.ArchiverTaskContext; import ch.systemsx.cisd.openbis.dss.generic.server.plugins.tasks.ArchiverTaskContext;
import ch.systemsx.cisd.openbis.generic.shared.dto.DatasetDescription; import ch.systemsx.cisd.openbis.generic.shared.dto.DatasetDescription;
...@@ -39,10 +38,9 @@ public class DemoArchiver extends AbstractArchiverProcessingPlugin ...@@ -39,10 +38,9 @@ public class DemoArchiver extends AbstractArchiverProcessingPlugin
private final static Set<String/* data set code */> archiveContents = new HashSet<String>(); private final static Set<String/* data set code */> archiveContents = new HashSet<String>();
public DemoArchiver(Properties properties, File storeRoot, public DemoArchiver(Properties properties, File storeRoot)
IDataSetCommandExecutor commandExecutor)
{ {
super(properties, storeRoot, commandExecutor, null, null); super(properties, storeRoot, null, null);
} }
@Override @Override
......
...@@ -30,11 +30,11 @@ import java.util.Properties; ...@@ -30,11 +30,11 @@ import java.util.Properties;
import ch.systemsx.cisd.common.collections.CollectionUtils; import ch.systemsx.cisd.common.collections.CollectionUtils;
import ch.systemsx.cisd.common.exceptions.Status; import ch.systemsx.cisd.common.exceptions.Status;
import ch.systemsx.cisd.common.filesystem.BooleanStatus; import ch.systemsx.cisd.common.filesystem.BooleanStatus;
import ch.systemsx.cisd.openbis.dss.generic.server.IDataSetCommandExecutor;
import ch.systemsx.cisd.openbis.dss.generic.server.plugins.tasks.ArchiverTaskContext; import ch.systemsx.cisd.openbis.dss.generic.server.plugins.tasks.ArchiverTaskContext;
import ch.systemsx.cisd.openbis.dss.generic.server.plugins.tasks.IArchiverPlugin; import ch.systemsx.cisd.openbis.dss.generic.server.plugins.tasks.IArchiverPlugin;
import ch.systemsx.cisd.openbis.dss.generic.server.plugins.tasks.ProcessingStatus; import ch.systemsx.cisd.openbis.dss.generic.server.plugins.tasks.ProcessingStatus;
import ch.systemsx.cisd.openbis.dss.generic.shared.QueueingDataSetStatusUpdaterService; import ch.systemsx.cisd.openbis.dss.generic.shared.QueueingDataSetStatusUpdaterService;
import ch.systemsx.cisd.openbis.dss.generic.shared.ServiceProvider;
import ch.systemsx.cisd.openbis.dss.generic.shared.dto.DataSetCodesWithStatus; import ch.systemsx.cisd.openbis.dss.generic.shared.dto.DataSetCodesWithStatus;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetArchivingStatus; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetArchivingStatus;
import ch.systemsx.cisd.openbis.generic.shared.dto.DatasetDescription; import ch.systemsx.cisd.openbis.generic.shared.dto.DatasetDescription;
...@@ -55,14 +55,10 @@ public abstract class AbstractArchiverProcessingPlugin extends AbstractDatastore ...@@ -55,14 +55,10 @@ public abstract class AbstractArchiverProcessingPlugin extends AbstractDatastore
private final IStatusChecker unarchivePrerequisiteOrNull; private final IStatusChecker unarchivePrerequisiteOrNull;
private final IDataSetCommandExecutor commandExecutor;
public AbstractArchiverProcessingPlugin(Properties properties, File storeRoot, public AbstractArchiverProcessingPlugin(Properties properties, File storeRoot,
IDataSetCommandExecutor commandExecutor,
IStatusChecker archivePrerequisiteOrNull, IStatusChecker unarchivePrerequisiteOrNull) IStatusChecker archivePrerequisiteOrNull, IStatusChecker unarchivePrerequisiteOrNull)
{ {
super(properties, storeRoot); super(properties, storeRoot);
this.commandExecutor = commandExecutor;
this.archivePrerequisiteOrNull = archivePrerequisiteOrNull; this.archivePrerequisiteOrNull = archivePrerequisiteOrNull;
this.unarchivePrerequisiteOrNull = unarchivePrerequisiteOrNull; this.unarchivePrerequisiteOrNull = unarchivePrerequisiteOrNull;
} }
...@@ -153,7 +149,7 @@ public abstract class AbstractArchiverProcessingPlugin extends AbstractDatastore ...@@ -153,7 +149,7 @@ public abstract class AbstractArchiverProcessingPlugin extends AbstractDatastore
ArchiverTaskContext context) ArchiverTaskContext context)
{ {
// the deletion will happen at a later point in time // the deletion will happen at a later point in time
commandExecutor.scheduleDeletionOfDataSets(datasets); ServiceProvider.getDataSetDeleter().scheduleDeletionOfDataSets(datasets);
} }
public ProcessingStatus unarchive(List<DatasetDescription> datasets, public ProcessingStatus unarchive(List<DatasetDescription> datasets,
......
...@@ -24,7 +24,6 @@ import ch.rinn.restrictions.Private; ...@@ -24,7 +24,6 @@ import ch.rinn.restrictions.Private;
import ch.systemsx.cisd.common.exceptions.Status; import ch.systemsx.cisd.common.exceptions.Status;
import ch.systemsx.cisd.common.exceptions.UserFailureException; import ch.systemsx.cisd.common.exceptions.UserFailureException;
import ch.systemsx.cisd.common.filesystem.BooleanStatus; import ch.systemsx.cisd.common.filesystem.BooleanStatus;
import ch.systemsx.cisd.openbis.dss.generic.server.IDataSetCommandExecutor;
import ch.systemsx.cisd.openbis.dss.generic.server.plugins.tasks.ArchiverTaskContext; import ch.systemsx.cisd.openbis.dss.generic.server.plugins.tasks.ArchiverTaskContext;
import ch.systemsx.cisd.openbis.generic.shared.dto.DatasetDescription; import ch.systemsx.cisd.openbis.generic.shared.dto.DatasetDescription;
...@@ -50,19 +49,17 @@ public class RsyncArchiver extends AbstractArchiverProcessingPlugin ...@@ -50,19 +49,17 @@ public class RsyncArchiver extends AbstractArchiverProcessingPlugin
private final ISshCommandExecutorFactory sshCommandExecutorFactory; private final ISshCommandExecutorFactory sshCommandExecutorFactory;
public RsyncArchiver(Properties properties, File storeRoot, public RsyncArchiver(Properties properties, File storeRoot)
IDataSetCommandExecutor commandExecutor)
{ {
this(properties, storeRoot, commandExecutor, new RsyncCopierFactory(), this(properties, storeRoot, new RsyncCopierFactory(), new SshCommandExecutorFactory());
new SshCommandExecutorFactory());
} }
@Private @Private
RsyncArchiver(Properties properties, File storeRoot, IDataSetCommandExecutor commandExecutor, RsyncArchiver(Properties properties, File storeRoot,
IPathCopierFactory pathCopierFactory, IPathCopierFactory pathCopierFactory,
ISshCommandExecutorFactory sshCommandExecutorFactory) ISshCommandExecutorFactory sshCommandExecutorFactory)
{ {
super(properties, storeRoot, commandExecutor, null, null); super(properties, storeRoot, null, null);
this.pathCopierFactory = pathCopierFactory; this.pathCopierFactory = pathCopierFactory;
this.sshCommandExecutorFactory = sshCommandExecutorFactory; this.sshCommandExecutorFactory = sshCommandExecutorFactory;
} }
......
...@@ -28,7 +28,6 @@ import ch.systemsx.cisd.common.logging.LogCategory; ...@@ -28,7 +28,6 @@ import ch.systemsx.cisd.common.logging.LogCategory;
import ch.systemsx.cisd.common.logging.LogFactory; import ch.systemsx.cisd.common.logging.LogFactory;
import ch.systemsx.cisd.common.utilities.ClassUtils; import ch.systemsx.cisd.common.utilities.ClassUtils;
import ch.systemsx.cisd.common.utilities.PropertyParametersUtil.SectionProperties; import ch.systemsx.cisd.common.utilities.PropertyParametersUtil.SectionProperties;
import ch.systemsx.cisd.openbis.dss.generic.server.IDataSetCommandExecutor;
/** /**
* Factory of Archiver Tasks. * Factory of Archiver Tasks.
...@@ -59,7 +58,7 @@ public class ArchiverPluginFactory ...@@ -59,7 +58,7 @@ public class ArchiverPluginFactory
return className != null; return className != null;
} }
public IArchiverPlugin createInstance(File storeRoot, IDataSetCommandExecutor commandExecutor) public IArchiverPlugin createInstance(File storeRoot)
{ {
if (isArchiverConfigured() == false) if (isArchiverConfigured() == false)
{ {
...@@ -68,7 +67,7 @@ public class ArchiverPluginFactory ...@@ -68,7 +67,7 @@ public class ArchiverPluginFactory
try try
{ {
return ClassUtils.create(IArchiverPlugin.class, className, archiverProperties, return ClassUtils.create(IArchiverPlugin.class, className, archiverProperties,
storeRoot, commandExecutor); storeRoot);
} catch (ConfigurationFailureException ex) } catch (ConfigurationFailureException ex)
{ {
throw ex; // rethrow the exception without changing the message throw ex; // rethrow the exception without changing the message
......
/*
* Copyright 2011 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;
import java.util.List;
import ch.systemsx.cisd.openbis.generic.shared.dto.DatasetDescription;
/**
* @author Kaloyan Enimanev
*/
public interface IDataSetDeleter
{
/**
* Schedules deletion of all specified data sets.
*/
void scheduleDeletionOfDataSets(List<DatasetDescription> dataSets);
}
...@@ -16,12 +16,18 @@ ...@@ -16,12 +16,18 @@
package ch.systemsx.cisd.openbis.dss.generic.shared; package ch.systemsx.cisd.openbis.dss.generic.shared;
import org.apache.log4j.Logger;
import org.springframework.aop.framework.Advised;
import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter; import org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter;
import com.marathon.util.spring.StreamSupportingHttpInvokerServiceExporter; import com.marathon.util.spring.StreamSupportingHttpInvokerServiceExporter;
import ch.systemsx.cisd.common.logging.LogCategory;
import ch.systemsx.cisd.common.logging.LogFactory;
import ch.systemsx.cisd.openbis.dss.generic.server.DataStoreService;
/** /**
* Provider of remote service onto openBIS. * Provider of remote service onto openBIS.
* *
...@@ -29,6 +35,9 @@ import com.marathon.util.spring.StreamSupportingHttpInvokerServiceExporter; ...@@ -29,6 +35,9 @@ import com.marathon.util.spring.StreamSupportingHttpInvokerServiceExporter;
*/ */
public class ServiceProvider public class ServiceProvider
{ {
private static final Logger operationLog = LogFactory.getLogger(LogCategory.OPERATION,
ServiceProvider.class);
// applicationContex it lazily initialized // applicationContex it lazily initialized
private static BeanFactory applicationContext = null; private static BeanFactory applicationContext = null;
...@@ -82,6 +91,20 @@ public class ServiceProvider ...@@ -82,6 +91,20 @@ public class ServiceProvider
return ((DataSourceProvider) getApplicationContext().getBean("data-source-provider")); return ((DataSourceProvider) getApplicationContext().getBean("data-source-provider"));
} }
public static IDataSetDeleter getDataSetDeleter()
{
Advised advised = (Advised) getApplicationContext().getBean("data-store-service");
try
{
DataStoreService dssService = (DataStoreService) advised.getTargetSource().getTarget();
return dssService.getDataSetCommandExecutor();
} catch (Exception ex)
{
operationLog.error("Cannot get IDataSetDeleter instance :" + ex.getMessage(), ex);
return null;
}
}
private ServiceProvider() private ServiceProvider()
{ {
} }
......
...@@ -26,7 +26,6 @@ import ch.systemsx.cisd.common.exceptions.Status; ...@@ -26,7 +26,6 @@ import ch.systemsx.cisd.common.exceptions.Status;
import ch.systemsx.cisd.common.exceptions.UserFailureException; import ch.systemsx.cisd.common.exceptions.UserFailureException;
import ch.systemsx.cisd.common.filesystem.BooleanStatus; import ch.systemsx.cisd.common.filesystem.BooleanStatus;
import ch.systemsx.cisd.common.utilities.PropertyUtils; import ch.systemsx.cisd.common.utilities.PropertyUtils;
import ch.systemsx.cisd.openbis.dss.generic.server.IDataSetCommandExecutor;
import ch.systemsx.cisd.openbis.dss.generic.server.plugins.standard.AbstractArchiverProcessingPlugin; import ch.systemsx.cisd.openbis.dss.generic.server.plugins.standard.AbstractArchiverProcessingPlugin;
import ch.systemsx.cisd.openbis.dss.generic.server.plugins.standard.HighWaterMarkChecker; import ch.systemsx.cisd.openbis.dss.generic.server.plugins.standard.HighWaterMarkChecker;
import ch.systemsx.cisd.openbis.dss.generic.server.plugins.standard.IStatusChecker; import ch.systemsx.cisd.openbis.dss.generic.server.plugins.standard.IStatusChecker;
...@@ -59,10 +58,9 @@ public class MLArchiverTask extends AbstractArchiverProcessingPlugin ...@@ -59,10 +58,9 @@ public class MLArchiverTask extends AbstractArchiverProcessingPlugin
private final String dataSourceName; private final String dataSourceName;
public MLArchiverTask(Properties properties, File storeRoot, public MLArchiverTask(Properties properties, File storeRoot)
IDataSetCommandExecutor commandExecutor)
{ {
super(properties, storeRoot, commandExecutor, null, tryCreateUnarchivingStatusChecker( super(properties, storeRoot, null, tryCreateUnarchivingStatusChecker(
properties, storeRoot)); properties, storeRoot));
dataSourceName = DataSourceProvider.extractDataSourceName(properties); dataSourceName = DataSourceProvider.extractDataSourceName(properties);
// Check if given data source exists // Check if given data source exists
......
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