Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Determine exact RAP version at runtime(How to determine the exact RAP version during runtime)
Determine exact RAP version at runtime [message #1708643] Fri, 18 September 2015 10:11 Go to next message
John Gymer is currently offline John GymerFriend
Messages: 279
Registered: November 2012
Location: UK
Senior Member
We use a lot of common code with RAP, Tabris and SWT which is built into various packages, each of which might pull in a different version of JARs. In particular, we build a 'production' RAP 3.0 package, a 'Tabris' RAP 2.3.1 package and a 'Beta' RAP 3.1 Nightly package - that's just today, plus SWT and WorkBench variants!

At runtime, I'd like to be able to determine which version I am running - what is the best approach to find this out? Note that I could be running under OSGi or just as a stand-alone WAR without any OSGi, so cannot rely on bundle information.

Thanks, John


---
Just because you can doesn't mean you should
Re: Determine exact RAP version at runtime [message #1709470 is a reply to message #1708643] Mon, 28 September 2015 16:47 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

Hi John,

how about this? It works without OSGi, but does it also work with?

private static String getRwtVersion() {
try (
InputStream input =
RWT.class.getClassLoader().getResourceAsStream( "META-INF/MANIFEST.MF" );
BufferedReader reader = new BufferedReader( new
InputStreamReader( input, "UTF-8" ) ))
{
String line = reader.readLine();
String header = "Bundle-Version";
while( line != null ) {
if( line.startsWith( header ) ) {
return line.substring( header.length() + 1 ).trim();
}
line = reader.readLine();
}
return null;
} catch( Exception exception ) {
throw new RuntimeException( exception );
}
}

Regards,
Ralf

--
Ralf Sternberg

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Determine exact RAP version at runtime [message #1709542 is a reply to message #1709470] Tue, 29 September 2015 08:13 Go to previous messageGo to next message
John Gymer is currently offline John GymerFriend
Messages: 279
Registered: November 2012
Location: UK
Senior Member
Thanks Ralf,
seems to work OK in OSGi too.


---
Just because you can doesn't mean you should
Re: Determine exact RAP version at runtime [message #1714173 is a reply to message #1709542] Tue, 10 November 2015 13:14 Go to previous message
John Gymer is currently offline John GymerFriend
Messages: 279
Registered: November 2012
Location: UK
Senior Member
Back briefly to this... OSGi was fine with the code above, but I never got around to testing it under a WAR without OSGi, where it of course does not work because we are not running OSGi bundles.
The MANIFEST being read at runtime has nothing to do with RAP/RWT. In this example I'm running RedHat JBoss 6.4, and it seems to just pick up the manifest from some totally unrelated location:

reading META-INF/MANIFEST.MF line...
META-INF/MANIFEST.MF line 'Manifest-Version: 1.0'
META-INF/MANIFEST.MF line 'Build-Timestamp: Thu, 22 Jan 2015 12:05:19 -0500'
META-INF/MANIFEST.MF line 'Implementation-Title: JSF Reference Implementation'
META-INF/MANIFEST.MF line 'Implementation-Version: 2.1.28.redhat-8'
META-INF/MANIFEST.MF line 'Os-Version: 2.6.32-504.3.3.el6.x86_64'
META-INF/MANIFEST.MF line 'Built-By: mockbuild'
META-INF/MANIFEST.MF line 'Specification-Vendor: JBoss by Red Hat'
META-INF/MANIFEST.MF line 'Created-By: 1.6.0_33-b33 (Sun Microsystems Inc.)'
META-INF/MANIFEST.MF line 'Os-Name: Linux'
META-INF/MANIFEST.MF line 'Implementation-URL: https://javaserverfaces.java.net/jsf-impl/'
META-INF/MANIFEST.MF line 'Java-Vendor: Sun Microsystems Inc.'
META-INF/MANIFEST.MF line 'Ant-Version: Apache Ant 1.8.2'
META-INF/MANIFEST.MF line 'Implementation-Vendor: JBoss by Red Hat'
META-INF/MANIFEST.MF line 'Scm-Revision: 5931389bf9d2d7b43d78a8f46aab8e154eae2355'
META-INF/MANIFEST.MF line 'Implementation-Vendor-Id: com.sun.faces'
META-INF/MANIFEST.MF line 'Scm-Url: http://git.app.eng.bos.redhat.com/jboss/mojarra.git/jsf-ri'
META-INF/MANIFEST.MF line 'Build-Jdk: 1.6.0_33'
META-INF/MANIFEST.MF line 'Java-Version: 1.6.0_33'
META-INF/MANIFEST.MF line 'Scm-Connection: scm:git:git://git.app.eng.bos.redhat.com/jboss/mojarra'
META-INF/MANIFEST.MF line ' .git/jsf-ri'
META-INF/MANIFEST.MF line 'Os-Arch: i386'
META-INF/MANIFEST.MF line 'Specification-Title: JSF Reference Implementation'
META-INF/MANIFEST.MF line 'Specification-Version: 2.1.28.redhat-8'
META-INF/MANIFEST.MF line 'Archiver-Version: Plexus Archiver'
META-INF/MANIFEST.MF line ''

Is there some other API in RAP that could be provided to more reliably get the version running? Perhaps an enhancement for the future, if there is no other way to do it currently?

Thanks, John


---
Just because you can doesn't mean you should
Previous Topic: Item text does not align middle in tree
Next Topic:Is it possible to develop a rap app without eclipse ide, but just using maven or osgi ?
Goto Forum:
  


Current Time: Thu Sep 26 12:28:20 GMT 2024

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

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

Back to the top