Package org.apache.maven.continuum.configuration

Examples of org.apache.maven.continuum.configuration.ConfigurationService


    }

    public String view()
        throws Exception
    {
        ConfigurationService configuration = getContinuum().getConfiguration();

        for ( BuildAgentConfiguration agent : configuration.getBuildAgents() )
        {
            if ( agent.getUrl().equals( buildAgent.getUrl() ) )
            {
                buildAgent = agent;
View Full Code Here


    public String save()
        throws Exception
    {
        boolean found = false;

        ConfigurationService configuration = getContinuum().getConfiguration();

        if ( configuration.getBuildAgents() != null )
        {
            for ( BuildAgentConfiguration agent : configuration.getBuildAgents() )
            {
                if ( buildAgent.getUrl().equals( agent.getUrl() ) )
                {
                    agent.setDescription( buildAgent.getDescription() );
                    agent.setEnabled( buildAgent.isEnabled() );

                    configuration.updateBuildAgent( agent );
                    found = true;
                }
            }
        }

        AuditLog event = new AuditLog( "Build Agent URL=" + buildAgent.getUrl(), AuditLogConstants.MODIFY_BUILD_AGENT );
        event.setCategory( AuditLogConstants.BUILD_AGENT );
        event.setCurrentUser( getPrincipal() );

        if ( !found )
        {
            configuration.addBuildAgent( buildAgent );
            event.setAction( AuditLogConstants.ADD_BUILD_AGENT );
        }
        else
        {
            if ( type.equals( "new" ) )
View Full Code Here

        else
        {
            getContinuum().getDistributedBuildManager().removeDistributedBuildQueueOfAgent( buildAgent.getUrl() );
        }

        ConfigurationService configuration = getContinuum().getConfiguration();

        if ( configuration.getBuildAgentGroups() != null )
        {  
            for ( BuildAgentGroupConfiguration buildAgentGroup : configuration.getBuildAgentGroups() )
            {
                if ( configuration.containsBuildAgentUrl( buildAgent.getUrl(), buildAgentGroup ) )
                {
                    message = getText( "buildAgent.error.remove.in.use" );
                    return ERROR;
                }
            }
        }

        if ( configuration.getBuildAgents() != null )
        {
            for ( BuildAgentConfiguration agent : configuration.getBuildAgents() )
            {
                if ( buildAgent.getUrl().equals( agent.getUrl() ) )
                {
                    configuration.removeBuildAgent( agent );

                    AuditLog event = new AuditLog( "Build Agent URL=" + agent.getUrl(), AuditLogConstants.REMOVE_BUILD_AGENT );
                    event.setCategory( AuditLogConstants.BUILD_AGENT );
                    event.setCurrentUser( getPrincipal() );
                    event.log();
View Full Code Here

                message = getText( "buildAgentGroup.error.remove.in.use" );
                return ERROR;
            }
        }

        ConfigurationService configuration = getContinuum().getConfiguration();

        for ( BuildAgentGroupConfiguration group : configuration.getBuildAgentGroups() )
        {
            if ( buildAgentGroup.getName().equals( group.getName() ) )
            {
                configuration.removeBuildAgentGroup( group );

                AuditLog event = new AuditLog( "Build Agent Group=" + group.getName(), AuditLogConstants.REMOVE_BUILD_AGENT_GROUP );
                event.setCategory( AuditLogConstants.BUILD_AGENT );
                event.setCurrentUser( getPrincipal() );
                event.log();
View Full Code Here

    public String saveGroup()
        throws Exception
    {
        boolean found = false;

        ConfigurationService configuration = getContinuum().getConfiguration();
        selectedbuildAgents = getBuildAgentsFromSelectedBuildAgents();

        if ( buildAgentGroup.getName() != null )
        {
            if ( buildAgentGroup.getName().equals( "" ) )
            {
                addActionError( getResourceBundle().getString( "buildAgentGroup.error.name.required" ) );
                return INPUT;
            }
            else if ( buildAgentGroup.getName().trim().equals( "" ) )
            {
                addActionError( getText( "buildAgentGroup.error.name.cannot.be.spaces" ) );
                return INPUT;
            }
        }

        if ( configuration.getBuildAgentGroups() != null )
        {
            for ( BuildAgentGroupConfiguration group : configuration.getBuildAgentGroups() )
            {
                if ( buildAgentGroup.getName().equals( group.getName() ) )
                {
                    group.setName( buildAgentGroup.getName() );
                    configuration.updateBuildAgentGroup( group );
                    found = true;
                    break;
                }
            }
        }

        AuditLog event = new AuditLog( "Build Agent Group=" + buildAgentGroup.getName(), AuditLogConstants.MODIFY_BUILD_AGENT_GROUP );
        event.setCategory( AuditLogConstants.BUILD_AGENT );
        event.setCurrentUser( getPrincipal() );

        if ( !found )
        {
            buildAgentGroup.setBuildAgents( selectedbuildAgents );
            configuration.addBuildAgentGroup( buildAgentGroup );
            event.setAction( AuditLogConstants.ADD_BUILD_AGENT_GROUP );
        }
        else
        // found
        {
            if ( typeGroup.equals( "new" ) )
            {
                addActionError( getResourceBundle().getString( "buildAgentGroup.error.duplicate" ) );
                return INPUT;
            }
            else if ( typeGroup.equals( "edit" ) )
            {
                buildAgentGroup.setBuildAgents( selectedbuildAgents );
                configuration.updateBuildAgentGroup( buildAgentGroup );
            }
        }

        getContinuum().getDistributedBuildManager().reload();
        event.log();
View Full Code Here

    }

    public String inputGroup()
        throws Exception
    {
        ConfigurationService configuration = getContinuum().getConfiguration();

        if ( buildAgentGroup != null && !StringUtils.isBlank( buildAgentGroup.getName() ) )
        {
            List<BuildAgentGroupConfiguration> agentGroups = configuration.getBuildAgentGroups();

            for ( BuildAgentGroupConfiguration group : agentGroups )
            {
                if ( buildAgentGroup.getName().equals( group.getName() ) )
                {
                    buildAgentGroup = group;
                    typeGroup = "edit";

                    this.buildAgentGroup = configuration.getBuildAgentGroup( buildAgentGroup.getName() );
                    this.buildAgents = configuration.getBuildAgents();

                    this.selectedBuildAgentIds = new ArrayList<String>();
                    if ( this.buildAgentGroup.getBuildAgents() != null )
                    {
                        for ( BuildAgentConfiguration buildAgentConfiguration : buildAgentGroup.getBuildAgents() )
View Full Code Here

        {
            Schedule schedule = getContinuum().getSchedule( scheduleId );
            dirPurge.setSchedule( schedule );
        }

        ConfigurationService configService = getContinuum().getConfiguration();
        String path = null;

        if ( this.directoryType.equals( PURGE_DIRECTORY_RELEASES ) )
        {
            path = configService.getWorkingDirectory().getAbsolutePath();
        }
        else if ( this.directoryType.equals( PURGE_DIRECTORY_BUILDOUTPUT ) )
        {
            path = configService.getBuildOutputDirectory().getAbsolutePath();
        }

        dirPurge.setLocation( path );

        return dirPurge;
View Full Code Here

                    populateGroupSummary( latestBuild );
                    model.setLastBuildDateTime( latestBuild.getEndTime() );
                    model.setLastBuildDuration( latestBuild.getDurationTime() );
                }

                ConfigurationService configuration = getContinuum().getConfiguration();

                if ( configuration.isDistributedBuildEnabled() &&
                                project.getState() == ContinuumProjectState.BUILDING )
                {
                    model.setLatestBuildId( 0 );
                }
            }
View Full Code Here

        final File chrootJailFile = new File( toSystemPath( "/home" ) );
        final File workingDirectory = new File( toSystemPath( "/dir1/dir2/workingdir" ) );

        final ShellCommandHelper helper = context.mock( ShellCommandHelper.class );

        ConfigurationService configurationService = new DefaultConfigurationService()
        {
            @Override
            public File getWorkingDirectory()
            {
                return workingDirectory;
View Full Code Here

    private boolean distributedBuildEnabled;

    public void prepare()
    {
        ConfigurationService configuration = getContinuum().getConfiguration();

        File workingDirectoryFile = configuration.getWorkingDirectory();
        if ( workingDirectoryFile != null )
        {
            workingDirectory = workingDirectoryFile.getAbsolutePath();
        }

        File buildOutputDirectoryFile = configuration.getBuildOutputDirectory();
        if ( buildOutputDirectoryFile != null )
        {
            buildOutputDirectory = buildOutputDirectoryFile.getAbsolutePath();
        }

        File deploymentRepositoryDirectoryFile = configuration.getDeploymentRepositoryDirectory();
        if ( deploymentRepositoryDirectoryFile != null )
        {
            deploymentRepositoryDirectory = deploymentRepositoryDirectoryFile.getAbsolutePath();
        }

        baseUrl = configuration.getUrl();

        if ( StringUtils.isEmpty( baseUrl ) )
        {
            HttpServletRequest request = ServletActionContext.getRequest();
            baseUrl = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() +
                request.getContextPath();
            logger.info( "baseUrl='" + baseUrl + "'" );
        }

        File releaseOutputDirectoryFile = configuration.getReleaseOutputDirectory();
        if ( releaseOutputDirectoryFile != null )
        {
            releaseOutputDirectory = releaseOutputDirectoryFile.getAbsolutePath();
        }

        numberOfAllowedBuildsinParallel = configuration.getNumberOfBuildsInParallel();

        if ( numberOfAllowedBuildsinParallel == 0 )
        {
            numberOfAllowedBuildsinParallel = 1;
        }

        String requireRelease = ServletActionContext.getRequest().getParameter( "requireReleaseOutput" );
        setRequireReleaseOutput( Boolean.valueOf( requireRelease ) );

        distributedBuildEnabled = configuration.isDistributedBuildEnabled();
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.continuum.configuration.ConfigurationService

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.