Poseidon for UMLTM
  UMLdoc
 PREV  CLASSIFIER    NEXT  CLASSIFIER     FRAMES    NO FRAMES      
SUMMARY:   INNER | ATTR | ASSOC | CONSTR | METHOD     DETAIL:   INNER | ATTR | ASSOC | CONSTR | METHOD     DIAGRAMS:   COLLAB | SEQ | STATE | ACTIV

com.gentleware.poseidon.generator

Class GeneratorFactory

com.gentleware.poseidon.generator.GeneratorFactory

public class GeneratorFactory


This class represents a factory for the basic facilities of the code generation. It holds the configuration and a list of known generation controllers. The GeneratorFactory is a singleton.
See also:
GeneratorController


 Attribute Summary
public static String  CONFIGURATION_PREFIX
 
private Map  _configuration
Holds the part of the application configuration that deals with code generation. 
private Map  _generatorControllerMap
Pairs the known generator controllers with a registration name created of the designated target language and the name of the providing plugin. 
private List  _listeners
Holds references to all objects that want to be notified of code generation events. 
private List  _unencrypted
Holds the file paths of all macro libraries and templates that should be loaded unencrypted. 
arrow_up
 

 Association Summary
private GeneratorFactory  _generatorFactory
The one and only instance of the factory. 
private VelocityEngine  _velocityEngine
The only instance of velocityEngine that is used currently. 
public GeneratorFactory  generatorFactory
 
arrow_up
 

 Constructor Summary
private   GeneratorFactory()
Creates a new GeneratorFactory object. 
arrow_up
 

 Method Summary
public void   addActionListener(ActionListener listener)
Adds a new listener to the list of known listeners. 
public boolean   addGeneratorController(String origin, GeneratorController controller)
Adds a generator controller to the collection of known generator controllers. 
public void   addMacroLibrary(String file)
Adds a new velocity macro library to the list of known macro libraries. 
public void   addMacroLibrary(String file, boolean treatAsUnencrypted)
Adds a new velocity macro library to the list of known macro libraries. 
public void   addUnencryptedTemplateOrLibrary(String name)
Adds the macro library or template with the given file name to the list of macros/templates that should be treated as unencrypted. 
public void   fireGenerationDone()
Fires an event indicating that the generation process is finished to all known listeners. 
public String   getCompiledExtension()
Returns the default file extension of compiled files for the currently adjusted target language. 
public Map   getConfiguration()
Returns the current configuration for the code generation. 
public String   getConfigurationEntry(String key)
Returns the value of the configuration entry for the given key. 
public GeneratorController   getGeneratorController()
Returns the generator controller that should be used for code generation. 
public GeneratorController   getGeneratorController(String key)
Returns the generator controller previously registered with hte given name. 
public static GeneratorFactory   getInstance()
Returns the one and only instance of the GeneratorFactory. 
public String   getLanguage()
Returns the currently adjusted target language for code generation. 
public List   getMacroLibraries()
Returns the list of known macro libraries. 
public Set   getRegisteredLanguages()
 
public String   getSourceExtension()
Returns the default file extension of source files for the currently adjusted target language. 
public List   getSourceExtensionList()
Returns the list of default file extensions of source files for the currently adjusted target language. 
VelocityEngine   getVelocityEngine()
Only used by GeneratorController and CodeTemplate. 
public void   reloadMacros()
Re-inits the velocity engine, sets all engine properties again from the current controller, and reloads the macro templates. 
public void   removeActionListener(ActionListener listener)
Removes a listener from the list of known listeners. 
public void   removeAllListeners()
Clears up the list of known listeners. 
public boolean   removeGeneratorController(String origin)
Removes a generator controller from the collection of known generator controllers. 
public void   removeMacroLibrary(String file)
Removes a velocity macro library from the list of known macro libraries. 
public void   removeUnencryptedTemplateOrLibrary(String name)
Removes the macro library or template with the given file name from the list of macros/templates that should be treated as unencrypted. 
public void   setConfigurationEntry(String key, String value)
 
