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

LMS-1506 data set copier using a template for destination

SVN: 15767
parent f0e0968a
No related branches found
No related tags found
No related merge requests found
......@@ -74,6 +74,12 @@ failure-interval = 10
# Valid only when auto-detection method is used to determine if an incoming data are ready to be processed.
quiet-period = 10
# Define names of data sources
data-sources = data-source
data-source.databaseEngineCode = postgresql
data-source.basicDatabaseName = phosphonetx
data-source.databaseKind = dev
# ---------------------------------------------------------------------------
# maintenance plugins configuration
# ---------------------------------------------------------------------------
......@@ -87,8 +93,7 @@ maintenance-plugins = data-set-clean-up
data-set-clean-up.class = ch.systemsx.cisd.etlserver.plugins.DataSetDeletionMaintenanceTask
data-set-clean-up.interval = 300
data-set-clean-up.database.basic-database-name = phosphonetx
data-set-clean-up.database.kind = dev
data-set-clean-up.data-source = data-source
# ---------------------------------------------------------------------------
......@@ -117,11 +122,11 @@ demo-reporter.properties-file =
processing-plugins = copy-data-sets
# The configuration of the processing plugin is the same as the reporting plugins configuration.
copy-data-sets.label = Data Set Copier
copy-data-sets.label = Data Set Copier to User Location
copy-data-sets.dataset-types = UNKNOWN
copy-data-sets.class = ch.systemsx.cisd.openbis.dss.generic.server.plugins.standard.DataSetCopier
copy-data-sets.class = ch.systemsx.cisd.openbis.dss.phosphonetx.server.plugins.DataSetCopierForUsers
#copy-data-sets.destination = /Volumes/share-1-\$/user/cisd/felmer/phosphonetx/
copy-data-sets.destination = vesuvio:tmp/LMS-1267
copy-data-sets.destination = vesuvio:tmp/${user}
data-set-validators = val1
......
/*
* 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.phosphonetx.server.plugins;
import static ch.systemsx.cisd.openbis.generic.shared.Constants.USER_PARAMETER;
import java.io.File;
import java.util.Map;
import java.util.Properties;
import ch.rinn.restrictions.Private;
import ch.systemsx.cisd.common.exceptions.UserFailureException;
import ch.systemsx.cisd.openbis.dss.generic.server.plugins.standard.Copier;
import ch.systemsx.cisd.openbis.dss.generic.server.plugins.standard.DataSetCopier;
import ch.systemsx.cisd.openbis.dss.generic.server.plugins.standard.IPathCopierFactory;
import ch.systemsx.cisd.openbis.dss.generic.server.plugins.standard.ISshCommandExecutorFactory;
import ch.systemsx.cisd.openbis.dss.generic.server.plugins.standard.RsyncCopierFactory;
import ch.systemsx.cisd.openbis.dss.generic.server.plugins.standard.SshCommandExecutorFactory;
/**
*
*
* @author Franz-Josef Elmer
*/
public class DataSetCopierForUsers extends DataSetCopier
{
private static final String USER_PARAMETER_STRING = "${" + USER_PARAMETER + "}";
private static final long serialVersionUID = 1L;
public DataSetCopierForUsers(Properties properties, File storeRoot)
{
this(properties, storeRoot, new RsyncCopierFactory(), new SshCommandExecutorFactory());
}
@Private
DataSetCopierForUsers(Properties properties, File storeRoot,
IPathCopierFactory pathCopierFactory,
ISshCommandExecutorFactory sshCommandExecutorFactory)
{
super(properties, storeRoot, new Copier(properties, pathCopierFactory,
sshCommandExecutorFactory)
{
private static final long serialVersionUID = 1L;
@Override
protected String transformHostFile(String originalHostFile,
Map<String, String> parameterBindings)
{
int indexOfParameter = originalHostFile.indexOf(USER_PARAMETER_STRING);
String hostFile = originalHostFile;
if (indexOfParameter >= 0)
{
String user = parameterBindings.get(USER_PARAMETER);
if (user == null)
{
throw new UserFailureException("Missing parameter '" + USER_PARAMETER
+ "'.");
}
hostFile =
originalHostFile.substring(0, indexOfParameter)
+ user
+ originalHostFile.substring(indexOfParameter
+ USER_PARAMETER_STRING.length());
}
return hostFile;
}
});
}
}
......@@ -17,8 +17,10 @@
package ch.systemsx.cisd.openbis.plugin.phosphonetx.server;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import ch.rinn.restrictions.Private;
......@@ -130,7 +132,9 @@ public class RawDataServiceInternal extends AbstractServer<IRawDataServiceIntern
String dataStoreServerCode = findDataStoreServer(dataSetProcessingKey);
IExternalDataTable externalDataTable =
businessObjectFactory.createExternalDataTable(session);
externalDataTable.processDatasets(dataSetProcessingKey, dataStoreServerCode, dataSetCodes);
Map<String, String> parameterBindings = new HashMap<String, String>();
externalDataTable.processDatasets(dataSetProcessingKey, dataStoreServerCode, dataSetCodes,
parameterBindings);
}
private List<Sample> loadAllRawDataSamples(Session session)
......
......@@ -121,7 +121,7 @@ public class RawDataServiceInternalTest extends AbstractServerTestCase
will(returnValue(externalDataTable));
List<String> dataSetCodes = Arrays.asList("ds2.0", "ds2.1");
one(externalDataTable).processDatasets(COPY_PROCESSING_KEY, "s2", dataSetCodes);
one(externalDataTable).processDatasets(COPY_PROCESSING_KEY, "s2", dataSetCodes, null);
}
});
......
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