[jboss-svn-commits] JBL Code SVN: r8405 - in labs/jbossesb/trunk/product/core/rosetta/src/org/jboss: internal/soa/esb/couriers/helpers internal/soa/esb/util soa/esb/util
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Dec 19 09:54:49 EST 2006
Author: b_georges
Date: 2006-12-19 09:54:42 -0500 (Tue, 19 Dec 2006)
New Revision: 8405
Modified:
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/couriers/helpers/FtpFileHandler.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/util/EdtFtpImpl.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/util/SecureFtpImpl.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/util/RemoteFileSystemFactory.java
Log:
Updated FtpFileHandler to call the RemoteFileSystemFactory passing a FileEpr instead of the ConfigTree, removed the kludge.
Deprecated the previous methods.
Fixed a small issue in SecureFtpimpl.
Some formatting and doc.
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/couriers/helpers/FtpFileHandler.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/couriers/helpers/FtpFileHandler.java 2006-12-19 14:49:39 UTC (rev 8404)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/couriers/helpers/FtpFileHandler.java 2006-12-19 14:54:42 UTC (rev 8405)
@@ -99,9 +99,6 @@
_logger.warn(e);
}
- // TODO Once the RemoteFileSystem has a constructor that takes FTPEpr,
- // we can get rid of this kludge
- configTreeFromEpr();
}
public boolean deleteFile(File file) throws CourierException
@@ -214,13 +211,12 @@
// Because ftp connections are volatile, we are always getting a fresh
// handle
// TODO there's room for optimization here - not for GA though
- // TODO check with Bruno - why is the getInstance() not needed ? is it OK ?
protected RemoteFileSystem getHandler() throws CourierException
{
try
{
RemoteFileSystem rfs = RemoteFileSystemFactory.getRemoteFileSystem(
- _tree, true);
+ _epr, true);
try
{
rfs.setRemoteDir(_remoteDir);
@@ -241,6 +237,9 @@
// this method is only needed until there's an appropriate constructor that
// takes an EPR
// see TODO in constructor
+ /**
+ * @deprecated
+ */
private void configTreeFromEpr() throws CourierException
{
try
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/util/EdtFtpImpl.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/util/EdtFtpImpl.java 2006-12-19 14:49:39 UTC (rev 8404)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/util/EdtFtpImpl.java 2006-12-19 14:54:42 UTC (rev 8405)
@@ -344,7 +344,7 @@
*/
public void remoteDelete(File p_oFile) throws Exception
{
- m_oConn.delete(FtpUtils.fileToFtpString(p_oFile));
+ m_oConn.delete(getRemoteDir() + "/" + p_oFile.getName());
}
/*
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/util/SecureFtpImpl.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/util/SecureFtpImpl.java 2006-12-19 14:49:39 UTC (rev 8404)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/util/SecureFtpImpl.java 2006-12-19 14:54:42 UTC (rev 8405)
@@ -34,7 +34,6 @@
import java.util.Vector;
import org.apache.log4j.Logger;
-import org.jboss.soa.esb.addressing.eprs.FTPEpr;
import org.jboss.soa.esb.addressing.eprs.SFTPEpr;
import org.jboss.soa.esb.common.Environment;
import org.jboss.soa.esb.common.ModulePropertyManager;
@@ -78,6 +77,7 @@
private ChannelSftp m_oSftpChannel = null;
+ // TODO Add support for certificate. Not for GA though.
private URL m_oCertificate = null;
@SuppressWarnings("unused")
@@ -118,7 +118,7 @@
public SecureFtpImpl(SFTPEpr p_oP, boolean p_bConnect) throws Exception
{
- m_oEpr = (SFTPEpr) p_oP;
+ m_oEpr = p_oP;
URL url = null;
try {
@@ -166,7 +166,7 @@
_logger.warn(e);
}
- try
+ try
{
m_oCertificate = m_oEpr.getCertificateURL();
} catch (URISyntaxException e) {
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/util/RemoteFileSystemFactory.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/util/RemoteFileSystemFactory.java 2006-12-19 14:49:39 UTC (rev 8404)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/util/RemoteFileSystemFactory.java 2006-12-19 14:54:42 UTC (rev 8405)
@@ -37,56 +37,88 @@
import org.jboss.soa.esb.helpers.ConfigTree;
import org.xml.sax.SAXException;
-public class RemoteFileSystemFactory {
+public class RemoteFileSystemFactory
+{
// private default constructor
- private RemoteFileSystemFactory() {
+ private RemoteFileSystemFactory()
+ {
}
- public static RemoteFileSystem getRemoteFileSystem(FileEpr p_oEpr, boolean p_bConnect)
- throws RemoteFileSystemException {
+ /**
+ * This method returns a RemoteFileSystem Implementation at runtime.
+ * The implementation depends on which protocol is specified in the
+ * URL of the RemoteFileSystem.
+ * We currently support "ftp" and "sftp"
+ * Refactoring related to JIRA Tasks: JBESB-127 and JBESB-197
+ * @param p_oEpr
+ * @param p_bConnect
+ * @return
+ * @throws RemoteFileSystemException
+ */
+ public static RemoteFileSystem getRemoteFileSystem(FileEpr p_oEpr,
+ boolean p_bConnect) throws RemoteFileSystemException
+ {
URL url = null;
- try {
- url = p_oEpr.getURL();
+ try
+ {
+ url = p_oEpr.getURL();
if (url.getProtocol().equals(RemoteFileSystem.FTP_PROTOCOL))
- return new EdtFtpImpl((FTPEpr)p_oEpr, p_bConnect);
- else if (url.getProtocol().equals(RemoteFileSystem.FTP_PROTOCOL))
- return new SecureFtpImpl((SFTPEpr)p_oEpr, p_bConnect);
+ return new EdtFtpImpl((FTPEpr) p_oEpr, p_bConnect);
+ else if (url.getProtocol().equals(RemoteFileSystem.SFTP_PROTOCOL))
+ return new SecureFtpImpl((SFTPEpr) p_oEpr, p_bConnect);
- } catch (MalformedURLException e) {
+ } catch (MalformedURLException e)
+ {
throw new RemoteFileSystemException(e);
- } catch (URISyntaxException e) {
+ } catch (URISyntaxException e)
+ {
throw new RemoteFileSystemException(e);
- } catch (Exception e) {
+ } catch (Exception e)
+ {
throw new RemoteFileSystemException(e);
}
throw new RemoteFileSystemException("Unknown or unsupported protocol");
}
- // TODO this will be replaced by the new method which takes an EPR rather than a config tree
+ /**
+ * @deprecated
+ * @param p_oP
+ * @param p_bConnect
+ * @return
+ * @throws RemoteFileSystemException
+ */
public static RemoteFileSystem getRemoteFileSystem(ConfigTree p_oP,
- boolean p_bConnect) throws RemoteFileSystemException {
- try {
+ boolean p_bConnect) throws RemoteFileSystemException
+ {
+ try
+ {
// TODO get the implementation class from properties.
// See SecureFtpImplUnitTest and EdtFtpImplUnitTest for Tests.
// return new SecureFtpImpl(p_oP,p_bConnect);
return new EdtFtpImpl(p_oP, p_bConnect);
- } catch (UnknownHostException ex) {
+ } catch (UnknownHostException ex)
+ {
throw new RemoteFileSystemException(ex);
- } catch (URISyntaxException e) {
+ } catch (URISyntaxException e)
+ {
throw new RemoteFileSystemException(e);
- } catch (FileNotFoundException e) {
+ } catch (FileNotFoundException e)
+ {
// TODO Auto-generated catch block
e.printStackTrace();
- } catch (SAXException e) {
+ } catch (SAXException e)
+ {
// TODO Auto-generated catch block
e.printStackTrace();
- } catch (IOException e) {
+ } catch (IOException e)
+ {
// TODO Auto-generated catch block
e.printStackTrace();
- } catch (Exception e) {
+ } catch (Exception e)
+ {
// TODO Auto-generated catch block
e.printStackTrace();
}
More information about the jboss-svn-commits
mailing list