[jboss-svn-commits] JBL Code SVN: r7741 - labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/util
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Nov 21 12:40:04 EST 2006
Author: b_georges
Date: 2006-11-21 12:40:01 -0500 (Tue, 21 Nov 2006)
New Revision: 7741
Added:
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/internal/soa/esb/util/SecureFtpUserInfo.java
Log:
These classes implement the RemoteFileSystem interface. see Jira tasks [JBESB-127 and JBESB-197]
Added: 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-11-21 17:37:47 UTC (rev 7740)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/util/EdtFtpImpl.java 2006-11-21 17:40:01 UTC (rev 7741)
@@ -0,0 +1,303 @@
+/*
+ * 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.internal.soa.esb.util;
+
+import java.io.File;
+import java.util.List;
+
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.helpers.KeyValuePair;
+import org.jboss.soa.esb.util.RemoteFileSystem;
+
+import com.enterprisedt.net.ftp.FTPClient;
+import com.enterprisedt.net.ftp.FTPConnectMode;
+import com.enterprisedt.net.ftp.FTPTransferType;
+
+/**
+ * Simplified FTP transfers
+ * <p>
+ * Description: Implements a simple set of FTP functionality Parameters to
+ * establish the FTP connection are provided at construction time and cannot
+ * change during the lifetime of the object <br/>Hides low level details.
+ * Current implementation is based on the "Entreprise Distributed Technology
+ * edtFTPj" library but this can be changed with no impact to existing code,
+ * just by changing this class without modifying the signature of it's public
+ * methods
+ * </p>
+ */
+
+public class EdtFtpImpl implements RemoteFileSystem {
+ private static final String TMP_SUFFIX = ".rosettaPart";
+
+ public enum XFER_TYPE {
+ ascii, binary
+ };
+
+ private ConfigTree m_oParms;
+
+ private String m_sFtpServer, m_sUser, m_sPasswd;
+
+ private String m_sRemoteDir, m_sLocalDir;
+
+ private int m_iPort;
+
+ private boolean m_bPassive;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.soa.esb.util.RemoteFileSystem#getRemoteDir()
+ */
+ public String getRemoteDir() {
+ return m_sRemoteDir;
+ }
+
+ private FTPClient m_oConn = new FTPClient();
+
+ private FTPTransferType m_oXferType = FTPTransferType.BINARY;
+
+ /**
+ * Checks validity and completeness of parameters, and keeps the info
+ * internally for subsequent FTP requests
+ *
+ * @param p_oP
+ * ConfigTree
+ * @throws Exception :
+ * if parameters are invalid or incomplete
+ * <li>Parameters: (XML attributes at the root level) </li>
+ * <li> ftpServer = name or IP of FTP server </li>
+ * <li> ftpUser = login ID for server </li>
+ * <li> ftpPassword </li>
+ * <li> localDirURI = absolute path in the local filesystem
+ * </li>
+ * <li> remoteDirURI = remote path is relative to ftp user home
+ * in remote computer </li>
+ */
+
+ public EdtFtpImpl(ConfigTree p_oP, boolean p_bConnect) throws Exception {
+ m_oParms = p_oP;
+ initialize(p_bConnect);
+ }
+
+ public EdtFtpImpl(List<KeyValuePair> attribs, boolean connect)
+ throws Exception {
+ m_oParms = new ConfigTree("fromProps");
+ for (KeyValuePair oCurr : attribs)
+ m_oParms.setAttribute(oCurr.getKey(), oCurr.getValue());
+ initialize(connect);
+ }
+
+ private void initialize(boolean bConnect) throws Exception {
+ checkParms();
+ if (bConnect) {
+ m_oConn.setRemoteHost(m_sFtpServer);
+ m_oConn.setRemotePort(m_iPort);
+ m_oConn.connect();
+ for (int i1 = 0; i1 < 10 && !m_oConn.connected(); i1++)
+ Thread.sleep(200);
+ if (!m_oConn.connected())
+ throw new Exception("Can't connect to FTP server");
+ m_oConn.user(m_sUser);
+ m_oConn.password(m_sPasswd);
+ m_oConn.setConnectMode((m_bPassive) ? FTPConnectMode.PASV
+ : FTPConnectMode.ACTIVE);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.soa.esb.util.RemoteFileSystem#quit()
+ */
+ public void quit() {
+ if (null != m_oConn)
+ try {
+ m_oConn.quit();
+ } catch (Exception e) {
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.soa.esb.util.RemoteFileSystem#deleteRemoteFile(java.lang.String)
+ */
+ public void deleteRemoteFile(String p_sFile) throws Exception {
+ m_oConn.delete(getRemoteDir() + "/" + new File(p_sFile).getName());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.soa.esb.util.RemoteFileSystem#remoteDelete(java.io.File)
+ */
+ public void remoteDelete(File p_oFile) throws Exception {
+ m_oConn.delete(fileToFtpString(p_oFile));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.soa.esb.util.RemoteFileSystem#getFileListFromRemoteDir(java.lang.String)
+ */
+ public String[] getFileListFromRemoteDir(String p_sSuffix) throws Exception {
+ String sSuffix = (null == p_sSuffix) ? "*" : "*" + p_sSuffix;
+ return m_oConn.dir(sSuffix);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.soa.esb.util.RemoteFileSystem#setRemoteDir(java.lang.String)
+ */
+ public void setRemoteDir(String p_sDir) throws Exception {
+ m_oConn.chdir(p_sDir);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.soa.esb.util.RemoteFileSystem#renameInRemoteDir(java.lang.String,
+ * java.lang.String)
+ */
+ public void renameInRemoteDir(String p_sFrom, String p_sTo)
+ throws Exception {
+ String sRmtFrom = new File(p_sFrom).getName();
+ String sRmtTo = new File(p_sTo).getName();
+
+ try {
+ m_oConn.rename(getRemoteDir() + "/" + sRmtFrom, getRemoteDir()
+ + "/" + sRmtTo);
+ } catch (Exception e) {
+ String sMess = this.getClass().getSimpleName()
+ + " can't rename in remote directory <" + e.getMessage()
+ + ">";
+ throw new Exception(sMess);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.soa.esb.util.RemoteFileSystem#remoteRename(java.io.File,
+ * java.io.File)
+ */
+ public void remoteRename(File p_oFrom, File p_oTo) throws Exception {
+ try {
+ m_oConn.rename(fileToFtpString(p_oFrom), fileToFtpString(p_oTo));
+ } catch (Exception e) {
+ String sMess = this.getClass().getSimpleName()
+ + " can't rename in remote directory <" + e.getMessage()
+ + ">";
+ throw new Exception(sMess);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.soa.esb.util.RemoteFileSystem#uploadFile(java.io.File,
+ * java.lang.String)
+ */
+ public void uploadFile(File p_oFile, String p_sRemoteName) throws Exception {
+ String sRemoteOK = getRemoteDir() + "/" + p_sRemoteName;
+ String sRemoteTmp = sRemoteOK + TMP_SUFFIX;
+ m_oConn.setType(m_oXferType);
+ m_oConn.put(fileToFtpString(p_oFile), sRemoteTmp);
+ m_oConn.rename(sRemoteTmp, sRemoteOK);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.soa.esb.util.RemoteFileSystem#downloadFile(java.lang.String,
+ * java.lang.String)
+ */
+ public void downloadFile(String p_sFile, String p_sFinalName)
+ throws Exception {
+ File oLocalDir = new File(m_sLocalDir);
+ File oLclFile = File.createTempFile("Rosetta_", TMP_SUFFIX, oLocalDir);
+
+ try {
+ oLclFile.delete();
+ } catch (Exception e) {
+ }
+ m_oConn.setType(m_oXferType);
+ m_oConn.get(fileToFtpString(oLclFile), p_sFile);
+
+ File oNew = new File(oLocalDir, p_sFinalName);
+ if (oNew.exists())
+ oNew.delete();
+ oLclFile.renameTo(oNew);
+ }
+
+ // Beware !!! The logic here seems wrong, but it works
+ // It appears that there's some kind of bug in the edtftpj.jar library
+ // The !XFER_TYPE.ascii.equals(p_oMode) should NOT be negated
+ // But it works when negated (newlines from Unix to DOS)
+ private void setXferType(XFER_TYPE p_oMode) {
+ m_oXferType = !XFER_TYPE.ascii.equals(p_oMode) ? FTPTransferType.ASCII
+ : FTPTransferType.BINARY;
+ }
+
+ private void checkParms() throws Exception {
+ m_sFtpServer = m_oParms.getAttribute(PARMS_FTP_SERVER);
+ if (null == m_sFtpServer)
+ throw new Exception("No FTP server specified");
+
+ m_sUser = m_oParms.getAttribute(PARMS_USER);
+ if (null == m_sUser)
+ throw new Exception("No username specified for FTP");
+
+ m_sPasswd = m_oParms.getAttribute(PARMS_PASSWD);
+ if (null == m_sPasswd)
+ throw new Exception("No password specified for FTP");
+
+ m_sRemoteDir = m_oParms.getAttribute(PARMS_REMOTE_DIR);
+ if (null == m_sRemoteDir)
+ m_sRemoteDir = "";
+
+ m_sLocalDir = m_oParms.getAttribute(PARMS_LOCAL_DIR);
+ if (null == m_sLocalDir)
+ m_sLocalDir = ".";
+
+ String sAux = m_oParms.getAttribute(PARMS_PORT);
+ m_iPort = (null == sAux) ? 21 : Integer.parseInt(sAux);
+
+ boolean bAscii = false;
+ sAux = m_oParms.getAttribute(PARMS_ASCII);
+ if (null != sAux)
+ bAscii = Boolean.parseBoolean(sAux);
+ setXferType((bAscii) ? XFER_TYPE.ascii : XFER_TYPE.binary);
+
+ m_bPassive = false;
+ sAux = m_oParms.getAttribute(PARMS_PASSIVE);
+ m_bPassive = (null != sAux) && Boolean.parseBoolean(sAux);
+
+ return;
+ }
+
+ public static String fileToFtpString(File p_oF) {
+ return (null == p_oF) ? null : p_oF.toString().replace("\\", "/");
+ }
+
+}
\ No newline at end of file
Added: 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-11-21 17:37:47 UTC (rev 7740)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/util/SecureFtpImpl.java 2006-11-21 17:40:01 UTC (rev 7741)
@@ -0,0 +1,292 @@
+/**
+ *
+ */
+package org.jboss.internal.soa.esb.util;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Vector;
+
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.helpers.KeyValuePair;
+import org.jboss.soa.esb.util.RemoteFileSystem;
+
+import com.jcraft.jsch.Channel;
+import com.jcraft.jsch.ChannelSftp;
+import com.jcraft.jsch.JSch;
+import com.jcraft.jsch.Session;
+import com.jcraft.jsch.SftpATTRS;
+import com.jcraft.jsch.UserInfo;
+import com.jcraft.jsch.ChannelSftp.LsEntry;
+
+/**
+ *
+ * Implementation of sftp (Secure FTP over SSH) Based on JSch from JCraft
+ * http://www.jcraft.com/
+ *
+ * @author b_georges
+ *
+ */
+
+public class SecureFtpImpl implements RemoteFileSystem {
+
+ private static final String TMP_SUFFIX = ".rosettaPart";
+
+ private static final String SECURE_CHANNEL = "sftp";
+
+ private ConfigTree m_oParms;
+
+ private String m_sFtpServer, m_sUser, m_sPasswd;
+
+ private String m_sRemoteDir, m_sLocalDir;
+
+ private int m_iPort;
+
+ // TODO: add support for this if appropriate.
+ private boolean m_bPassive;
+
+ // The objects implementing ssh
+ private JSch m_oJSch = new JSch();
+
+ private Session session = null;
+
+ private Channel m_oChannel = null;
+
+ private ChannelSftp m_oSftpChannel = null;
+
+ // TODO: add support for keys We will do without it for now
+ private String m_sPrivateKeyFileName = null;
+
+ private boolean m_bConnected;
+
+ public SecureFtpImpl(ConfigTree p_oP, boolean p_bConnect) throws Exception {
+ m_oParms = p_oP;
+ initialize(p_bConnect);
+ }
+
+ public SecureFtpImpl(List<KeyValuePair> attribs, boolean connect)
+ throws Exception {
+ m_oParms = new ConfigTree("fromProps");
+ for (KeyValuePair oCurr : attribs)
+ m_oParms.setAttribute(oCurr.getKey(), oCurr.getValue());
+ initialize(connect);
+ }
+
+ private void initialize(boolean bConnect) throws Exception {
+ checkParms();
+ if (bConnect) {
+ session = m_oJSch.getSession(m_sUser, m_sFtpServer, m_iPort);
+
+ // username and password will be given via UserInfo interface.
+ UserInfo ui = new SecureFtpUserInfo("");
+ session.setUserInfo(ui);
+
+ session.connect();
+
+ m_oChannel = session.openChannel(SECURE_CHANNEL);
+
+ m_oChannel.connect();
+
+ m_oSftpChannel = (ChannelSftp) m_oChannel;
+
+ for (int i1 = 0; i1 < 10 && !session.isConnected(); i1++)
+ Thread.sleep(200);
+ if (!session.isConnected())
+ throw new Exception("Can't connect to FTP server");
+
+ m_bConnected = this.session.isConnected();
+ }
+ // TODO set connection Mode [PASSIVE|ACTIVE]using m_bPassive ?
+
+ }
+
+ private void checkParms() throws Exception {
+ m_sFtpServer = m_oParms.getAttribute(PARMS_FTP_SERVER);
+ if (null == m_sFtpServer)
+ throw new Exception("No FTP server specified");
+
+ m_sUser = m_oParms.getAttribute(PARMS_USER);
+ if (null == m_sUser)
+ throw new Exception("No username specified for FTP");
+
+ m_sPasswd = m_oParms.getAttribute(PARMS_PASSWD);
+ if (null == m_sPasswd)
+ throw new Exception("No password specified for FTP");
+
+ m_sRemoteDir = m_oParms.getAttribute(PARMS_REMOTE_DIR);
+ if (null == m_sRemoteDir)
+ m_sRemoteDir = "";
+
+ m_sLocalDir = m_oParms.getAttribute(PARMS_LOCAL_DIR);
+ if (null == m_sLocalDir)
+ m_sLocalDir = ".";
+
+ String sAux = m_oParms.getAttribute(PARMS_PORT);
+ m_iPort = (null == sAux) ? 22 : Integer.parseInt(sAux);
+
+ boolean bAscii = false;
+ sAux = m_oParms.getAttribute(PARMS_ASCII);
+ if (null != sAux)
+ bAscii = Boolean.parseBoolean(sAux);
+
+ m_bPassive = false;
+ sAux = m_oParms.getAttribute(PARMS_PASSIVE);
+ m_bPassive = (null != sAux) && Boolean.parseBoolean(sAux);
+
+ return;
+ }
+
+ /*
+ * Deletes a file on the SFTP-Server
+ *
+ * @param fileName The file's Name to be removed from the SFTP-Server
+ *
+ * @see org.jboss.soa.esb.util.RemoteFileSystem#deleteRemoteFile(java.lang.String)
+ */
+ public void deleteRemoteFile(String p_sFile) throws Exception {
+ m_oSftpChannel.rm(getRemoteDir() + "/" + new File(p_sFile).getName());
+ }
+
+ /*
+ * Deletes a file on the SFTP-Server
+ *
+ * @param fileName The file to be removed from the SFTP-Server
+ *
+ * @see org.jboss.soa.esb.util.RemoteFileSystem#remoteDelete(java.io.File)
+ */
+ public void remoteDelete(File p_oFile) throws Exception {
+ m_oSftpChannel.rm(fileToFtpString(p_oFile));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.soa.esb.util.RemoteFileSystem#getFileListFromRemoteDir(java.lang.String)
+ */
+ public String[] getFileListFromRemoteDir(String p_sSuffix) throws Exception {
+ String sSuffix = (null == p_sSuffix) ? "*" : "*" + p_sSuffix;
+ List<String> lFileList = new ArrayList<String>();
+ Vector vFileList = m_oSftpChannel.ls(sSuffix);
+ if (vFileList != null) {
+ for (int i = 0; i < vFileList.size(); i++) {
+ Object obj = vFileList.elementAt(i);
+ if (obj instanceof LsEntry) {
+ SftpATTRS oSftAttr = ((LsEntry) obj).getAttrs();
+ if (!oSftAttr.isDir()) {
+ lFileList.add(((LsEntry) obj).getFilename());
+ }
+ }
+ }
+ }
+ return (String[]) lFileList.toArray();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.soa.esb.util.RemoteFileSystem#setRemoteDir(java.lang.String)
+ */
+ public void setRemoteDir(String p_sDir) throws Exception {
+ m_oSftpChannel.cd(p_sDir);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.soa.esb.util.RemoteFileSystem#renameInRemoteDir(java.lang.String,
+ * java.lang.String)
+ */
+ public void renameInRemoteDir(String p_sFrom, String p_sTo)
+ throws Exception {
+
+ String sRmtFrom = new File(p_sFrom).getName();
+ String sRmtTo = new File(p_sTo).getName();
+
+ try {
+ m_oSftpChannel.rename(getRemoteDir() + "/" + sRmtFrom,
+ getRemoteDir() + "/" + sRmtTo);
+ } catch (Exception e) {
+ String sMess = this.getClass().getSimpleName()
+ + " can't rename in remote directory <" + e.getMessage()
+ + ">";
+ throw new Exception(sMess);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.soa.esb.util.RemoteFileSystem#remoteRename(java.io.File,
+ * java.io.File)
+ */
+ public void remoteRename(File p_oFrom, File p_oTo) throws Exception {
+ try {
+ m_oSftpChannel.rename(fileToFtpString(p_oFrom),
+ fileToFtpString(p_oTo));
+ } catch (Exception e) {
+ String sMess = this.getClass().getSimpleName()
+ + " can't rename in remote directory <" + e.getMessage()
+ + ">";
+ throw new Exception(sMess);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.soa.esb.util.RemoteFileSystem#uploadFile(java.io.File,
+ * java.lang.String)
+ */
+ public void uploadFile(File p_oFile, String p_sRemoteName) throws Exception {
+ String sRemoteOK = getRemoteDir() + "/" + p_sRemoteName;
+ String sRemoteTmp = sRemoteOK + TMP_SUFFIX;
+ // m_oSftpChannel.setType(m_oXferType);
+ m_oSftpChannel.put(fileToFtpString(p_oFile), sRemoteTmp);
+ m_oSftpChannel.rename(sRemoteTmp, sRemoteOK);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.soa.esb.util.RemoteFileSystem#downloadFile(java.lang.String,
+ * java.lang.String)
+ */
+ public void downloadFile(String p_sFile, String p_sFinalName)
+ throws Exception {
+ File oLocalDir = new File(m_sLocalDir);
+ File oLclFile= File.createTempFile("Rosetta_",TMP_SUFFIX,oLocalDir);
+
+ try { oLclFile.delete(); }
+ catch (Exception e) {}
+ //TODO check if we have to set the Transfer Type with JSch impl => m_oXferType
+ m_oSftpChannel.get(fileToFtpString(oLclFile),p_sFile);
+
+ File oNew = new File(oLocalDir,p_sFinalName);
+ if (oNew.exists()) oNew.delete();
+ oLclFile.renameTo(oNew);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.soa.esb.util.RemoteFileSystem#getRemoteDir()
+ */
+ public String getRemoteDir() {
+ return m_sRemoteDir;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.soa.esb.util.RemoteFileSystem#quit()
+ */
+ public void quit() {
+ m_oSftpChannel.quit();
+ }
+
+ public static String fileToFtpString(File p_oF) {
+ return (null == p_oF) ? null : p_oF.toString().replace("\\", "/");
+ }
+
+}
Added: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/util/SecureFtpUserInfo.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/util/SecureFtpUserInfo.java 2006-11-21 17:37:47 UTC (rev 7740)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/util/SecureFtpUserInfo.java 2006-11-21 17:40:01 UTC (rev 7741)
@@ -0,0 +1,81 @@
+/**
+ *
+ */
+package org.jboss.internal.soa.esb.util;
+
+import com.jcraft.jsch.UserInfo;
+
+/**
+ * @author geo
+ *
+ */
+public class SecureFtpUserInfo implements UserInfo {
+
+ /** The user-password */
+ String password = null;
+
+ /**
+ * Constructor
+ *
+ * @param password
+ * The users password.
+ */
+ public SecureFtpUserInfo(String password) {
+ this.password = password;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.jcraft.jsch.UserInfo#getPassphrase()
+ */
+ public String getPassphrase() {
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.jcraft.jsch.UserInfo#getPassword()
+ */
+ public String getPassword() {
+ return password;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.jcraft.jsch.UserInfo#promptPassphrase(java.lang.String)
+ */
+ public boolean promptPassphrase(String arg0) {
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.jcraft.jsch.UserInfo#promptPassword(java.lang.String)
+ */
+ public boolean promptPassword(String arg0) {
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.jcraft.jsch.UserInfo#promptYesNo(java.lang.String)
+ */
+ public boolean promptYesNo(String arg0) {
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.jcraft.jsch.UserInfo#showMessage(java.lang.String)
+ */
+ public void showMessage(String arg0) {
+
+ }
+
+}
More information about the jboss-svn-commits
mailing list