Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » Scout Client/Server Version Management
Scout Client/Server Version Management [message #858409] Fri, 27 April 2012 05:47 Go to next message
Adrian MoserFriend
Messages: 67
Registered: March 2011
Member
Using the version parameter on HttpServiceTunnel and by removing the "min-version" init parameter on HttpProxyHandlerServlet on the server a client version >= server version is enforced by Scout.

String version = Activator.getDefault().getBundle().getVersion().toString();
String serverUrl = getBundle().getBundleContext().getProperty("server.url");
setServiceTunnel(new HttpServiceTunnel(this, serverUrl, version));


But how can I enforce a strict check, client version == server version?
Re: Scout Client/Server Version Management [message #867243 is a reply to message #858409] Tue, 01 May 2012 07:37 Go to previous messageGo to next message
Claudio Guglielmo is currently offline Claudio GuglielmoFriend
Messages: 256
Registered: March 2010
Senior Member
Hi Adrian

As you may have noticed the version check is done in DefaultTransactionDelegate.invokeImpl. Unfortunately there is no obvious way to exchange that functionality, but there is a possibility.

If I were you I would create a custom TransactionDelegate and override invokeImpl. There you can insert your version check. If it fails, return a VersionMismatchException as it is done in DefaultTransactionDelegate, otherwise call super.invokeImpl.

ServiceTunnelResponse serviceRes = new ServiceTunnelResponse(null, null, new VersionMismatchException(requestVersion.toString(), m_requestMinVersion.toString()));
return serviceRes; 


To activate your custom transaction delegate simply extend ServiceTunnelServlet and add the following code:

@Override
protected ServiceTunnelResponse runServerJobTransactionWithDelegate(ServiceTunnelRequest req, Bundle[] loaderBundles, Version requestMinVersion, boolean debug) throws Exception {
  return new CustomTransactionDelegate(loaderBundles, requestMinVersion, debug).invoke(req);
}



Please let us know if that works for you, I haven't tried it.

Regards
Claudio
Re: Scout Client/Server Version Management [message #883726 is a reply to message #858409] Sat, 09 June 2012 07:32 Go to previous message
Adrian MoserFriend
Messages: 67
Registered: March 2011
Member
Thanks, your suggestion works, here is the code if someone is interested. Additionally, please make sure you have a customized translation for "VersionMismatchTextXY", since the original text refers to the simple standard check.

  @Override
  protected ServiceTunnelResponse invokeImpl(ServiceTunnelRequest serviceReq) throws Throwable {
    if (requestMinVersion != null) {
      String v = serviceReq.getVersion();
      if (v == null) {
        v = "0.0.0";
      }
      Version requestVersion = Version.parseVersion(v);
      if (requestVersion.compareTo(requestMinVersion) != 0) {
        ServiceTunnelResponse serviceRes = new ServiceTunnelResponse(null, null, new VersionMismatchException(requestVersion.toString(), requestMinVersion.toString()));
        return serviceRes;
      }
    }
    return super.invokeImpl(serviceReq);
  }
Previous Topic:failed to load data
Next Topic:migrate from 3.7 to 3.8
Goto Forum:
  


Current Time: Fri Apr 26 01:33:43 GMT 2024

Powered by FUDForum. Page generated in 0.03413 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top