public void   setLanguage(String lang)
Adjusts the target language for code generation. 
public boolean   treatAsUnencrypted(String file)
Tests, if the macro library or template with the given file name should be treated as unencrypted. 
public void   updateConfiguration()
Retrieves the part of the application configuration dealing with code generation. 
arrow_up
 

Tagged Values
static false
gentleware-imported-line-number 22
gentleware-imported-package-statement-line-number 5
 

 Attribute Detail

CONFIGURATION_PREFIX

public static String CONFIGURATION_PREFIX

arrow_up


_configuration

private Map _configuration

Holds the part of the application configuration that deals with code generation.  
arrow_up


_generatorControllerMap

private Map _generatorControllerMap

Pairs the known generator controllers with a registration name created of the designated target language and the name of the providing plugin.  
arrow_up


_listeners

private List _listeners

Holds references to all objects that want to be notified of code generation events.  
arrow_up


_unencrypted

private List _unencrypted

Holds the file paths of all macro libraries and templates that should be loaded unencrypted.  
arrow_up
 Association Detail

_generatorFactory

private GeneratorFactory _generatorFactory

The one and only instance of the factory.  
arrow_up


_velocityEngine

private VelocityEngine _velocityEngine

The only instance of velocityEngine that is used currently.  
arrow_up


generatorFactory

public GeneratorFactory generatorFactory

arrow_up
 Constructor Detail

GeneratorFactory

private com.gentleware.poseidon.generator.GeneratorFactory GeneratorFactory()


Creates a new GeneratorFactory object. This constructor cannot be called from outside the GeneratorFactory.  
Returns:
arrow_up
 Method Detail

addActionListener

public void addActionListener(ActionListener listener)


Adds a new listener to the list of known listeners.  
Parameters:
listener - Listener to be added.
arrow_up


addGeneratorController

public boolean addGeneratorController(String origin, GeneratorController controller)


Adds a generator controller to the collection of known generator controllers. The object is registered along with a name, that makes it possible to access it later. The name should consist of the target language and the name of the providing plugin separated by a dot. It is possible that a generator controller appears more than once in the collection, if it is able to handle code generation to more than one target language.  
Parameters:
origin - The name the generator controller should be registered with.
controller - The generator controller to be added.
Returns:
True, if the generator controller has been added successfully, otherwise false.
arrow_up


addMacroLibrary

public void addMacroLibrary(String file)


Adds a new velocity macro library to the list of known macro libraries. The library will be treated as encrypted.  
Parameters:
file - Name of the macro library file to be added.
arrow_up


addMacroLibrary

public void addMacroLibrary(String file, boolean treatAsUnencrypted)


Adds a new velocity macro library to the list of known macro libraries.  
Parameters:
file - Name of the macro library file to be added.
treatAsUnencrypted - True, if the macro library should be treated as unencrypted.
arrow_up


addUnencryptedTemplateOrLibrary

public void addUnencryptedTemplateOrLibrary(String name)


Adds the macro library or template with the given file name to the list of macros/templates that should be treated as unencrypted.  
Parameters:
name - The name of the macro library or template file to be added.
arrow_up


fireGenerationDone

public void fireGenerationDone()


Fires an event indicating that the generation process is finished to all known listeners.  
arrow_up


getCompiledExtension

public String getCompiledExtension()


Returns the default file extension of compiled files for the currently adjusted target language.  
Returns:
The default file extension without separators.
arrow_up


getConfiguration

public Map getConfiguration()


Returns the current configuration for the code generation.  
Returns:
All configuration entries dealing with code generation.
arrow_up


getConfigurationEntry

public String getConfigurationEntry(String key)


Returns the value of the configuration entry for the given key. The entry is searched in the code generation configuration only.  
Parameters:
key - The key to looked after.
Returns:
The value of the entry or "" if the key is unknown.
arrow_up


getGeneratorController

public GeneratorController getGeneratorController()


Returns the generator controller that should be used for code generation. The decision, what generator controller to use, is based on the current configuration of the code generation. This method retrieves the current target language and the enabled plugin. Only one plugin should be enabled. Otherwise, an error is displayed and null is returned.  
Returns:
The generator controller to be used or null if more than one or no plugin is enabled for code generation.
arrow_up


