Package org.apache.maven.continuum.configuration

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


    public BuildAgentConfiguration updateBuildAgent( BuildAgentConfiguration buildAgentConfiguration )
        throws ConfigurationStoringException, ContinuumConfigurationException
    {
        try
        {
            ConfigurationService configurationService = continuum.getConfiguration();
            org.apache.continuum.configuration.BuildAgentConfiguration buildAgent = configurationService.getBuildAgent(
                buildAgentConfiguration.getUrl() );
            BuildAgentConfiguration buildAgentConfigurationToUpdate = buildAgent != null ? populateBuildAgent(
                buildAgent ) : null;

            if ( buildAgentConfigurationToUpdate != null )
            {
                buildAgentConfigurationToUpdate.setDescription( StringEscapeUtils.escapeXml(
                    buildAgentConfiguration.getDescription() ) );
                buildAgentConfigurationToUpdate.setEnabled( buildAgentConfiguration.isEnabled() );
                configurationService.updateBuildAgent( populateBuildAgent( buildAgentConfigurationToUpdate ) );
                configurationService.store();
                return populateBuildAgent( configurationService.getBuildAgent( buildAgentConfiguration.getUrl() ) );
            }
            else
            {
                return null;
            }
View Full Code Here


        {
            addActionError( "Number of Allowed Builds in Parallel must be greater than zero." );
            return ERROR;
        }

        ConfigurationService configuration = getContinuum().getConfiguration();

        configuration.setWorkingDirectory( new File( workingDirectory ) );

        configuration.setBuildOutputDirectory( new File( buildOutputDirectory ) );

        configuration.setNumberOfBuildsInParallel( numberOfAllowedBuildsinParallel );

        if ( StringUtils.isNotEmpty( deploymentRepositoryDirectory ) )
        {
            configuration.setDeploymentRepositoryDirectory( new File( deploymentRepositoryDirectory ) );
        }
        else
        {
            configuration.setDeploymentRepositoryDirectory( null );
        }

        configuration.setUrl( baseUrl );

        configuration.setInitialized( true );

        if ( StringUtils.isNotEmpty( releaseOutputDirectory ) )
        {
            configuration.setReleaseOutputDirectory( new File( releaseOutputDirectory ) );
        }
        else if ( isRequireReleaseOutput() )
        {
            addActionError( getText( "configuration.releaseOutputDirectory.required" ) );
            return ERROR;
        }
        else
        {
            configuration.setReleaseOutputDirectory( null );
        }

        configuration.setDistributedBuildEnabled( distributedBuildEnabled );

        configuration.setSharedSecretPassword( sharedSecretPassword );

        configuration.store();

        return SUCCESS;
    }
View Full Code Here

    public boolean removeBuildAgent( String url )
        throws BuildAgentConfigurationException, ConfigurationStoringException, ContinuumConfigurationException,
        ContinuumException
    {
        ConfigurationService configurationService = continuum.getConfiguration();

        boolean SUCCESS;
        org.apache.continuum.configuration.BuildAgentConfiguration buildAgent = configurationService.getBuildAgent(
            url );
        BuildAgentConfiguration buildAgentConfiguration = buildAgent != null ? populateBuildAgent( buildAgent ) : null;
        if ( buildAgentConfiguration != null )
        {
            if ( continuum.getDistributedBuildManager().isBuildAgentBusy( buildAgentConfiguration.getUrl() ) )
            {
                throw new BuildAgentConfigurationException(
                    "Cannot delete build agent because it's busy at the moment" );
            }

            if ( configurationService.getBuildAgentGroups() != null )
            {
                for ( org.apache.continuum.configuration.BuildAgentGroupConfiguration buildAgentGroup : configurationService.getBuildAgentGroups() )
                {
                    if ( configurationService.containsBuildAgentUrl( buildAgentConfiguration.getUrl(),
                                                                     buildAgentGroup ) )
                    {
                        throw new BuildAgentConfigurationException(
                            "Cannot delete build agent because it's in use at the moment" );
                    }
                }
            }

            try
            {
                continuum.getDistributedBuildManager().removeDistributedBuildQueueOfAgent(
                    buildAgentConfiguration.getUrl() );
                configurationService.removeBuildAgent( populateBuildAgent( buildAgentConfiguration ) );
                configurationService.store();
                SUCCESS = true;
            }
            catch ( ContinuumException e )
            {
                throw new ContinuumException( "Error when removing build agent in build queue", e );
View Full Code Here

    }

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

        if ( buildAgent != null )
        {
            String escapedBuildAgentUrl = StringEscapeUtils.escapeXml( buildAgent.getUrl() );
            buildAgent.setUrl( escapedBuildAgentUrl );

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

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

        ConfigurationService configuration = getContinuum().getConfiguration();

        // escape xml to prevent xss attacks
        buildAgent.setDescription(
            StringEscapeUtils.escapeXml( StringEscapeUtils.unescapeXml( buildAgent.getDescription() ) ) );

        if ( configuration.getBuildAgents() != null )
        {
            for ( BuildAgentConfiguration agent : configuration.getBuildAgents() )
            {
                if ( agent.getUrl().equals( buildAgent.getUrl() ) )
                {
                    if ( type.equals( "new" ) )
                    {
                        addActionError( getResourceBundle().getString( "buildAgent.error.duplicate" ) );
                        return INPUT;
                    }
                    else
                    {
                        agent.setDescription( buildAgent.getDescription() );
                        agent.setEnabled( buildAgent.isEnabled() );
                        configuration.updateBuildAgent( agent );
                        configuration.store();
                    }
                    found = true;
                }
            }
        }

        // update first, so that we don't add or change it if it fails
        try
        {
            getContinuum().getDistributedBuildManager().update( buildAgent );
        }
        catch ( ContinuumException e )
        {
            addActionError( e.getMessage() );
            return INPUT;
        }

        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 );
            configuration.store();
            event.setAction( AuditLogConstants.ADD_BUILD_AGENT );
        }

        event.log();
View Full Code Here

        return SUCCESS;
    }

    public List<BuildAgentConfiguration> getAllBuildAgents()
    {
        ConfigurationService configurationService = continuum.getConfiguration();

        List<org.apache.continuum.configuration.BuildAgentConfiguration> buildAgents =
            configurationService.getBuildAgents();
        List<BuildAgentConfiguration> buildAgentConfigurations = new ArrayList<BuildAgentConfiguration>();

        if ( buildAgents != null )
        {
            for ( org.apache.continuum.configuration.BuildAgentConfiguration buildAgent : buildAgents )
View Full Code Here

    }

    public List<BuildAgentConfiguration> getBuildAgentsWithInstallations()
        throws Exception
    {
        ConfigurationService configurationService = continuum.getConfiguration();

        List<org.apache.continuum.configuration.BuildAgentConfiguration> buildAgents =
            configurationService.getBuildAgents();
        List<BuildAgentConfiguration> buildAgentConfigurations = new ArrayList<BuildAgentConfiguration>();

        if ( buildAgents != null )
        {
            for ( org.apache.continuum.configuration.BuildAgentConfiguration buildAgent : buildAgents )
View Full Code Here

        {
            message = getText( "buildAgent.error.delete.busy" );
            return ERROR;
        }

        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() ) )
                {
                    getContinuum().getDistributedBuildManager().removeDistributedBuildQueueOfAgent(
                        buildAgent.getUrl() );
                    configuration.removeBuildAgent( agent );
                    configuration.store();

                    AuditLog event =
                        new AuditLog( "Build Agent URL=" + agent.getUrl(), AuditLogConstants.REMOVE_BUILD_AGENT );
                    event.setCategory( AuditLogConstants.BUILD_AGENT );
                    event.setCurrentUser( getPrincipal() );
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

    }

    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

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.