Package org.apache.maven.scm.provider.jazz.command

Examples of org.apache.maven.scm.provider.jazz.command.JazzScmCommand


        }

        JazzUpdateConsumer updateConsumer = new JazzUpdateConsumer( repo, getLogger() );
        ErrorConsumer err = new ErrorConsumer( getLogger() );

        JazzScmCommand updateCmd = createAcceptCommand( repo, fileSet );
        int status = updateCmd.execute( updateConsumer, err );

        if ( status != 0 || err.hasBeenFed() )
        {
            return new UpdateScmResult( updateCmd.getCommandString(),
                                        "Error code for Jazz SCM update command - " + status, err.getOutput(), false );
        }

        if ( getLogger().isDebugEnabled() )
        {
            Iterator<ScmFile> iter = updateConsumer.getUpdatedFiles().iterator();
            if ( iter.hasNext() )
            {
                getLogger().debug( "Iterating over \"Update\" results" );
                while ( iter.hasNext() )
                {
                    ScmFile file = (ScmFile) iter.next();
                    getLogger().debug( file.getPath() + " : " + file.getStatus() );
                }
            }
            else
            {
                getLogger().debug( "There are no updated files" );
            }
        }

        // Now, just (re)load the workspace into the sand box.
        // We can use the checkout directory for this.
        return new UpdateScmResult( updateCmd.getCommandString(), updateConsumer.getUpdatedFiles() );
    }
View Full Code Here


            getLogger().debug( "Executing checkin command..." );
        }

        // Create a changeset. We need to do this, as otherwise the information contained in the message
        // will be lost forever.
        JazzScmCommand createChangesetCmd = createCreateChangesetCommand( repository, fileSet, message );
        DebugLoggerConsumer outputConsumer = new DebugLoggerConsumer( getLogger() );
        ErrorConsumer errConsumer = new ErrorConsumer( getLogger() );

        int status = createChangesetCmd.execute( outputConsumer, errConsumer );
        if ( status != 0 || errConsumer.hasBeenFed() )
        {
            return new CheckInScmResult( createChangesetCmd.getCommandString(),
                                         "Error code for Jazz SCM create changeset command - " + status,
                                         errConsumer.getOutput(), false );
        }

        // Now check in the files themselves.
View Full Code Here

        return new UpdateScmResult( updateCmd.getCommandString(), updateConsumer.getUpdatedFiles() );
    }

    public JazzScmCommand createAcceptCommand( ScmProviderRepository repo, ScmFileSet fileSet )
    {
        JazzScmCommand command = new JazzScmCommand( JazzConstants.CMD_ACCEPT, repo, fileSet, getLogger() );

        command.addArgument( JazzConstants.ARG_FLOW_COMPONENTS );

        return command;
    }
View Full Code Here

        // Now, if it has a flow target, deliver it.
        JazzScmProviderRepository jazzRepo = (JazzScmProviderRepository) repo;
        if ( jazzRepo.isPushChangesAndHaveFlowTargets() )
        {
            // Push if we need too
            JazzScmCommand deliverCmd = createDeliverCommand( (JazzScmProviderRepository) repo, fileSet );
            StreamConsumer deliverConsumer =
                new DebugLoggerConsumer( getLogger() );      // No need for a dedicated consumer for this
            ErrorConsumer errConsumer = new ErrorConsumer( getLogger() );

            int status = deliverCmd.execute( deliverConsumer, errConsumer );
            if ( status != 0 || errConsumer.hasBeenFed() )
            {
                return new CheckInScmResult( deliverCmd.getCommandString(),
                                             "Error code for Jazz SCM deliver command - " + status,
                                             errConsumer.getOutput(), false );
            }
        }
View Full Code Here

        return new CheckInScmResult( addResult.getCommandLine(), addResult.getAddedFiles() );
    }

    public JazzScmCommand createCreateChangesetCommand( ScmProviderRepository repo, ScmFileSet fileSet, String message )
    {
        JazzScmCommand command =
            new JazzScmCommand( JazzConstants.CMD_CREATE, JazzConstants.CMD_SUB_CHANGESET, repo, false, fileSet,
                                getLogger() );
        command.addArgument( message );

        return command;
    }
