Search in sources :

Example 11 with Sandbox

use of org.apache.maven.scm.provider.integrity.Sandbox in project maven-scm by apache.

the class IntegrityRemoveCommand method executeRemoveCommand.

/**
 * {@inheritDoc}
 */
@Override
public RemoveScmResult executeRemoveCommand(ScmProviderRepository repository, ScmFileSet fileSet, String message) throws ScmException {
    getLogger().info("Attempting to un-register sandbox in directory " + fileSet.getBasedir().getAbsolutePath());
    RemoveScmResult result;
    IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
    try {
        Sandbox siSandbox = iRepo.getSandbox();
        Response res = siSandbox.drop();
        int exitCode = res.getExitCode();
        boolean success = (exitCode == 0 ? true : false);
        result = new RemoveScmResult(res.getCommandString(), "", "Exit Code: " + exitCode, success);
    } catch (APIException aex) {
        ExceptionHandler eh = new ExceptionHandler(aex);
        getLogger().error("MKS API Exception: " + eh.getMessage());
        getLogger().info(eh.getCommand() + " exited with return code " + eh.getExitCode());
        result = new RemoveScmResult(eh.getCommand(), eh.getMessage(), "Exit Code: " + eh.getExitCode(), false);
    }
    return result;
}
Also used : Response(com.mks.api.response.Response) ExceptionHandler(org.apache.maven.scm.provider.integrity.ExceptionHandler) APIException(com.mks.api.response.APIException) IntegrityScmProviderRepository(org.apache.maven.scm.provider.integrity.repository.IntegrityScmProviderRepository) RemoveScmResult(org.apache.maven.scm.command.remove.RemoveScmResult) Sandbox(org.apache.maven.scm.provider.integrity.Sandbox)

Aggregations

Sandbox (org.apache.maven.scm.provider.integrity.Sandbox)11 IntegrityScmProviderRepository (org.apache.maven.scm.provider.integrity.repository.IntegrityScmProviderRepository)11 APIException (com.mks.api.response.APIException)9 ExceptionHandler (org.apache.maven.scm.provider.integrity.ExceptionHandler)9 Response (com.mks.api.response.Response)8 ScmResult (org.apache.maven.scm.ScmResult)5 ScmFile (org.apache.maven.scm.ScmFile)4 WorkItem (com.mks.api.response.WorkItem)3 File (java.io.File)3 Result (com.mks.api.response.Result)2 WorkItemIterator (com.mks.api.response.WorkItemIterator)2 ArrayList (java.util.ArrayList)2 ScmException (org.apache.maven.scm.ScmException)2 AddScmResult (org.apache.maven.scm.command.add.AddScmResult)1 CheckInScmResult (org.apache.maven.scm.command.checkin.CheckInScmResult)1 CheckOutScmResult (org.apache.maven.scm.command.checkout.CheckOutScmResult)1 EditScmResult (org.apache.maven.scm.command.edit.EditScmResult)1 LoginScmResult (org.apache.maven.scm.command.login.LoginScmResult)1 RemoveScmResult (org.apache.maven.scm.command.remove.RemoveScmResult)1 StatusScmResult (org.apache.maven.scm.command.status.StatusScmResult)1