Currently, when using the API of Integrity (using the mskclient.jar as a library for all needed functions to communicate with the server) to connect to a server using a local integration point, the api will automatically start the client (assuming that `setAutoStartIntegrityClient`is called with `true` as the first parameter) which is set in the PATH environment variable at the first position. That, in general, works great, but is a problem when more than one client is installed on one machine and both are used to run a specific Java code using the MKS Api against a specific server (e.g. 10.8 and 10.9 as installed version).
A workaround would be, to adjust the PATH variable whenever I need to start another Integrity client. Unfortunately, this requires an ugly wrapper script for any Java code, which should be executed, to set adjust the PATH variable in this context only, or administrator permissions on a Windows machine to change it globally. Both ways aren't a real solution.
Example code:
IntegrationPointFactory ipf = IntegrationPointFactory.getInstance();
integrationPoint = ipf.createLocalIntegrationPoint(APIVersion.API_4_16);
integrationPoint.setAutoStartIntegrityClient(true);
Session session = integrationPoint.createNamedSession("testIntegrationPoint", null, getUserName(), getUserPass());
cmdRunner = session.createCmdRunner();
cmdRunner.setDefaultHostname("server_name");
cmdRunner.setDefaultPort(7001);
cmdRunner.setDefaultUsername(getUserName());
cmdRunner.setDefaultPassword(getUserPass());
cmdRunner.execute(new Command(Command.IM, "about"));
In this example, it would be great, to have a way to select the client to start, e.g. by a relative path, or an absolute one (in some, e.g. company, contexts, it's safe to assume, that a specific
application is installed in a specific path), e.g.:
IntegrationPointFactory ipf = IntegrationPointFactory.getInstance();
integrationPoint = ipf.createLocalIntegrationPoint(APIVersion.API_4_16);
integrationPoint.setIntegrityClientPath("C:\absolute\path\to\integrity\client\im.exe");
integrationPoint.setAutoStartIntegrityClient(true);
Session session = integrationPoint.createNamedSession("testIntegrationPoint", null, getUserName(), getUserPass());
cmdRunner = session.createCmdRunner();
cmdRunner.setDefaultHostname("server_name");
cmdRunner.setDefaultPort(7001);
cmdRunner.setDefaultUsername(getUserName());
cmdRunner.setDefaultPassword(getUserPass());
cmdRunner.execute(new Command(Command.IM, "about"));
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.