getGeneratorController

public GeneratorController getGeneratorController(String key)


Returns the generator controller previously registered with hte given name.  
Parameters:
key - The name, the generator controller has been registrered under.
Returns:
GeneratorController object registered under the name key or null if key is not known.
arrow_up


getInstance

public static GeneratorFactory getInstance()


Returns the one and only instance of the GeneratorFactory.  
Returns:
The only GeneratorFactory instance.
arrow_up


getLanguage

public String getLanguage()


Returns the currently adjusted target language for code generation.  
Returns:
Adjusted target language.
arrow_up


getMacroLibraries

public List getMacroLibraries()


Returns the list of known macro libraries. (not implemented yet)  
Returns:
null.
arrow_up


getRegisteredLanguages

public Set getRegisteredLanguages()

Returns:
A set of all the registered language keys.
arrow_up


getSourceExtension

public String getSourceExtension()


Returns the default file extension of source files for the currently adjusted target language.  
Returns:
The default file extension without separators.
arrow_up


getSourceExtensionList

public List getSourceExtensionList()


Returns the list of default file extensions of source files for the currently adjusted target language.  
Returns:
The list of default file extensions.
arrow_up


getVelocityEngine

VelocityEngine getVelocityEngine()


Only used by GeneratorController and CodeTemplate.  
Returns:
arrow_up


reloadMacros

public void reloadMacros()


Re-inits the velocity engine, sets all engine properties again from the current controller, and reloads the macro templates.  
arrow_up


removeActionListener

public void removeActionListener(ActionListener listener)


Removes a listener from the list of known listeners.  
Parameters:
listener - Listener to be removed.
arrow_up


removeAllListeners

public void removeAllListeners()


Clears up the list of known listeners. No more listeners will be known after call of this method.  
arrow_up


removeGeneratorController

public boolean removeGeneratorController(String origin)


Removes a generator controller from the collection of known generator controllers. The generator controller will be identified by the name it has been registered with. Trying to remove a generator controller with an unknown name returns true.  
Parameters:
origin - Registrationname of the generator controller to be removed.
Returns:
True, if removing the generator controller has been successful, otherwise false.
arrow_up


removeMacroLibrary

public void removeMacroLibrary(String file)


Removes a velocity macro library from the list of known macro libraries. (not implemented yet)  
Parameters:
file - Name of macro library file to be removed.
arrow_up


removeUnencryptedTemplateOrLibrary

public void removeUnencryptedTemplateOrLibrary(String name)


Removes the macro library or template with the given file name from the list of macros/templates that should be treated as unencrypted.  
Parameters:
name - The name of the macro library or template file to be removed.
arrow_up


setConfigurationEntry

public void setConfigurationEntry(String key, String value)

Parameters:
key -
value -
arrow_up


setLanguage

public void setLanguage(String lang)


Adjusts the target language for code generation.  
Parameters:
lang - New target language.
arrow_up


treatAsUnencrypted

public boolean treatAsUnencrypted(String file)


Tests, if the macro library or template with the given file name should be treated as unencrypted.  
Parameters:
file - The name of the macro library or template file to be tested.
Returns:
True, if the macro library or template should be treated as unencrytped, otherwise false.
arrow_up


updateConfiguration

public void updateConfiguration()


Retrieves the part of the application configuration dealing with code generation.  
arrow_up
Created  2004 - 12 - 1

    Poseidon for UMLTM
  UMLdoc
 PREV  CLASSIFIER    NEXT  CLASSIFIER     FRAMES    NO FRAMES      
SUMMARY:   INNER | ATTR | ASSOC | CONSTR | METHOD     DETAIL:   INNER | ATTR | ASSOC | CONSTR | METHOD     DIAGRAMS:   COLLAB | SEQ | STATE | ACTIV

Generated with Poseidon for UMLTM.
Poseidon is a registered trademark of Gentleware AG in Germany, USA and other countries. Copyright 2003-2004 Gentleware AG, Schanzenstr. 70, 20357 Hamburg, Germany. All Rights Reserved.

UML is a trademark or registered trademark of Object Management Group, Inc. in the U.S. and other countries.