org.jomc.tools
Class JavaSources

Package class diagram package JavaSources
java.lang.Object
  extended by org.jomc.tools.JomcTool
      extended by org.jomc.tools.JavaSources

public class JavaSources
extends JomcTool

Manages Java source code.

Use cases

Version:
$Id: JavaSources.java 744 2009-10-06 04:43:21Z schulte2005 $
Author:
Christian Schulte
See Also:
JomcTool.getModules()

Nested Class Summary
 class JavaSources.JavaEditor
          Extension to SectionEditor for editing Java source code.
 class JavaSources.JavaImplementationEditor
          Extension to JavaEditor for editing implementation source code.
 class JavaSources.JavaSpecificationEditor
          Extension to JavaEditor for editing specification source code.
 
Nested classes/interfaces inherited from class org.jomc.tools.JomcTool
JomcTool.Listener
 
Field Summary
private static String ANNOTATIONS_SECTION_NAME
          Constant for the name of the implementation annotations source code section.
private static String CONSTRUCTORS_HEAD_TEMPLATE
          Name of the implementation-constructors-head.vm template.
private static String CONSTRUCTORS_SECTION_NAME
          Constant for the name of the constructors source code section.
private static String CONSTRUCTORS_TAIL_TEMPLATE
          Name of the implementation-constructors-tail.vm template.
private static String DEFAULT_CONSTRUCTOR_SECTION_NAME
          Constant for the name of the default constructor source code section.
private static String DEPENDENCIES_SECTION_NAME
          Constant for the name of the dependencies source code section.
private static String DEPENDENCIES_TEMPLATE
          Name of the implementation-dependencies.vm template.
private static String DOCUMENTATION_SECTION_NAME
          Constant for the name of the documentation source code section.
private static String GENERATOR_NAME
          Name of the generator.
private static String GENERATOR_VERSION
          Constant for the version of the generator.
private static String IMPLEMENTATION_ANNOTATIONS_TEMPLATE
          Name of the implementation-annotations.vm template.
private static String IMPLEMENTATION_DOCUMENTATION_TEMPLATE
          Name of the implementation-documentation.vm template.
private static String IMPLEMENTATION_LICENSE_TEMPLATE
          Name of the implementation-license.vm template.
private static String IMPLEMENTATION_TEMPLATE
          Name of the Implementation.java.vm template.
private static String LICENSE_SECTION_NAME
          Constant for the name of the license source code section.
private static String MESSAGES_SECTION_NAME
          Constant for the name of the messages source code section.
private static String MESSAGES_TEMPLATE
          Name of the implementation-messages.vm template.
private static String PROPERTIES_SECTION_NAME
          Constant for the name of the properties source code section.
private static String PROPERTIES_TEMPLATE
          Name of the implementation-properties.vm template.
private static String SPECIFICATION_ANNOTATIONS_TEMPLATE
          Name of the specification-annotations.vm template.
private static String SPECIFICATION_DOCUMENTATION_TEMPLATE
          Name of the specification-documentation.vm template.
private static String SPECIFICATION_LICENSE_TEMPLATE
          Name of the specification-license.vm template.
private static String SPECIFICATION_TEMPLATE
          Name of the Specification.java.vm template.
 
Constructor Summary
JavaSources()
          Creates a new JavaSources instance.
JavaSources(JavaSources tool)
          Creates a new JavaSources instance taking a JavaSources instance to initialize the instance with.
 
Method Summary
private  String getAnnotationsSection(Implementation implementation)
          Gets the Java source code of the implementation annotations section.
private  String getAnnotationsSection(Specification specification)
          Gets the Java source code of the specification annotations section.
private  String getConstructorsSectionHeadContent(Implementation implementation)
          Gets the Java source code of the constructors section head content of an implementation.
private  String getConstructorsSectionTailContent(Implementation implementation)
          Gets the Java source code of the constructors section tail content of an implementation.
private  String getDependenciesSection(Implementation implementation)
          Gets the Java source code of the dependencies section of an implementation.
private  String getDocumentationSection(Implementation implementation)
          Gets the Java source code of the documentation section of an implementation.
private  String getDocumentationSection(Specification specification)
          Gets the Java source code of the documentation section of a specification.
 JavaSources.JavaImplementationEditor getImplementationEditor(Implementation implementation)
          Gets a new editor for editing Java implementation source code.
