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 no...@apache.org on 2010/02/06 20:15:50 UTC

svn commit: r907279 - /james/server/trunk/jpa-store/src/main/java/org/apache/james/server/jpa/JPAUsersRepository.java

Author: norman
Date: Sat Feb  6 19:15:49 2010
New Revision: 907279

URL: http://svn.apache.org/viewvc?rev=907279&view=rev
Log:
reformat 

Modified:
    james/server/trunk/jpa-store/src/main/java/org/apache/james/server/jpa/JPAUsersRepository.java

Modified: james/server/trunk/jpa-store/src/main/java/org/apache/james/server/jpa/JPAUsersRepository.java
URL: http://svn.apache.org/viewvc/james/server/trunk/jpa-store/src/main/java/org/apache/james/server/jpa/JPAUsersRepository.java?rev=907279&r1=907278&r2=907279&view=diff
==============================================================================
--- james/server/trunk/jpa-store/src/main/java/org/apache/james/server/jpa/JPAUsersRepository.java (original)
+++ james/server/trunk/jpa-store/src/main/java/org/apache/james/server/jpa/JPAUsersRepository.java Sat Feb  6 19:15:49 2010
@@ -33,9 +33,8 @@
 import org.apache.james.api.user.UsersRepository;
 
 /**
- * Proof-of-concept repository using JPA.
- * TODO: Support managed contexts.
- * TODO: Use factory and support pooled contexts
+ * Proof-of-concept repository using JPA. TODO: Support managed contexts. TODO:
+ * Use factory and support pooled contexts
  */
 public class JPAUsersRepository implements UsersRepository {
 
@@ -45,11 +44,9 @@
 
     private EntityManager entityManager;
 
-    
-    
-
     /**
      * Gets current logger.
+     * 
      * @return the logger
      */
     public final Log getLogger() {
@@ -58,7 +55,9 @@
 
     /**
      * Setter injection for logging.
-     * @param logger the logger to set
+     * 
+     * @param logger
+     *            the logger to set
      */
     public final void setLogger(Log logger) {
         this.logger = logger;
@@ -66,6 +65,7 @@
 
     /**
      * Gets entity manager.
+     * 
      * @return the entityManager
      */
     public final EntityManager getEntityManager() {
@@ -74,7 +74,9 @@
 
     /**
      * Sets entity manager.
-     * @param entityManager the entityManager to set
+     * 
+     * @param entityManager
+     *            the entityManager to set
      */
     @PersistenceContext
     public final void setEntityManager(EntityManager entityManager) {
@@ -83,29 +85,32 @@
 
     /**
      * Adds a user to the repository with the specified User object.
-     *
-     * @param user the user to be added
-     *
+     * 
+     * @param user
+     *            the user to be added
+     * 
      * @return true if succesful, false otherwise
      * @since James 1.2.2
      * 
      * @deprecated James 2.4 user should be added using username/password
-     * because specific implementations of UsersRepository will support specific 
-     * implementations of users object.
+     *             because specific implementations of UsersRepository will
+     *             support specific implementations of users object.
      */
     public boolean addUser(User user) {
         throw new UnsupportedOperationException();
     }
 
     /**
-     * Adds a user to the repository with the specified attributes.  In current
+     * 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
+     * 
+     * @param name
+     *            the name of the user to be added
+     * @param attributes
+     *            see decription
      * 
      * @deprecated James 2.4 user is always added using username/password and
-     * eventually modified by retrieving it later.
+     *             eventually modified by retrieving it later.
      */
     public void addUser(String name, Object attributes) {
         throw new UnsupportedOperationException();
@@ -114,8 +119,10 @@
     /**
      * Adds a user to the repository with the specified password
      * 
-     * @param username the username of the user to be added
-     * @param password the password of the user to add
+     * @param username
+     *            the username of the user to be added
+     * @param password
+     *            the password of the user to add
      * @return true if succesful, false otherwise
      * 
      * @since James 2.3.0
@@ -138,12 +145,13 @@
     }
 
     /**
-     * Get the user object with the specified user name.  Return null if no
-     * such user.
-     *
-     * @param name the name of the user to retrieve
+     * 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
      */
     public User getUserByName(String name) {
@@ -151,8 +159,7 @@
     }
 
     private JPAUser getJPAUserByName(String name) {
-        try
-        {
+        try {
             return (JPAUser) entityManager.createNamedQuery("findUserByName").setParameter("name", name).getSingleResult();
         } catch (PersistenceException e) {
             logger.debug("Failed to find user", e);
@@ -161,15 +168,17 @@
     }
 
     /**
-     * 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
+     * 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
      * @deprecated James 2.4 now caseSensitive is a property of the repository
-     * implementations and the getUserByName will search according to this property.
+     *             implementations and the getUserByName will search according
+     *             to this property.
      */
     public User getUserByNameCaseInsensitive(String name) {
         throw new UnsupportedOperationException();
@@ -178,8 +187,9 @@
     /**
      * 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
+     * 
+     * @param name
+     *            the name to case-correct
      * @return the case-correct name of the user, null if the user doesn't exist
      */
     public String getRealName(String name) {
@@ -187,9 +197,9 @@
     }
 
     /**
-     * Update the repository with the specified user object. A user object
-     * with this username must already exist.
-     *
+     * Update the repository with the specified user object. A user object with
+     * this username must already exist.
+     * 
      * @return true if successful.
      */
     public boolean updateUser(User user) {
@@ -236,8 +246,9 @@
 
     /**
      * Returns whether or not this user is in the repository
-     *
-     * @param name the name to check in the repository
+     * 
+     * @param name
+     *            the name to check in the repository
      * @return whether the user is in the repository
      */
     public boolean contains(String name) {
@@ -250,14 +261,16 @@
     }
 
     /**
-     * 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
+     * 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
      * 
      * @deprecated James 2.4 now caseSensitive is a property of the repository
-     * implementations and the contains will search according to this property.
+     *             implementations and the contains will search according to
+     *             this property.
      */
     public boolean containsCaseInsensitive(String name) {
         throw new UnsupportedOperationException();
@@ -265,24 +278,23 @@
 
     /**
      * 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
-     *
+     * 
+     * @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
      */
     public boolean test(String name, String password) {
         final JPAUser user = getJPAUserByName(name);
         final boolean result;
-        if (user == null)
-        {
+        if (user == null) {
             result = false;
-        }
-        else
-        {
+        } else {
             result = user.verifyPassword(password);
         }
         return result;
@@ -290,14 +302,12 @@
 
     /**
      * Returns a count of the users in the repository.
-     *
+     * 
      * @return the number of users in the repository
      */
     public int countUsers() {
-        try
-        {
-            return ((Long) entityManager.createNamedQuery("countUsers")
-                            .getSingleResult()).intValue();
+        try {
+            return ((Long) entityManager.createNamedQuery("countUsers").getSingleResult()).intValue();
         } catch (PersistenceException e) {
             logger.debug("Failed to find user", e);
             return 0;



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org