KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > util > PasswordGeneratorModule


1 /*
2
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8
9 */

10 package org.mmbase.util;
11 import org.mmbase.module.Module;
12
13 import org.mmbase.util.logging.Logger;
14 import org.mmbase.util.logging.Logging;
15
16 /**
17
18  */

19 public class PasswordGeneratorModule extends Module implements PasswordGeneratorInterface {
20
21     // logger
22
private static Logger log = Logging.getLoggerInstance(PasswordGeneratorModule.class);
23
24     private final PasswordGenerator pw;
25
26     public PasswordGeneratorModule() {
27         pw = new PasswordGenerator();
28     }
29
30     /**
31      * Called when the module is loaded.
32      * Not used.
33      */

34     public void onload() {
35     }
36
37     /**
38      * Called when the module is reloaded.
39      * Tries to retrieve a default template for a password from the
40      * template property from the module configuration file.
41      * Not used.
42      */

43     public void reload() {
44         pw.defaulttemplate = getInitParameter("template");
45         if (pw.defaulttemplate == null) pw.defaulttemplate = "SSSSSS";
46     }
47
48     /**
49      * Initializes the module.
50      * Tries to retrieve a default template for a password from the
51      * template property from the module configuration file.
52      */

53     public void init() {
54         pw.defaulttemplate = getInitParameter("template");
55         if (pw.defaulttemplate == null) pw.defaulttemplate = "SSSSSS";
56     }
57
58     /**
59      * Called when the module is unloaded.
60      * Not used.
61      */

62     public void unload() {
63     }
64
65     /**
66      * Called when the module is shut down (removed).
67      * Not used.
68      */

69     public void shutdown() {
70     }
71
72
73     public String JavaDoc getPassword() {
74         return pw.getPassword();
75     }
76     public String JavaDoc getPassword(String JavaDoc t) {
77         return pw.getPassword(t);
78     }
79
80 }
81
Popular Tags