View Full Code Here

        return command;
    }

    public JazzScmCommand createCheckInCommand( ScmProviderRepository repo, ScmFileSet fileSet )
    {
        JazzScmCommand command =
            new JazzScmCommand( JazzConstants.CMD_CHECKIN, null, repo, false, fileSet, getLogger() );

        // TODO, this was taken out to quickly test how the release plugin works.
        // The release plugin has the fileSet.getbaseDir() as the project it is checking in
        // This happens to be a folder under the sandbox root, and so the checkin would fail because it needs
        // to check in at the sandbox root level (not sub folders)
        // The SCM Plugin has a basedir parameter that you can pass it, so everythig works ok from the scm-plugin alone
        // but the release-plugin doesn't look like it lets you do that. (or I didn't have enough time
        // to figure out how to do it properly).

        // if (fileSet != null) {
        // command.addArgument(JazzConstants.LOAD_ROOT_DIRECTORY_ARG);
        // command.addArgument(fileSet.getBasedir().getAbsolutePath());
        // }

        List<File> files = fileSet.getFileList();
        if ( files != null && !files.isEmpty() )
        {
            Iterator<File> it = files.iterator();
            while ( it.hasNext() )
            {
                File file = (File) it.next();
                command.addArgument( file.getPath() ); // Check in only the files specified
            }
        }
        else
        {
            command.addArgument( "." ); // This will check in all local changes
        }

        return command;
    }
View Full Code Here

    // Create the JazzScmCommand to execute the "scm deliver ..." command
    // This will deliver the changes to the flow target (stream or other workspace).
    public JazzScmCommand createDeliverCommand( JazzScmProviderRepository repo, ScmFileSet fileSet )
    {
        JazzScmCommand command = new JazzScmCommand( JazzConstants.CMD_DELIVER, repo, fileSet, getLogger() );

        if ( repo.getWorkspace() != null && !repo.getWorkspace().equals( "" ) )
        {
            command.addArgument( JazzConstants.ARG_DELIVER_SOURCE );
            command.addArgument( repo.getWorkspace() );
        }

        if ( repo.getFlowTarget() != null && !repo.getFlowTarget().equals( "" ) )
        {
            command.addArgument( JazzConstants.ARG_DELIVER_TARGET );
            command.addArgument( repo.getFlowTarget() );
        }

        // This command is needed so that the deliver operation will work.
        // Files that are not under source control (a--) [temp files etc]
        // will cause the deliver operation to fail with the error:
        // "Cannot deliver because there are one or more items that are not checked in.
        // Check in the changes or rerun with --overwrite-uncommitted."
        // However, from the maven perspective, we only need files that are
        // under source control to be delivered. Maven has already checked
        // for this (via the status command).
        //
        // So we add this argument to allow the deliver to work.
        command.addArgument( JazzConstants.ARG_OVERWRITE_UNCOMMITTED );

        return command;
    }
View Full Code Here

        }

        DebugLoggerConsumer editConsumer = new DebugLoggerConsumer( getLogger() );
        ErrorConsumer errConsumer = new ErrorConsumer( getLogger() );

        JazzScmCommand editCmd = createEditCommand( repo, fileSet );
        int status = editCmd.execute( editConsumer, errConsumer );

        if ( status != 0 || errConsumer.hasBeenFed() )
        {
            return new EditScmResult( editCmd.getCommandString(), "Error code for Jazz SCM edit command - " + status,
                                      errConsumer.getOutput(), false );
        }

        return new EditScmResult( editCmd.getCommandString(), "Successfully Completed.", editConsumer.getOutput(),
                                  true );
    }
View Full Code Here

                                  true );
    }

    protected JazzScmCommand createEditCommand( ScmProviderRepository repo, ScmFileSet fileSet )
    {
        JazzScmCommand command =
            new JazzScmCommand( JazzConstants.CMD_LOCK, JazzConstants.CMD_SUB_ACQUIRE, repo, fileSet, getLogger() );

        List<File> files = fileSet.getFileList();
        if ( files != null && !files.isEmpty() )
        {
            Iterator<File> it = files.iterator();
            while ( it.hasNext() )
            {
                File file = (File) it.next();
                command.addArgument( file.getPath() ); // Lock only the files specified
            }
        }
        else
        {
            command.addArgument( "." ); // Lock all files
        }
        return command;
    }
View Full Code Here

        }

        // Now that we have a list of files to process, we can "add" (scm checkin) them.
        JazzAddConsumer addConsumer = new JazzAddConsumer( repo, getLogger() );
        ErrorConsumer errConsumer = new ErrorConsumer( getLogger() );
        JazzScmCommand command = createAddCommand( repo, fileSet );

        int status = command.execute( addConsumer, errConsumer );
        if ( status != 0 || errConsumer.hasBeenFed() )
        {
            return new AddScmResult( command.getCommandString(),
                                     "Error code for Jazz SCM add (checkin) command - " + status,
                                     errConsumer.getOutput(), false );
        }

        return new AddScmResult( command.getCommandString(), addConsumer.getFiles() );
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.scm.provider.jazz.command.JazzScmCommand

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.