[jboss-svn-commits] JBL Code SVN: r7740 - labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/util
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Nov 21 12:37:50 EST 2006
Author: b_georges
Date: 2006-11-21 12:37:47 -0500 (Tue, 21 Nov 2006)
New Revision: 7740
Added:
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/util/RemoteFileSystem.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/util/RemoteFileSystemException.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/util/RemoteFileSystemFactory.java
Log:
Added RemoteFileSystem and related classes [see Jira Tasks JBESB-127, JBESB-197]. And details in the design forum.
Part of the refactoring to support multiple protocols for Remote File Systems
Added: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/util/RemoteFileSystem.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/util/RemoteFileSystem.java 2006-11-21 16:07:03 UTC (rev 7739)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/util/RemoteFileSystem.java 2006-11-21 17:37:47 UTC (rev 7740)
@@ -0,0 +1,120 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.soa.esb.util;
+
+import java.io.File;
+
+public interface RemoteFileSystem {
+
+ public static final String PARMS_FTP_SERVER = "ftpServer";
+
+ public static final String PARMS_USER = "ftpUser";
+
+ public static final String PARMS_PASSWD = "ftpPassword";
+
+ public static final String PARMS_PORT = "ftpPort";
+
+ public static final String PARMS_REMOTE_DIR = "ftpRemoteDir";
+
+ public static final String PARMS_LOCAL_DIR = "ftpLocalDir";
+
+ public static final String PARMS_ASCII = "ftpAscii";
+
+ public static final String PARMS_PASSIVE = "ftpPassive";
+
+ public String getRemoteDir();
+
+ /**
+ * Terminates ftp session and frees resources
+ * <li>Well behaved programs should make sure to call this method </li>
+ */
+ public void quit(); //_________________________________
+
+ /**
+ * Deletes specified file in remote directory
+ * @param p_sFile String : filename to delete. Method will attempt to delete
+ * file with rightmost node of argument within remote directory specified in 'remoteDirURI'
+ * @throws Exception : if ftp connection cannot be established, or file
+ * cannot be deleted in remote directory
+ */
+ public void deleteRemoteFile(String p_sFile) throws Exception; //_________________________________
+
+ public void remoteDelete(File p_oFile) throws Exception; //_________________________________
+
+ /**
+ * Gets the list of files in the remote directory that end with arg0
+ * @param p_sSuffix String : retrieve only files that end with that suffix - all files if null
+ * @throws Exception : if ftp connection cannot be established, or problems encountered
+ */
+ public String[] getFileListFromRemoteDir(String p_sSuffix) throws Exception; //_________________________________
+
+ /**
+ * Change remote directory
+ * @param p_sDir String : directory to set
+ * @throws Exception : if ftp connection cannot be established, or problems encountered
+ */
+ public void setRemoteDir(String p_sDir) throws Exception; //_________________________________
+
+ /**
+ * Renames specified file in remote directory to specified new name
+ * @param p_sFrom String : filename to rename
+ * @param p_sTo String : new filename
+ * @throws Exception : if ftp connection cannot be established, or file
+ * cannot be renamed to new name in remote directory
+ * <li>Method will attempt to rename file with rightmost node of argument
+ * within remote directory specified in 'remoteDirURI', to new name inside
+ * the SAME remote directory
+ */
+ public void renameInRemoteDir(String p_sFrom, String p_sTo)
+ throws Exception; //_________________________________
+
+ public void remoteRename(File p_oFrom, File p_oTo) throws Exception; //_________________________________
+
+ /**
+ * Uploads specified file from local directory (localDirURI) to remote
+ * directory (remoteDirURI)
+ * @param p_sFile String : filename to upload
+ * @throws Exception : if ftp connection cannot be established, or file
+ * cannot be uploaded
+ * <li> local file will be renamed during transfer ('.xferNotReady' appended
+ * to name)</li>
+ * <li> upon successful completion. the suffix '.xferDone' will be appended
+ * to the original filename </li>
+ */
+ public void uploadFile(File p_oFile, String p_sRemoteName) throws Exception; //_________________________________
+
+ /**
+ * Downloads specified file from remote directory (remoteDirURI) to local
+ * directory (localDirURI)
+ * @param p_sFile String : filename to download
+ * @throws Exception : if ftp connection cannot be established, or file
+ * cannot be downloaded
+ * <li> local file is assigned a temporary name during transfer </li>
+ * <li> upon successful completion, local temporary file will be renamed to
+ * name specified in argument, and suffix '.xferDone' will be appended
+ * to the original filename in the remote directory </li>
+ */
+ public void downloadFile(String p_sFile, String p_sFinalName)
+ throws Exception; //_________________________________
+
+}
\ No newline at end of file
Added: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/util/RemoteFileSystemException.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/util/RemoteFileSystemException.java 2006-11-21 16:07:03 UTC (rev 7739)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/util/RemoteFileSystemException.java 2006-11-21 17:37:47 UTC (rev 7740)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.util;
+
+import org.jboss.soa.esb.BaseException;
+
+/**
+ * Dispatch Exception.
+ * @author b_georges
+ * @since Version 4.0
+ */
+public class RemoteFileSystemException extends BaseException
+{
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Construct an exception instance.
+ * @param message Exception message.
+ */
+ public RemoteFileSystemException(String message) { super(message); }
+
+ /**
+ * Construct an exception instance.
+ * @param message Exception message.
+ * @param cause Exception cause.
+ */
+ public RemoteFileSystemException(String message, Throwable cause) { super(message, cause); }
+
+ /**
+ * Construct an exception instance.
+ * @param cause Exception cause.
+ */
+ public RemoteFileSystemException(Throwable cause) { super(cause); }
+}
Added: 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-11-21 16:07:03 UTC (rev 7739)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/util/RemoteFileSystemFactory.java 2006-11-21 17:37:47 UTC (rev 7740)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.util;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.URISyntaxException;
+
+import org.jboss.internal.soa.esb.util.EdtFtpImpl;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.xml.sax.SAXException;
+
+public class RemoteFileSystemFactory
+{
+
+ //
+ private static final RemoteFileSystemFactory _instance = new RemoteFileSystemFactory();
+
+ // private default constructor
+ private RemoteFileSystemFactory() {}
+
+ public static RemoteFileSystemFactory getInstance()
+ {
+ return _instance;
+ }
+
+ public static RemoteFileSystem getRemoteFileSystem(ConfigTree p_oP, 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 (URISyntaxException e) {
+ throw new RemoteFileSystemException(e);
+ }
+ catch (FileNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (SAXException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ throw new RemoteFileSystemException("Unknown protocol");
+ }
+
+}
More information about the jboss-svn-commits
mailing list