Package org.apache.maven.scm.repository

Examples of org.apache.maven.scm.repository.ScmRepositoryException


        }
        String[] tokens = StringUtils.split( rest, String.valueOf( delimiter ) );

        if ( tokens.length < 2 )
        {
            throw new ScmRepositoryException( "Invalid SCM URL: The url has to be on the form: " + VSS_URL_FORMAT );
        }
        else
        {
            vssDir = tokens[0];
View Full Code Here


                    String tmp = scmSpecificUrl.substring( i1 + 1, lastDelimiter );
                    port = Integer.parseInt( tmp );
                }
                catch ( NumberFormatException ex )
                {
                    throw new ScmRepositoryException( "The port has to be a number." );
                }
            }
        }
        else
        {
View Full Code Here

            host = tokens[0];

            if ( tokens[1].indexOf( '/' ) == -1 )
            {
                throw new ScmRepositoryException(
                    "Invalid SCM URL: The url has to be on the form: " + STARTEAM_URL_FORMAT );
            }

            int at = tokens[1].indexOf( '/' );

            port = new Integer( tokens[1].substring( 0, at ) ).intValue();

            path = tokens[1].substring( at );
        }
        else
        {
            throw new ScmRepositoryException(
                "Invalid SCM URL: The url has to be on the form: " + STARTEAM_URL_FORMAT );
        }

        try
        {
            return new StarteamScmProviderRepository( user, password, host, port, path );
        }
        catch ( Exception e )
        {
            throw new ScmRepositoryException(
                "Invalid SCM URL: The url has to be on the form: " + STARTEAM_URL_FORMAT );
        }
    }
View Full Code Here

    {
        ScmUrlParserResult result = parseScmUrl( scmSpecificUrl, delimiter );

        if ( result.getMessages().size() > 0 )
        {
            throw new ScmRepositoryException( "The scm url is invalid.", result.getMessages() );
        }

        return result.getRepository();
    }
View Full Code Here

    public ScmProviderRepository makeProviderScmRepository( File path )
        throws ScmRepositoryException, UnknownRepositoryStructure
    {
        if ( path == null || !path.isDirectory() )
        {
            throw new ScmRepositoryException( path.getAbsolutePath() + " isn't a valid directory." );
        }

        File cvsDirectory = new File( path, "CVS" );

        if ( !cvsDirectory.exists() )
        {
            throw new ScmRepositoryException( path.getAbsolutePath() + " isn't a cvs checkout directory." );
        }

        File cvsRootFile = new File( cvsDirectory, "Root" );

        File moduleFile = new File( cvsDirectory, "Repository" );

        String cvsRoot;

        String module;

        try
        {
            cvsRoot = FileUtils.fileRead( cvsRootFile ).trim().substring( 1 );
        }
        catch ( IOException e )
        {
            throw new ScmRepositoryException( "Can't read " + cvsRootFile.getAbsolutePath() );
        }
        try
        {
            module = FileUtils.fileRead( moduleFile ).trim();
        }
        catch ( IOException e )
        {
            throw new ScmRepositoryException( "Can't read " + moduleFile.getAbsolutePath() );
        }

        return makeProviderScmRepository( cvsRoot + ":" + module, ':' );
    }
View Full Code Here

            URI tfsUri = URI.create( tfsUrl );
            String scheme = tfsUri.getScheme();
            getLogger().info( "Scheme - " + scheme );
            if ( scheme == null || !( scheme.equalsIgnoreCase( "http" ) || scheme.equalsIgnoreCase( "https" ) ) )
            {
                throw new ScmRepositoryException( "TFS Url \"" + tfsUrl + "\" is not a valid URL. "
                    + "The TFS Url syntax is " + TFS_URL_FORMAT );
            }
        }
        catch ( IllegalArgumentException e )
        {
            throw new ScmRepositoryException( "TFS Url \"" + tfsUrl + "\" is not a valid URL. The TFS Url syntax is "
                + TFS_URL_FORMAT );
        }

        String username = null;
        String password = null;
