Package org.apache.maven.archiva.configuration

Examples of org.apache.maven.archiva.configuration.RepositoryConfiguration


            // Already in the database.  Skip it.
            return;
        }

        File artifactFile = toFile( artifact );
        RepositoryConfiguration repo = getRepository( artifact );
        ProjectModelReader reader = project400Reader;

        if ( StringUtils.equals( "legacy", repo.getLayout() ) )
        {
            reader = project300Reader;
        }

        try
View Full Code Here


        return archivaConfiguration.getConfiguration().findRepositoryById( repoId );
    }

    private File toFile( ArchivaArtifact artifact )
    {
        RepositoryConfiguration repoConfig = getRepository( artifact );

        BidirectionalRepositoryLayout layout = null;

        try
        {
            layout = layoutFactory.getLayout( artifact );
        }
        catch ( LayoutException e )
        {
            getLogger().warn( "Unable to determine layout of " + artifact + ": " + e.getMessage(), e );
            return null;
        }

        String path = layout.toPath( artifact );
        RepositoryURL url = new RepositoryURL( repoConfig.getUrl() );
        return new File( url.getPath(), path );
    }
View Full Code Here

                .getInstance(), configLocalRepos );

            Iterator it = configLocalRepos.iterator();
            while ( it.hasNext() )
            {
                RepositoryConfiguration repoconfig = (RepositoryConfiguration) it.next();
                ArchivaRepository repo = ArchivaConfigurationAdaptor.toArchivaRepository( repoconfig );
                try
                {
                    RepositoryProjectResolver resolver = toResolver( repo );
View Full Code Here

            this.repositoryMap.clear();

            Iterator it = configuration.getConfiguration().getRepositories().iterator();
            while ( it.hasNext() )
            {
                RepositoryConfiguration repoconfig = (RepositoryConfiguration) it.next();
                if ( !repoconfig.isManaged() )
                {
                    continue;
                }

                ArchivaRepository repository = ArchivaConfigurationAdaptor.toArchivaRepository( repoconfig );
                IndexedRepositoryDetails pnl = new IndexedRepositoryDetails();

                pnl.path = repository.getUrl().getPath();
                pnl.layout = (BidirectionalRepositoryLayout) this.bidirectionalLayoutMap.get( repoconfig.getLayout() );

                pnl.index = indexFactory.createHashcodeIndex( repository );

                this.repositoryMap.put( repoconfig.getId(), pnl );
            }
        }
    }
View Full Code Here

        if ( id == null )
        {
            this.repository = new AdminRepositoryConfiguration();
        }

        RepositoryConfiguration repoconfig = archivaConfiguration.getConfiguration().findRepositoryById( id );
        if ( repoconfig != null )
        {
            this.repository = new AdminRepositoryConfiguration( repoconfig );
        }
    }
View Full Code Here

    private void removeRepository( String repoId )
    {
        getLogger().info( ".removeRepository()" );

        RepositoryConfiguration toremove = archivaConfiguration.getConfiguration().findRepositoryById( repoId );
        if ( toremove != null )
        {
            archivaConfiguration.getConfiguration().removeRepository( toremove );
        }
    }
View Full Code Here

    {
        List repos = archivaConfiguration.getConfiguration().getRepositories();
        Iterator it = repos.iterator();
        while ( it.hasNext() )
        {
            RepositoryConfiguration repoConfig = (RepositoryConfiguration) it.next();
            try
            {
                try
                {
                    ArchivaRepository repository = dao.getRepositoryDAO().getRepository( repoConfig.getId() );
                    // Found repository.  Update it.

                    repository.getModel().setName( repoConfig.getName() );
                    repository.getModel().setUrl( repoConfig.getUrl() );
                    repository.getModel().setLayoutName( repoConfig.getLayout() );
                    repository.getModel().setCreationSource( "configuration" );
                    repository.getModel().setReleasePolicy( repoConfig.isReleases() );
                    repository.getModel().setSnapshotPolicy( repoConfig.isSnapshots() );

                    dao.getRepositoryDAO().saveRepository( repository );
                }
                catch ( ObjectNotFoundException e )
                {
                    // Add the repository to the database.
                    getLogger().info( "Adding repository configuration to DB: " + repoConfig );
                    ArchivaRepository drepo = ArchivaConfigurationAdaptor.toArchivaRepository( repoConfig );
                    drepo.getModel().setCreationSource( "configuration" );
                    dao.getRepositoryDAO().saveRepository( drepo );
                }
            }
            catch ( ArchivaDatabaseException e )
            {
                // Log error.
                getLogger().error( "Unable to add configured repositories to the database: " + e.getMessage(), e );
            }

            // manage roles for repositories
            try
            {
                if ( !roleManager.templatedRoleExists( "archiva-repository-observer", repoConfig.getId() ) )
                {
                    roleManager.createTemplatedRole( "archiva-repository-observer", repoConfig.getId() );
                }

                if ( !roleManager.templatedRoleExists( "archiva-repository-manager", repoConfig.getId() ) )
                {
                    roleManager.createTemplatedRole( "archiva-repository-manager", repoConfig.getId() );
                }
            }
            catch ( RoleManagerException e )
            {
                // Log error.
View Full Code Here

    {
        List repositories = configuration.getConfiguration().getRepositories();
        Iterator itrepos = repositories.iterator();
        while ( itrepos.hasNext() )
        {
            RepositoryConfiguration repo = (RepositoryConfiguration) itrepos.next();
            if ( !repo.isManaged() )
            {
                // Skip non-managed.
                continue;
            }

            RepositoryURL url = new RepositoryURL( repo.getUrl() );
            File repoDir = new File( url.getPath() );

            if ( !repoDir.exists() )
            {
                if ( !repoDir.mkdirs() )
                {
                    // Skip invalid directories.
                    log( "Unable to create missing directory for " + url.getPath() );
                    continue;
                }
            }

            DavServerComponent server = createServer( repo.getId(), repoDir, servletConfig );

            server.addListener( audit );
        }
    }
View Full Code Here

        }
    }

    public String getRepositoryName( DavServerRequest request )
    {
        RepositoryConfiguration repoConfig = getRepository( request );
        if ( repoConfig == null )
        {
            return "Unknown";
        }

        return repoConfig.getName();
    }
View Full Code Here

            // Already in the database.  Skip it.
            return;
        }

        File artifactFile = toFile( artifact );
        RepositoryConfiguration repo = getRepository( artifact );
        ProjectModelReader reader = project400Reader;

        if ( StringUtils.equals( "legacy", repo.getLayout() ) )
        {
            reader = project300Reader;
        }

        try
View Full Code Here

TOP

Related Classes of org.apache.maven.archiva.configuration.RepositoryConfiguration

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.