You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by da...@apache.org on 2003/01/06 16:50:53 UTC

cvs commit: jakarta-james/src/java/org/apache/mailet User.java UsersRepository.java

danny       2003/01/06 07:50:53

  Added:       src/java/org/apache/mailet User.java UsersRepository.java
  Removed:     src/java/org/apache/james/services User.java
                        UsersRepository.java
  Log:
  removing avalon dependance in mailets.
  Step four moving User and UserRepository to org.apache.mailet
  
  Revision  Changes    Path
  1.1                  jakarta-james/src/java/org/apache/mailet/User.java
  
  Index: User.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.mailet;
  
  /**
   * Interface for objects representing users.
   *
   * @author Charles Benett <ch...@benett1.demon.co.uk>
   *
   * @version $Revision: 1.1 $
   */
  
  public interface User {
  
      /**
       * Return the user name of this user
       *
       * @return the user name for this user
       */
      String getUserName();
  
      /**
       * Return true if pass matches password of this user.
       *
       * @param pass the password to test
       * @return whether the password being tested is valid
       */
      boolean verifyPassword(String pass);
  
      /**
       * Sets new password from String. No checks made on guessability of
       * password.
       *
       * @param newPass the String that is the new password.
       * @return true if newPass successfully added
       */
      boolean setPassword(String newPass);
  }
  
  
  
  1.1                  jakarta-james/src/java/org/apache/mailet/UsersRepository.java
  
  Index: UsersRepository.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.mailet;
  
  import java.util.Iterator;
  
  
  /**
   * Interface for a repository of users. A repository represents a logical
   * grouping of users, typically by common purpose. E.g. the users served by an
   * email server or the members of a mailing list.
   *
   * @author  Federico Barbieri <sc...@pop.systemy.it>
   * @author Charles Benett <ch...@benett1.demon.co.uk>
   *
   * @version $Revision: 1.1 $
   */
  public interface UsersRepository {
  
      /**
       * The component role used by components implementing this service
       */
     // String ROLE = "org.apache.mailet.UsersRepository";
  
      String USER = "USER";
  
      /**
       * Adds a user to the repository with the specified User object.
       *
       * @param user the user to be added
       *
       * @return true if succesful, false otherwise
       * @since James 1.2.2
       */
      boolean addUser(User user);
  
      /**
       * Adds a user to the repository with the specified attributes.  In current
       * implementations, the Object attributes is generally a String password.
       *
       * @param name the name of the user to be added
       * @param attributes see decription
       */
      void addUser(String name, Object attributes);
  
      /**
       * Gets the attribute for a user.  Not clear on behavior.
       *
       * @deprecated  Removed As of James 2.1 . Use the {@link #getUserByName(String) getUserByName} method.
       */
      //Object getAttributes(String name);
  
  
      /**
       * Get the user object with the specified user name.  Return null if no
       * such user.
       *
       * @param name the name of the user to retrieve
       * @return the user being retrieved, null if the user doesn't exist
       *
       * @since James 1.2.2
       */
      User getUserByName(String name);
  
      /**
       * Get the user object with the specified user name. Match user naems on
       * a case insensitive basis.  Return null if no such user.
       *
       * @param name the name of the user to retrieve
       * @return the user being retrieved, null if the user doesn't exist
       *
       * @since James 1.2.2
       */
      User getUserByNameCaseInsensitive(String name);
  
      /**
       * Returns the user name of the user matching name on an equalsIgnoreCase
       * basis. Returns null if no match.
       *
       * @param name the name to case-correct
       * @return the case-correct name of the user, null if the user doesn't exist
       */
      String getRealName(String name);
  
      /**
       * Update the repository with the specified user object. A user object
       * with this username must already exist.
       *
       * @return true if successful.
       */
      boolean updateUser(User user);
  
      /**
       * Removes a user from the repository
       *
       * @param name the user to remove from the repository
       */
      void removeUser(String name);
  
      /**
       * Returns whether or not this user is in the repository
       *
       * @param name the name to check in the repository
       * @return whether the user is in the repository
       */
      boolean contains(String name);
  
      /**
       * Returns whether or not this user is in the repository. Names are
       * matched on a case insensitive basis.
       *
       * @param name the name to check in the repository
       * @return whether the user is in the repository
       */
      boolean containsCaseInsensitive(String name);
  
  
      /**
       * Tests a user with the appropriate attributes.  In current implementations,
       * this typically means "check the password" where a String password is passed
       * as the Object attributes.
       *
       * @deprecated As of James 1.2.2, use {@link #test(String, String) test(String name, String password)}
       */
      boolean test(String name, Object attributes);
  
      /**
       * Test if user with name 'name' has password 'password'.
       *
       * @param name the name of the user to be tested
       * @param password the password to be tested
       *
       * @return true if the test is successful, false if the user
       *              doesn't exist or if the password is incorrect
       *
       * @since James 1.2.2
       */
      boolean test(String name, String password);
  
      /**
       * Returns a count of the users in the repository.
       *
       * @return the number of users in the repository
       */
      int countUsers();
  
      /**
       * List users in repository.
       *
       * @return Iterator over a collection of Strings, each being one user in the repository.
       */
      Iterator list();
  
  }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>