Package org.apache.maven.wagon

Examples of org.apache.maven.wagon.TransferFailedException


            is = ftp.retrieveFileStream( filename );
        }
        catch ( IOException e )
        {
            throw new TransferFailedException( "Error transferring file via FTP", e );
        }

        inputData.setInputStream( is );
    }
View Full Code Here


            return ret;
        }
        catch ( IOException e )
        {
            throw new TransferFailedException( "Error transferring file via FTP", e );
        }
    }
View Full Code Here

                || ( status == FTPReply.COMMAND_OK )     // not in the RFC but used by some FTP servers
                || ( status == FTPReply.SYSTEM_STATUS ) );
        }
        catch ( IOException e )
        {
            throw new TransferFailedException( "Error transferring file via FTP", e );
        }
        catch ( ResourceDoesNotExistException e )
        {
            return false;
        }
View Full Code Here

            if ( !ftp.changeWorkingDirectory( getRepository().getBasedir() ) )
            {
                RepositoryPermissions permissions = getRepository().getPermissions();
                if ( !makeFtpDirectoryRecursive( getRepository().getBasedir(), permissions ) )
                {
                    throw new TransferFailedException(
                        "Required directory: '" + getRepository().getBasedir() + "' " + "could not get created" );
                }

                // try it again sam ...
                if ( !ftp.changeWorkingDirectory( getRepository().getBasedir() ) )
                {
                    throw new TransferFailedException( "Required directory: '" + getRepository().getBasedir() + "' "
                                                           + "is missing and could not get created" );
                }
            }
        }
        catch ( IOException e )
        {
            throw new TransferFailedException( "Cannot change to root path " + getRepository().getBasedir(), e );
        }

        fireTransferDebug(
            "Recursively uploading directory " + sourceDirectory.getAbsolutePath() + " as " + destinationDirectory );
        ftpRecursivePut( sourceDirectory, destinationDirectory );
