It's all about the answers!

Ask a question

Plain Java API: Is there a method to expose the version ?


Kevin Ramer (4.5k6171189) | asked May 06 '14, 4:40 p.m.
edited May 06 '14, 4:45 p.m.
I have a stand-alone application that uses the Plain Java API.  I would like to include details that I can expose at run-time when the application starts or a separate on-demand run.   To this end I have created a VersionInfo class which my ant build fills in certain tokens with information I can determine by running a script.   For example, to find the DB2 client version:

java -cp lib/db2jcc.jar com.ibm.db2.jcc.DB2Jcc -version
IBM DB2 JDBC Universal Driver Architecture 3.64.106

I found
com.ibm.team.repository.common.TeamRepositoryException  

which has a getClientVersion() method but trying to instantiate one of these sandwiched
between TeamPlatform.startup() and TeamPlatform.shutdown() doesn't do much

So: is there some class/method that would give an understandable version of the running or built
against client libraries ?

Chopping the build string off of com.ibm.team.workitem.client is ambiguous at best....


3 answers



permanent link
Donald Nong (14.4k314) | answered May 07 '14, 2:11 a.m.
edited May 07 '14, 2:14 a.m.
If you are developing a standalone Java application and want to show the version information on the splash screen or when accepting the -version command line parameter, you need to implement it yourself (write your own getVersion() function). You will need to hardcode the version in the code or read it from some environment variable or configuration files.
The TeamRepositoryException class is definitely not the right choice. If you want to get the version of the Jazz server, consider these.
com.ibm.team.repository.common.Version
com.ibm.team.repository.client.util.RepositoryUtil.getRepositoryVersion
com.ibm.team.repository.client.util.RepositoryUtil.getRepositoryBuildId


Comments
Kevin Ramer commented May 07 '14, 8:25 a.m.

The app I have is a headless task.   I have separate User Libraries in my Eclipse environment so I can quickly swap client versions.   I have try to record the API class version by pulling the build info off the tail of:

jazz3_libs/com.ibm.team.workitem.client_3.1.0.v20120504_0401.jar

But for a v3 and v4 these don't look very distinguishable:

[ramerk@oc6557108854 rfe_rtc_bridge]$ scripts/gen_build_info.sh v3
buildstamp=2014/05/07 08:21
db2jccversion=IBM DB2 JDBC Universal Driver Architecture 3.50.152
rtcclientversion=3.1.0.v20120504
[ramerk@oc6557108854 rfe_rtc_bridge]$ scripts/gen_build_info.sh v4
buildstamp=2014/05/07 08:21
db2jccversion=IBM DB2 JDBC Universal Driver Architecture 3.50.152
rtcclientversion=3.1.500.v20130501


Tim Mok commented May 07 '14, 9:11 a.m.
JAZZ DEVELOPER

It looks like there are differences you can use to distinguish clients.

[ramerk@oc6557108854 rfe_rtc_bridge]$ scripts/gen_build_info.sh v3
buildstamp=2014/05/07 08:21
db2jccversion=IBM DB2 JDBC Universal Driver Architecture 3.50.152
rtcclientversion=3.1.0.v20120504
[ramerk@oc6557108854 rfe_rtc_bridge]$ scripts/gen_build_info.sh v4
buildstamp=2014/05/07 08:21
db2jccversion=IBM DB2 JDBC Universal Driver Architecture 3.50.152
rtcclientversion=3.1.500.v20130501


Donald Nong commented May 07 '14, 10:02 p.m.

If you're going to get the version of each library (.jar), then reading the "Bundle-Version" property in the META-INF\MANIFEST.MF file in the .jar file appears to be more reliable. Most of the plugin libraries contain this file.


permanent link
Arne Bister (2.6k12732) | answered May 07 '14, 1:50 a.m.
JAZZ DEVELOPER
Kevin,

will the article 361 on Share and Manage Documents through the Web UI do the job?
If this is helpful, please accept the answer.

- Arne

permanent link
Ralph Schoon (59.4k23642) | answered May 07 '14, 4:12 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
I was not able to find the code that prints the version of the Plain Java Client Libraries.

Comments
Ralph Schoon commented May 07 '14, 4:28 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

You could try to look if com.ibm.team.repository.service.internal.VersionCompatibilityRestService provides you with some information. It does however not seem to be the version of the Plain Java Client Libraries.


Your answer


Register or to post your answer.