Package org.jboss.soa.esb.util

Examples of org.jboss.soa.esb.util.RemoteFileSystemException


                        m_oParms.setAttribute(PARMS_TIMEOUT_DATA, Integer.toString(m_iTimeoutData));
                        m_oParms.setAttribute(PARMS_TIMEOUT_SO, Integer.toString(m_iTimeoutSo));
                }
                catch (Exception e)
                {
                        throw new RemoteFileSystemException(e);
                }
        }
View Full Code Here


            try
            {
                changeRemoteDirectory() ;
                if (!m_oConn.deleteFile(p_sFile))
                {
                    throw new RemoteFileSystemException("Failed to delete remote file: " + m_oConn.getReplyString());
                }
            }
            catch (final IOException ioe)
            {
                throw new RemoteFileSystemException(ioe);
            }
        }
View Full Code Here

                       
                    changeRemoteDirectory() ;
                    final InputStream is = m_oConn.retrieveFileStream(p_sFile) ;
                    if (is == null)
                    {
                        throw new RemoteFileSystemException("Could not download file: " + m_oConn.getReplyString());
                    }
                   
                    try
                    {
                        final FileOutputStream fos = new FileOutputStream(oNewTmp) ;
                        try
                        {
                            copyStream(is, fos) ;
                        }
                        finally
                        {
                            fos.close() ;
                        }
                    }
                    finally
                    {
                        is.close() ;
                    }
                    if (!m_oConn.completePendingCommand())
                    {
                        boolean result = oNewTmp.delete();
                        if (!result) {
                          logger.error("Could not delete file " + oNewTmp.getAbsolutePath());
                        }
                        throw new RemoteFileSystemException("Failed to download contents: " + m_oConn.getReplyString()) ;
                    }
                    FileUtil.renameTo(oNewTmp, oNew) ;
                }
                catch (final IOException ioe)
                {
                    throw new RemoteFileSystemException(ioe) ;
                }
        }
View Full Code Here

                        changeRemoteDirectory() ;
                        return m_oConn.listNames() ;
                    }
                    catch (final IOException ioe)
                    {
                        throw new RemoteFileSystemException(ioe) ;
                    }             
            } else {
              String sSuffix = "*" + p_sSuffix;

              try
              {
                changeRemoteDirectory() ;
                return m_oConn.listNames(sSuffix) ;
              }
              catch (final IOException ioe)
              {
                throw new RemoteFileSystemException(ioe) ;
              }
            }
        }
View Full Code Here

                    }
                   
                    connect() ;
                   
                    if (!m_oConn.isConnected())
                        throw new RemoteFileSystemException(
                                        "Can't connect to FTP server");
                   
                    if (!m_oConn.login(m_sUser, m_sPasswd))
                    {
                        m_oConn.logout() ;
                        throw new RemoteFileSystemException("Remote login failed: " + m_oConn.getReplyString());
                    }
                    m_oConn.setFileType(FTP.BINARY_FILE_TYPE) ;
                    if (m_bPassive)
                    {
                        m_oConn.enterLocalPassiveMode() ;
                    }
                    if (m_iTimeoutData > 0)
                    {
                        m_oConn.setDataTimeout(m_iTimeoutData);
                    }
                    if (m_iTimeoutSo > 0)
                    {
                        m_oConn.setSoTimeout(m_iTimeoutSo);
                    }
                }
                catch (final IOException ioe)
                {
                    if (m_oConn.isConnected())
                    {
                        try
                        {
                            m_oConn.disconnect() ;
                        }
                        catch (final IOException ioe2) {} // ignore
                    }
                    throw new RemoteFileSystemException(ioe);
                }
            }
        }
View Full Code Here

                try
                {
                    changeRemoteDirectory() ;
                    if (!m_oConn.deleteFile(p_oFile.getName()))
                    {
                        throw new RemoteFileSystemException("Failed to delete remote file: " + m_oConn.getReplyString());
                    }
                }
                catch (final IOException ioe)
                {
                    throw new RemoteFileSystemException(ioe);
                }
        }
View Full Code Here

                {
                        changeRemoteDirectory();
                        if (!m_oConn.rename(FtpClientUtil.fileToFtpString(p_oFrom),
                                FtpUtils.fileToFtpString(p_oTo)))
                        {
                            throw new RemoteFileSystemException("Failed to rename file: " + m_oConn.getReplyString());
                        }
                }
                catch (final IOException ioe)
                {
                    throw new RemoteFileSystemException(ioe);
                }
        }
View Full Code Here

            try
            {
                changeRemoteDirectory() ;
                if (!m_oConn.rename(p_sFrom, p_sTo))
                {
                    throw new RemoteFileSystemException("Failed to rename file: " + m_oConn.getReplyString());
                }
            }
            catch (final IOException ioe)
            {
                throw new RemoteFileSystemException(ioe);
            }
        }
View Full Code Here

                final String sRemoteTmp = p_sRemoteName + TMP_SUFFIX;
               
                final OutputStream os = m_oConn.storeFileStream(sRemoteTmp) ;
                if (os == null)
                {
                    throw new RemoteFileSystemException("Failed to obtain output stream: " + m_oConn.getReplyString()) ;
                }
               
                try
                {
                    final FileInputStream fis = new FileInputStream(p_oFile) ;
                    try
                    {
                        copyStream(fis, os) ;
                    }
                    finally
                    {
                        fis.close() ;
                    }
                }
                finally
                {
                    os.flush() ;
                    os.close() ;
                }
                if (!m_oConn.completePendingCommand())
                {
                    throw new RemoteFileSystemException("Failed to upload contents: " + m_oConn.getReplyString()) ;
                }
               
                boolean retryProblem = true// https://jira.jboss.org/jira/browse/JBESB-1995

                for (int i = 0; i < m_iRenameRetry; i++)
                {
                    if (m_oConn.rename(sRemoteTmp, p_sRemoteName))
                    {
                        retryProblem = false;
                       
                        break;
                    }
                    else
                    {
                        if (i+1 < m_iRenameRetry)
                        {
                            try
                            {
                                Thread.sleep(1000L); // 1 second
                            }
                            catch (final Exception ex)
                            {
                            }
                        }
                    }
                }
               
                if (retryProblem)
                    throw new RemoteFileSystemException("Failed to rename file: " + m_oConn.getReplyString());
            }
            catch (final IOException ioe)
            {
                throw new RemoteFileSystemException(ioe);
            }
        }
View Full Code Here

            final String remoteDir = getRemoteDir() ;
            if ((remoteDir != null) && (remoteDir.length() > 0))
            {
                if (!m_oConn.changeWorkingDirectory(remoteDir))
                {
                    throw new RemoteFileSystemException("Failed to change to remote directory: " + m_oConn.getReplyString());
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.jboss.soa.esb.util.RemoteFileSystemException

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.