Skip to content
Snippets Groups Projects
Commit 0c3e1157 authored by gakin's avatar gakin
Browse files

SSDM-4389 : Refactoring

SVN: 37539
parent 0aaf0e94
No related branches found
No related tags found
No related merge requests found
......@@ -16,15 +16,12 @@
package ch.ethz.sis.openbis.generic.server.dss;
import ch.ethz.sis.openbis.generic.server.EntityRetriever;
import ch.systemsx.cisd.openbis.common.api.client.IServicePinger;
import ch.systemsx.cisd.openbis.common.api.client.ServiceFinder;
import ch.systemsx.cisd.openbis.dss.generic.server.oaipmh.JythonBasedRequestHandler;
import ch.systemsx.cisd.openbis.dss.generic.server.plugins.jython.IRequestHandlerPluginScriptRunner;
import ch.systemsx.cisd.openbis.dss.generic.shared.ServiceProvider;
import ch.systemsx.cisd.openbis.generic.server.jython.api.v1.IMasterDataRegistrationTransaction;
import ch.systemsx.cisd.openbis.generic.server.jython.api.v1.impl.EncapsulatedCommonServer;
import ch.systemsx.cisd.openbis.generic.server.jython.api.v1.impl.MasterDataRegistrationService;
import ch.systemsx.cisd.openbis.generic.shared.ICommonServer;
import ch.systemsx.cisd.openbis.generic.shared.dto.SessionContextDTO;
/**
......@@ -38,18 +35,8 @@ public class ResourceSyncRequestHandler extends JythonBasedRequestHandler
protected void setVariables(IRequestHandlerPluginScriptRunner runner, SessionContextDTO session)
{
super.setVariables(runner, session);
ServiceFinder finder = new ServiceFinder("openbis", "/rmi-common");
ICommonServer commonServer =
finder.createService(ICommonServer.class, ServiceProvider.getConfigProvider().getOpenBisServerUrl(),
new IServicePinger<ICommonServer>()
{
@Override
public void ping(ICommonServer service)
{
service.getVersion();
}
});
EncapsulatedCommonServer encapsulatedServer = EncapsulatedCommonServer.create(commonServer, session.getSessionToken());
String openBisServerUrl = ServiceProvider.getConfigProvider().getOpenBisServerUrl();
EncapsulatedCommonServer encapsulatedServer = ServiceFinderUtils.getEncapsulatedCommonServer(session.getSessionToken(), openBisServerUrl);
MasterDataRegistrationService service = new MasterDataRegistrationService(encapsulatedServer);
IMasterDataRegistrationTransaction masterDataRegistrationTransaction = service.transaction();
......
/*
* Copyright 2016 ETH Zuerich, SIS
*
* 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.ethz.sis.openbis.generic.server.dss;
import ch.systemsx.cisd.openbis.common.api.client.IServicePinger;
import ch.systemsx.cisd.openbis.common.api.client.ServiceFinder;
import ch.systemsx.cisd.openbis.generic.server.jython.api.v1.impl.EncapsulatedCommonServer;
import ch.systemsx.cisd.openbis.generic.shared.ICommonServer;
/**
*
*
* @author Ganime Betul Akin
*/
public class ServiceFinderUtils
{
public static EncapsulatedCommonServer getEncapsulatedCommonServer(String sessionToken, String openBisServerUrl)
{
ServiceFinder finder = new ServiceFinder("openbis", "/rmi-common");
ICommonServer commonServer =
finder.createService(ICommonServer.class, openBisServerUrl,
new IServicePinger<ICommonServer>()
{
@Override
public void ping(ICommonServer service)
{
service.getVersion();
}
});
return EncapsulatedCommonServer.create(commonServer, sessionToken);
}
}
\ No newline at end of file
......@@ -36,7 +36,6 @@ import java.util.Set;
import org.apache.commons.codec.binary.Hex;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.time.DateUtils;
import org.apache.log4j.Logger;
import org.w3c.dom.Document;
......@@ -59,6 +58,7 @@ import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.DataSetFile;
import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.fetchoptions.DataSetFileFetchOptions;
import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.search.DataSetFileSearchCriteria;
import ch.ethz.sis.openbis.generic.server.EntityRetriever;
import ch.ethz.sis.openbis.generic.server.dss.ServiceFinderUtils;
import ch.ethz.sis.openbis.generic.server.dss.plugins.harvester.config.SyncConfig;
import ch.ethz.sis.openbis.generic.server.dss.plugins.harvester.synchronizer.ResourceListParserData.Connection;
import ch.ethz.sis.openbis.generic.server.dss.plugins.harvester.synchronizer.ResourceListParserData.DataSetWithConnections;
......@@ -77,7 +77,6 @@ import ch.systemsx.cisd.common.concurrent.ParallelizedExecutor;
import ch.systemsx.cisd.common.exceptions.Status;
import ch.systemsx.cisd.common.filesystem.FileUtilities;
import ch.systemsx.cisd.common.logging.Log4jSimpleLogger;
import ch.systemsx.cisd.common.spring.HttpInvokerUtils;
import ch.systemsx.cisd.etlserver.registrator.api.v1.impl.ConversionUtils;
import ch.systemsx.cisd.openbis.dss.generic.shared.DataSetDirectoryProvider;
import ch.systemsx.cisd.openbis.dss.generic.shared.DataSetProcessingContext;
......@@ -91,7 +90,6 @@ import ch.systemsx.cisd.openbis.generic.server.jython.api.v1.impl.EncapsulatedCo
import ch.systemsx.cisd.openbis.generic.server.jython.api.v1.impl.MasterDataRegistrationException;
import ch.systemsx.cisd.openbis.generic.server.jython.api.v1.impl.MasterDataRegistrationTransactionWrapper;
import ch.systemsx.cisd.openbis.generic.server.jython.api.v1.impl.MasterDataTransactionErrors;
import ch.systemsx.cisd.openbis.generic.shared.ICommonServer;
import ch.systemsx.cisd.openbis.generic.shared.basic.TechId;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.AbstractExternalData;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Experiment;
......@@ -448,13 +446,10 @@ public class EntitySynchronizer
private MasterDataRegistrationTransactionWrapper getMasterDataRegistrationTransactionWrapper()
{
ICommonServer commonService =
HttpInvokerUtils.createServiceStub(ICommonServer.class, ServiceProvider.getConfigProvider().getOpenBisServerUrl() +
"/openbis/rmi-common",
5 * DateUtils.MILLIS_PER_MINUTE);
EncapsulatedCommonServer encapsulatedServer =
EncapsulatedCommonServer.create(commonService, ServiceProvider.getOpenBISService().getSessionToken());
return new MasterDataRegistrationTransactionWrapper(encapsulatedServer);
String openBisServerUrl = ServiceProvider.getConfigProvider().getOpenBisServerUrl();
String sessionToken = ServiceProvider.getOpenBISService().getSessionToken();
EncapsulatedCommonServer encapsulatedCommonServer = ServiceFinderUtils.getEncapsulatedCommonServer(sessionToken, openBisServerUrl);
return new MasterDataRegistrationTransactionWrapper(encapsulatedCommonServer);
}
private void processDeletions(ResourceListParserData data) throws NoSuchAlgorithmException, UnsupportedEncodingException
......
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