简体   繁体   中英

MKS Integrity Java api throws exception on createsandbox

i try to implement a Java Application to sync down sandboxes.

Command cmd = new Command( Command.SI, "createsandbox" );
cmd.addOption( new Option( "recurse" ) );
cmd.addOption( new Option( "nopopulate" ) );
cmd.addOption( new Option( "project", ptcProject ) );
cmd.addOption( new Option( "cwd", sandboxDir ) );
api.runCommand( cmd );

With this part of sourcecode I got this Exception.

Sandboxes cannot be created or imported directly on the Integrity Server.

as Input i use for Project

Project: #p=e:/MKSProjects/<unknown>/<unknown>.pj#<subproject>/project.pj
cwd: C:\\Temp\\<notexistingfolder>

What is wrong here? My MKSAPI.jar Version is 4.15

As @vasilenicusor said, use a LocalIntegrationPoint to create a sandbox on the local machine.

This code works the way you are expecting ...

IntegrationPointFactory ipfact = IntegrationPointFactory.getInstance();

IntegrationPoint ip = ipfact.createLocalIntegrationPoint(APIVersion.API_4_16);

Session session = ip.createNamedSession("test", APIVersion.API_4_16, user, passwd);

CmdRunner cr = session.createCmdRunner();

Command cmd = new Command( Command.SI, "createsandbox" );
cmd.addOption( new Option( "recurse" ) );
cmd.addOption( new Option( "nopopulate" ) );
cmd.addOption( new Option( "project", ptcProject ) );
cmd.addOption( new Option( "cwd", sandboxDir ) );

cr.execute(cmd);

cr.release();

session.release();

ip.release();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM