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

SSDM-4389 : Proper solution to handle both openbis alternative URLs when...

SSDM-4389 : Proper solution to handle both openbis alternative URLs when calling rmi-common service.

SVN: 37526
parent efdbae0e
No related branches found
No related tags found
No related merge requests found
......@@ -15,11 +15,9 @@
*/
package ch.ethz.sis.openbis.generic.server.dss;
import org.apache.commons.lang.time.DateUtils;
import ch.ethz.sis.openbis.generic.server.EntityRetriever;
import ch.systemsx.cisd.common.spring.HttpInvokerUtils;
import ch.systemsx.cisd.common.ssl.SslCertificateHelper;
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;
......@@ -40,15 +38,18 @@ public class ResourceSyncRequestHandler extends JythonBasedRequestHandler
protected void setVariables(IRequestHandlerPluginScriptRunner runner, SessionContextDTO session)
{
super.setVariables(runner, session);
String openBisUrl = ServiceProvider.getConfigProvider().getOpenBisServerUrl();
SslCertificateHelper.trustAnyCertificate(openBisUrl);
ICommonServer commonService =
HttpInvokerUtils.createServiceStub(ICommonServer.class, ((String.valueOf(properties.get("server-url")).trim()))
+ "/rmi-common",
5 * DateUtils.MILLIS_PER_MINUTE);
EncapsulatedCommonServer encapsulatedServer = EncapsulatedCommonServer.create(commonService, session.getSessionToken());
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());
MasterDataRegistrationService service = new MasterDataRegistrationService(encapsulatedServer);
IMasterDataRegistrationTransaction masterDataRegistrationTransaction = service.transaction();
......
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