KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejbca > util > passgen > PasswordGeneratorFactory


1 /*************************************************************************
2  * *
3  * EJBCA: The OpenSource Certificate Authority *
4  * *
5  * This software is free software; you can redistribute it and/or *
6  * modify it under the terms of the GNU Lesser General Public *
7  * License as published by the Free Software Foundation; either *
8  * version 2.1 of the License, or any later version. *
9  * *
10  * See terms of license at gnu.org. *
11  * *
12  *************************************************************************/

13  
14 package org.ejbca.util.passgen;
15
16 /**
17  * Factory class creating PasswordGenerators.
18  *
19  * @version $Id: PasswordGeneratorFactory.java,v 1.1 2006/01/17 20:28:05 anatom Exp $
20  */

21 public class PasswordGeneratorFactory {
22     
23     
24     public static final int PASSWORDTYPE_DIGITS = 0;
25     public static final int PASSWORDTYPE_LETTERSANDDIGITS = 1;
26     public static final int PASSWORDTYPE_ALLPRINTABLE = 2;
27     
28     static final IPasswordGenerator[] classes = { new DigitPasswordGenerator(),
29                                                   new LettersAndDigitsPasswordGenerator(),
30                                                   new AllPrintableCharPasswordGenerator()};
31    
32     
33     /**
34      * Method returning an instance of the specified IPasswordGenerator class.
35      *
36      * @param type should be on of the PasswordGeneratorFactory constants.
37      */

38     
39     public static IPasswordGenerator getInstance(int type){
40        return classes[type];
41     }
42    
43 }
44
Popular Tags