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/usermanager BaseUser.java DbUserManager.java LdapUserManager.java PropertiesUserManager.java
Date Wed, 07 Sep 2005 05:01:39 GMT
rana_b      2005/09/06 22:01:39

  Added:       src/java/org/apache/ftpserver/usermanager BaseUser.java
                        DbUserManager.java LdapUserManager.java
                        PropertiesUserManager.java
  Log:
  Refactored - removed avalon entirely
  
  Revision  Changes    Path
  1.1                  incubator-ftpserver/src/java/org/apache/ftpserver/usermanager/BaseUser.java
  
  Index: BaseUser.java
  ===================================================================
  // $Id: BaseUser.java,v 1.1 2005/09/07 05:01:39 rana_b Exp $
  /*
   * Copyright 2004 The Apache Software Foundation
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package org.apache.ftpserver.usermanager;
  
  import java.io.Serializable;
  
  import org.apache.ftpserver.ftplet.User;
  
  /**
   * Generic user class. 
   * The user attributes are:
   * <ul>
   *   <li>uid</li>
   *   <li>userpassword</li>
   *   <li>enableflag</li>
   *   <li>homedirectory</li>
   *   <li>writepermission</li>
   *   <li>idletime</li>
   *   <li>uploadrate</li>
   *   <li>downloadrate</li>
   * </ul>
   *
   * @author <a href="mailto:rana_b@yahoo.com">Rana Bhattacharyya</a>
   */
  
  public
  class BaseUser implements User, Serializable {
      
      private static final long serialVersionUID = -47371353779731294L;
      
      public static final String ATTR_LOGIN             = "uid";
      public static final String ATTR_PASSWORD          = "userpassword";
      public static final String ATTR_HOME              = "homedirectory";
      public static final String ATTR_WRITE_PERM        = "writepermission";
      public static final String ATTR_ENABLE            = "enableflag";
      public static final String ATTR_MAX_IDLE_TIME     = "idletime";
      public static final String ATTR_MAX_UPLOAD_RATE   = "uploadrate";
      public static final String ATTR_MAX_DOWNLOAD_RATE = "downloadrate";
      
      private String m_name        = null;
      private String m_password    = null;
  
      private int m_maxIdleTimeSec  = 0; // no limit
      private int m_maxUploadRate   = 0; // no limit
      private int m_maxDownloadRate = 0; // no limit
  
      private boolean m_hasWritePermission;
      
      private String m_homeDir    = null;
      private boolean m_isEnabled = true;
      
      /**
       * Default constructor.
       */
      public BaseUser() {
      }
      
      /**
       * Copy constructor.
       */
      public BaseUser(User user) {
          m_name = user.getName();
          m_password = user.getPassword();
          m_maxIdleTimeSec = user.getMaxIdleTime();
          m_maxUploadRate = user.getMaxUploadRate();
          m_maxDownloadRate = user.getMaxDownloadRate();
          m_hasWritePermission = user.getWritePermission();
          m_homeDir = user.getHomeDirectory();
          m_isEnabled = user.getEnabled();
      }
      
      /**
       * Get the user name.
       */
      public String getName() {
          return m_name;
      }
          
      /**
       * Set user name.
       */
      public void setName(String name) {
          m_name = name;
      }
      
      /**
       * Get the user password.
       */
      public String getPassword() {
          return m_password;
      }
      
      /**
       * Set user password.
       */
      public void setPassword(String pass) {
          m_password = pass;
      }
  
      /**
       * Get the maximum idle time in second.
       */
      public int getMaxIdleTime() {
          return m_maxIdleTimeSec;
      }
  
      /**
       * Set the maximum idle time in second.
       */
      public void setMaxIdleTime(int idleSec) {
          m_maxIdleTimeSec = idleSec;
          if(m_maxIdleTimeSec < 0) {
              m_maxIdleTimeSec = 0;
          }
      }
  
      /**
       * Get the user enable status.
       */
      public boolean getEnabled() {
          return m_isEnabled;
      }
      
      /**
       * Set the user enable status.
       */
      public void setEnabled(boolean enb) {
          m_isEnabled = enb;
      }
  
      /**
       * Get maximum user upload rate in bytes/sec.
       */
      public int getMaxUploadRate() {
          return m_maxUploadRate;
      }
      
      /**
       * Set user maximum upload rate limit.
       * Less than or equal to zero means no limit.
       */
      public void setMaxUploadRate(int rate) {
          m_maxUploadRate = rate;
      }
      
      /**
       * Get maximum user download rate in bytes/sec.
       */
      public int getMaxDownloadRate() {
          return m_maxDownloadRate;
      }
      
      /**
       * Set user maximum download rate limit.
       * Less than or equal to zero means no limit.
       */
      public void setMaxDownloadRate(int rate) {
          m_maxDownloadRate = rate;
      }
      
      /**
       * Get the user home directory.
       */
      public String getHomeDirectory() {
          return m_homeDir;
      }
  
      /**
       * Set the user home directory.
       */
      public void setHomeDirectory(String home) {
          m_homeDir = home;
      } 
          
      /**
       * Get write permission.
       */
      public boolean getWritePermission() {
          return m_hasWritePermission;
      }
      
      /**
       * Set write permission.
       */
      public void setWritePermission(boolean writePerm) {
          m_hasWritePermission = writePerm;
      } 
  
      /** 
       * String representation.
       */
      public String toString() {
          return m_name;
      }    
  }
  
  
  
  1.7       +387 -198  incubator-ftpserver/src/java/org/apache/ftpserver/usermanager/DbUserManager.java
  
  
  
  
  1.7       +181 -254  incubator-ftpserver/src/java/org/apache/ftpserver/usermanager/LdapUserManager.java
  
  
  
  
  1.8       +171 -149  incubator-ftpserver/src/java/org/apache/ftpserver/usermanager/PropertiesUserManager.java
  
  
  
  

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


Mime
View raw message