Package org.apache.archiva.configuration

Examples of org.apache.archiva.configuration.RemoteRepositoryConfiguration


        ManagedRepositoryConfiguration testRepo = new ManagedRepositoryConfiguration();
        testRepo.setId( TEST_REPO_ID );
        testRepo.setLocation( new File( "target/test-repository" ).getAbsolutePath() );
        c.addManagedRepository( testRepo );

        RemoteRepositoryConfiguration testRemoteRepo = new RemoteRepositoryConfiguration();
        testRemoteRepo.setId( TEST_REMOTE_REPO_ID );
        testRemoteRepo.setLayout( "default" );
        testRemoteRepo.setName( "Central Repository" );
        testRemoteRepo.setUrl( "http://central.repo.com/maven2" );
        testRemoteRepo.setTimeout( 10 );
        c.addRemoteRepository( testRemoteRepo );

        ProxyConnectorConfiguration proxyConnector = new ProxyConnectorConfiguration();
        proxyConnector.setSourceRepoId( TEST_REPO_ID );
        proxyConnector.setTargetRepoId( TEST_REMOTE_REPO_ID );
View Full Code Here


    public void testGetProjectVersionMetadataWithParentNoRemoteReposConfigured()
         throws Exception
    {
        // remove configuration
        Configuration config = configuration.getConfiguration();
        RemoteRepositoryConfiguration remoteRepo = config.findRemoteRepositoryById( TEST_REMOTE_REPO_ID );
        config.removeRemoteRepository( remoteRepo );

        configuration.save( config );

        copyTestArtifactWithParent( "target/test-classes/com/example/test/test-artifact-module-a",
View Full Code Here

        List<ProxyConnectorConfiguration> proxyConnectors = proxyConnectorsMap.get( repoId );
        if( proxyConnectors != null )
        {
            for( ProxyConnectorConfiguration proxyConnector : proxyConnectors )
            {
                RemoteRepositoryConfiguration remoteRepoConfig = archivaConfiguration.getConfiguration().findRemoteRepositoryById(
                    proxyConnector.getTargetRepoId() );

                if( remoteRepoConfig != null )
                {
                    remoteRepositories.add( remoteRepoConfig );
View Full Code Here

                int count = 0;
                for ( Iterator iter = value.getRemoteRepositories().iterator(); iter.hasNext(); count++ )
                {
                    String name = "remoteRepositories.remoteRepository(" + count + ")";
                    RemoteRepositoryConfiguration o = ( RemoteRepositoryConfiguration ) iter.next();
                    writeRemoteRepositoryConfiguration( prefix + name + ".", o, registry );
                }
            }
            if ( value.getProxyConnectors() != null && value.getProxyConnectors().size() > 0
)
View Full Code Here

        value.setManagedRepositories( managedRepositories );
        java.util.List remoteRepositories = new java.util.ArrayList/*<RemoteRepositoryConfiguration>*/();
        List remoteRepositoriesSubsets = registry.getSubsetList( prefix + "remoteRepositories.remoteRepository" );
        for ( Iterator i = remoteRepositoriesSubsets.iterator(); i.hasNext(); )
        {
            RemoteRepositoryConfiguration v = readRemoteRepositoryConfiguration( "", (Registry) i.next() );
            remoteRepositories.add( v );
        }
        value.setRemoteRepositories( remoteRepositories );
        java.util.List proxyConnectors = new java.util.ArrayList/*<ProxyConnectorConfiguration>*/();
        List proxyConnectorsSubsets = registry.getSubsetList( prefix + "proxyConnectors.proxyConnector" );
View Full Code Here

        return value;
    }
   
    private RemoteRepositoryConfiguration readRemoteRepositoryConfiguration( String prefix, Registry registry )
    {
        RemoteRepositoryConfiguration value = new RemoteRepositoryConfiguration();

        String url = registry.getString( prefix + "url", value.getUrl() );
        value.setUrl( url );
        String username = registry.getString( prefix + "username", value.getUsername() );
        value.setUsername( username );
        String password = registry.getString( prefix + "password", value.getPassword() );
        value.setPassword( password );
        int timeout = registry.getInt( prefix + "timeout", value.getTimeout() );
        value.setTimeout( timeout );
        String refreshCronExpression = registry.getString( prefix + "refreshCronExpression", value.getRefreshCronExpression() );
        value.setRefreshCronExpression( refreshCronExpression );
        boolean downloadRemoteIndex = registry.getBoolean( prefix + "downloadRemoteIndex", value.isDownloadRemoteIndex() );
        value.setDownloadRemoteIndex( downloadRemoteIndex );
        String remoteIndexUrl = registry.getString( prefix + "remoteIndexUrl", value.getRemoteIndexUrl() );
        value.setRemoteIndexUrl( remoteIndexUrl );
        String remoteDownloadNetworkProxyId = registry.getString( prefix + "remoteDownloadNetworkProxyId", value.getRemoteDownloadNetworkProxyId() );
        value.setRemoteDownloadNetworkProxyId( remoteDownloadNetworkProxyId );
        int remoteDownloadTimeout = registry.getInt( prefix + "remoteDownloadTimeout", value.getRemoteDownloadTimeout() );
        value.setRemoteDownloadTimeout( remoteDownloadTimeout );
        boolean downloadRemoteIndexOnStartup = registry.getBoolean( prefix + "downloadRemoteIndexOnStartup", value.isDownloadRemoteIndexOnStartup() );
        value.setDownloadRemoteIndexOnStartup( downloadRemoteIndexOnStartup );
        String id = registry.getString( prefix + "id", value.getId() );
        value.setId( id );
        String name = registry.getString( prefix + "name", value.getName() );
        value.setName( name );
        String layout = registry.getString( prefix + "layout", value.getLayout() );
        value.setLayout( layout );
        String indexDir = registry.getString( prefix + "indexDir", value.getIndexDir() );
        value.setIndexDir( indexDir );

        return value;
    }
View Full Code Here

        value.setManagedRepositories( managedRepositories );
        java.util.List remoteRepositories = new java.util.ArrayList/*<RemoteRepositoryConfiguration>*/();
        List remoteRepositoriesSubsets = registry.getSubsetList( prefix + "remoteRepositories.remoteRepository" );
        for ( Iterator i = remoteRepositoriesSubsets.iterator(); i.hasNext(); )
        {
            RemoteRepositoryConfiguration v = readRemoteRepositoryConfiguration( "", (Registry) i.next() );
            remoteRepositories.add( v );
        }
        value.setRemoteRepositories( remoteRepositories );
        java.util.List proxyConnectors = new java.util.ArrayList/*<ProxyConnectorConfiguration>*/();
        List proxyConnectorsSubsets = registry.getSubsetList( prefix + "proxyConnectors.proxyConnector" );
View Full Code Here

        return value;
    }
   
    private RemoteRepositoryConfiguration readRemoteRepositoryConfiguration( String prefix, Registry registry )
    {
        RemoteRepositoryConfiguration value = new RemoteRepositoryConfiguration();

    //String url = registry.getString( prefix + "url", value.getUrl() );

    List<String> urlList = registry.getList( prefix + "url" );
    String url = value.getUrl();
    if (urlList != null && !urlList.isEmpty() )
    {
        StringBuilder sb = new StringBuilder(  );
        for (int i = 0,size = urlList.size();i<size;i++)
        {
            sb.append( urlList.get( i ) );
            if (i<size - 1)
            {
                sb.append( ',' );
            }
        }
        url = sb.toString();
    }

        value.setUrl( url );
    //String username = registry.getString( prefix + "username", value.getUsername() );

    List<String> usernameList = registry.getList( prefix + "username" );
    String username = value.getUsername();
    if (usernameList != null && !usernameList.isEmpty() )
    {
        StringBuilder sb = new StringBuilder(  );
        for (int i = 0,size = usernameList.size();i<size;i++)
        {
            sb.append( usernameList.get( i ) );
            if (i<size - 1)
            {
                sb.append( ',' );
            }
        }
        username = sb.toString();
    }

        value.setUsername( username );
    //String password = registry.getString( prefix + "password", value.getPassword() );

    List<String> passwordList = registry.getList( prefix + "password" );
    String password = value.getPassword();
    if (passwordList != null && !passwordList.isEmpty() )
    {
        StringBuilder sb = new StringBuilder(  );
        for (int i = 0,size = passwordList.size();i<size;i++)
        {
            sb.append( passwordList.get( i ) );
            if (i<size - 1)
            {
                sb.append( ',' );
            }
        }
        password = sb.toString();
    }

        value.setPassword( password );
    int timeout = registry.getInt( prefix + "timeout", value.getTimeout() );
        value.setTimeout( timeout );
    //String refreshCronExpression = registry.getString( prefix + "refreshCronExpression", value.getRefreshCronExpression() );

    List<String> refreshCronExpressionList = registry.getList( prefix + "refreshCronExpression" );
    String refreshCronExpression = value.getRefreshCronExpression();
    if (refreshCronExpressionList != null && !refreshCronExpressionList.isEmpty() )
    {
        StringBuilder sb = new StringBuilder(  );
        for (int i = 0,size = refreshCronExpressionList.size();i<size;i++)
        {
            sb.append( refreshCronExpressionList.get( i ) );
            if (i<size - 1)
            {
                sb.append( ',' );
            }
        }
        refreshCronExpression = sb.toString();
    }

        value.setRefreshCronExpression( refreshCronExpression );
        boolean downloadRemoteIndex = registry.getBoolean( prefix + "downloadRemoteIndex", value.isDownloadRemoteIndex() );
        value.setDownloadRemoteIndex( downloadRemoteIndex );
    //String remoteIndexUrl = registry.getString( prefix + "remoteIndexUrl", value.getRemoteIndexUrl() );

    List<String> remoteIndexUrlList = registry.getList( prefix + "remoteIndexUrl" );
    String remoteIndexUrl = value.getRemoteIndexUrl();
    if (remoteIndexUrlList != null && !remoteIndexUrlList.isEmpty() )
    {
        StringBuilder sb = new StringBuilder(  );
        for (int i = 0,size = remoteIndexUrlList.size();i<size;i++)
        {
            sb.append( remoteIndexUrlList.get( i ) );
            if (i<size - 1)
            {
                sb.append( ',' );
            }
        }
        remoteIndexUrl = sb.toString();
    }

        value.setRemoteIndexUrl( remoteIndexUrl );
    //String remoteDownloadNetworkProxyId = registry.getString( prefix + "remoteDownloadNetworkProxyId", value.getRemoteDownloadNetworkProxyId() );

    List<String> remoteDownloadNetworkProxyIdList = registry.getList( prefix + "remoteDownloadNetworkProxyId" );
    String remoteDownloadNetworkProxyId = value.getRemoteDownloadNetworkProxyId();
    if (remoteDownloadNetworkProxyIdList != null && !remoteDownloadNetworkProxyIdList.isEmpty() )
    {
        StringBuilder sb = new StringBuilder(  );
        for (int i = 0,size = remoteDownloadNetworkProxyIdList.size();i<size;i++)
        {
            sb.append( remoteDownloadNetworkProxyIdList.get( i ) );
            if (i<size - 1)
            {
                sb.append( ',' );
            }
        }
        remoteDownloadNetworkProxyId = sb.toString();
    }

        value.setRemoteDownloadNetworkProxyId( remoteDownloadNetworkProxyId );
    int remoteDownloadTimeout = registry.getInt( prefix + "remoteDownloadTimeout", value.getRemoteDownloadTimeout() );
        value.setRemoteDownloadTimeout( remoteDownloadTimeout );
        boolean downloadRemoteIndexOnStartup = registry.getBoolean( prefix + "downloadRemoteIndexOnStartup", value.isDownloadRemoteIndexOnStartup() );
        value.setDownloadRemoteIndexOnStartup( downloadRemoteIndexOnStartup );
        java.util.Map extraParameters = registry.getProperties( prefix + "extraParameters" );
        value.setExtraParameters( extraParameters );
        java.util.Map extraHeaders = registry.getProperties( prefix + "extraHeaders" );
        value.setExtraHeaders( extraHeaders );
    //String id = registry.getString( prefix + "id", value.getId() );

    List<String> idList = registry.getList( prefix + "id" );
    String id = value.getId();
    if (idList != null && !idList.isEmpty() )
    {
        StringBuilder sb = new StringBuilder(  );
        for (int i = 0,size = idList.size();i<size;i++)
        {
            sb.append( idList.get( i ) );
            if (i<size - 1)
            {
                sb.append( ',' );
            }
        }
        id = sb.toString();
    }

        value.setId( id );
    //String name = registry.getString( prefix + "name", value.getName() );

    List<String> nameList = registry.getList( prefix + "name" );
    String name = value.getName();
    if (nameList != null && !nameList.isEmpty() )
    {
        StringBuilder sb = new StringBuilder(  );
        for (int i = 0,size = nameList.size();i<size;i++)
        {
            sb.append( nameList.get( i ) );
            if (i<size - 1)
            {
                sb.append( ',' );
            }
        }
        name = sb.toString();
    }

        value.setName( name );
    //String layout = registry.getString( prefix + "layout", value.getLayout() );

    List<String> layoutList = registry.getList( prefix + "layout" );
    String layout = value.getLayout();
    if (layoutList != null && !layoutList.isEmpty() )
    {
        StringBuilder sb = new StringBuilder(  );
        for (int i = 0,size = layoutList.size();i<size;i++)
        {
            sb.append( layoutList.get( i ) );
            if (i<size - 1)
            {
                sb.append( ',' );
            }
        }
        layout = sb.toString();
    }

        value.setLayout( layout );
    //String indexDir = registry.getString( prefix + "indexDir", value.getIndexDir() );

    List<String> indexDirList = registry.getList( prefix + "indexDir" );
    String indexDir = value.getIndexDir();
    if (indexDirList != null && !indexDirList.isEmpty() )
    {
        StringBuilder sb = new StringBuilder(  );
        for (int i = 0,size = indexDirList.size();i<size;i++)
        {
            sb.append( indexDirList.get( i ) );
            if (i<size - 1)
            {
                sb.append( ',' );
            }
        }
        indexDir = sb.toString();
    }

        value.setIndexDir( indexDir );
    //String description = registry.getString( prefix + "description", value.getDescription() );

    List<String> descriptionList = registry.getList( prefix + "description" );
    String description = value.getDescription();
    if (descriptionList != null && !descriptionList.isEmpty() )
    {
        StringBuilder sb = new StringBuilder(  );
        for (int i = 0,size = descriptionList.size();i<size;i++)
        {
            sb.append( descriptionList.get( i ) );
            if (i<size - 1)
            {
                sb.append( ',' );
            }
        }
        description = sb.toString();
    }

        value.setDescription( description );

        return value;
    }
View Full Code Here

                int count = 0;
                for ( Iterator iter = value.getRemoteRepositories().iterator(); iter.hasNext(); count++ )
                {
                    String name = "remoteRepositories.remoteRepository(" + count + ")";
                    RemoteRepositoryConfiguration o = ( RemoteRepositoryConfiguration ) iter.next();
                    writeRemoteRepositoryConfiguration( prefix + name + ".", o, registry );
                }
            }
            if ( value.getProxyConnectors() != null && value.getProxyConnectors().size() > 0
)
View Full Code Here

        return repo;
    }

    protected RemoteRepositoryConfiguration createRemoteRepository( String id, String name, String url )
    {
        RemoteRepositoryConfiguration repo = new RemoteRepositoryConfiguration();
        repo.setId( id );
        repo.setName( name );
        repo.setUrl( url );
        return repo;
    }
View Full Code Here

TOP

Related Classes of org.apache.archiva.configuration.RemoteRepositoryConfiguration

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.