Bug 1263 - Add .gitignore to md-sal-app-simple archetype 14/8514/1
authorDevin Avery <devin.avery@brocade.com>
Tue, 1 Jul 2014 09:55:24 +0000 (05:55 -0400)
committerDevin Avery <devin.avery@brocade.com>
Tue, 1 Jul 2014 19:03:30 +0000 (15:03 -0400)
* Modified the generate project so that you need to run generate
from the specific generate directory.
* Added a .gitignore file which ignores the generate directory,
along with some other standards that we generally want to ignore.

Change-Id: Icb750b5383d391a364e0d0b8a7b46802394cfc33
Signed-off-by: Devin Avery <devin.avery@brocade.com>
main/archetypes/archetype-md-sal-app-simple/src/main/resources/META-INF/maven/archetype-metadata.xml
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/.gitignore [new file with mode: 0644]
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/java/generate/CodeGenerator.java
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/java/generate/CodeGeneratorUtil.java
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/java/generate/ConsumerTemplateProcessor.java
main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/generate/src/main/java/generate/ProviderTemplateProcessor.java

index 9115d389759325f26e0b973b589357d120616b11..e3886af49762122642138f57b8ead43272db41ac 100644 (file)
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<archetype-descriptor xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd"
-name="md-sal-apps"
-    xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-
+<archetype-descriptor
+  xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd"
+  name="md-sal-apps"
+  xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <requiredProperties>
     <requiredProperty key="appName">
       <defaultValue>task</defaultValue>
@@ -13,22 +13,6 @@ name="md-sal-apps"
     </requiredProperty>
   </requiredProperties>
   <modules>
-    <module id="sample-generate" dir="generate" name="sample-generate">
-    <fileSets>
-     <fileSet filtered="true" packaged="true" encoding="UTF-8">
-        <directory>src/main/java</directory>
-          <includes>
-            <include>**/*.java</include>
-          </includes>
-        </fileSet>
-        <fileSet encoding="UTF-8">
-          <directory>src/main/template</directory>
-          <includes>
-            <include>**/*.vm</include>
-          </includes>
-        </fileSet>
-  </fileSets>
-    </module>
     <module id="sample-model" dir="model" name="sample-model">
       <fileSets>
         <fileSet encoding="UTF-8">
@@ -95,4 +79,37 @@ name="md-sal-apps"
       </fileSets>
     </module>
   </modules>
-</archetype-descriptor>
+  
+  <fileSets>
+    <!-- explicitly copy over the .gitignore file to ignore the generate project -->  
+    <fileSet>
+      <directory></directory>
+      <includes>
+        <include>.gitignore</include>
+      </includes>
+    </fileSet>
+    
+    <!--  The following 3 file sets copy over the "generate" project, which is a one time use
+          project which should be used to generate additional files that are needed. 
+          We do NOT want this project included in the final project so we need to manually copy
+          the files instead of calling it a "module" like we do for other folders above. -->
+    <fileSet filtered="true" packaged="true" encoding="UTF-8">
+      <directory>generate/src/main/java</directory>
+      <includes>
+        <include>**/*.java</include>
+      </includes>
+    </fileSet>
+    <fileSet encoding="UTF-8">
+      <directory>generate/src/main/template</directory>
+      <includes>
+        <include>**/*.vm</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" encoding="UTF-8">
+      <directory>generate</directory>
+      <includes>
+        <include>pom.xml</include>
+      </includes>
+    </fileSet>
+  </fileSets>
+</archetype-descriptor>
\ No newline at end of file
diff --git a/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/.gitignore b/main/archetypes/archetype-md-sal-app-simple/src/main/resources/archetype-resources/.gitignore
new file mode 100644 (file)
index 0000000..7aaf8c9
--- /dev/null
@@ -0,0 +1,31 @@
+
+#####standard .git ignore entries#####
+
+*.class
+**/target
+bin/
+dist
+workspace
+*~
+target
+target-ide
+.classpath
+.project
+.settings
+MANIFEST.MF
+opendaylight/northbound/integrationtest/logs/*
+*.ipr
+*.iml
+*.iws
+.idea
+yang-gen-config
+yang-gen-sal
+classes
+out/
+.externalToolBuilders
+maven-eclipse.xml
+.DS_STORE
+.metadata
+
+#####Archetype .git ignore entries#######
+generate
\ No newline at end of file
index 4a298b90d94fbb4f73cc046b436e419a6866dbd9..2dbe47abffe877eea31fc96c77770838338ccbd4 100644 (file)
@@ -28,7 +28,13 @@ import org.json.simple.parser.JSONParser;
 public class CodeGenerator {
 
   private static String basePackage = "${package}";
-
+  /** 
+   * This variable holds the relative path from the working directory to the root folder where
+   * we want to generate the specified files. Since the CodeGenerator is expected to be invoked from
+   * the child "generate" folder, we will set the path to root to be its parent.  
+   */
+  public static final String PATH_TO_ROOT_DIR = "../";
+  
   /**
    * This method expects two arguments application name and fields for application,
    * which it will receive from command line, while generating the project.
@@ -72,7 +78,7 @@ public class CodeGenerator {
     context.put("fields", fields);
     /* now render the template into a File */
     String path = "model/src/main/yang/"+appName + ".yang";
