Author: ate
Date: Wed Mar 24 16:03:05 2010
New Revision: 927101

URL: http://svn.apache.org/viewvc?rev=927101&view=rev
Log:
code (format) cleanup and adding missing license header

Modified:
    
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/administration/
   (props changed)
    
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/administration/SimplePasswordGeneratorImpl.java
    
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/administration/PasswordGenerator.java

Propchange: 
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/administration/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Mar 24 16:03:05 2010
@@ -1,2 +1,2 @@
-target
+target
 surefire*.properties

Modified: 
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/administration/SimplePasswordGeneratorImpl.java
URL: 
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/administration/SimplePasswordGeneratorImpl.java?rev=927101&r1=927100&r2=927101&view=diff
==============================================================================
--- 
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/administration/SimplePasswordGeneratorImpl.java
 (original)
+++ 
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/administration/SimplePasswordGeneratorImpl.java
 Wed Mar 24 16:03:05 2010
@@ -24,35 +24,30 @@ import org.apache.taglibs.random.RandomS
 
 /**
  * @version $Id$
- *
  */
 public class SimplePasswordGeneratorImpl implements PasswordGenerator
 {
     /** the list of characters from which a password can be generatored. */
-    protected static final char[] DEFAULT_PASS_CHARS = {'a', 'b', 'c', 'd', 
'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
-        'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
-        'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
-        'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
-        '1', '2', '3', '4', '5', '6', '7', '8', '9', '0'};
-        // removed these for aesthetic purposes
-        //'!', '&',  '-', '_', '=',
-        // '*','@', '#', '$', '%', '^',
-        //'+',
-    
-    protected char[] passwordChars = DEFAULT_PASS_CHARS;
-    protected ArrayList<Character> upper = new ArrayList<Character>();
-    protected ArrayList<Character> lower = new ArrayList<Character>();
-    protected Integer length = new Integer(12);
+    protected static final char[]         DEFAULT_PASS_CHARS = { 'a', 'b', 
'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 
's',
+                    't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 
'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 
'U',
+                    'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', 
'7', '8', '9', '0' };
+    // removed these for aesthetic purposes
+    // '!', '&', '-', '_', '=',
+    // '*','@', '#', '$', '%', '^',
+    // '+',
+    protected char[]                      passwordChars      = 
SimplePasswordGeneratorImpl.DEFAULT_PASS_CHARS;
+    protected ArrayList<Character>        upper              = new 
ArrayList<Character>();
+    protected ArrayList<Character>        lower              = new 
ArrayList<Character>();
+    protected Integer                     length             = new Integer(12);
     protected CredentialPasswordValidator validator;
-    
+
     protected RandomStrg newRandomStrg()
     {
         RandomStrg rs = new RandomStrg();
-        
         try
         {
             rs.generateRandomObject();
-        } 
+        }
         catch (Exception e)
         {
             // this would only get thrown if we tried a secure random and the 
provider
@@ -61,50 +56,52 @@ public class SimplePasswordGeneratorImpl
         }
         return rs;
     }
-    
+
     protected void initRandomStrg(RandomStrg rs)
     {
         rs.setLength(new Integer(12));
-        rs.setSingle(passwordChars,passwordChars.length);
-        rs.setRanges(upper,lower);
+        rs.setSingle(passwordChars, passwordChars.length);
+        rs.setRanges(upper, lower);
     }
-    
+
     /**
-        * @param length the length to set
-        */
-       public void setLength(Integer length)
-       {
-               this.length = length;
-       }
-
-       /**
-        * @param validator the validator to set
-        */
-       public void setValidator(CredentialPasswordValidator validator)
-       {
-               this.validator = validator;
-       }
-       
-       public void setPasswordChars(String passwordChars)
-       {
-               if (passwordChars != null && passwordChars.length() > 1)
-               {
-                       this.passwordChars = passwordChars.toCharArray();
-               }
-       }
-       
-       public void setLowerRange(String lowerChars)
-       {
-           if (lowerChars != null)
-           {
-               lower.clear();
+     * @param length
+     *            the length to set
+     */
+    public void setLength(Integer length)
+    {
+        this.length = length;
+    }
+
+    /**
+     * @param validator
+     *            the validator to set
+     */
+    public void setValidator(CredentialPasswordValidator validator)
+    {
+        this.validator = validator;
+    }
+
+    public void setPasswordChars(String passwordChars)
+    {
+        if (passwordChars != null && passwordChars.length() > 1)
+        {
+            this.passwordChars = passwordChars.toCharArray();
+        }
+    }
+
+    public void setLowerRange(String lowerChars)
+    {
+        if (lowerChars != null)
+        {
+            lower.clear();
             for (char c : lowerChars.toCharArray())
             {
                 lower.add(new Character(c));
             }
-           }
-       }
-       
+        }
+    }
+
     public void setUpperRange(String upperChars)
     {
         if (upperChars != null)
@@ -116,31 +113,31 @@ public class SimplePasswordGeneratorImpl
             }
         }
     }
-    
-       /* (non-Javadoc)
+
+    /*
+     * (non-Javadoc)
      * @see 
org.apache.jetspeed.administration.PasswordGenerator#generatePassword()
      */
-       public String generatePassword()
+    public String generatePassword()
     {
         String retval = null;
-        
         RandomStrg rs = newRandomStrg();
         initRandomStrg(rs);
         while (retval == null)
         {
-               retval = rs.getRandom();
-               if (validator != null)
-               {
-                       try
-                       {
-                       validator.validate(retval);
-                       }
-               catch (SecurityException sex)
-               {
-                       retval = null;
-               }
-               }
+            retval = rs.getRandom();
+            if (validator != null)
+            {
+                try
+                {
+                    validator.validate(retval);
+                }
+                catch (SecurityException sex)
+                {
+                    retval = null;
+                }
+            }
         }
-        return retval;        
+        return retval;
     }
 }

Modified: 
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/administration/PasswordGenerator.java
URL: 
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/administration/PasswordGenerator.java?rev=927101&r1=927100&r2=927101&view=diff
==============================================================================
--- 
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/administration/PasswordGenerator.java
 (original)
+++ 
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/administration/PasswordGenerator.java
 Wed Mar 24 16:03:05 2010
@@ -1,6 +1,25 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jetspeed.administration;
 
+/**
+ * @version $Id$
+ */
 public interface PasswordGenerator
 {
-    public abstract String generatePassword();
+    String generatePassword();
 }
\ No newline at end of file



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to