org.mmbase.util
Class PasswordGenerator

java.lang.Object
  |
  +--org.mmbase.module.Module
        |
        +--org.mmbase.util.PasswordGenerator
All Implemented Interfaces:
PasswordGeneratorInterface

public class PasswordGenerator
extends Module
implements PasswordGeneratorInterface

Module for the automatic generation of passwords. Based on the code of Arnold G. Reinhold, Cambridge, MA, USA. This code is under the GNU License as specified by the original author.
The passwords generated by this class are based on a template. A template can exists of a number of characters, which are replaced by the generator as follows:
A : is replaced by a random letter (a - z).
C : is replaced by a random alphanumeric character (0-9, a-z)
H : is replaced by a random hex character (0-9,A-F)
S : is replaced by a random syllable. This, alterating, an element from a set of consonants or an element form a set of vowels. A syllable can be more than one character (i.e. "qu").
6 : is replaced by a random dice-roll (1-6)
9 : is replaced by a random digit (0-9)

Version:
9 Jan 1997
Author:
Rico Jansen, Pierre van Rooden (javadocs)

Constructor Summary
PasswordGenerator()
          Creates the generator
 
Method Summary
 java.lang.String getModuleInfo()
          Returns a description of the module.
 java.lang.String getPassword()
          Generate a password, based on the default template for this module.
 java.lang.String getPassword(java.lang.String template)
          Generate a password, based on the given template.
 void init()
          Initializes the module.
static void main(java.lang.String[] args)
          Entry point when calling from teh command line.
 void onload()
          Called when the module is loaded.
 void reload()
          Called when the module is reloaded.
 void shutdown()
          Called when the module is shut down (removed).
 void unload()
          Called when the module is unloaded.
 
Methods inherited from class org.mmbase.module.Module
getClassName, getInitParameter, getInitParameters, getMaintainer, getMimeType, getMimeTypeFile, getModule, getModule, getModules, getName, getProperties, getProperty, getVersion, hasStarted, loadModulesFromDisk, maintainance, setClassName, setInitParameter, setMaintainer, setName, setVersion, shutdownModules, startModule, startModules, state
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PasswordGenerator

public PasswordGenerator()
Creates the generator
Method Detail

onload

public void onload()
Called when the module is loaded. Not used.
Overrides:
onload in class Module

reload

public void reload()
Called when the module is reloaded. Tries to retrieve a default template for a password from the template property from the module configuration file. Not used.

init

public void init()
Initializes the module. Tries to retrieve a default template for a password from the template property from the module configuration file.
Overrides:
init in class Module

unload

public void unload()
Called when the module is unloaded. Not used.

shutdown

public void shutdown()
Called when the module is shut down (removed). Not used.
Overrides:
shutdown in class Module

main

public static void main(java.lang.String[] args)
Entry point when calling from teh command line. Used for testing.

getPassword

public java.lang.String getPassword()
Generate a password, based on the default template for this module.
Specified by:
getPassword in interface PasswordGeneratorInterface
Returns:
the generated password.

getPassword

public java.lang.String getPassword(java.lang.String template)
Generate a password, based on the given template.
Specified by:
getPassword in interface PasswordGeneratorInterface
Parameters:
template - the template the password should be based on.
Returns:
the generated password.

getModuleInfo

public java.lang.String getModuleInfo()
Returns a description of the module.
Overrides:
getModuleInfo in class Module


MMBase build 1.6.5.20030923