Author Topic: How can I verify version of ODWEK Java API ?  (Read 5310 times)

Firoozeh M

  • Guest
How can I verify version of ODWEK Java API ?
« on: March 06, 2012, 09:20:42 AM »
as a CMOD developer I need to know how I can find the version of ODWEK Java API. is there any way to find that out?

johnnoel

  • Jr. Member
  • **
  • Posts: 35
    • View Profile
Re: How can I verify version of ODWEK Java API ?
« Reply #1 on: June 20, 2014, 08:37:23 PM »
Use ODServer class and GetVersion method.

Class ODServer
java.lang.Object
  extended by com.ibm.edms.od.ODServer

All Implemented Interfaces: java.io.Serializable


getVersion
public java.lang.String getVersion()
Get the ODWEK Version string for this version of the ODApi.jar.

Returns:String indicating the Release and PTF version of ODWEK.

Code Snippet

      ODConfig ocfg = new ODConfig();
      ODServer osrv = new ODServer(ocfg);
      osrv.initialize("Testing");
      osrv.setServerName("localhost");
      osrv.setPort(1445);
      osrv.setUserId("admin");
      osrv.setPassword("password");
      osrv.logon();
      System.out.println("ODWEK Version is " + osrv.getVersion());


Alessandro Perucchi

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1002
    • View Profile
Re: How can I verify version of ODWEK Java API ?
« Reply #2 on: March 18, 2015, 09:10:52 AM »
I know this is an old thread, but still... I've been bitten by that thing... so I prefer to give the correct solution.

As johnnoel said, you can use the method ODServer.getVersion().
BUT and that's important to know, when you compile java, it will try to optimize the output for performance.
And since the version of ODWEK is stored as a constant, and the getVersion() basically is returning that constant... the java compiled code will replace all ODServer.getVersion() with the ODWEK version you are using in your development environment.

Example: You are using ODWEK 9.0.0.1 to develop. You compile your code, and run it in a test environment with ODWEK 8.5.0.7... you test will still show ODWEK Version 9.0.0.1 instead of 8.5.0.7

This is really NASTY !!! And this was solved with ODWEK 9.5.

How to solve that, and ensure that you always have the version of ODWEK you are running, if you haven't compiled your Java with ODWEK 9.5?

Add .intern()

->  ODServer.getVersion().intern()

Hope that helps someone!

Yours sincerely,
Alessandro
Alessandro Perucchi

#Install #Migrations #Conversion #Educate #Repair #Upgrade #Migrate #Enhance #Optimize #AIX #Linux #Multiplatforms #DB2 #Windows #Oracle #TSM #Tivoli #Performance #Audits #Customizing #Availability #HA #DR #JavaApi #ContentNavigator #ICN #WEBi #ODWEK #Services #PDF #AFP #XML