private  String getImplementationTemplate(Implementation implementation)
          Gets the Java source code template of an implementation.
private  String getLicenseSection(Implementation implementation)
          Gets the Java source code of the license section of an implementation..
private  String getLicenseSection(Specification specification)
          Gets the Java source code of the license section of a specification.
private  String getMessage(String key, Object args)
           
private  String getMessagesSection(Implementation implementation)
          Gets the Java source code of the messages section of an implementation.
private  String getPropertiesSection(Implementation implementation)
          Gets the Java source code of the properties section of an implementation.
 JavaSources.JavaSpecificationEditor getSpecificationEditor(Specification specification)
          Gets a new editor for editing Java specification source code.
private  String getSpecificationTemplate(Specification specification)
          Gets the Java source code template of specification.
 VelocityContext getVelocityContext()
          Gets the velocity context used for merging templates.
 void manageSources(File sourcesDirectory)
          Manages the source code of the modules of the instance.
 void manageSources(Implementation implementation, File sourcesDirectory)
          Manages the source code of a given implementation of the modules of the instance.
 void manageSources(Module module, File sourcesDirectory)
          Manages the source code of a given module of the modules of the instance.
 void manageSources(Specification specification, File sourcesDirectory)
          Manages the source code of a given specification of the modules of the instance.
 
Methods inherited from class org.jomc.tools.JomcTool
getDisplayLanguage, getInputEncoding, getJavaClasspathLocation, getJavaClasspathLocation, getJavadocComment, getJavaGetterMethodName, getJavaGetterMethodName, getJavaGetterMethodName, getJavaInterfaces, getJavaModifierName, getJavaModifierName, getJavaModifierName, getJavaPackageName, getJavaPackageName, getJavaPackageName, getJavaString, getJavaTypeName, getJavaTypeName, getJavaTypeName, getJavaTypeName, getJavaTypeName, getJavaTypeName, getListeners, getLongDate, getLongDateTime, getLongTime, getModelManager, getModules, getOutputEncoding, getProfile, getShortDate, getShortDateTime, getShortTime, getTemplateEncoding, getVelocityEngine, getVelocityTemplate, getYears, isJavaClassDeclaration, isJavaClassDeclaration, isJavaDefaultPackage, isJavaDefaultPackage, isJavaPrimitiveType, log, setInputEncoding, setModelManager, setModules, setOutputEncoding, setProfile, setTemplateEncoding, setVelocityEngine
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONSTRUCTORS_SECTION_NAME

private static final String CONSTRUCTORS_SECTION_NAME
Constant for the name of the constructors source code section.

See Also:
Constant Field Values

DEFAULT_CONSTRUCTOR_SECTION_NAME

private static final String DEFAULT_CONSTRUCTOR_SECTION_NAME
Constant for the name of the default constructor source code section.

See Also:
Constant Field Values

DEPENDENCIES_SECTION_NAME

private static final String DEPENDENCIES_SECTION_NAME
Constant for the name of the dependencies source code section.

See Also:
Constant Field Values

PROPERTIES_SECTION_NAME

private static final String PROPERTIES_SECTION_NAME
Constant for the name of the properties source code section.

See Also:
Constant Field Values

MESSAGES_SECTION_NAME

private static final String MESSAGES_SECTION_NAME
Constant for the name of the messages source code section.

See Also:
Constant Field Values

LICENSE_SECTION_NAME

private static final String LICENSE_SECTION_NAME
Constant for the name of the license source code section.

See Also:
Constant Field Values

DOCUMENTATION_SECTION_NAME

private static final String DOCUMENTATION_SECTION_NAME
Constant for the name of the documentation source code section.

See Also:
Constant Field Values

ANNOTATIONS_SECTION_NAME

private static final String ANNOTATIONS_SECTION_NAME
Constant for the name of the implementation annotations source code section.

See Also:
Constant Field Values

GENERATOR_NAME

private static final String GENERATOR_NAME
Name of the generator.


GENERATOR_VERSION

private static final String GENERATOR_VERSION
Constant for the version of the generator.

See Also:
Constant Field Values

CONSTRUCTORS_HEAD_TEMPLATE

private static final String CONSTRUCTORS_HEAD_TEMPLATE
Name of the implementation-constructors-head.vm template.

See Also:
Constant Field Values

