01: /*************************************************************************
02: * *
03: * EJBCA: The OpenSource Certificate Authority *
04: * *
05: * This software is free software; you can redistribute it and/or *
06: * modify it under the terms of the GNU Lesser General Public *
07: * License as published by the Free Software Foundation; either *
08: * version 2.1 of the License, or any later version. *
09: * *
10: * See terms of license at gnu.org. *
11: * *
12: *************************************************************************/package org.ejbca.util.passgen;
13:
14: /**
15: * Factory class creating PasswordGenerators.
16: *
17: * @version $Id: PasswordGeneratorFactory.java,v 1.1 2006/01/17 20:28:05 anatom Exp $
18: */
19: public class PasswordGeneratorFactory {
20:
21: public static final int PASSWORDTYPE_DIGITS = 0;
22: public static final int PASSWORDTYPE_LETTERSANDDIGITS = 1;
23: public static final int PASSWORDTYPE_ALLPRINTABLE = 2;
24:
25: static final IPasswordGenerator[] classes = {
26: new DigitPasswordGenerator(),
27: new LettersAndDigitsPasswordGenerator(),
28: new AllPrintableCharPasswordGenerator() };
29:
30: /**
31: * Method returning an instance of the specified IPasswordGenerator class.
32: *
33: * @param type should be on of the PasswordGeneratorFactory constants.
34: */
35:
36: public static IPasswordGenerator getInstance(int type) {
37: return classes[type];
38: }
39:
40: }
|