Package org.apache.archiva.admin.model

Examples of org.apache.archiva.admin.model.RepositoryAdminException


        getRepositoryCommonValidator().basicValidation( remoteRepository, false );

        //TODO we can validate it's a good uri/url
        if ( StringUtils.isEmpty( remoteRepository.getUrl() ) )
        {
            throw new RepositoryAdminException( "url cannot be null" );
        }

        //MRM-752 - url needs trimming
        remoteRepository.setUrl( StringUtils.trim( remoteRepository.getUrl() ) );
View Full Code Here


        RemoteRepositoryConfiguration remoteRepositoryConfiguration =
            configuration.getRemoteRepositoriesAsMap().get( repositoryId );
        if ( remoteRepositoryConfiguration == null )
        {
            throw new RepositoryAdminException(
                "remoteRepository with id " + repositoryId + " not exist cannot remove it" );
        }

        configuration.removeRemoteRepository( remoteRepositoryConfiguration );
View Full Code Here

        RemoteRepositoryConfiguration remoteRepositoryConfiguration =
            configuration.getRemoteRepositoriesAsMap().get( repositoryId );
        if ( remoteRepositoryConfiguration == null )
        {
            throw new RepositoryAdminException(
                "remoteRepository with id " + repositoryId + " not exist cannot remove it" );
        }

        configuration.removeRemoteRepository( remoteRepositoryConfiguration );
View Full Code Here

                                               remoteRepository.getUrl(), calculateIndexRemoteUrl( remoteRepository ),
                                               mavenIndexerUtils.getAllIndexCreators() );
        }
        catch ( MalformedURLException e )
        {
            throw new RepositoryAdminException( e.getMessage(), e );
        }
        catch ( IOException e )
        {
            throw new RepositoryAdminException( e.getMessage(), e );
        }
        catch ( UnsupportedExistingLuceneIndexException e )
        {
            throw new RepositoryAdminException( e.getMessage(), e );
        }

    }
View Full Code Here

    public Boolean addProxyConnector( ProxyConnector proxyConnector, AuditInformation auditInformation )
        throws RepositoryAdminException
    {
        if ( getProxyConnector( proxyConnector.getSourceRepoId(), proxyConnector.getTargetRepoId() ) != null )
        {
            throw new RepositoryAdminException(
                "Unable to add proxy connector, as one already exists with source repository id ["
                    + proxyConnector.getSourceRepoId() + "] and target repository id ["
                    + proxyConnector.getTargetRepoId() + "]." );
        }
View Full Code Here

        Configuration configuration = getArchivaConfiguration().getConfiguration();
        ProxyConnectorConfiguration proxyConnectorConfiguration =
            findProxyConnector( proxyConnector.getSourceRepoId(), proxyConnector.getTargetRepoId(), configuration );
        if ( proxyConnectorConfiguration == null )
        {
            throw new RepositoryAdminException(
                "unable to find ProxyConnector with source " + proxyConnector.getSourceRepoId() + " and target "
                    + proxyConnector.getTargetRepoId() );
        }
        configuration.removeProxyConnector( proxyConnectorConfiguration );
        saveConfiguration( configuration );
View Full Code Here

        throws RepositoryAdminException
    {
        // validate source a Managed target a Remote
        if ( managedRepositoryAdmin.getManagedRepository( proxyConnector.getSourceRepoId() ) == null )
        {
            throw new RepositoryAdminException(
                "non valid ProxyConnector sourceRepo with id " + proxyConnector.getSourceRepoId()
                    + " is not a ManagedRepository" );
        }
        if ( remoteRepositoryAdmin.getRemoteRepository( proxyConnector.getTargetRepoId() ) == null )
        {
            throw new RepositoryAdminException(
                "non valid ProxyConnector sourceRepo with id " + proxyConnector.getTargetRepoId()
                    + " is not a RemoteRepository" );
        }

        // FIXME validate NetworkProxyConfiguration too when available
View Full Code Here

            return;
        }

        if ( fileType.getPatterns().contains( pattern ) )
        {
            throw new RepositoryAdminException( "File type [" + fileTypeId + "] already contains pattern [" + pattern + "]" );
        }
        fileType.addPattern( pattern );

        saveConfiguration( configuration );
        triggerAuditEvent( "", "", AuditEvent.ADD_PATTERN, auditInformation );
View Full Code Here

        throws RepositoryAdminException
    {
        Configuration configuration = getArchivaConfiguration().getConfiguration();
        if ( getFileTypeById( fileType.getId(), configuration ) != null )
        {
            throw new RepositoryAdminException(
                "impossible to FileType with id " + fileType.getId() + " already exists" );
        }

        configuration.getRepositoryScanning().addFileType(
            new BeanReplicator().replicateBean( fileType, org.apache.archiva.configuration.FileType.class ) );
View Full Code Here

        if ( !update )
        {

            if ( config.getManagedRepositoriesAsMap().containsKey( repoId ) )
            {
                throw new RepositoryAdminException( "Unable to add new repository with id [" + repoId
                                                        + "], that id already exists as a managed repository." );
            }
            else if ( config.getRepositoryGroupsAsMap().containsKey( repoId ) )
            {
                throw new RepositoryAdminException( "Unable to add new repository with id [" + repoId
                                                        + "], that id already exists as a repository group." );
            }
            else if ( config.getRemoteRepositoriesAsMap().containsKey( repoId ) )
            {
                throw new RepositoryAdminException( "Unable to add new repository with id [" + repoId
                                                        + "], that id already exists as a remote repository." );
            }
        }

        if ( StringUtils.isBlank( repoId ) )
        {
            throw new RepositoryAdminException( "Repository ID cannot be empty." );
        }

        if ( !GenericValidator.matchRegexp( repoId, REPOSITORY_ID_VALID_EXPRESSION ) )
        {
            throw new RepositoryAdminException(
                "Invalid repository ID. Identifier must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." );
        }

        String name = abstractRepository.getName();

        if ( StringUtils.isBlank( name ) )
        {
            throw new RepositoryAdminException( "repository name cannot be empty" );
        }

        if ( !GenericValidator.matchRegexp( name, REPOSITORY_NAME_VALID_EXPRESSION ) )
        {
            throw new RepositoryAdminException(
                "Invalid repository name. Repository Name must only contain alphanumeric characters, white-spaces(' '), "
                    + "forward-slashes(/), open-parenthesis('('), close-parenthesis(')'),  underscores(_), dots(.), and dashes(-)." );
        }

    }
View Full Code Here

TOP

Related Classes of org.apache.archiva.admin.model.RepositoryAdminException

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.