CONSTRUCTORS_TAIL_TEMPLATE

private static final String CONSTRUCTORS_TAIL_TEMPLATE
Name of the implementation-constructors-tail.vm template.

See Also:
Constant Field Values

DEPENDENCIES_TEMPLATE

private static final String DEPENDENCIES_TEMPLATE
Name of the implementation-dependencies.vm template.

See Also:
Constant Field Values

PROPERTIES_TEMPLATE

private static final String PROPERTIES_TEMPLATE
Name of the implementation-properties.vm template.

See Also:
Constant Field Values

MESSAGES_TEMPLATE

private static final String MESSAGES_TEMPLATE
Name of the implementation-messages.vm template.

See Also:
Constant Field Values

SPECIFICATION_LICENSE_TEMPLATE

private static final String SPECIFICATION_LICENSE_TEMPLATE
Name of the specification-license.vm template.

See Also:
Constant Field Values

IMPLEMENTATION_LICENSE_TEMPLATE

private static final String IMPLEMENTATION_LICENSE_TEMPLATE
Name of the implementation-license.vm template.

See Also:
Constant Field Values

SPECIFICATION_DOCUMENTATION_TEMPLATE

private static final String SPECIFICATION_DOCUMENTATION_TEMPLATE
Name of the specification-documentation.vm template.

See Also:
Constant Field Values

IMPLEMENTATION_DOCUMENTATION_TEMPLATE

private static final String IMPLEMENTATION_DOCUMENTATION_TEMPLATE
Name of the implementation-documentation.vm template.

See Also:
Constant Field Values

IMPLEMENTATION_TEMPLATE

private static final String IMPLEMENTATION_TEMPLATE
Name of the Implementation.java.vm template.

See Also:
Constant Field Values

SPECIFICATION_TEMPLATE

private static final String SPECIFICATION_TEMPLATE
Name of the Specification.java.vm template.

See Also:
Constant Field Values

SPECIFICATION_ANNOTATIONS_TEMPLATE

private static final String SPECIFICATION_ANNOTATIONS_TEMPLATE
Name of the specification-annotations.vm template.

See Also:
Constant Field Values

IMPLEMENTATION_ANNOTATIONS_TEMPLATE

private static final String IMPLEMENTATION_ANNOTATIONS_TEMPLATE
Name of the implementation-annotations.vm template.

See Also:
Constant Field Values
Constructor Detail

JavaSources

public JavaSources()
Creates a new JavaSources instance.


JavaSources

public JavaSources(JavaSources tool)
Creates a new JavaSources instance taking a JavaSources instance to initialize the instance with.

Parameters:
tool - The instance to initialize the new instance with,
Method Detail

manageSources

public void manageSources(File sourcesDirectory)
                   throws IOException
Manages the source code of the modules of the instance.

Parameters:
sourcesDirectory - The directory holding the sources to manage.
Throws:
NullPointerException - if sourcesDirectory is null.
IOException - if managing sources fails.
See Also:
manageSources(org.jomc.model.Module, java.io.File)

manageSources

public void manageSources(Module module,
                          File sourcesDirectory)
                   throws IOException
Manages the source code of a given module of the modules of the instance.

Parameters:
module - The module to process.
sourcesDirectory - The directory holding the sources to manage.
Throws:
NullPointerException - if module or sourcesDirectory is null.
IOException - if managing sources fails.
See Also:
manageSources(org.jomc.model.Specification, java.io.File), manageSources(org.jomc.model.Implementation, java.io.File)

manageSources

public void manageSources(Specification specification,
                          File sourcesDirectory)
                   throws IOException
Manages the source code of a given specification of the modules of the instance.

Parameters:
specification - The specification to process.
sourcesDirectory - The directory holding the sources to manage.
Throws:
NullPointerException - if specification or sourcesDirectory is null.
IOException - if managing sources fails.
See Also:
getSpecificationEditor(org.jomc.model.Specification)

manageSources

public void manageSources(Implementation implementation,
                          File sourcesDirectory)
                   throws IOException
Manages the source code of a given implementation of the modules of the instance.

Parameters:
implementation - The implementation to process.
sourcesDirectory - The directory holding the sources to manage.
Throws:
NullPointerException - if implementation or sourcesDirectory is null.
IOException - if managing sources fails.
See Also:
getImplementationEditor(org.jomc.model.Implementation)

getSpecificationEditor

