com.sap.mdm.examples
Class GetServerVersion
java.lang.Object
com.sap.mdm.examples.GetServerVersion
- public class GetServerVersion
- extends Object
This example shows you how to create a simple connection and
execute the session-less command GetServerVersionCommand.
The first thing the program does is to create a connection using the getInstance()
method of the SimpleConnectionFactory class.
This method requires a string argument as a ConnectionTag.
The ConnectionTag is the host name of the MDM Server, plus an optional TCP/IP port number
on which the server listens. The format is <host name or IP address>[;<port number>].
If no port number is given, the default port 59950 is used.
Examples for ConnectionTag:
localhost – connection the locally installed MDM server is created, using the default port.
some.server.com;41003 – connection using the non standard port 41003.
Note: Configuring the MDM Server to listen on a different port than the default port is not yet available.
If for any reason the connection can not be established, the factory class throws a ConnectionException.
Then an instance of the command GetServerVersionCommand is created.
As for any command, the constructor requires the used connection as an argument.
Since this command does not need any further arguments, the execute() method is called,
which sends the command to the server and waits for the result.
Any error after the calling of the execute() method will result in an CommandException being thrown.
Finally the result can be retrieved from the command using the getVersion() method,
which returns the build version of the MDM Server as a string.
Source code for GetServerVersion.java
main
public static void main(String[] args)
Copyright 2004-2007 by SAP AG. All Rights Reserved.
SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP
products and services mentioned herein as well as their respective logos
are trademarks or registered trademarks of SAP AG in Germany and in
several other countries all over the world. All other product and
service names mentioned are the trademarks of their respective
companies. Data contained in this document serves informational purposes
only. National product specifications may vary.
These materials are subject to change without notice. These materials
are provided by SAP AG and its affiliated companies (SAP Group) for
informational purposes only, without representation or warranty of any
kind, and SAP Group shall not be liable for errors or omissions with
respect to the materials. The only warranties for SAP Group products and
services are those that are set forth in the express warranty statements
accompanying such products and services, if any. Nothing herein should
be construed as constituting an additional warranty.