Using the Java API

The Java API is separated into a set of packages and classes. Keep the following in mind:

  • The main class is SSCMAPI, which includes methods for all primary actions that can be performed against the Surround SCM Server. This class is located in the com.seapine.surroundscm.api package.
  • The Surround SCM API library file must be in the application path for the solution to run.

Key concepts

All calls use an SSCMContext class as the container that holds data for the currently connected session. The Mainline and Branch members are used by other functions to identify the mainline and branch to perform operations against. The Cookie member is initially populated inside the connect function.

You typically begin using the API with a call to SSCMAPI.Connect, which establishes the initial SSCMContext. You then set the context to the mainline and repository currently used. After all calls are complete, make a final call to SSCMAPI.Disconnect to close the session.

SSCMResult class

All calls also return an SSCMResult class or one of its subclasses. This result code indicates the status of the last call made and defines several enumerated values are defined. You can use the SSCMAPI.getLastError static method to return a string based on the error code and the error generated by the Surround SCM Server. Only the server error string for the last error is stored by the API. The call string is cleared on the next successful function call.

Using the API on Mac

The surroundscm-api.jar looks for the native library using the libsscmapi.jnilib filename. The native library included with the API is named in the following format: libsscmapi.x.y.z.dylib, where x, y, and z are the major, minor, and point release version numbers respectively.

To use the API on Mac, create a symlink called libsscmapi.jnilib that points to the native library.

Using the API on Linux

The surroundscm-api.jar looks for the native library using the libsscmapi.so filename. The native library included with the API is named in the following format: libsscmapi.so.x.y.z, where x, y, and z are the major, minor, and point release version numbers respectively.

To use the API on Linux, create a symlink called libsscmapi.so that points to the native library.