org.jomc.tools
Class JavaBundles

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

public class JavaBundles
extends JomcTool

Generates Java bundles.

Use cases

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

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jomc.tools.JomcTool
JomcTool.Listener
 
Field Summary
private static String BUNDLE_SUFFIX
          Constant for the suffix appended to implementation identifiers.
private static String BUNDLE_TEMPLATE
          Location of the Bundle.java.vm template.
private  Locale defaultLocale
          The language of the default language properties file of the bundle.
private static String GENERATOR_NAME
          Name of the generator.
private static String GENERATOR_VERSION
          Constant for the version of the generator.
 
Constructor Summary
JavaBundles()
          Creates a new JavaBundles instance.
JavaBundles(JavaBundles tool)
          Creates a new JavaBundles instance taking a JavaBundles instance to initialize the instance with.
 
Method Summary
private  void assertValidTemplates(Implementation implementation)
           
 Locale getDefaultLocale()
          Gets the language of the default language properties file of the bundle.
private  String getMessage(String key, Object args)
           
 Map<Locale,Properties> getResourceBundleResources(Implementation implementation)
          Gets the resource bundle properties of a given implementation.
 String getResourceBundleSources(Implementation implementation)
          Gets the source code of the Java class for accessing the resource bundle of a given implementation.
 VelocityContext getVelocityContext()
          Gets the velocity context used for merging templates.
 void setDefaultLocale(Locale value)
          Sets the language of the default language properties file of the bundle.
 void writeBundleResources(File resourcesDirectory)
          Writes bundle resources of the modules of the instance to a given directory.
 void writeBundleResources(Implementation implementation, File resourcesDirectory)
          Writes the bundle resources of a given implementation from the modules of the instance to a directory.
 void writeBundleResources(Module module, File resourcesDirectory)
          Writes bundle resources of a given module from the modules of the instance to a given directory.
 void writeBundleSources(File sourcesDirectory)
          Writes bundle sources of the modules of the instance to a given directory.
 void writeBundleSources(Implementation implementation, File sourcesDirectory)
          Writes bundle sources of a given implementation from the modules of the instance to a given directory.
 void writeBundleSources(Module module, File sourcesDirectory)
          Writes bundle sources of a given module from the modules of the instance to a given directory.
 
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

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

BUNDLE_TEMPLATE

private static final String BUNDLE_TEMPLATE
Location of the Bundle.java.vm template.

See Also:
Constant Field Values

BUNDLE_SUFFIX

private static final String BUNDLE_SUFFIX
Constant for the suffix appended to implementation identifiers.

See Also:
Constant Field Values

defaultLocale

private Locale defaultLocale
The language of the default language properties file of the bundle.

Constructor Detail

JavaBundles

public JavaBundles()
Creates a new JavaBundles instance.


JavaBundles

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

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

getDefaultLocale

public Locale getDefaultLocale()
Gets the language of the default language properties file of the bundle.

Returns:
The language of the default language properties file of the bundle.
See Also:
setDefaultLocale(java.util.Locale)

setDefaultLocale

public void setDefaultLocale(Locale value)
Sets the language of the default language properties file of the bundle.

Parameters:
value - The language of the default language properties file of the bundle.
See Also:
getDefaultLocale()

writeBundleSources

public void writeBundleSources(File sourcesDirectory)
                        throws IOException
Writes bundle sources of the modules of the instance to a given directory.

Parameters:
sourcesDirectory - The directory to write sources to.
Throws:
NullPointerException - if sourcesDirectory is null.
IOException - if writing fails.
See Also:
writeBundleSources(org.jomc.model.Module, java.io.File)

writeBundleSources

public void writeBundleSources(Module module,
                               File sourcesDirectory)
                        throws IOException
Writes bundle sources of a given module from the modules of the instance to a given directory.

Parameters:
module - The module to process.
sourcesDirectory - The directory to write sources to.
Throws:
NullPointerException - if module or sourcesDirectory is null.
IOException - if writing fails.
See Also:
writeBundleSources(org.jomc.model.Implementation, java.io.File)

writeBundleSources

public void writeBundleSources(Implementation implementation,
                               File sourcesDirectory)
                        throws IOException
Writes bundle sources of a given implementation from the modules of the instance to a given directory.

Parameters:
implementation - The implementation to process.
sourcesDirectory - The directory to write sources to.
Throws:
NullPointerException - if implementation or sourcesDirectory is null.
IOException - if writing fails.
See Also:
getResourceBundleSources(org.jomc.model.Implementation)

writeBundleResources

public void writeBundleResources(File resourcesDirectory)
                          throws IOException
Writes bundle resources of the modules of the instance to a given directory.

Parameters:
resourcesDirectory - The directory to write resources to.
Throws:
NullPointerException - if resourcesDirectory is null.
IOException - if writing fails.
See Also:
writeBundleResources(org.jomc.model.Module, java.io.File)

writeBundleResources

public void writeBundleResources(Module module,
                                 File resourcesDirectory)
                          throws IOException
Writes bundle resources of a given module from the modules of the instance to a given directory.

Parameters:
module - The module to process.
resourcesDirectory - The directory to write resources to.
Throws:
NullPointerException - if module or resourcesDirectory is null.
IOException - if writing fails.
See Also:
writeBundleResources(org.jomc.model.Implementation, java.io.File)

writeBundleResources

public void writeBundleResources(Implementation implementation,
                                 File resourcesDirectory)
                          throws IOException
Writes the bundle resources of a given implementation from the modules of the instance to a directory.

Parameters:
implementation - The implementation to process.
resourcesDirectory - The directory to write resources to.
Throws:
NullPointerException - if implementation or resourcesDirectory is null.
IOException - if writing fails.
See Also:
getResourceBundleResources(org.jomc.model.Implementation)

getResourceBundleSources

public String getResourceBundleSources(Implementation implementation)
                                throws IOException
Gets the source code of the Java class for accessing the resource bundle of a given implementation.

Parameters:
implementation - The implementation to get the source code of.
Returns:
The source code of the Java class for accessing the resource bundle of implementation.
Throws:
NullPointerException - if implementation is null.
IOException - if getting the source code fails.

getResourceBundleResources

public Map<Locale,Properties> getResourceBundleResources(Implementation implementation)
                                                  throws IOException
Gets the resource bundle properties of a given implementation.

Parameters:
implementation - The implementation to get resource bundle properties of.
Returns:
Resource bundle properties of implementation.
Throws:
NullPointerException - if implementation is null.
IOException - if getting the resources fails.

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.

assertValidTemplates

private void assertValidTemplates(Implementation implementation)

getMessage

private String getMessage(String key,
                          Object args)


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