incubator-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ran...@apache.org
Subject cvs commit: incubator-ftpserver/src/java/org/apache/ftpserver/filesystem NativeFileSystemManager.java NativeFileSystemView.java OSVirualFileSystemManager.java OSVirualFileSystemView.java
Date Thu, 06 Oct 2005 06:04:19 GMT
rana_b      2005/10/05 23:04:19

  Modified:    src/java/org/apache/ftpserver/filesystem
                        NativeFileSystemManager.java
                        NativeFileSystemView.java
                        OSVirualFileSystemManager.java
                        OSVirualFileSystemView.java
  Log:
  commons-logging used
  
  Revision  Changes    Path
  1.2       +11 -9     incubator-ftpserver/src/java/org/apache/ftpserver/filesystem/NativeFileSystemManager.java
  
  Index: NativeFileSystemManager.java
  ===================================================================
  RCS file: /home/cvs/incubator-ftpserver/src/java/org/apache/ftpserver/filesystem/NativeFileSystemManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- NativeFileSystemManager.java	9 Sep 2005 11:17:03 -0000	1.1
  +++ NativeFileSystemManager.java	6 Oct 2005 06:04:19 -0000	1.2
  @@ -18,11 +18,12 @@
   
   import java.io.File;
   
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
   import org.apache.ftpserver.ftplet.Configuration;
   import org.apache.ftpserver.ftplet.FileSystemManager;
   import org.apache.ftpserver.ftplet.FileSystemView;
   import org.apache.ftpserver.ftplet.FtpException;
  -import org.apache.ftpserver.ftplet.Logger;
   import org.apache.ftpserver.ftplet.User;
   
   /**
  @@ -33,21 +34,22 @@
   public 
   class NativeFileSystemManager implements FileSystemManager {
   
  -    private Logger m_logger;
  +    private Log m_log;
       private boolean m_createHome;
       
  +    
       /**
  -     * Set the logger object.
  +     * Set the log factory.
        */
  -    public void setLogger(Logger logger) {
  -        m_logger = logger;
  +    public void setLogFactory(LogFactory factory) {
  +        m_log = factory.getInstance(getClass());
       }
       
       /**
        * Configure the file system manager - does nothing.
        */
       public void configure(Configuration conf) throws FtpException {
  -        m_createHome = conf.getBoolean("create-home", false);
  +        m_createHome  = conf.getBoolean("create-home", false); 
       }
       
       /**
  @@ -66,11 +68,11 @@
               String homeDirStr = user.getHomeDirectory();
               File homeDir = new File(homeDirStr);
               if(homeDir.isFile()) {
  -                m_logger.warn("Not a directory :: " + homeDirStr);
  +                m_log.warn("Not a directory :: " + homeDirStr);
                   throw new FtpException("Not a directory :: " + homeDirStr);
               }
               if( (!homeDir.exists()) && (!homeDir.mkdirs()) ) {
  -                m_logger.warn("Cannot create user home :: " + homeDirStr);
  +                m_log.warn("Cannot create user home :: " + homeDirStr);
                   throw new FtpException("Cannot create user home :: " + homeDirStr);
               }
           }
  
  
  
  1.2       +2 -2      incubator-ftpserver/src/java/org/apache/ftpserver/filesystem/NativeFileSystemView.java
  
  Index: NativeFileSystemView.java
  ===================================================================
  RCS file: /home/cvs/incubator-ftpserver/src/java/org/apache/ftpserver/filesystem/NativeFileSystemView.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- NativeFileSystemView.java	9 Sep 2005 11:17:03 -0000	1.1
  +++ NativeFileSystemView.java	6 Oct 2005 06:04:19 -0000	1.2
  @@ -43,7 +43,7 @@
       
       
       /**
  -     * Constructor - set the user and logger objects.
  +     * Constructor - set the user object.
        */
       protected NativeFileSystemView(User user) throws FtpException {
           
  
  
  
  1.3       +15 -11    incubator-ftpserver/src/java/org/apache/ftpserver/filesystem/OSVirualFileSystemManager.java
  
  Index: OSVirualFileSystemManager.java
  ===================================================================
  RCS file: /home/cvs/incubator-ftpserver/src/java/org/apache/ftpserver/filesystem/OSVirualFileSystemManager.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- OSVirualFileSystemManager.java	9 Sep 2005 11:18:17 -0000	1.2
  +++ OSVirualFileSystemManager.java	6 Oct 2005 06:04:19 -0000	1.3
  @@ -16,15 +16,16 @@
    */
   package org.apache.ftpserver.filesystem;
   
  +import java.io.File;
  +
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
   import org.apache.ftpserver.ftplet.Configuration;
   import org.apache.ftpserver.ftplet.FileSystemManager;
   import org.apache.ftpserver.ftplet.FileSystemView;
   import org.apache.ftpserver.ftplet.FtpException;
  -import org.apache.ftpserver.ftplet.Logger;
   import org.apache.ftpserver.ftplet.User;
   
  -import java.io.File;
  -
   /**
    * This is a operating system based virtual root file system manager. 
    * 
  @@ -33,14 +34,17 @@
   public 
   class OSVirualFileSystemManager implements FileSystemManager {  
       
  -    private Logger m_logger;
  +    private Log m_log;
  +    private LogFactory m_logFactory;
       private boolean m_createHome;
       
  +    
       /**
  -     * Set the logger object.
  +     * Set the log factory.
        */
  -    public void setLogger(Logger logger) {
  -        m_logger = logger;
  +    public void setLogFactory(LogFactory factory) {
  +        m_logFactory = factory;
  +        m_log = m_logFactory.getInstance(getClass());
       }
       
       /**
  @@ -66,16 +70,16 @@
               String homeDirStr = user.getHomeDirectory();
               File homeDir = new File(homeDirStr);
               if(homeDir.isFile()) {
  -                m_logger.warn("Not a directory :: " + homeDirStr);
  +                m_log.warn("Not a directory :: " + homeDirStr);
                   throw new FtpException("Not a directory :: " + homeDirStr);
               }
               if( (!homeDir.exists()) && (!homeDir.mkdirs()) ) {
  -                m_logger.warn("Cannot create user home :: " + homeDirStr);
  +                m_log.warn("Cannot create user home :: " + homeDirStr);
                   throw new FtpException("Cannot create user home :: " + homeDirStr);
               }
           }
           
  -        OSVirualFileSystemView fsView = new OSVirualFileSystemView(user, m_logger);
  +        OSVirualFileSystemView fsView = new OSVirualFileSystemView(user, m_logFactory);
           return fsView;
       }   
   }
  
  
  
  1.3       +13 -11    incubator-ftpserver/src/java/org/apache/ftpserver/filesystem/OSVirualFileSystemView.java
  
  Index: OSVirualFileSystemView.java
  ===================================================================
  RCS file: /home/cvs/incubator-ftpserver/src/java/org/apache/ftpserver/filesystem/OSVirualFileSystemView.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- OSVirualFileSystemView.java	9 Sep 2005 11:18:17 -0000	1.2
  +++ OSVirualFileSystemView.java	6 Oct 2005 06:04:19 -0000	1.3
  @@ -16,15 +16,16 @@
    */
   package org.apache.ftpserver.filesystem;
   
  +import java.io.File;
  +import java.io.IOException;
  +
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
   import org.apache.ftpserver.ftplet.FileObject;
   import org.apache.ftpserver.ftplet.FileSystemView;
   import org.apache.ftpserver.ftplet.FtpException;
  -import org.apache.ftpserver.ftplet.Logger;
   import org.apache.ftpserver.ftplet.User;
   
  -import java.io.File;
  -import java.io.IOException;
  -
   
   /**
    * Get the user file system view.
  @@ -34,7 +35,7 @@
   public 
   class OSVirualFileSystemView implements FileSystemView {
   
  -    private Logger m_logger;
  +    private Log m_log;
       
       // root directory will be always absolute (canonical name) and
       // the path separator will be always '/'. The root directory
  @@ -45,10 +46,11 @@
       private boolean m_hasWritePermission;
       
       /**
  -     * Constructor - set user and logger objects.
  +     * Constructor - set the user object.
        */
  -    public OSVirualFileSystemView(User user, Logger logger) throws FtpException {
  -        m_logger = logger;
  +    public OSVirualFileSystemView(User user, LogFactory factory) throws FtpException {
  +        
  +        m_log = factory.getInstance(getClass());
           try {
               File root = new File(user.getHomeDirectory());
               m_rootName = root.getCanonicalPath();
  @@ -61,7 +63,7 @@
               m_currDir = new OSVirtualFileObject(root, m_rootName, m_hasWritePermission);
           }
           catch(IOException ex) {
  -            m_logger.warn("OSVirualFileSystemView.OSVirualFileSystemView()", ex);
  +            m_log.warn("OSVirualFileSystemView.OSVirualFileSystemView()", ex);
               throw new FtpException("OSVirualFileSystemView.OSVirualFileSystemView()", ex);
           }
       }
  @@ -122,7 +124,7 @@
               return virtualFile;
           }
           catch(IOException ex) {
  -            m_logger.warn("OSVirtualFileSystemView.getFileObject()", ex);
  +            m_log.warn("OSVirtualFileSystemView.getFileObject()", ex);
               throw new FtpException("OSVirtualFileSystemView.getFileObject()", ex);
           }
       }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@incubator.apache.org
For additional commands, e-mail: cvs-help@incubator.apache.org


Mime
View raw message