eu.scape_project.xa.tw.gen
Class PropertiesSubstitutor

java.lang.Object
  extended by eu.scape_project.xa.tw.gen.Substitutor
      extended by eu.scape_project.xa.tw.gen.PropertiesSubstitutor

public class PropertiesSubstitutor
extends Substitutor

PropertiesSubstitutor

Version:
0.3
Author:
shsdev https://github.com/shsdev

Field Summary
 
Fields inherited from class eu.scape_project.xa.tw.gen.Substitutor
ve
 
Constructor Summary
PropertiesSubstitutor()
          Default constructor
PropertiesSubstitutor(String propertiesAbsPath)
          Reads the properties from the project configuration properties file and creates the substitution variable map.
 
Method Summary
 void addVariable(String key, String val)
          Adds a key value pair to the subsitutor
 void deriveVariables()
          Derives some variables from the service definition
 String getContextProp(String string)
          Note that the velocity context variables are underscore (_) separated, e.g.
 String getGenerateDir()
          Getter for the generated directory
 String getGlobalProjectPrefix()
          Getter for the global project prefix
 String getProjectDirectory()
          Getter for the project midfix (e.g.
 String getProjectMidfix()
          Getter for the project midfix (e.g.
 String getProjectPackagePath()
          Getter for the project midfix (e.g.
 String getProjectResourcesDir()
          Getter for the resources directory
 String getProp(String string)
          Note that the properties are dot separated like defined in the properties file (e.g.
 PropertyUtil getPropertyUtils()
          Getter for the property utils
 ServiceDef getServiceDef()
           
 String getTemplateDir()
          Getter for the template directory
 void processFile(File path)
           
 void setServiceDef(ServiceDef serviceDef)
           
 
Methods inherited from class eu.scape_project.xa.tw.gen.Substitutor
applySubstitution, applySubstitution, getContext, processDirectory, putKeyValuePair, replaceVars
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertiesSubstitutor

public PropertiesSubstitutor()
Default constructor


PropertiesSubstitutor

public PropertiesSubstitutor(String propertiesAbsPath)
                      throws GeneratorException
Reads the properties from the project configuration properties file and creates the substitution variable map.

Parameters:
propertiesAbsPath - the path to the properties file
Throws:
GeneratorException
Method Detail

addVariable

public void addVariable(String key,
                        String val)
Adds a key value pair to the subsitutor

Parameters:
key - the key
val - the value associated with the key

deriveVariables

public void deriveVariables()
                     throws GeneratorException
Derives some variables from the service definition

Throws:
GeneratorException

processFile

public void processFile(File path)
                 throws GeneratorException
Specified by:
processFile in class Substitutor
Throws:
GeneratorException

getGlobalProjectPrefix

public String getGlobalProjectPrefix()
Getter for the global project prefix

Returns:
global project prefix

getProjectResourcesDir

public String getProjectResourcesDir()
Getter for the resources directory

Returns:
resources directory

getTemplateDir

public String getTemplateDir()
Getter for the template directory

Returns:
template directory

getGenerateDir

public String getGenerateDir()
Getter for the generated directory

Returns:
the generated directory

getProjectMidfix

public String getProjectMidfix()
Getter for the project midfix (e.g. SomeTool)

Returns:
project midfix

getProjectDirectory

public String getProjectDirectory()
Getter for the project midfix (e.g. SomeTool)

Returns:
project midfix

getPropertyUtils

public PropertyUtil getPropertyUtils()
Getter for the property utils

Returns:
property utils

getProjectPackagePath

public String getProjectPackagePath()
Getter for the project midfix (e.g. SomeTool)

Returns:
project midfix

getProp

public String getProp(String string)
Note that the properties are dot separated like defined in the properties file (e.g. some.variable=value).

Parameters:
string - Variable
Returns:
Value

getContextProp

public String getContextProp(String string)
Note that the velocity context variables are underscore (_) separated, e.g. use some_variable=value if you have defined some.variable=value in the properties file. file (e.g. some.variable=value).

Parameters:
string - Variable
Returns:
Value

getServiceDef

public ServiceDef getServiceDef()
Returns:
the serviceDef

setServiceDef

public void setServiceDef(ServiceDef serviceDef)
Parameters:
serviceDef - the serviceDef to set


Copyright © 2013. All Rights Reserved.