Home > 7.1, arsystem, java, remedy > Java – Get Server Information

Java – Get Server Information

December 21st, 2008

Using the Java API we can get all kinds of information about the AR System server.

In this example we will get information back about the server, operating system and databank. We are using the getServerInfo(requestList) method for that.

We first specify which information we want to get back from the server:

int[] requestList = new int[7];
requestList[0] = ServerInfo.DB_TYPE;
requestList[1] = ServerInfo.SERVER_IDENT;
requestList[2] = ServerInfo.OS;

We create a new integer array and fill it with the static values that we want. For example ServerInfo.DB_TYPE is the type of database. If you want to have a complete list of all the information you can get back refer to the ServerInfo class in the javadocs.

Now we go to the server and ask for a ServerInfoMap of the information. We use the .getServerInfo() method from ARServerUser for that.

ServerInfoMap serverInfoMap = context.getServerInfo(requestList);

What we have now is an object that is filled with the information we requested, we can get this information out by using the .get method of our ServerInfoMap object. like this:

System.out.println("Database Type: " + serverInfoMap.get(1));
System.out.println("Database Version: " + serverInfoMap.get(Constants.AR_SERVER_INFO_DB_VERSION));
System.out.println("Full Hostname: "+ serverInfoMap.get(Constants.AR_SERVER_INFO_FULL_HOSTNAME));

As you can see for the key we can use either the ServerInfo.INT, Constants.INT or the normal integer values.

You can download the full source code here: arsystemserverinfo (don’t forget to change the servername)

7.1, arsystem, java, remedy

  1. | #1

    great site you are having fresh content that helps to get knowledgeable information.

  1. No trackbacks yet.