scriptella.tools.template
Class TemplateManager

java.lang.Object
  extended by scriptella.tools.template.TemplateManager
Direct Known Subclasses:
DataMigrator

public class TemplateManager
extends java.lang.Object

ETL files template manager.

Version:
1.0
Author:
Fyodor Kupolov

Field Summary
protected  java.util.logging.Logger logger
           
protected static java.lang.String PROPS_EXT
           
protected static java.lang.String XML_EXT
           
 
Constructor Summary
TemplateManager()
           
 
Method Summary
protected  boolean checkFile(java.lang.String name)
          Returns true if file doesn't exist.
 void create(java.util.Map<java.lang.String,?> properties)
          Produce template files.
static void create(java.lang.String name, java.lang.String propertiesFile)
          Creates an ETL template using a specified template manager name and properties file.
protected  java.lang.String defineName()
          Defines base name for ETL.
static TemplateManager forName(java.lang.String name)
          Loads a specified by name.
protected  java.lang.String loadResourceAsString(java.lang.String resourcePath)
          Loads specifed classpath resource into a string.
protected  java.io.Writer newFileWriter(java.lang.String fileName)
          Template factory method for writers.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XML_EXT

protected static final java.lang.String XML_EXT
See Also:
Constant Field Values

PROPS_EXT

protected static final java.lang.String PROPS_EXT
See Also:
Constant Field Values

logger

protected final java.util.logging.Logger logger
Constructor Detail

TemplateManager

public TemplateManager()
Method Detail

create

public void create(java.util.Map<java.lang.String,?> properties)
            throws java.io.IOException
Produce template files.

Parameters:
properties - configuration properties.
Throws:
java.io.IOException - if output fails.

loadResourceAsString

protected java.lang.String loadResourceAsString(java.lang.String resourcePath)
                                         throws java.io.IOException
Loads specifed classpath resource into a string.

Parameters:
resourcePath - path to resource.
Returns:
loaded resource.
Throws:
java.io.IOException - if IO error occurs.

defineName

protected java.lang.String defineName()
Defines base name for ETL.


newFileWriter

protected java.io.Writer newFileWriter(java.lang.String fileName)
                                throws java.io.IOException
Template factory method for writers.

Throws:
java.io.IOException

checkFile

protected boolean checkFile(java.lang.String name)
Returns true if file doesn't exist.

Parameters:
name - file name.

create

public static void create(java.lang.String name,
                          java.lang.String propertiesFile)
                   throws java.io.IOException
Creates an ETL template using a specified template manager name and properties file.

Parameters:
name - etl template name.
propertiesFile - configuration properties file.
Throws:
java.io.IOException - if I/O error occurs.

forName

public static TemplateManager forName(java.lang.String name)
Loads a specified by name.

Parameters:
name - template name. Cannot be null.
Returns:
loaded template manager.


Copyright © Copyright 2006-2009 The Scriptella Project Team.