Package org.apache.continuum.taskqueue

Examples of org.apache.continuum.taskqueue.BuildProjectTask


        Map<String, BuildProjectTask> currentBuilds = getContinuum().getBuildsManager().getCurrentBuilds();
        Set<String> keySet = currentBuilds.keySet();

        for ( String key : keySet )
        {
            BuildProjectTask task = currentBuilds.get( key );
            if ( task != null )
            {
                return task.getProjectId();
            }
        }
        return -1;
    }
View Full Code Here


    // ----------------------------------------------------------------------

    public void executeTask( Task task )
        throws TaskExecutionException
    {
        BuildProjectTask buildProjectTask = (BuildProjectTask) task;

        controller.build( buildProjectTask.getProjectId(), buildProjectTask.getBuildDefinitionId(),
                          buildProjectTask.getBuildTrigger(), buildProjectTask.getScmResult() );
    }
View Full Code Here

            Map<String, BuildProjectTask> currentBuildMap =
                getContinuum().getDistributedBuildManager().getProjectsCurrentlyBuilding();

            for ( String url : currentBuildMap.keySet() )
            {
                BuildProjectTask task = currentBuildMap.get( url );

                Project project = getContinuum().getProject( task.getProjectId() );

                DistributedBuildSummary summary = new DistributedBuildSummary();
                summary.setProjectId( project.getId() );
                summary.setProjectName( project.getName() );
                summary.setProjectGroupName( project.getProjectGroup().getName() );
                summary.setBuildDefinitionId( task.getBuildDefinitionId() );
                summary.setBuildDefinitionLabel( task.getBuildDefinitionLabel() );
                summary.setHashCode( task.getHashCode() );
                summary.setBuildAgentUrl( url );

                currentDistributedBuilds.add( summary );
            }

            // prepare build queues
            Map<String, List<PrepareBuildProjectsTask>> prepareBuildMap =
                getContinuum().getDistributedBuildManager().getProjectsInPrepareBuildQueue();

            for ( String url : prepareBuildMap.keySet() )
            {
                for ( PrepareBuildProjectsTask task : prepareBuildMap.get( url ) )
                {
                    ProjectGroup projectGroup = getContinuum().getProjectGroup( task.getProjectGroupId() );

                    PrepareBuildSummary summary = new PrepareBuildSummary();
                    summary.setBuildAgentUrl( url );
                    summary.setProjectGroupId( task.getProjectGroupId() );
                    summary.setProjectGroupName( projectGroup.getName() );
                    summary.setScmRootAddress( task.getScmRootAddress() );
                    summary.setScmRootId( task.getProjectScmRootId() );
                    summary.setHashCode( task.getHashCode() );

                    distributedPrepareBuildQueues.add( summary );
                }
            }

            // build queues
            Map<String, List<BuildProjectTask>> buildMap =
                getContinuum().getDistributedBuildManager().getProjectsInBuildQueue();

            for ( String url : buildMap.keySet() )
            {
                for ( BuildProjectTask task : buildMap.get( url ) )
                {
                    DistributedBuildSummary summary = new DistributedBuildSummary();

                    Project project = getContinuum().getProject( task.getProjectId() );

                    summary.setProjectId( project.getId() );
                    summary.setProjectName( project.getName() );
                    summary.setProjectGroupName( project.getProjectGroup().getName() );
                    summary.setBuildDefinitionId( task.getBuildDefinitionId() );
                    summary.setBuildDefinitionLabel( task.getBuildDefinitionLabel() );
                    summary.setHashCode( task.getHashCode() );
                    summary.setBuildAgentUrl( url );

                    distributedBuildQueues.add( summary );
                }
            }

            return DISTRIBUTED_BUILD_SUCCESS;
        }
        else
        {
            try
            {
                // current prepare builds
                Map<String, PrepareBuildProjectsTask> currentPrepareBuildTasks =
                    getContinuum().getBuildsManager().getCurrentProjectInPrepareBuild();

                Set<String> keySet = currentPrepareBuildTasks.keySet();
                for ( String key : keySet )
                {
                    PrepareBuildProjectsTask prepareBuildTask = currentPrepareBuildTasks.get( key );

                    PrepareBuildSummary s = new PrepareBuildSummary();
                    s.setProjectGroupId( prepareBuildTask.getProjectGroupId() );
                    s.setProjectGroupName( prepareBuildTask.getProjectGroupName() );
                    s.setScmRootId( prepareBuildTask.getProjectScmRootId() );
                    s.setScmRootAddress( prepareBuildTask.getScmRootAddress() );
                    s.setQueueName( key );
                    currentPrepareBuilds.add( s );
                }
            }
            catch ( BuildManagerException e )
            {
                addActionError( e.getMessage() );
                return ERROR;
            }

            try
            {
                // current builds
                Map<String, BuildProjectTask> currentBuilds = getContinuum().getBuildsManager().getCurrentBuilds();
                Set<String> keySet = currentBuilds.keySet();
                for ( String key : keySet )
                {
                    BuildProjectTask buildTask = currentBuilds.get( key );
                    BuildProjectQueue queue = new BuildProjectQueue();
                    queue.setName( key );
                    queue.setTask( buildTask );
                    currentBuildProjectTasks.add( queue );
                }
View Full Code Here

        for ( BuildContext buildContext : buildContexts )
        {
            BuildTrigger buildTrigger = new BuildTrigger( buildContext.getTrigger(), buildContext.getUsername() );

            BuildProjectTask buildProjectTask = new BuildProjectTask( buildContext.getProjectId(),
                                                                      buildContext.getBuildDefinitionId(), buildTrigger,
                                                                      buildContext.getProjectName(),
                                                                      buildContext.getBuildDefinitionLabel(),
                                                                      buildContext.getScmResult(),
                                                                      buildContext.getProjectGroupId() );
            buildProjectTask.setMaxExecutionTime( buildContext.getMaxExecutionTime() * 1000 );

            try
            {
                if ( !buildAgentTaskQueueManager.isProjectInBuildQueue( buildProjectTask.getProjectId() ) )
                {
                    log.info( "Adding project {} to build queue", buildProjectTask.getProjectId() );
                    buildAgentTaskQueueManager.getBuildQueue().put( buildProjectTask );
                }
            }
            catch ( TaskQueueException e )
            {
View Full Code Here

    {
        try
        {
            Map<String, Object> project = new HashMap<String, Object>();

            BuildProjectTask task = buildAgentTaskQueueManager.getCurrentProjectInBuilding();

            if ( task != null )
            {
                project.put( ContinuumBuildAgentUtil.KEY_PROJECT_ID, new Integer( task.getProjectId() ) );
                project.put( ContinuumBuildAgentUtil.KEY_BUILD_DEFINITION_ID, new Integer( task.getBuildDefinitionId() ) );
                project.put( ContinuumBuildAgentUtil.KEY_TRIGGER, new Integer( task.getTrigger() ) );
                project.put( ContinuumBuildAgentUtil.KEY_PROJECT_GROUP_ID, new Integer( task.getProjectGroupId() ) );
                project.put( ContinuumBuildAgentUtil.KEY_BUILD_DEFINITION_LABEL, task.getBuildDefinitionLabel() );
            }

            return project;
        }
        catch ( TaskQueueManagerException e )
View Full Code Here

            if ( currentPrepareBuildTask != null && currentPrepareBuildTask.getProjectGroupId() == projectGroupId )
            {
                return true;
            }

            BuildProjectTask currentBuildTask = buildAgentTaskQueueManager.getCurrentProjectInBuilding();

            if ( currentBuildTask != null && currentBuildTask.getProjectGroupId() == projectGroupId )
            {
                return true;
            }

            for ( PrepareBuildProjectsTask task : buildAgentTaskQueueManager.getProjectsInPrepareBuildQueue() )
View Full Code Here

    public boolean isProjectCurrentlyBuilding( int projectId )
    {
        try
        {
            BuildProjectTask currentBuildTask = buildAgentTaskQueueManager.getCurrentProjectInBuilding();

            if ( currentBuildTask != null && currentBuildTask.getProjectId() == projectId )
            {
                return true;
            }
        }
        catch ( TaskQueueManagerException e )
View Full Code Here

            // current builds
            Map<String, BuildProjectTask> currentBuildMap = getContinuum().getDistributedBuildManager().getProjectsCurrentlyBuilding();

            for ( String url : currentBuildMap.keySet() )
            {
                BuildProjectTask task = currentBuildMap.get( url );

                Project project = getContinuum().getProject( task.getProjectId() );

                DistributedBuildSummary summary = new DistributedBuildSummary();
                summary.setProjectId( project.getId() );
                summary.setProjectName( project.getName() );
                summary.setProjectGroupName( project.getProjectGroup().getName() );
                summary.setBuildDefinitionId( task.getBuildDefinitionId() );
                summary.setBuildDefinitionLabel( task.getBuildDefinitionLabel() );
                summary.setHashCode( task.getHashCode() );
                summary.setBuildAgentUrl( url );

                currentDistributedBuilds.add( summary );
            }
           
            // prepare build queues
            Map<String, List<PrepareBuildProjectsTask>> prepareBuildMap = getContinuum().getDistributedBuildManager().getProjectsInPrepareBuildQueue();

            for ( String url : prepareBuildMap.keySet() )
            {
                for ( PrepareBuildProjectsTask task : prepareBuildMap.get( url ) )
                {
                    ProjectGroup projectGroup = getContinuum().getProjectGroup( task.getProjectGroupId() );

                    PrepareBuildSummary summary = new PrepareBuildSummary();
                    summary.setBuildAgentUrl( url );
                    summary.setProjectGroupId( task.getProjectGroupId() );
                    summary.setProjectGroupName( projectGroup.getName() );
                    summary.setScmRootAddress( task.getScmRootAddress() );
                    summary.setScmRootId( task.getProjectScmRootId() );
                    summary.setHashCode( task.getHashCode() );

                    distributedPrepareBuildQueues.add( summary );
                }
            }

            // build queues
            Map<String, List<BuildProjectTask>> buildMap = getContinuum().getDistributedBuildManager().getProjectsInBuildQueue();

            for ( String url : buildMap.keySet() )
            {
                for ( BuildProjectTask task : buildMap.get( url ) )
                {
                    DistributedBuildSummary summary = new DistributedBuildSummary();

                    Project project = getContinuum().getProject( task.getProjectId() );

                    summary.setProjectId( project.getId() );
                    summary.setProjectName( project.getName() );
                    summary.setProjectGroupName( project.getProjectGroup().getName() );
                    summary.setBuildDefinitionId( task.getBuildDefinitionId() );
                    summary.setBuildDefinitionLabel( task.getBuildDefinitionLabel() );
                    summary.setHashCode( task.getHashCode() );
                    summary.setBuildAgentUrl( url );

                    distributedBuildQueues.add( summary );
                }
            }

            return DISTRIBUTED_BUILD_SUCCESS;
        }
        else
        {
            try
            {
                // current prepare builds
                PrepareBuildProjectsTask currentPrepareBuildTask = getContinuum().getBuildsManager().getCurrentProjectInPrepareBuild();

                if ( currentPrepareBuildTask != null )
                {
                    PrepareBuildSummary s = new PrepareBuildSummary();
                   
                    s.setProjectGroupId( currentPrepareBuildTask.getProjectGroupId() );
                    s.setProjectGroupName( currentPrepareBuildTask.getProjectGroupName() );
                    s.setScmRootId( currentPrepareBuildTask.getProjectScmRootId() );
                    s.setScmRootAddress( currentPrepareBuildTask.getScmRootAddress() );
                    currentPrepareBuilds.add( s );
                }
            }
            catch ( BuildManagerException e )
            {
                addActionError( e.getMessage() );
                return ERROR;
            }

            try
            {
                // current builds
                Map<String, BuildProjectTask> currentBuilds = getContinuum().getBuildsManager().getCurrentBuilds();
                Set<String> keySet = currentBuilds.keySet();
                for ( String key : keySet )
                {
                    BuildProjectTask buildTask = currentBuilds.get( key );
                    BuildProjectQueue queue = new BuildProjectQueue();
                    queue.setName( key );
                    queue.setTask( buildTask );
                    currentBuildProjectTasks.add( queue );
                }
View Full Code Here

        Map<String, BuildProjectTask> currentBuilds = getContinuum().getBuildsManager().getCurrentBuilds();
        Set<String> keySet = currentBuilds.keySet();

        for ( String key : keySet )
        {
            BuildProjectTask task = currentBuilds.get( key );
            if ( task != null )
            {
                return task.getProjectId();
            }
        }
        return -1;
    }
View Full Code Here

            if ( StringUtils.isEmpty( buildDefinitionLabel ) )
            {
                buildDefinitionLabel = buildDefinition.getGoals();
            }
   
            BuildProjectTask buildTask =
                new BuildProjectTask( projectId, buildDefinition.getId(), trigger, projectName, buildDefinitionLabel,
                                      scmResult, projectGroupId );
            try
            {
                log.info(
                    "Project '" + projectName + "' added to overall build queue '" + overallBuildQueue.getName() + "'." );
View Full Code Here

TOP

Related Classes of org.apache.continuum.taskqueue.BuildProjectTask

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.