public JavaSources.JavaSpecificationEditor getSpecificationEditor(Specification specification)
Gets a new editor for editing Java specification source code.

Parameters:
specification - The specification to create a new editor for.
Returns:
A new editor for editing the source code of specification.
Throws:
NullPointerException - if specification is null.

getImplementationEditor

public JavaSources.JavaImplementationEditor getImplementationEditor(Implementation implementation)
Gets a new editor for editing Java implementation source code.

Parameters:
implementation - The implementation to create a new editor for.
Returns:
A new editor for editing the source code of implementation.
Throws:
NullPointerException - if implementation is null.

getVelocityContext

public VelocityContext getVelocityContext()
Gets the velocity context used for merging templates.

Overrides:
getVelocityContext in class JomcTool
Returns:
The velocity context used for merging templates.

getSpecificationTemplate

private String getSpecificationTemplate(Specification specification)
                                 throws IOException
Gets the Java source code template of specification.

Parameters:
specification - The specification to get the source code template of.
Throws:
IOException - if getting the source code section fails.

getImplementationTemplate

private String getImplementationTemplate(Implementation implementation)
                                  throws IOException
Gets the Java source code template of an implementation.

Parameters:
implementation - The implementation to get the source code template of.
Throws:
IOException - if getting the source code section fails.

getLicenseSection

private String getLicenseSection(Specification specification)
                          throws IOException
Gets the Java source code of the license section of a specification.

Parameters:
specification - The specification to get the source code of the license section of.
Throws:
IOException - if getting the source code section fails.

getLicenseSection

private String getLicenseSection(Implementation implementation)
                          throws IOException
Gets the Java source code of the license section of an implementation..

Parameters:
implementation - The implementation to get the source code of the license section of.
Throws:
IOException - if getting the source code section fails.

getAnnotationsSection

private String getAnnotationsSection(Specification specification)
                              throws IOException
Gets the Java source code of the specification annotations section.

Parameters:
specification - The specification to get the source code of the annotations section of.
Throws:
IOException - if getting the source code section fails.

getAnnotationsSection

private String getAnnotationsSection(Implementation implementation)
                              throws IOException
Gets the Java source code of the implementation annotations section.

Parameters:
implementation - The implementation to get the source code of the annotations section of.
Throws:
IOException - if getting the source code section fails.

getDocumentationSection

private String getDocumentationSection(Specification specification)
                                throws IOException
Gets the Java source code of the documentation section of a specification.

Parameters:
specification - The specification to get the source code section of.
Throws:
IOException - if getting the source code section fails.

getDocumentationSection

private String getDocumentationSection(Implementation implementation)
                                throws IOException
Gets the Java source code of the documentation section of an implementation.

Parameters:
implementation - The implementation to get the source code section of.
Throws:
IOException - if getting the source code section fails.

getConstructorsSectionHeadContent

private String getConstructorsSectionHeadContent(Implementation implementation)
                                          throws IOException
Gets the Java source code of the constructors section head content of an implementation.

Parameters:
implementation - The implementation to get the constructors section head content of.
Throws:
IOException - if getting the source code section fails.

getConstructorsSectionTailContent

private String getConstructorsSectionTailContent(Implementation implementation)
                                          throws IOException
Gets the Java source code of the constructors section tail content of an implementation.

Parameters:
implementation - The implementation to get the constructors section tail content of.
Throws:
IOException - if getting the source code section fails.

getDependenciesSection

private String getDependenciesSection(Implementation implementation)
                               throws IOException
Gets the Java source code of the dependencies section of an implementation.

Parameters:
implementation - The implementation to get the source code of the dependencies section of.
Throws:
IOException - if getting the source code section fails.

getPropertiesSection

private String getPropertiesSection(Implementation implementation)
                             throws IOException
Gets the Java source code of the properties section of an implementation.

Parameters:
implementation - The implementation to get the source code of the properties section of.
Throws:
IOException - if getting the source code section fails.

getMessagesSection

private String getMessagesSection(Implementation implementation)
                           throws IOException
Gets the Java source code of the messages section of an implementation.

Parameters:
implementation - The implementation to get the source code of the messages section of.
Throws:
IOException - if getting the source code section fails.

getMessage

private String getMessage(String key,
                          Object args)


Copyright © 2005-2009 The JOMC Project. All Rights Reserved.