cancel
Showing results for 
Search instead for 
Did you mean: 

Getting the Portal version

Former Member
0 Kudos

Hi,

I wanted to write a java code that will fetch me the Portal Version.

I have installed the Portal 6.0 SP9

I came across this code in the jar

"com.sap.portal.runtime.system.clusterinformation_api.jar"

private File getVersionRootDir()

{

IClusterInformation clusterInfo = (IClusterInformation)PortalRuntime.getRuntimeResources().getService("com.sap.portal.runtime.system.clusterinformation.clusterinformation");

String serverRootDir = clusterInfo.getSAPJ2EEServerDirectory();

return new File(serverRootDir, "../../portal_misc/versions");

}

Now i went through the class IClusterInformation which is an interface.

Here it is an abstarct class

public abstract String getSAPJ2EEServerDirectory();

I wanted to get the implementation of this method.

Thank

Manoj

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Manoj,

Can you please let me know the jar file that has to be included to access the class IClusterInformation.

Thanks,

Sudhir

Former Member
0 Kudos

Hi Sudhir,

I did not get the class IClusterInformation.

But if you want to get the Portal version you could do the folloiwng

Try to get the following System property form the J2EE server.

System.getProperty("sys.global.dir");

Here you will get the path

/usr/sap/<SAPSID>/SYS/global.

Form here write Java code to do the followign

String sysGlobalDir = System.getProperty("sys.global.dir");

if (sysGlobalDir == null)

{

// aRequest.getLogger().warning(this, "getVersionRootDir(): system property sys.global.dir not set.");

System.out.println( "getVersionRootDir(): system property sys.global.dir not set.");

} else

{

versionRootDir = new File(sysGlobalDir, "portal_versions");

}

if (versionRootDir != null && versionRootDir.exists())

{

File versionTxtFile = new File(versionRootDir, "version_id.txt");

if (versionTxtFile.exists())

{

portalVersion = getVersionNumber(versionTxtFile);

} else

{

System.err.println("FILE DOES NOT EXIST");

}

}

implement the getVersionNumber() funmction to read the line form the file version_id.txt.

Hope this helps

Regards

Manoj

Former Member
0 Kudos

Hi,

Have a look at class com.sapportals.portal.prt.runtime.PortalRuntime. There is a method getVersion(). I think this is what you need.

Regards

Daniel