View Full Code Here

        {
            ScmUrlParserResult result = parseScmUrl( scmSpecificUrl, delimiter );
   
            if ( result.messages.size() > 0 )
            {
                throw new ScmRepositoryException( "The scm url " + scmSpecificUrl + " is invalid.", result.messages );
            }
   
            return result.repository;
        }
        catch ( ScmException e )
        {
            // XXX We should allow throwing of SCMException.
            throw new ScmRepositoryException( "Error creating the scm repository", e );
        }
    }
View Full Code Here

            throw new NullPointerException( "Path argument is null" );
        }

        if ( !path.isDirectory() )
        {
            throw new ScmRepositoryException( path.getAbsolutePath() + " isn't a valid directory." );
        }

        if ( !new File( path, ".git" ).exists() )
        {
            throw new ScmRepositoryException( path.getAbsolutePath() + " isn't a git checkout directory." );
        }

        try
        {
            return makeProviderScmRepository( getRepositoryURL( path ), ':' );
        }
        catch ( ScmException e )
        {
            // XXX We should allow throwing of SCMException.
            throw new ScmRepositoryException( "Error creating the scm repository", e );
        }
    }
View Full Code Here

            URI jazzUri = URI.create( jazzUrl );
            String scheme = jazzUri.getScheme();
            getLogger().debug( "Scheme - " + scheme );
            if ( scheme == null || !( scheme.equalsIgnoreCase( "http" ) || scheme.equalsIgnoreCase( "https" ) ) )
            {
                throw new ScmRepositoryException(
                    "Jazz Url \"" + jazzUrl + "\" is not a valid URL. The Jazz Url syntax is " + JAZZ_URL_FORMAT );
            }
        }
        catch ( IllegalArgumentException e )
        {
            throw new ScmRepositoryException(
                "Jazz Url \"" + jazzUrl + "\" is not a valid URL. The Jazz Url syntax is " + JAZZ_URL_FORMAT );
        }

        // At this point, jazzUrl is guaranteed to start with either http:// or https://
        // Further process the jazzUrl to extract the server name and port.
        String hostname = null;
        int port = 0;

        if ( havePort )
        {
            // jazzUrlAndWorkspace should be: http[s]://server_name:port/contextRoot:repositoryWorkspace
            // jazzUrl should be            : http[s]://server_name:port/contextRoot
            int protocolIndex = jazzUrl.indexOf( ":" ) + 3;     // The +3 accounts for the "://"
            int portIndex = jazzUrl.indexOf( ":", protocolIndex + 1 );
            hostname = jazzUrl.substring( protocolIndex, portIndex );
            int pathIndex = jazzUrl.indexOf( "/", portIndex + 1 );
            String portNo = jazzUrl.substring( portIndex + 1, pathIndex );
            try
            {
                port = Integer.parseInt( portNo );
            }
            catch ( NumberFormatException nfe )
            {
                throw new ScmRepositoryException(
                    "Jazz Url \"" + jazzUrl + "\" is not a valid URL. The Jazz Url syntax is " + JAZZ_URL_FORMAT );
            }
        }
        else
        {
            // jazzUrlAndWorkspace should be: http[s]://server_name/contextRoot:repositoryWorkspace
            // jazzUrl should be            : http[s]://server_name/contextRoot
            // So we will set port to zero.
            int protocolIndex = jazzUrl.indexOf( ":" ) + 3;     // The +3 accounts for the "://"
            int pathIndex = jazzUrl.indexOf( "/", protocolIndex + 1 );
            if ( ( protocolIndex != -1 ) && ( pathIndex != -1 ) )
            {
                hostname = jazzUrl.substring( protocolIndex, pathIndex );
            }
            else
            {
                throw new ScmRepositoryException(
                    "Jazz Url \"" + jazzUrl + "\" is not a valid URL. The Jazz Url syntax is " + JAZZ_URL_FORMAT );
            }
        }

        getLogger().debug( "Creating JazzScmProviderRepository with the following values:" );
View Full Code Here

        }
        String[] tokens = StringUtils.split( rest, String.valueOf( delimiter ) );

        if ( tokens.length < 2 )
        {
            throw new ScmRepositoryException( "Invalid SCM URL: The url has to be on the form: " + VSS_URL_FORMAT );
        }
        else
        {
            vssDir = tokens[0];
View Full Code Here

TOP

Related Classes of org.apache.maven.scm.repository.ScmRepositoryException

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.