Package com.mks.api.response

Examples of com.mks.api.response.Response


        IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
        try
        {
            Sandbox siSandbox = iRepo.getSandbox();
            File memberFile = new File( workingDirectory.getAbsoluteFile() + File.separator + filename );
            Response res = siSandbox.lock( memberFile, filename );
            int exitCode = res.getExitCode();
            boolean success = ( exitCode == 0 ? true : false );
            result = new ScmResult( res.getCommandString(), "", "Exit Code: " + exitCode, success );
        }
        catch ( APIException aex )
        {
            ExceptionHandler eh = new ExceptionHandler( aex );
            getLogger().error( "MKS API Exception: " + eh.getMessage() );
View Full Code Here


        IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
        try
        {
            Sandbox siSandbox = iRepo.getSandbox();
            File memberFile = new File( workingDirectory.getAbsoluteFile() + File.separator + filename );
            Response res = siSandbox.unlock( memberFile, filename );
            int exitCode = res.getExitCode();
            boolean success = ( exitCode == 0 ? true : false );
            result = new ScmResult( res.getCommandString(), "", "Exit Code: " + exitCode, success );
        }
        catch ( APIException aex )
        {
            ExceptionHandler eh = new ExceptionHandler( aex );
            getLogger().error( "MKS API Exception: " + eh.getMessage() );
View Full Code Here

        EditScmResult result;
        IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
        try
        {
            Sandbox siSandbox = iRepo.getSandbox();
            Response res = siSandbox.makeWriteable();
            int exitCode = res.getExitCode();
            boolean success = ( exitCode == 0 ? true : false );
            result = new EditScmResult( res.getCommandString(), "", "Exit Code: " + exitCode, success );
        }
        catch ( APIException aex )
        {
            ExceptionHandler eh = new ExceptionHandler( aex );
            getLogger().error( "MKS API Exception: " + eh.getMessage() );
View Full Code Here

        getLogger().info( "Creating subprojects one per directory, as required for " + dirPath );
        MkdirScmResult result;
        IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
        try
        {
            Response res = iRepo.getSandbox().createSubproject( dirPath );
            String subProject = res.getWorkItems().next().getResult().getField( "resultant" ).getItem().getDisplayId();
            List<ScmFile> createdDirs = new ArrayList<ScmFile>();
            createdDirs.add( new ScmFile( subProject, ScmFileStatus.ADDED ) );
            int exitCode = res.getExitCode();
            boolean success = ( exitCode == 0 ? true : false );
            getLogger().info( "Successfully created subproject " + subProject );
            result = new MkdirScmResult( createdDirs,
                                         new ScmResult( res.getCommandString(), "", "Exit Code: " + exitCode,
                                                        success ) );
        }
        catch ( APIException aex )
        {
            ExceptionHandler eh = new ExceptionHandler( aex );
View Full Code Here

            getLogger().info( "Sandbox location is " + siSandbox.getSandboxDir() );
            // Now attempt to create the sandbox, if it doesn't already exist
            if ( siSandbox.create() )
            {
                // Resynchronize the new or previously created sandbox
                Response res = siSandbox.resync();
                // Lets output what we got from running this command
                WorkItemIterator wit = res.getWorkItems();
                while ( wit.hasNext() )
                {
                    WorkItem wi = wit.next();
                    if ( wi.getModelType().equals( SIModelTypeName.MEMBER ) )
                    {
                        Result message = wi.getResult();
                        getLogger().debug( wi.getDisplayId() + " " + ( null != message ? message.getMessage() : "" ) );
                    }
                }
                int exitCode = res.getExitCode();
                boolean success = ( exitCode == 0 ? true : false );
                result = new CheckOutScmResult( res.getCommandString(), "", "Exit Code: " + exitCode, success );
            }
            else
            {
                result = new CheckOutScmResult( "si createsandbox", "Failed to create sandbox!", "", false );
            }
View Full Code Here

        try
        {
            // Make sure we've got a valid sandbox, otherwise create it...
            if ( siSandbox.create() )
            {
                Response res = siSandbox.resync();
                // Lets capture what we got from running this resync
                WorkItemIterator wit = res.getWorkItems();
                while ( wit.hasNext() )
                {
                    WorkItem wi = wit.next();
                    if ( wi.getModelType().equals( SIModelTypeName.MEMBER ) )
                    {
                        Result message = wi.getResult();
                        getLogger().debug( wi.getDisplayId() + " " + ( null != message ? message.getMessage() : "" ) );
                        if ( null != message && message.getMessage().length() > 0 )
                        {
                            updatedFiles.add( new ScmFile( wi.getDisplayId(),
                                                           message.getMessage().equalsIgnoreCase( "removed" )
                                                               ? ScmFileStatus.DELETED
                                                               : ScmFileStatus.UPDATED ) );
                        }
                    }
                }
                return new UpdateScmResult( res.getCommandString(), updatedFiles );
            }
            else
            {
                return new UpdateScmResult( "si resync", "Failed to synchronize workspace", "", false );
            }
View Full Code Here

        getLogger().info(
            "Attempting to branch project " + siProject.getProjectName() + " using branch name '" + branchName + "'" );
        try
        {
            Project.validateTag( branchName );
            Response res = siProject.createDevPath( branchName );
            int exitCode = res.getExitCode();
            boolean success = ( exitCode == 0 ? true : false );
            ScmResult scmResult = new ScmResult( res.getCommandString(), "", "Exit Code: " + exitCode, success );
            result = new BranchScmResult( new ArrayList<ScmFile>(), scmResult );
        }
        catch ( APIException aex )
        {
            ExceptionHandler eh = new ExceptionHandler( aex );
View Full Code Here

            // Get information about the Project
            Project siProject = iRepo.getProject();
            // Ensure this is not a build project configuration
            if ( !siProject.isBuild() )
            {
                Response res = siProject.checkpoint( msg, chkptLabel );
                int exitCode = res.getExitCode();
                boolean success = ( exitCode == 0 ? true : false );
                WorkItem wi = res.getWorkItem( siProject.getConfigurationPath() );
                String chkpt = wi.getResult().getField( "resultant" ).getItem().getId();
                getLogger().info(
                    "Successfully checkpointed project " + siProject.getConfigurationPath() + " with label '"
                        + chkptLabel + "', new revision is " + chkpt );
                result =
                    new TagScmResult( res.getCommandString(), wi.getResult().getMessage(), "Exit Code: " + exitCode,
                                      success );
            }
            else
            {
                getLogger().error(
View Full Code Here

        coCMD.addOption( new Option( "revision", memberRev ) );
        // Add the member selection
        coCMD.addSelection( memberID );

        // Execute the checkout command
        Response res = api.runCommand( coCMD );

        // Return true if we were successful
        return ( res.getExitCode() == 0 );
    }
View Full Code Here

    public ExceptionHandler( APIException ex )
    {
       
        // API Exceptions can be nested.  Hence we will need to recurse the
        // exception hierarchy to dig for a conclusive message
        Response response = ex.getResponse();

        // Print the stack trace to standard out for debugging purposes
        ex.printStackTrace();
       
        // The API failed to execute the command (i.e. a real API error)
        if ( null == response )
        {           
            message = ex.getMessage();
            command = new java.lang.String();
            //exitCode = Integer.parseInt(ex.getExceptionId());
            exitCode = -1;
        }
        else
        {
            command = response.getCommandString();
            try
            {
                exitCode = response.getExitCode();
            }
            catch ( InterruptedException ie )
            {
                // Just print out the stack trace
                ie.printStackTrace();
                exitCode = -1;
            }
            WorkItemIterator wit = response.getWorkItems();
            // In the event there is a problem with one of the command's elements
            // we have to dig deeper into the exception...
            try
            {
                while ( wit.hasNext() )
View Full Code Here

TOP

Related Classes of com.mks.api.response.Response

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.