View Full Code Here

                        // first, try to create it
                        if ( makeFtpDirectoryRecursive( fileName, permissions ) )
                        {
                            if ( !ftp.changeWorkingDirectory( fileName ) )
                            {
                                throw new TransferFailedException(
                                    "Unable to change cwd on ftp server to " + fileName + " when processing "
                                        + sourceFile.getAbsolutePath() );
                            }
                        }
                        else
                        {
                            throw new TransferFailedException(
                                "Unable to create directory " + fileName + " when processing "
                                    + sourceFile.getAbsolutePath() );
                        }
                    }
                }
                catch ( IOException e )
                {
                    throw new TransferFailedException(
                        "IOException caught while processing path at " + sourceFile.getAbsolutePath(), e );
                }
            }

            File[] files = sourceFile.listFiles();
            if ( files != null && files.length > 0 )
            {
                fireTransferDebug( "listing children of = " + sourceFile.getAbsolutePath() + " found " + files.length );

                // Directories first, then files. Let's go deep early.
                for ( int i = 0; i < files.length; i++ )
                {
                    if ( files[i].isDirectory() )
                    {
                        ftpRecursivePut( files[i], files[i].getName() );
                    }
                }
                for ( int i = 0; i < files.length; i++ )
                {
                    if ( !files[i].isDirectory() )
                    {
                        ftpRecursivePut( files[i], files[i].getName() );
                    }
                }
            }

            // Step back up a directory once we're done with the contents of this one.
            try
            {
                ftp.changeToParentDirectory();
            }
            catch ( IOException e )
            {
                throw new TransferFailedException( "IOException caught while attempting to step up to parent directory"
                                                       + " after successfully processing "
                                                       + sourceFile.getAbsolutePath(), e );
            }
        }
        else
        {
            // Oh how I hope and pray, in denial, but today I am still just a file.

            FileInputStream sourceFileStream = null;
            try
            {
                sourceFileStream = new FileInputStream( sourceFile );

                // It's a file. Upload it in the current directory.
                if ( ftp.storeFile( fileName, sourceFileStream ) )
                {
                    if ( permissions != null )
                    {
                        // Process permissions; note that if we get errors or exceptions here, they are ignored.
                        // This appears to be a conscious decision, based on other parts of this code.
                        String group = permissions.getGroup();
                        if ( group != null )
                        {
                            try
                            {
                                ftp.sendSiteCommand( "CHGRP " + permissions.getGroup() );
                            }
                            catch ( IOException e )
                            {
                            }
                        }
                        String mode = permissions.getFileMode();
                        if ( mode != null )
                        {
                            try
                            {
                                ftp.sendSiteCommand( "CHMOD " + permissions.getDirectoryMode() );
                            }
                            catch ( IOException e )
                            {
                            }
                        }
                    }
                }
                else
                {
                    String msg =
                        "Cannot transfer resource:  '" + sourceFile.getAbsolutePath() + "' FTP Server response: "
                            + ftp.getReplyString();
                    throw new TransferFailedException( msg );
                }
            }
            catch ( IOException e )
            {
                throw new TransferFailedException(
                    "IOException caught while attempting to upload " + sourceFile.getAbsolutePath(), e );
            }
            finally
            {
                IOUtil.close( sourceFileStream );
View Full Code Here

        }
        catch ( ScmException e )
        {
            fireTransferError( target, e, TransferEvent.REQUEST_GET );

            throw new TransferFailedException( "Error interacting with SCM: " + e.getMessage(), e );
        }
        catch ( IOException e )
        {
            fireTransferError( target, e, TransferEvent.REQUEST_GET );

            throw new TransferFailedException( "Error interacting with SCM: " + e.getMessage(), e );
        }

        if ( source.isFile() )
        {
            postProcessListeners( target, source, TransferEvent.REQUEST_PUT );
View Full Code Here

        }
        catch ( ScmException e )
        {
            fireTransferError( resource, e, TransferEvent.REQUEST_PUT );

            throw new TransferFailedException( "Error listing repository: " + e.getMessage(), e );
        }

        // ok, we've established that target exists, or is empty.
        // Check the resource out; if it doesn't exist, that means we're in the svn repo url root,
        // and the configuration is incorrect. We will not try repo.getParent since most scm's don't
        // implement that.

        try
        {
            String repoUrl = getRepository().getUrl();
            if ( "svn".equals( scmProvider.getScmType() ) )
            {
                // Subversion is the only SCM that adds path structure to represent tags and branches.
                // The rest use scmVersion and scmVersionType.
                repoUrl += "/" + target.replace( '\\', '/' );
            }
            scmRepository = getScmRepository( repoUrl );
            CheckOutScmResult ret =
                scmProvider.checkOut( scmRepository, new ScmFileSet( new File( checkoutDirectory, "" ) ),
                                      makeScmVersion(), false );

            checkScmResult( ret );
        }
        catch ( ScmException e )
        {
            fireTransferError( resource, e, TransferEvent.REQUEST_PUT );

            throw new TransferFailedException( "Error checking out: " + e.getMessage(), e );
        }

        // now create the subdirs in target, if it's a parent of targetName

        String relPath = "";

        while ( !stack.isEmpty() )
        {
            String p = (String) stack.pop();
            relPath += p + "/";

            File newDir = new File( checkoutDirectory, relPath );
            if ( !newDir.mkdirs() )
            {
                throw new TransferFailedException(
                    "Failed to create directory " + newDir.getAbsolutePath() + "; parent should exist: "
                        + checkoutDirectory );
            }

            try
            {
                addFiles( scmProvider, scmRepository, checkoutDirectory, relPath );
            }
            catch ( ScmException e )
            {
                fireTransferError( resource, e, TransferEvent.REQUEST_PUT );

                throw new TransferFailedException( "Failed to add directory " + newDir + " to working copy", e );
            }
        }

        return relPath;
    }
View Full Code Here

        }
        catch ( ScmException e )
        {
            fireTransferError( resource, e, TransferEvent.REQUEST_GET );

            throw new TransferFailedException( "Error getting file from SCM", e );
        }
        catch ( IOException e )
        {
            fireTransferError( resource, e, TransferEvent.REQUEST_GET );

            throw new TransferFailedException( "Error getting file from SCM", e );
        }

        postProcessListeners( resource, destination, TransferEvent.REQUEST_GET );

        fireGetCompleted( resource, destination );
View Full Code Here

            return files;
        }
        catch ( ScmException e )
        {
            throw new TransferFailedException( "Error getting filelist from SCM", e );
        }
    }
View Full Code Here

            commandExecutor.executeCommand( mkdirCmd );
        }
        catch ( CommandExecutionException e )
        {
            throw new TransferFailedException( "Error performing commands for file transfer", e );
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.wagon.TransferFailedException

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.