Package org.apache.continuum.configuration.model

Examples of org.apache.continuum.configuration.model.ContinuumConfigurationModel


        FileInputStream fis = null;
        try
        {
            fis = new FileInputStream( file );
            ContinuumConfigurationModelXpp3Reader configurationXpp3Reader = new ContinuumConfigurationModelXpp3Reader();
            ContinuumConfigurationModel configuration = configurationXpp3Reader.read( new InputStreamReader( fis ) );

            this.generalConfiguration = new GeneralConfiguration();

            this.generalConfiguration.setNumberOfBuildsInParallel( configuration.getNumberOfBuildsInParallel() );
            this.generalConfiguration.setBaseUrl( configuration.getBaseUrl() );
            if ( StringUtils.isNotEmpty( configuration.getBuildOutputDirectory() ) )
            {
                // TODO take care if file exists ?
                this.generalConfiguration.setBuildOutputDirectory(
                    new File( configuration.getBuildOutputDirectory() ) );
            }
            if ( StringUtils.isNotEmpty( configuration.getDeploymentRepositoryDirectory() ) )
            {
                // TODO take care if file exists ?
                this.generalConfiguration.setDeploymentRepositoryDirectory(
                    new File( configuration.getDeploymentRepositoryDirectory() ) );
            }
            if ( StringUtils.isNotEmpty( configuration.getWorkingDirectory() ) )
            {
                // TODO take care if file exists ?
                this.generalConfiguration.setWorkingDirectory( new File( configuration.getWorkingDirectory() ) );
            }
            if ( configuration.getProxyConfiguration() != null )
            {
                ProxyConfiguration proxyConfiguration =
                    new ProxyConfiguration( configuration.getProxyConfiguration().getProxyHost(),
                                            configuration.getProxyConfiguration().getProxyPassword(),
                                            configuration.getProxyConfiguration().getProxyPort(),
                                            configuration.getProxyConfiguration().getProxyUser() );
                this.generalConfiguration.setProxyConfiguration( proxyConfiguration );
            }
            if ( StringUtils.isNotEmpty( configuration.getReleaseOutputDirectory() ) )
            {
                // TODO take care if file exists?
                this.generalConfiguration.setReleaseOutputDirectory(
                    new File( configuration.getReleaseOutputDirectory() ) );
            }
            if ( configuration.getBuildAgents() != null )
            {
                List<BuildAgentConfiguration> buildAgents = new ArrayList<BuildAgentConfiguration>();

                List<org.apache.continuum.configuration.model.BuildAgentConfiguration> agents =
                    configuration.getBuildAgents();
                for ( org.apache.continuum.configuration.model.BuildAgentConfiguration agent : agents )
                {
                    BuildAgentConfiguration buildAgent =
                        new BuildAgentConfiguration( agent.getUrl(), agent.getDescription(), agent.isEnabled() );
                    buildAgents.add( buildAgent );
                }

                this.generalConfiguration.setBuildAgents( buildAgents );
            }
            if ( configuration.getBuildAgentGroups() != null )
            {
                List<BuildAgentGroupConfiguration> buildAgentGroups = new ArrayList<BuildAgentGroupConfiguration>();
                List<org.apache.continuum.configuration.model.BuildAgentGroupConfiguration> groups =
                    configuration.getBuildAgentGroups();

                for ( org.apache.continuum.configuration.model.BuildAgentGroupConfiguration group : groups )
                {
                    List<BuildAgentConfiguration> agents = new ArrayList<BuildAgentConfiguration>();
                    List<org.apache.continuum.configuration.model.BuildAgentConfiguration> modelAgents =
View Full Code Here


    public void save( File file )
        throws ContinuumConfigurationException
    {
        try
        {
            ContinuumConfigurationModel configurationModel = new ContinuumConfigurationModel();
            configurationModel.setBaseUrl( this.generalConfiguration.getBaseUrl() );
            configurationModel.setNumberOfBuildsInParallel( this.generalConfiguration.getNumberOfBuildsInParallel() );

            // normally not null but NPE free is better !
            if ( this.generalConfiguration.getBuildOutputDirectory() != null )
            {
                configurationModel.setBuildOutputDirectory(
                    this.generalConfiguration.getBuildOutputDirectory().getPath() );
            }
            if ( this.generalConfiguration.getWorkingDirectory() != null )
            {
                configurationModel.setWorkingDirectory( this.generalConfiguration.getWorkingDirectory().getPath() );
            }
            if ( this.generalConfiguration.getDeploymentRepositoryDirectory() != null )
            {
                configurationModel.setDeploymentRepositoryDirectory(
                    this.generalConfiguration.getDeploymentRepositoryDirectory().getPath() );
            }
            if ( this.generalConfiguration.getProxyConfiguration() != null )
            {
                configurationModel.setProxyConfiguration(
                    new org.apache.continuum.configuration.model.ProxyConfiguration() );
                configurationModel.getProxyConfiguration().setProxyHost(
                    this.generalConfiguration.getProxyConfiguration().getProxyHost() );
                configurationModel.getProxyConfiguration().setProxyPassword(
                    this.generalConfiguration.getProxyConfiguration().getProxyPassword() );
                configurationModel.getProxyConfiguration().setProxyPort(
                    this.generalConfiguration.getProxyConfiguration().getProxyPort() );
                configurationModel.getProxyConfiguration().setProxyHost(
                    this.generalConfiguration.getProxyConfiguration().getProxyHost() );
            }
            if ( this.generalConfiguration.getReleaseOutputDirectory() != null )
            {
                configurationModel.setReleaseOutputDirectory(
                    this.generalConfiguration.getReleaseOutputDirectory().getPath() );
            }
            if ( this.generalConfiguration.getBuildAgents() != null )
            {
                List<org.apache.continuum.configuration.model.BuildAgentConfiguration> buildAgents =
                    new ArrayList<org.apache.continuum.configuration.model.BuildAgentConfiguration>();

                for ( BuildAgentConfiguration agent : this.generalConfiguration.getBuildAgents() )
                {
                    org.apache.continuum.configuration.model.BuildAgentConfiguration buildAgent =
                        new org.apache.continuum.configuration.model.BuildAgentConfiguration();
                    buildAgent.setUrl( agent.getUrl() );
                    buildAgent.setDescription( agent.getDescription() );
                    buildAgent.setEnabled( agent.isEnabled() );

                    buildAgents.add( buildAgent );
                }
                configurationModel.setBuildAgents( buildAgents );
            }
            if ( this.generalConfiguration.getBuildAgentGroups() != null )
            {
                List<org.apache.continuum.configuration.model.BuildAgentGroupConfiguration> buildAgentGroups =
                    new ArrayList<org.apache.continuum.configuration.model.BuildAgentGroupConfiguration>();

                for ( BuildAgentGroupConfiguration group : this.generalConfiguration.getBuildAgentGroups() )
                {
                    org.apache.continuum.configuration.model.BuildAgentGroupConfiguration buildAgentGroup =
                        new org.apache.continuum.configuration.model.BuildAgentGroupConfiguration();
                    buildAgentGroup.setName( group.getName() );

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

                    if ( group.getBuildAgents() != null )
                    {
                        for ( BuildAgentConfiguration agent : group.getBuildAgents() )
                        {
                            org.apache.continuum.configuration.model.BuildAgentConfiguration buildAgent =
                                new org.apache.continuum.configuration.model.BuildAgentConfiguration();
                            buildAgent.setUrl( agent.getUrl() );
                            buildAgent.setDescription( agent.getDescription() );
                            buildAgent.setEnabled( agent.isEnabled() );

                            buildAgents.add( buildAgent );
                        }

                        buildAgentGroup.setBuildAgents( buildAgents );
                    }

                    buildAgentGroups.add( buildAgentGroup );
                }
                configurationModel.setBuildAgentGroups( buildAgentGroups );
            }

            ContinuumConfigurationModelXpp3Writer writer = new ContinuumConfigurationModelXpp3Writer();
            FileWriter fileWriter = new FileWriter( file );
            writer.write( fileWriter, configurationModel );
View Full Code Here

    public void save( File file )
        throws ContinuumConfigurationException
    {
        try
        {
            ContinuumConfigurationModel configurationModel = new ContinuumConfigurationModel();
            configurationModel.setBaseUrl( this.generalConfiguration.getBaseUrl() );
            configurationModel.setNumberOfBuildsInParallel( this.generalConfiguration.getNumberOfBuildsInParallel() );

            // normally not null but NPE free is better !
            if ( this.generalConfiguration.getBuildOutputDirectory() != null )
            {
                configurationModel.setBuildOutputDirectory( this.generalConfiguration.getBuildOutputDirectory()
                    .getPath() );
            }
            if ( this.generalConfiguration.getWorkingDirectory() != null )
            {
                configurationModel.setWorkingDirectory( this.generalConfiguration.getWorkingDirectory().getPath() );
            }
            if ( this.generalConfiguration.getDeploymentRepositoryDirectory() != null )
            {
                configurationModel.setDeploymentRepositoryDirectory( this.generalConfiguration
                    .getDeploymentRepositoryDirectory().getPath() );
            }
            if ( this.generalConfiguration.getProxyConfiguration() != null )
            {
                configurationModel
                    .setProxyConfiguration( new org.apache.continuum.configuration.model.ProxyConfiguration() );
                configurationModel.getProxyConfiguration().setProxyHost(
                                                                         this.generalConfiguration
                                                                             .getProxyConfiguration().getProxyHost() );
                configurationModel.getProxyConfiguration().setProxyPassword(
                                                                             this.generalConfiguration
                                                                                 .getProxyConfiguration()
                                                                                 .getProxyPassword() );
                configurationModel.getProxyConfiguration().setProxyPort(
                                                                         this.generalConfiguration
                                                                             .getProxyConfiguration().getProxyPort() );
                configurationModel.getProxyConfiguration().setProxyHost(
                                                                         this.generalConfiguration
                                                                             .getProxyConfiguration().getProxyHost() );
            }
            if ( this.generalConfiguration.getReleaseOutputDirectory() != null )
            {
                configurationModel.setReleaseOutputDirectory( this.generalConfiguration.getReleaseOutputDirectory()
                    .getPath() );
            }
            if ( this.generalConfiguration.getBuildAgents() != null )
            {
                List buildAgents = new ArrayList();

                for ( BuildAgentConfiguration agent : this.generalConfiguration.getBuildAgents() )
                {
                    org.apache.continuum.configuration.model.BuildAgentConfiguration buildAgent =
                        new org.apache.continuum.configuration.model.BuildAgentConfiguration();
                    buildAgent.setUrl( agent.getUrl() );
                    buildAgent.setDescription( agent.getDescription() );
                    buildAgent.setEnabled( agent.isEnabled() );
                   
                    buildAgents.add( buildAgent );
                }
                configurationModel.setBuildAgents( buildAgents );
            }

            ContinuumConfigurationModelXpp3Writer writer = new ContinuumConfigurationModelXpp3Writer();
            FileWriter fileWriter = new FileWriter( file );
            writer.write( fileWriter, configurationModel );
View Full Code Here

        throws ContinuumConfigurationException
    {
        try
        {
            ContinuumConfigurationModelXpp3Reader configurationXpp3Reader = new ContinuumConfigurationModelXpp3Reader();
            ContinuumConfigurationModel configuration = configurationXpp3Reader
                .read( new InputStreamReader( new FileInputStream( file ) ) );

            this.generalConfiguration = new GeneralConfiguration();

            this.generalConfiguration.setNumberOfBuildsInParallel( configuration.getNumberOfBuildsInParallel() );
            this.generalConfiguration.setBaseUrl( configuration.getBaseUrl() );
            if ( StringUtils.isNotEmpty( configuration.getBuildOutputDirectory() ) )
            {
                // TODO take care if file exists ?
                this.generalConfiguration.setBuildOutputDirectory( new File( configuration
                    .getBuildOutputDirectory() ) );
            }
            if ( StringUtils.isNotEmpty( configuration.getDeploymentRepositoryDirectory() ) )
            {
                // TODO take care if file exists ?
                this.generalConfiguration.setDeploymentRepositoryDirectory( new File( configuration
                    .getDeploymentRepositoryDirectory() ) );
            }
            if ( StringUtils.isNotEmpty( configuration.getWorkingDirectory() ) )
            {
                // TODO take care if file exists ?
                this.generalConfiguration.setWorkingDirectory( new File( configuration.getWorkingDirectory() ) );
            }
            if ( configuration.getProxyConfiguration() != null )
            {
                ProxyConfiguration proxyConfiguration = new ProxyConfiguration( configuration
                    .getProxyConfiguration().getProxyHost(), configuration.getProxyConfiguration()
                    .getProxyPassword(), configuration.getProxyConfiguration().getProxyPort(), configuration
                    .getProxyConfiguration().getProxyUser() );
                this.generalConfiguration.setProxyConfiguration( proxyConfiguration );
            }
            if ( StringUtils.isNotEmpty( configuration.getReleaseOutputDirectory() ) )
            {
                // TODO take care if file exists?
                this.generalConfiguration.setReleaseOutputDirectory( new File( configuration
                    .getReleaseOutputDirectory() ) );
            }
            if ( configuration.getBuildAgents() != null )
            {
                List<BuildAgentConfiguration> buildAgents = new ArrayList<BuildAgentConfiguration>();

                List<org.apache.continuum.configuration.model.BuildAgentConfiguration> agents = configuration.getBuildAgents();
                for ( org.apache.continuum.configuration.model.BuildAgentConfiguration agent : agents )
                {
                    BuildAgentConfiguration buildAgent = new BuildAgentConfiguration( agent.getUrl(),
                                                                                      agent.getDescription(),
                                                                                      agent.isEnabled() );
View Full Code Here

        FileInputStream fis = null;
        try
        {
            fis = new FileInputStream( file );
            ContinuumConfigurationModelXpp3Reader configurationXpp3Reader = new ContinuumConfigurationModelXpp3Reader();
            ContinuumConfigurationModel configuration = configurationXpp3Reader.read( new InputStreamReader( fis ) );

            this.generalConfiguration = new GeneralConfiguration();

            this.generalConfiguration.setNumberOfBuildsInParallel( configuration.getNumberOfBuildsInParallel() );
            this.generalConfiguration.setBaseUrl( configuration.getBaseUrl() );
            this.generalConfiguration.setSharedSecretPassword( configuration.getSharedSecretPassword() );

            if ( StringUtils.isNotEmpty( configuration.getBuildOutputDirectory() ) )
            {
                // TODO take care if file exists ?
                this.generalConfiguration.setBuildOutputDirectory( new File(
                    configuration.getBuildOutputDirectory() ) );
            }
            if ( StringUtils.isNotEmpty( configuration.getDeploymentRepositoryDirectory() ) )
            {
                // TODO take care if file exists ?
                this.generalConfiguration.setDeploymentRepositoryDirectory( new File(
                    configuration.getDeploymentRepositoryDirectory() ) );
            }
            if ( StringUtils.isNotEmpty( configuration.getWorkingDirectory() ) )
            {
                // TODO take care if file exists ?
                this.generalConfiguration.setWorkingDirectory( new File( configuration.getWorkingDirectory() ) );
            }
            if ( configuration.getProxyConfiguration() != null )
            {
                ProxyConfiguration proxyConfiguration = new ProxyConfiguration(
                    configuration.getProxyConfiguration().getProxyHost(),
                    configuration.getProxyConfiguration().getProxyPassword(),
                    configuration.getProxyConfiguration().getProxyPort(),
                    configuration.getProxyConfiguration().getProxyUser() );
                this.generalConfiguration.setProxyConfiguration( proxyConfiguration );
            }
            if ( StringUtils.isNotEmpty( configuration.getReleaseOutputDirectory() ) )
            {
                // TODO take care if file exists?
                this.generalConfiguration.setReleaseOutputDirectory( new File(
                    configuration.getReleaseOutputDirectory() ) );
            }

            // set the configuration for diistributedBuildEnabled
            this.generalConfiguration.setDistributedBuildEnabled( configuration.isDistributedBuildEnabled() );

            this.generalConfiguration.setInitialized( configuration.isInitialized() );

            if ( configuration.getBuildAgents() != null )
            {
                List<BuildAgentConfiguration> buildAgents = new ArrayList<BuildAgentConfiguration>();

                List<org.apache.continuum.configuration.model.BuildAgentConfiguration> agents =
                    configuration.getBuildAgents();
                for ( org.apache.continuum.configuration.model.BuildAgentConfiguration agent : agents )
                {
                    BuildAgentConfiguration buildAgent = new BuildAgentConfiguration( agent.getUrl(),
                                                                                      agent.getDescription(),
                                                                                      agent.isEnabled() );
                    buildAgents.add( buildAgent );
                }

                this.generalConfiguration.setBuildAgents( buildAgents );
            }
            if ( configuration.getBuildAgentGroups() != null )
            {
                List<BuildAgentGroupConfiguration> buildAgentGroups = new ArrayList<BuildAgentGroupConfiguration>();
                List<org.apache.continuum.configuration.model.BuildAgentGroupConfiguration> groups =
                    configuration.getBuildAgentGroups();

                for ( org.apache.continuum.configuration.model.BuildAgentGroupConfiguration group : groups )
                {
                    List<BuildAgentConfiguration> agents = new ArrayList<BuildAgentConfiguration>();
                    List<org.apache.continuum.configuration.model.BuildAgentConfiguration> modelAgents =
View Full Code Here

    public void save( File file )
        throws ContinuumConfigurationException
    {
        try
        {
            ContinuumConfigurationModel configurationModel = new ContinuumConfigurationModel();
            configurationModel.setBaseUrl( this.generalConfiguration.getBaseUrl() );
            configurationModel.setNumberOfBuildsInParallel( this.generalConfiguration.getNumberOfBuildsInParallel() );
            configurationModel.setSharedSecretPassword( this.generalConfiguration.getSharedSecretPassword() );

            // normally not null but NPE free is better !
            if ( this.generalConfiguration.getBuildOutputDirectory() != null )
            {
                configurationModel.setBuildOutputDirectory(
                    this.generalConfiguration.getBuildOutputDirectory().getPath() );
            }
            if ( this.generalConfiguration.getWorkingDirectory() != null )
            {
                configurationModel.setWorkingDirectory( this.generalConfiguration.getWorkingDirectory().getPath() );
            }
            if ( this.generalConfiguration.getDeploymentRepositoryDirectory() != null )
            {
                configurationModel.setDeploymentRepositoryDirectory(
                    this.generalConfiguration.getDeploymentRepositoryDirectory().getPath() );
            }
            if ( this.generalConfiguration.getProxyConfiguration() != null )
            {
                configurationModel.setProxyConfiguration(
                    new org.apache.continuum.configuration.model.ProxyConfiguration() );
                configurationModel.getProxyConfiguration().setProxyHost(
                    this.generalConfiguration.getProxyConfiguration().getProxyHost() );
                configurationModel.getProxyConfiguration().setProxyPassword(
                    this.generalConfiguration.getProxyConfiguration().getProxyPassword() );
                configurationModel.getProxyConfiguration().setProxyPort(
                    this.generalConfiguration.getProxyConfiguration().getProxyPort() );
                configurationModel.getProxyConfiguration().setProxyHost(
                    this.generalConfiguration.getProxyConfiguration().getProxyHost() );
            }
            if ( this.generalConfiguration.getReleaseOutputDirectory() != null )
            {
                configurationModel.setReleaseOutputDirectory(
                    this.generalConfiguration.getReleaseOutputDirectory().getPath() );
            }

            // set configuration for distributedBuildEnabled.
            configurationModel.setDistributedBuildEnabled( this.generalConfiguration.isDistributedBuildEnabled() );

            configurationModel.setInitialized( this.generalConfiguration.isInitialized() );

            if ( this.generalConfiguration.getBuildAgents() != null )
            {
                List<org.apache.continuum.configuration.model.BuildAgentConfiguration> buildAgents =
                    new ArrayList<org.apache.continuum.configuration.model.BuildAgentConfiguration>();

                for ( BuildAgentConfiguration agent : this.generalConfiguration.getBuildAgents() )
                {
                    org.apache.continuum.configuration.model.BuildAgentConfiguration buildAgent =
                        new org.apache.continuum.configuration.model.BuildAgentConfiguration();
                    buildAgent.setUrl( agent.getUrl() );
                    buildAgent.setDescription( agent.getDescription() );
                    buildAgent.setEnabled( agent.isEnabled() );

                    buildAgents.add( buildAgent );
                }
                configurationModel.setBuildAgents( buildAgents );
            }
            if ( this.generalConfiguration.getBuildAgentGroups() != null )
            {
                List<org.apache.continuum.configuration.model.BuildAgentGroupConfiguration> buildAgentGroups =
                    new ArrayList<org.apache.continuum.configuration.model.BuildAgentGroupConfiguration>();

                for ( BuildAgentGroupConfiguration group : this.generalConfiguration.getBuildAgentGroups() )
                {
                    org.apache.continuum.configuration.model.BuildAgentGroupConfiguration buildAgentGroup =
                        new org.apache.continuum.configuration.model.BuildAgentGroupConfiguration();
                    buildAgentGroup.setName( group.getName() );

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

                    if ( group.getBuildAgents() != null )
                    {
                        for ( BuildAgentConfiguration agent : group.getBuildAgents() )
                        {
                            org.apache.continuum.configuration.model.BuildAgentConfiguration buildAgent =
                                new org.apache.continuum.configuration.model.BuildAgentConfiguration();
                            buildAgent.setUrl( agent.getUrl() );
                            buildAgent.setDescription( agent.getDescription() );
                            buildAgent.setEnabled( agent.isEnabled() );

                            buildAgents.add( buildAgent );
                        }

                        buildAgentGroup.setBuildAgents( buildAgents );
                    }

                    buildAgentGroups.add( buildAgentGroup );
                }
                configurationModel.setBuildAgentGroups( buildAgentGroups );
            }

            ContinuumConfigurationModelXpp3Writer writer = new ContinuumConfigurationModelXpp3Writer();
            FileWriter fileWriter = new FileWriter( file );
            writer.write( fileWriter, configurationModel );
View Full Code Here

        throws ContinuumConfigurationException
    {
        try
        {
            ContinuumConfigurationModelXpp3Reader configurationXpp3Reader = new ContinuumConfigurationModelXpp3Reader();
            ContinuumConfigurationModel configuration =
                configurationXpp3Reader.read( new InputStreamReader( new FileInputStream( file ) ) );

            this.generalConfiguration = new GeneralConfiguration();

            this.generalConfiguration.setNumberOfBuildsInParallel( configuration.getNumberOfBuildsInParallel() );
            this.generalConfiguration.setBaseUrl( configuration.getBaseUrl() );
            if ( StringUtils.isNotEmpty( configuration.getBuildOutputDirectory() ) )
            {
                // TODO take care if file exists ?
                this.generalConfiguration.setBuildOutputDirectory(
                    new File( configuration.getBuildOutputDirectory() ) );
            }
            if ( StringUtils.isNotEmpty( configuration.getDeploymentRepositoryDirectory() ) )
            {
                // TODO take care if file exists ?
                this.generalConfiguration.setDeploymentRepositoryDirectory(
                    new File( configuration.getDeploymentRepositoryDirectory() ) );
            }
            if ( StringUtils.isNotEmpty( configuration.getWorkingDirectory() ) )
            {
                // TODO take care if file exists ?
                this.generalConfiguration.setWorkingDirectory( new File( configuration.getWorkingDirectory() ) );
            }
            if ( configuration.getProxyConfiguration() != null )
            {
                ProxyConfiguration proxyConfiguration =
                    new ProxyConfiguration( configuration.getProxyConfiguration().getProxyHost(),
                                            configuration.getProxyConfiguration().getProxyPassword(),
                                            configuration.getProxyConfiguration().getProxyPort(),
                                            configuration.getProxyConfiguration().getProxyUser() );
                this.generalConfiguration.setProxyConfiguration( proxyConfiguration );
            }
            if ( StringUtils.isNotEmpty( configuration.getReleaseOutputDirectory() ) )
            {
                // TODO take care if file exists?
                this.generalConfiguration.setReleaseOutputDirectory(
                    new File( configuration.getReleaseOutputDirectory() ) );
            }
            if ( configuration.getBuildAgents() != null )
            {
                List<BuildAgentConfiguration> buildAgents = new ArrayList<BuildAgentConfiguration>();

                List<org.apache.continuum.configuration.model.BuildAgentConfiguration> agents =
                    configuration.getBuildAgents();
                for ( org.apache.continuum.configuration.model.BuildAgentConfiguration agent : agents )
                {
                    BuildAgentConfiguration buildAgent =
                        new BuildAgentConfiguration( agent.getUrl(), agent.getDescription(), agent.isEnabled() );
                    buildAgents.add( buildAgent );
                }

                this.generalConfiguration.setBuildAgents( buildAgents );
            }
            if ( configuration.getBuildAgentGroups() != null )
            {
                List<BuildAgentGroupConfiguration> buildAgentGroups = new ArrayList<BuildAgentGroupConfiguration>();
                List<org.apache.continuum.configuration.model.BuildAgentGroupConfiguration> groups =
                    configuration.getBuildAgentGroups();

                for ( org.apache.continuum.configuration.model.BuildAgentGroupConfiguration group : groups )
                {
                    List<BuildAgentConfiguration> agents = new ArrayList<BuildAgentConfiguration>();
                    List<org.apache.continuum.configuration.model.BuildAgentConfiguration> modelAgents =
View Full Code Here

    public void save( File file )
        throws ContinuumConfigurationException
    {
        try
        {
            ContinuumConfigurationModel configurationModel = new ContinuumConfigurationModel();
            configurationModel.setBaseUrl( this.generalConfiguration.getBaseUrl() );
            configurationModel.setNumberOfBuildsInParallel( this.generalConfiguration.getNumberOfBuildsInParallel() );

            // normally not null but NPE free is better !
            if ( this.generalConfiguration.getBuildOutputDirectory() != null )
            {
                configurationModel.setBuildOutputDirectory(
                    this.generalConfiguration.getBuildOutputDirectory().getPath() );
            }
            if ( this.generalConfiguration.getWorkingDirectory() != null )
            {
                configurationModel.setWorkingDirectory( this.generalConfiguration.getWorkingDirectory().getPath() );
            }
            if ( this.generalConfiguration.getDeploymentRepositoryDirectory() != null )
            {
                configurationModel.setDeploymentRepositoryDirectory(
                    this.generalConfiguration.getDeploymentRepositoryDirectory().getPath() );
            }
            if ( this.generalConfiguration.getProxyConfiguration() != null )
            {
                configurationModel.setProxyConfiguration(
                    new org.apache.continuum.configuration.model.ProxyConfiguration() );
                configurationModel.getProxyConfiguration().setProxyHost(
                    this.generalConfiguration.getProxyConfiguration().getProxyHost() );
                configurationModel.getProxyConfiguration().setProxyPassword(
                    this.generalConfiguration.getProxyConfiguration().getProxyPassword() );
                configurationModel.getProxyConfiguration().setProxyPort(
                    this.generalConfiguration.getProxyConfiguration().getProxyPort() );
                configurationModel.getProxyConfiguration().setProxyHost(
                    this.generalConfiguration.getProxyConfiguration().getProxyHost() );
            }
            if ( this.generalConfiguration.getReleaseOutputDirectory() != null )
            {
                configurationModel.setReleaseOutputDirectory(
                    this.generalConfiguration.getReleaseOutputDirectory().getPath() );
            }
            if ( this.generalConfiguration.getBuildAgents() != null )
            {
                List<org.apache.continuum.configuration.model.BuildAgentConfiguration> buildAgents =
                    new ArrayList<org.apache.continuum.configuration.model.BuildAgentConfiguration>();

                for ( BuildAgentConfiguration agent : this.generalConfiguration.getBuildAgents() )
                {
                    org.apache.continuum.configuration.model.BuildAgentConfiguration buildAgent =
                        new org.apache.continuum.configuration.model.BuildAgentConfiguration();
                    buildAgent.setUrl( agent.getUrl() );
                    buildAgent.setDescription( agent.getDescription() );
                    buildAgent.setEnabled( agent.isEnabled() );

                    buildAgents.add( buildAgent );
                }
                configurationModel.setBuildAgents( buildAgents );
            }
            if ( this.generalConfiguration.getBuildAgentGroups() != null )
            {
                List<org.apache.continuum.configuration.model.BuildAgentGroupConfiguration> buildAgentGroups =
                    new ArrayList<org.apache.continuum.configuration.model.BuildAgentGroupConfiguration>();

                for ( BuildAgentGroupConfiguration group : this.generalConfiguration.getBuildAgentGroups() )
                {
                    org.apache.continuum.configuration.model.BuildAgentGroupConfiguration buildAgentGroup =
                        new org.apache.continuum.configuration.model.BuildAgentGroupConfiguration();
                    buildAgentGroup.setName( group.getName() );

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

                    if ( group.getBuildAgents() != null )
                    {
                        for ( BuildAgentConfiguration agent : group.getBuildAgents() )
                        {
                            org.apache.continuum.configuration.model.BuildAgentConfiguration buildAgent =
                                new org.apache.continuum.configuration.model.BuildAgentConfiguration();
                            buildAgent.setUrl( agent.getUrl() );
                            buildAgent.setDescription( agent.getDescription() );
                            buildAgent.setEnabled( agent.isEnabled() );

                            buildAgents.add( buildAgent );
                        }

                        buildAgentGroup.setBuildAgents( buildAgents );
                    }

                    buildAgentGroups.add( buildAgentGroup );
                }
                configurationModel.setBuildAgentGroups( buildAgentGroups );
            }

            ContinuumConfigurationModelXpp3Writer writer = new ContinuumConfigurationModelXpp3Writer();
            FileWriter fileWriter = new FileWriter( file );
            writer.write( fileWriter, configurationModel );
View Full Code Here

        throws ContinuumConfigurationException
    {
        try
        {
            ContinuumConfigurationModelXpp3Reader configurationXpp3Reader = new ContinuumConfigurationModelXpp3Reader();
            ContinuumConfigurationModel configuration =
                configurationXpp3Reader.read( new InputStreamReader( new FileInputStream( file ) ) );

            this.generalConfiguration = new GeneralConfiguration();

            this.generalConfiguration.setNumberOfBuildsInParallel( configuration.getNumberOfBuildsInParallel() );
            this.generalConfiguration.setBaseUrl( configuration.getBaseUrl() );
            if ( StringUtils.isNotEmpty( configuration.getBuildOutputDirectory() ) )
            {
                // TODO take care if file exists ?
                this.generalConfiguration.setBuildOutputDirectory(
                    new File( configuration.getBuildOutputDirectory() ) );
            }
            if ( StringUtils.isNotEmpty( configuration.getDeploymentRepositoryDirectory() ) )
            {
                // TODO take care if file exists ?
                this.generalConfiguration.setDeploymentRepositoryDirectory(
                    new File( configuration.getDeploymentRepositoryDirectory() ) );
            }
            if ( StringUtils.isNotEmpty( configuration.getWorkingDirectory() ) )
            {
                // TODO take care if file exists ?
                this.generalConfiguration.setWorkingDirectory( new File( configuration.getWorkingDirectory() ) );
            }
            if ( configuration.getProxyConfiguration() != null )
            {
                ProxyConfiguration proxyConfiguration =
                    new ProxyConfiguration( configuration.getProxyConfiguration().getProxyHost(),
                                            configuration.getProxyConfiguration().getProxyPassword(),
                                            configuration.getProxyConfiguration().getProxyPort(),
                                            configuration.getProxyConfiguration().getProxyUser() );
                this.generalConfiguration.setProxyConfiguration( proxyConfiguration );
            }
            if ( StringUtils.isNotEmpty( configuration.getReleaseOutputDirectory() ) )
            {
                // TODO take care if file exists?
                this.generalConfiguration.setReleaseOutputDirectory(
                    new File( configuration.getReleaseOutputDirectory() ) );
            }
            if ( configuration.getBuildAgents() != null )
            {
                List<BuildAgentConfiguration> buildAgents = new ArrayList<BuildAgentConfiguration>();

                List<org.apache.continuum.configuration.model.BuildAgentConfiguration> agents =
                    configuration.getBuildAgents();
                for ( org.apache.continuum.configuration.model.BuildAgentConfiguration agent : agents )
                {
                    BuildAgentConfiguration buildAgent =
                        new BuildAgentConfiguration( agent.getUrl(), agent.getDescription(), agent.isEnabled() );
                    buildAgents.add( buildAgent );
                }

                this.generalConfiguration.setBuildAgents( buildAgents );
            }
            if ( configuration.getBuildAgentGroups() != null )
            {
                List<BuildAgentGroupConfiguration> buildAgentGroups = new ArrayList<BuildAgentGroupConfiguration>();
                List<org.apache.continuum.configuration.model.BuildAgentGroupConfiguration> groups =
                    configuration.getBuildAgentGroups();

                for ( org.apache.continuum.configuration.model.BuildAgentGroupConfiguration group : groups )
                {
                    List<BuildAgentConfiguration> agents = new ArrayList<BuildAgentConfiguration>();
                    List<org.apache.continuum.configuration.model.BuildAgentConfiguration> modelAgents =
View Full Code Here

    public void save( File file )
        throws ContinuumConfigurationException
    {
        try
        {
            ContinuumConfigurationModel configurationModel = new ContinuumConfigurationModel();
            configurationModel.setBaseUrl( this.generalConfiguration.getBaseUrl() );
            configurationModel.setNumberOfBuildsInParallel( this.generalConfiguration.getNumberOfBuildsInParallel() );

            // normally not null but NPE free is better !
            if ( this.generalConfiguration.getBuildOutputDirectory() != null )
            {
                configurationModel.setBuildOutputDirectory(
                    this.generalConfiguration.getBuildOutputDirectory().getPath() );
            }
            if ( this.generalConfiguration.getWorkingDirectory() != null )
            {
                configurationModel.setWorkingDirectory( this.generalConfiguration.getWorkingDirectory().getPath() );
            }
            if ( this.generalConfiguration.getDeploymentRepositoryDirectory() != null )
            {
                configurationModel.setDeploymentRepositoryDirectory(
                    this.generalConfiguration.getDeploymentRepositoryDirectory().getPath() );
            }
            if ( this.generalConfiguration.getProxyConfiguration() != null )
            {
                configurationModel.setProxyConfiguration(
                    new org.apache.continuum.configuration.model.ProxyConfiguration() );
                configurationModel.getProxyConfiguration().setProxyHost(
                    this.generalConfiguration.getProxyConfiguration().getProxyHost() );
                configurationModel.getProxyConfiguration().setProxyPassword(
                    this.generalConfiguration.getProxyConfiguration().getProxyPassword() );
                configurationModel.getProxyConfiguration().setProxyPort(
                    this.generalConfiguration.getProxyConfiguration().getProxyPort() );
                configurationModel.getProxyConfiguration().setProxyHost(
                    this.generalConfiguration.getProxyConfiguration().getProxyHost() );
            }
            if ( this.generalConfiguration.getReleaseOutputDirectory() != null )
            {
                configurationModel.setReleaseOutputDirectory(
                    this.generalConfiguration.getReleaseOutputDirectory().getPath() );
            }
            if ( this.generalConfiguration.getBuildAgents() != null )
            {
                List<org.apache.continuum.configuration.model.BuildAgentConfiguration> buildAgents =
                    new ArrayList<org.apache.continuum.configuration.model.BuildAgentConfiguration>();

                for ( BuildAgentConfiguration agent : this.generalConfiguration.getBuildAgents() )
                {
                    org.apache.continuum.configuration.model.BuildAgentConfiguration buildAgent =
                        new org.apache.continuum.configuration.model.BuildAgentConfiguration();
                    buildAgent.setUrl( agent.getUrl() );
                    buildAgent.setDescription( agent.getDescription() );
                    buildAgent.setEnabled( agent.isEnabled() );

                    buildAgents.add( buildAgent );
                }
                configurationModel.setBuildAgents( buildAgents );
            }
            if ( this.generalConfiguration.getBuildAgentGroups() != null )
            {
                List<org.apache.continuum.configuration.model.BuildAgentGroupConfiguration> buildAgentGroups =
                    new ArrayList<org.apache.continuum.configuration.model.BuildAgentGroupConfiguration>();

                for ( BuildAgentGroupConfiguration group : this.generalConfiguration.getBuildAgentGroups() )
                {
                    org.apache.continuum.configuration.model.BuildAgentGroupConfiguration buildAgentGroup =
                        new org.apache.continuum.configuration.model.BuildAgentGroupConfiguration();
                    buildAgentGroup.setName( group.getName() );

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

                    if ( group.getBuildAgents() != null )
                    {
                        for ( BuildAgentConfiguration agent : group.getBuildAgents() )
                        {
                            org.apache.continuum.configuration.model.BuildAgentConfiguration buildAgent =
                                new org.apache.continuum.configuration.model.BuildAgentConfiguration();
                            buildAgent.setUrl( agent.getUrl() );
                            buildAgent.setDescription( agent.getDescription() );
                            buildAgent.setEnabled( agent.isEnabled() );

                            buildAgents.add( buildAgent );
                        }

                        buildAgentGroup.setBuildAgents( buildAgents );
                    }

                    buildAgentGroups.add( buildAgentGroup );
                }
                configurationModel.setBuildAgentGroups( buildAgentGroups );
            }

            ContinuumConfigurationModelXpp3Writer writer = new ContinuumConfigurationModelXpp3Writer();
            FileWriter fileWriter = new FileWriter( file );
            writer.write( fileWriter, configurationModel );
View Full Code Here

TOP

Related Classes of org.apache.continuum.configuration.model.ContinuumConfigurationModel

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.