package com.divae.ageto.hybris.install.task;

import java.io.File;
import java.util.Map;

/**
 * @author Klaus Hauschild
 */
public class CreatePomTask extends AbstractWorkDirectoryTask {

    private final String              template;
    private final String              targetDirectory;
    private final Map<String, String> parameters;

    public CreatePomTask(final String template, final String targetDirectory, final Map<String, String> parameters) {
        this.template = template;
        this.targetDirectory = targetDirectory;
        this.parameters = parameters;
    }

    @Override
    protected void execute(final TaskContext taskContext, final File workDirectory) {
        // PomCreator.create(taskContext.getHybrisVersion().getVersion(), parameters, template, workDirectory, targetDirectory);


        // final Map<String, String> token = Maps.newHashMap();
        // token.putAll(parameters);
        // token.put("hybris.version", taskContext.getHybrisVersion().getVersion());
        // try (final BufferedReader reader = new BufferedReader(
        // new TokenReplacingReader(new InputStreamReader(ClassLoader.getSystemResourceAsStream(template)), token))) {
        //
        // final List<String> lines = Lists.newArrayList();
        // String line;
        // while ((line = reader.readLine()) != null) {
        // lines.add(line);
        // }
        //
        // final File directory = new File(workDirectory, targetDirectory);
        // directory.mkdirs();
        // final File targetFile = new File(directory, "pom.xml");
        // targetFile.createNewFile();
        // try (final BufferedWriter writer = new BufferedWriter(new FileWriter(targetFile))) {
        // for (final String lineToWrite : lines) {
        // try {
        // writer.write(lineToWrite);
        // writer.newLine();
        // } catch (final Exception exception) {
        // throw new RuntimeException(exception);
        // }
        // }
        // }
        //
        // } catch (final Exception exception) {
        // throw new RuntimeException(exception);
        // }
    }
}

@@ -58,34 +58,260 @@
 .io.
-File;%0Aimport java.util.Map
+BufferedReader;%0Aimport java.io.BufferedWriter;%0Aimport java.io.File;%0Aimport java.io.FileWriter;%0Aimport java.io.InputStreamReader;%0Aimport java.util.List;%0Aimport java.util.Map;%0A%0Aimport com.google.common.collect.Lists;%0Aimport com.google.common.collect.Maps
 ;%0A%0A/
@@ -918,142 +918,8 @@
     
- // PomCreator.create(taskContext.getHybrisVersion().getVersion(), parameters, template, workDirectory, targetDirectory);%0A%0A%0A        //
  fin
@@ -967,35 +967,32 @@
 shMap();%0A       
- //
  token.putAll(pa
@@ -1009,19 +1009,16 @@
 %0A       
- //
  token.p
@@ -1083,35 +1083,32 @@
 sion());%0A       
- //
  try (final Buff
@@ -1155,18 +1155,23 @@
         
-//
+       
  new Tok
@@ -1271,37 +1271,28 @@
 en))) %7B%0A
-  
+%0A
       
-//%0A
      
-   //
  final L
@@ -1341,18 +1341,19 @@
         
-//
+   
  String 
@@ -1366,18 +1366,19 @@
         
-//
+   
  while (
@@ -1423,18 +1423,23 @@
         
-//
+       
  lines.a
@@ -1460,34 +1460,26 @@
     
-// %7D%0A   
+    %7D%0A%0A
      
-//%0A
       
-  //
  fin
@@ -1548,18 +1548,19 @@
         
-//
+   
  directo
@@ -1580,18 +1580,19 @@
         
+ 
-//
+  
  final F
@@ -1648,18 +1648,19 @@
         
-//
+   
  targetF
@@ -1684,26 +1684,27 @@
 ();%0A        
+ 
-//
+  
  try (final 
@@ -1785,18 +1785,23 @@
         
-//
+       
  for (fi
@@ -1842,18 +1842,27 @@
         
-//
+           
  try %7B%0A 
@@ -1860,34 +1860,47 @@
   try %7B%0A        
+      
-//
+         
  writer.write(li
@@ -1919,18 +1919,31 @@
         
-//
+               
  writer.
@@ -1953,34 +1953,43 @@
 Line();%0A        
-//
+           
  %7D catch (final 
@@ -2011,34 +2011,47 @@
 tion) %7B%0A        
-//
+               
  throw new Runti
@@ -2078,37 +2078,32 @@
 n);%0A        
-// %7D%0A
         
 // %7D%0A       
@@ -2082,34 +2082,35 @@
                 
-//
+   
  %7D%0A        // %7D%0A
@@ -2108,21 +2108,30 @@
     
-// %7D%0A
+        %7D%0A    
         
 //%0A 
@@ -2130,18 +2130,18 @@
     
-//
+%7D%0A
 %0A       
  // 
@@ -2136,19 +2136,16 @@
 %0A       
- //
  %7D catch
@@ -2183,18 +2183,19 @@
         
-//
+   
  throw n
@@ -2237,11 +2237,8 @@
     
- //
  %7D%0A 

Remove PomCreator #12