-    CodeGeneratorUtil.writeFile(path, context, template);
+    CodeGeneratorUtil.writeFile(PATH_TO_ROOT_DIR, path, context, template);
   }
 
   private static void processInitialConfig(String appName, VelocityEngine ve) throws Exception{
@@ -83,7 +89,7 @@ public class CodeGenerator {
     context.put("app", appName);
     /* now render the template into a File */
     String path = "configuration/initial/05-"+appName + "-sample.xml";
-    CodeGeneratorUtil.writeFile(path, context, template);
+    CodeGeneratorUtil.writeFile(PATH_TO_ROOT_DIR, path, context, template);
   }
 
 
@@ -96,7 +102,7 @@ public class CodeGenerator {
     context.put("app", appName);
     context.put("capitalApp", CodeGeneratorUtil.capitalizeFirstLetter(appName));
     String path = "web/src/main/resources/WEB-INF/pages/view.jsp";
-    CodeGeneratorUtil.writeFile(path, context, template);
+    CodeGeneratorUtil.writeFile(PATH_TO_ROOT_DIR, path, context, template);
   }
 
 }
index 679c246e7efdc225cdaa72cd98c783ba96501174..ee58422264fc3d1204c62d2d87f84f0aa2bd9401 100644 (file)
@@ -20,9 +20,14 @@ import org.apache.velocity.VelocityContext;
  *
  */
 public class CodeGeneratorUtil {
-
-  public static void writeFile(String path, VelocityContext context, Template template) throws Exception {
-    File file = new File(path);
+  
+  /**
+   * Writes a file in the given <code>path</give>, using the <code>generateLocation</code> as
+   * the working (parent) directory. 
+   */
+  public static void writeFile(String generateLocation,
+                               String path, VelocityContext context, Template template) throws Exception {
+    File file = new File( generateLocation, path);
     File parent = file.getParentFile();
     if(!parent.exists()){
       parent.mkdirs();
index 07e44b210904188f8ce63b54b3eeac06266527a9..e6fd46aae8c2146e0a6548c17bedec991173a8f1 100644 (file)
@@ -37,7 +37,7 @@ public class ConsumerTemplateProcessor {
     context.put("package", basePackage);
     String path = "consumer/src/main/java/"+ basePackage.replaceAll("\\.", "/") + "/consumer/"
         + CodeGeneratorUtil.capitalizeFirstLetter(appName)+"ConsumerImpl.java";
-    CodeGeneratorUtil.writeFile(path, context, template);
+    CodeGeneratorUtil.writeFile( CodeGenerator.PATH_TO_ROOT_DIR, path, context, template);
   }
 
   private static void processConsumerService(String appName, VelocityEngine ve)  throws Exception{
@@ -48,7 +48,7 @@ public class ConsumerTemplateProcessor {
     context.put("package", basePackage);
     String path = "consumer/src/main/java/"+ basePackage.replaceAll("\\.", "/") + "/consumer/"
         + CodeGeneratorUtil.capitalizeFirstLetter(appName)+"ConsumerService.java";
-    CodeGeneratorUtil.writeFile(path, context, template);
+    CodeGeneratorUtil.writeFile( CodeGenerator.PATH_TO_ROOT_DIR, path, context, template);
   }
 
   private static void processConsumerModule(String appName, VelocityEngine ve)  throws Exception{
@@ -59,7 +59,7 @@ public class ConsumerTemplateProcessor {
     context.put("package", basePackage);
     String path = "consumer/src/main/java/org/opendaylight/controller/config/yang/config/"+
         appName +"_consumer/impl/" + CodeGeneratorUtil.capitalizeFirstLetter(appName)+"ConsumerModule.java";
-    CodeGeneratorUtil.writeFile(path, context, template);
+    CodeGeneratorUtil.writeFile( CodeGenerator.PATH_TO_ROOT_DIR, path, context, template);
   }
 
   private static void processConsumerModuleFactory(String appName, VelocityEngine ve)  throws Exception{
@@ -70,7 +70,7 @@ public class ConsumerTemplateProcessor {
     context.put("package", basePackage);
     String path = "consumer/src/main/java/org/opendaylight/controller/config/yang/config/"+
         appName +"_consumer/impl/" + CodeGeneratorUtil.capitalizeFirstLetter(appName)+"ConsumerModuleFactory.java";
-    CodeGeneratorUtil.writeFile(path, context, template);
+    CodeGeneratorUtil.writeFile( CodeGenerator.PATH_TO_ROOT_DIR, path, context, template);
   }
 
   private static void processConsumerYang(String appName, VelocityEngine ve)  throws Exception{
@@ -80,7 +80,7 @@ public class ConsumerTemplateProcessor {
     VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
     context.put("package", basePackage);
     String path = "consumer/src/main/yang/"+ appName + "-consumer-impl.yang";
-    CodeGeneratorUtil.writeFile(path, context, template);
+    CodeGeneratorUtil.writeFile( CodeGenerator.PATH_TO_ROOT_DIR, path, context, template);
   }
 
   private static void processConsumerServiceInterface(String appName, VelocityEngine ve)  throws Exception{
@@ -91,7 +91,7 @@ public class ConsumerTemplateProcessor {
     context.put("package", basePackage);
     String path = "consumer/src/main/yang-gen-config/org/opendaylight/controller/config/yang/config/"
     + appName+"_consumer/impl/"+ CodeGeneratorUtil.capitalizeFirstLetter(appName) + "ConsumerServiceServiceInterface.java";
-    CodeGeneratorUtil.writeFile(path, context, template);
+    CodeGeneratorUtil.writeFile( CodeGenerator.PATH_TO_ROOT_DIR, path, context, template);
   }
 
   private static void processAbstractConsumerModule(String appName, VelocityEngine ve)  throws Exception{
@@ -101,7 +101,7 @@ public class ConsumerTemplateProcessor {
     VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
     String path = "consumer/src/main/yang-gen-config/org/opendaylight/controller/config/yang/config/"
         + appName+"_consumer/impl/Abstract"+ CodeGeneratorUtil.capitalizeFirstLetter(appName) + "ConsumerModule.java";
-    CodeGeneratorUtil.writeFile(path, context, template);
+    CodeGeneratorUtil.writeFile( CodeGenerator.PATH_TO_ROOT_DIR, path, context, template);
   }
 
   private static void processAbstractConsumerModuleFactory(String appName, VelocityEngine ve)  throws Exception{
@@ -111,7 +111,7 @@ public class ConsumerTemplateProcessor {
     VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
     String path = "consumer/src/main/yang-gen-config/org/opendaylight/controller/config/yang/config/"
         + appName+"_consumer/impl/Abstract"+ CodeGeneratorUtil.capitalizeFirstLetter(appName) + "ConsumerModuleFactory.java";
-    CodeGeneratorUtil.writeFile(path, context, template);
+    CodeGeneratorUtil.writeFile( CodeGenerator.PATH_TO_ROOT_DIR, path, context, template);
   }
 
   private static void processConsumerModuleMXBean(String appName, VelocityEngine ve)  throws Exception{
@@ -121,7 +121,7 @@ public class ConsumerTemplateProcessor {
     VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
     String path = "consumer/src/main/yang-gen-config/org/opendaylight/controller/config/yang/config/"
         + appName+"_consumer/impl/"+ CodeGeneratorUtil.capitalizeFirstLetter(appName) + "ConsumerModuleMXBean.java";
-    CodeGeneratorUtil.writeFile(path, context, template);
+    CodeGeneratorUtil.writeFile( CodeGenerator.PATH_TO_ROOT_DIR, path, context, template);
   }
 
   private static void processAbstractConsumerService(String appName, VelocityEngine ve)  throws Exception{
@@ -133,7 +133,7 @@ public class ConsumerTemplateProcessor {
     context.put("lowerApp", lowerApp);
     String path = "consumer/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/controller/config/"
         + lowerApp+"/consumer/impl/rev140523/"+ CodeGeneratorUtil.capitalizeFirstLetter(appName) + "ConsumerService.java";
-    CodeGeneratorUtil.writeFile(path, context, template);
+    CodeGeneratorUtil.writeFile( CodeGenerator.PATH_TO_ROOT_DIR, path, context, template);
   }
 
   private static void processAbstractConsumerImpl(String appName, VelocityEngine ve)  throws Exception{
@@ -145,7 +145,7 @@ public class ConsumerTemplateProcessor {
     context.put("lowerApp", lowerApp);
     String path = "consumer/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/controller/config/"
         + lowerApp+"/consumer/impl/rev140523/"+ CodeGeneratorUtil.capitalizeFirstLetter(appName) + "ConsumerImpl.java";
-    CodeGeneratorUtil.writeFile(path, context, template);
+    CodeGeneratorUtil.writeFile( CodeGenerator.PATH_TO_ROOT_DIR, path, context, template);
   }
 
   private static void processYangModelBindingProvider(String appName, VelocityEngine ve)  throws Exception{
@@ -157,7 +157,7 @@ public class ConsumerTemplateProcessor {
     context.put("lowerApp", lowerApp);
     String path = "consumer/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/controller/config/"
         + lowerApp+"/consumer/impl/rev140523/$YangModelBindingProvider.java";
-    CodeGeneratorUtil.writeFile(path, context, template);
+    CodeGeneratorUtil.writeFile( CodeGenerator.PATH_TO_ROOT_DIR, path, context, template);
   }
 
   private static void processYangModuleInfoImpl(String appName, VelocityEngine ve)  throws Exception{
@@ -169,7 +169,7 @@ public class ConsumerTemplateProcessor {
     context.put("lowerApp", lowerApp);
     String path = "consumer/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/controller/config/"
         + lowerApp+"/consumer/impl/rev140523/$YangModuleInfoImpl.java";
-    CodeGeneratorUtil.writeFile(path, context, template);
+    CodeGeneratorUtil.writeFile( CodeGenerator.PATH_TO_ROOT_DIR, path, context, template);
   }
 
   private static void processConsumerImplInterface(String appName, VelocityEngine ve)  throws Exception{
@@ -182,7 +182,7 @@ public class ConsumerTemplateProcessor {
     String path = "consumer/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/controller/config/"
         + lowerApp+"/consumer/impl/rev140523/modules/module/configuration/"+ CodeGeneratorUtil.capitalizeFirstLetter(appName) +
         "ConsumerImpl.java";
-    CodeGeneratorUtil.writeFile(path, context, template);
+    CodeGeneratorUtil.writeFile( CodeGenerator.PATH_TO_ROOT_DIR, path, context, template);
   }
 
   private static void processConsumerImplBuilder(String appName, VelocityEngine ve)  throws Exception{
@@ -195,7 +195,7 @@ public class ConsumerTemplateProcessor {
     String path = "consumer/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/controller/config/"
         + lowerApp+"/consumer/impl/rev140523/modules/module/configuration/"+ CodeGeneratorUtil.capitalizeFirstLetter(appName) +
         "ConsumerImplBuilder.java";
-    CodeGeneratorUtil.writeFile(path, context, template);
+    CodeGeneratorUtil.writeFile( CodeGenerator.PATH_TO_ROOT_DIR, path, context, template);
   }
 
   private static void processRpcRegistry(String appName, VelocityEngine ve)  throws Exception{
@@ -208,7 +208,7 @@ public class ConsumerTemplateProcessor {
     String path = "consumer/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/controller/config/"
         + lowerApp+"/consumer/impl/rev140523/modules/module/configuration/"+ lowerApp+
         "/consumer/impl/RpcRegistry.java";
-    CodeGeneratorUtil.writeFile(path, context, template);
+    CodeGeneratorUtil.writeFile( CodeGenerator.PATH_TO_ROOT_DIR, path, context, template);
   }
 
   private static void processRpcRegistryBuilder(String appName, VelocityEngine ve)  throws Exception{
@@ -221,7 +221,7 @@ public class ConsumerTemplateProcessor {
     String path = "consumer/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/controller/config/"
         + lowerApp+"/consumer/impl/rev140523/modules/module/configuration/"+ lowerApp+
         "/consumer/impl/RpcRegistryBuilder.java";
-    CodeGeneratorUtil.writeFile(path, context, template);
+    CodeGeneratorUtil.writeFile( CodeGenerator.PATH_TO_ROOT_DIR, path, context, template);
   }
 
 }
\ No newline at end of file
index 4e94bdca98cc9152333c4d9768db7edb320b2a79..e5493327fb29dc3bc5384792d08b5e4734197e47 100644 (file)
@@ -46,14 +46,14 @@ public class ProviderTemplateProcessor {
     context.put("fields", fields);
     context.put("package", basePackage);
     String path = "provider/src/main/java/"+ basePackage.replaceAll("\\.", "/") + "/provider/"+capitalAppName+"Provider.java";
-    CodeGeneratorUtil.writeFile(path, context, template);
+    CodeGeneratorUtil.writeFile( CodeGenerator.PATH_TO_ROOT_DIR, path, context, template);
   }
 
   private static void processProviderYang(String appName, VelocityEngine ve)  throws Exception {
     Template template = ve.getTemplate( "provider/providerYang.vm" );
     VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
     String path = "provider/src/main/yang/"+ appName + "-provider-impl.yang";
-    CodeGeneratorUtil.writeFile(path, context, template);
+    CodeGeneratorUtil.writeFile( CodeGenerator.PATH_TO_ROOT_DIR, path, context, template);
   }
 
   private static void processProviderSalImpl(String appName, VelocityEngine ve)  throws Exception {
@@ -64,7 +64,7 @@ public class ProviderTemplateProcessor {
 
     String path = "provider/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/controller/config/"
         + lowerApp + "/provider/impl/rev140523/" + CodeGeneratorUtil.capitalizeFirstLetter(appName) +"ProviderImpl.java";
-    CodeGeneratorUtil.writeFile(path, context, template);
+    CodeGeneratorUtil.writeFile( CodeGenerator.PATH_TO_ROOT_DIR, path, context, template);
   }
 
   private static void processProviderSalYangModImpl(String appName, VelocityEngine ve)  throws Exception {
@@ -74,7 +74,7 @@ public class ProviderTemplateProcessor {
     context.put("lowerApp", lowerApp);
     String path = "provider/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/controller/config/"
         + lowerApp + "/provider/impl/rev140523/$YangModuleInfoImpl.java";
-    CodeGeneratorUtil.writeFile(path, context, template);
+    CodeGeneratorUtil.writeFile( CodeGenerator.PATH_TO_ROOT_DIR, path, context, template);
   }
 
   private static void processProviderSalYangBinding(String appName, VelocityEngine ve)  throws Exception {
@@ -84,7 +84,7 @@ public class ProviderTemplateProcessor {
     context.put("lowerApp", lowerApp);
     String path = "provider/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/controller/config/"
         + lowerApp + "/provider/impl/rev140523/$YangModelBindingProvider.java";
-    CodeGeneratorUtil.writeFile(path, context, template);
+    CodeGeneratorUtil.writeFile( CodeGenerator.PATH_TO_ROOT_DIR, path, context, template);
   }
 
   private static void processProviderSalConfImpl(String appName, VelocityEngine ve)  throws Exception {
@@ -94,7 +94,7 @@ public class ProviderTemplateProcessor {
     context.put("lowerApp", lowerApp);
     String path = "provider/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/controller/config/"
         + lowerApp + "/provider/impl/rev140523/modules/module/configuration/"+ CodeGeneratorUtil.capitalizeFirstLetter(appName) +"ProviderImpl.java";
-    CodeGeneratorUtil.writeFile(path, context, template);
+    CodeGeneratorUtil.writeFile( CodeGenerator.PATH_TO_ROOT_DIR, path, context, template);
   }
 
   private static void processProviderSalConfBuilder(String appName, VelocityEngine ve)  throws Exception {
@@ -104,7 +104,7 @@ public class ProviderTemplateProcessor {
     context.put("lowerApp", lowerApp);
     String path = "provider/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/controller/config/"
         + lowerApp + "/provider/impl/rev140523/modules/module/configuration/"+ CodeGeneratorUtil.capitalizeFirstLetter(appName) +"ProviderImplBuilder.java";
-    CodeGeneratorUtil.writeFile(path, context, template);
+    CodeGeneratorUtil.writeFile( CodeGenerator.PATH_TO_ROOT_DIR, path, context, template);
   }
 
   private static void processProviderSalDataBroker(String appName, VelocityEngine ve)  throws Exception {
@@ -114,7 +114,7 @@ public class ProviderTemplateProcessor {
     context.put("lowerApp", lowerApp);
     String path = "provider/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/controller/config/"
         + lowerApp + "/provider/impl/rev140523/modules/module/configuration/"+ lowerApp +"/provider/impl/DataBroker.java";
-    CodeGeneratorUtil.writeFile(path, context, template);
+    CodeGeneratorUtil.writeFile( CodeGenerator.PATH_TO_ROOT_DIR, path, context, template);
   }
 
   private static void processProviderSalBrokerBuilder(String appName, VelocityEngine ve)  throws Exception {
@@ -124,7 +124,7 @@ public class ProviderTemplateProcessor {
     context.put("lowerApp", lowerApp);
     String path = "provider/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/controller/config/"
         + lowerApp + "/provider/impl/rev140523/modules/module/configuration/"+ lowerApp +"/provider/impl/DataBrokerBuilder.java";
-    CodeGeneratorUtil.writeFile(path, context, template);
+    CodeGeneratorUtil.writeFile( CodeGenerator.PATH_TO_ROOT_DIR, path, context, template);
   }
 
   private static void processProviderSalRpc(String appName, VelocityEngine ve)  throws Exception {
@@ -134,7 +134,7 @@ public class ProviderTemplateProcessor {
     context.put("lowerApp", lowerApp);
     String path = "provider/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/controller/config/"
         + lowerApp + "/provider/impl/rev140523/modules/module/configuration/"+ lowerApp +"/provider/impl/RpcRegistry.java";
-    CodeGeneratorUtil.writeFile(path, context, template);
+    CodeGeneratorUtil.writeFile( CodeGenerator.PATH_TO_ROOT_DIR, path, context, template);
   }
 
   private static void processProviderSalRpcBuilder(String appName, VelocityEngine ve)  throws Exception {
@@ -144,7 +144,7 @@ public class ProviderTemplateProcessor {
     context.put("lowerApp", lowerApp);
     String path = "provider/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/controller/config/"
         + lowerApp + "/provider/impl/rev140523/modules/module/configuration/"+ lowerApp +"/provider/impl/RpcRegistryBuilder.java";
-    CodeGeneratorUtil.writeFile(path, context, template);
+    CodeGeneratorUtil.writeFile( CodeGenerator.PATH_TO_ROOT_DIR, path, context, template);
   }
 
   private static void processProviderAbstractModule(String appName, VelocityEngine ve)  throws Exception {
@@ -152,7 +152,7 @@ public class ProviderTemplateProcessor {
     VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
     String path = "provider/src/main/yang-gen-config/org/opendaylight/controller/config/yang/config/"
         + appName + "_provider/impl/Abstract"+ CodeGeneratorUtil.capitalizeFirstLetter(appName) +"ProviderModule.java";
-    CodeGeneratorUtil.writeFile(path, context, template);
+    CodeGeneratorUtil.writeFile( CodeGenerator.PATH_TO_ROOT_DIR, path, context, template);
   }
 
   private static void processProviderAbstractModuleFactory(String appName, VelocityEngine ve)  throws Exception {
@@ -160,7 +160,7 @@ public class ProviderTemplateProcessor {
     VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
     String path = "provider/src/main/yang-gen-config/org/opendaylight/controller/config/yang/config/"
         + appName + "_provider/impl/Abstract"+ CodeGeneratorUtil.capitalizeFirstLetter(appName) +"ProviderModuleFactory.java";
-    CodeGeneratorUtil.writeFile(path, context, template);
+    CodeGeneratorUtil.writeFile( CodeGenerator.PATH_TO_ROOT_DIR, path, context, template);
   }
 
   private static void processProviderMXBean(String appName, VelocityEngine ve)  throws Exception {
@@ -168,7 +168,7 @@ public class ProviderTemplateProcessor {
     VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
     String path = "provider/src/main/yang-gen-config/org/opendaylight/controller/config/yang/config/"
         + appName + "_provider/impl/"+ CodeGeneratorUtil.capitalizeFirstLetter(appName) +"ProviderModuleMXBean.java";
-    CodeGeneratorUtil.writeFile(path, context, template);
+    CodeGeneratorUtil.writeFile( CodeGenerator.PATH_TO_ROOT_DIR, path, context, template);
   }
 
   private static void processProviderModule(String appName, VelocityEngine ve)  throws Exception {
@@ -177,7 +177,7 @@ public class ProviderTemplateProcessor {
     context.put("package", basePackage);
     String path = "provider/src/main/java/org/opendaylight/controller/config/yang/config/"
         + appName + "_provider/impl/"+ CodeGeneratorUtil.capitalizeFirstLetter(appName) +"ProviderModule.java";
-    CodeGeneratorUtil.writeFile(path, context, template);
+    CodeGeneratorUtil.writeFile( CodeGenerator.PATH_TO_ROOT_DIR, path, context, template);
   }
 
   private static void processProviderModuleFactory(String appName, VelocityEngine ve)  throws Exception {
@@ -185,6 +185,6 @@ public class ProviderTemplateProcessor {
     VelocityContext context = CodeGeneratorUtil.createBasicVelocityContext(appName);
     String path = "provider/src/main/java/org/opendaylight/controller/config/yang/config/"
         + appName + "_provider/impl/"+ CodeGeneratorUtil.capitalizeFirstLetter(appName) +"ProviderModuleFactory.java";
-    CodeGeneratorUtil.writeFile(path, context, template);
+    CodeGeneratorUtil.writeFile( CodeGenerator.PATH_TO_ROOT_DIR, path, context, template);
   }
 }
\ No newline at end of file