package es.tid.ps.dynamicprofile;

import es.tid.ps.dynamicprofile.categoryextraction.CategoryExtractionMapper;
import es.tid.ps.dynamicprofile.categoryextraction.CategoryExtractionReducer;
import es.tid.ps.dynamicprofile.categoryextraction.CategoryInformation;
import es.tid.ps.dynamicprofile.categoryextraction.CompositeKey;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.mapreduce.*;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.input.TextInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat;

public class DynamicProfileMain {
    public static void main(String[] args) throws Exception {
        String termsInDomainFlatFileName = args[0];
        String dictionaryFileName = args[1];
        String categoryPatterMappingFileName = args[2];
        String categoryNamesFileName = args[3];
       
        Configuration conf = new Configuration();
        conf.set("termsInDomainFlatFileName", termsInDomainFlatFileName);
        conf.set("dictionaryFileName", dictionaryFileName);
        conf.set("categoryPatterMappingFileName", categoryPatterMappingFileName);
        conf.set("categoryNamesFileName", categoryNamesFileName);
        
        Job job = new Job(conf, "Dynamic profile");
        job.setJobName("dynamicprofile");
        job.setInputFormatClass(TextInputFormat.class);
        job.setOutputKeyClass(CompositeKey.class);
        job.setOutputValueClass(CategoryInformation.class);
        job.setOutputFormatClass(TextOutputFormat.class);
        job.setMapperClass(CategoryExtractionMapper.class);
        job.setReducerClass(CategoryExtractionReducer.class);
        FileInputFormat.addInputPath(job, new Path(args[4]));
        FileOutputFormat.setOutputPath(job, new Path(args[5]));
        
        job.waitForCompletion(true);
    }
}

@@ -83,247 +83,9 @@
 ion.
-CategoryExtractionMapper;%0Aimport es.tid.ps.dynamicprofile.categoryextraction.CategoryExtractionReducer;%0Aimport es.tid.ps.dynamicprofile.categoryextraction.CategoryInformation;%0Aimport es.tid.ps.dynamicprofile.categoryextraction.CompositeKey
+*
 ;%0A%0Ai
@@ -553,216 +553,8 @@
 n %7B%0A
-        String termsInDomainFlatFileName = args%5B0%5D;%0A        String dictionaryFileName = args%5B1%5D;%0A        String categoryPatterMappingFileName = args%5B2%5D;%0A        String categoryNamesFileName = args%5B3%5D;%0A       
 %0A   
@@ -650,33 +650,15 @@
 e%22, 
-termsInDomainFlatFileName
+args%5B0%5D
 );%0A 
@@ -695,34 +695,23 @@
 eName%22, 
-dictionaryFileName
+args%5B1%5D
 );%0A     
@@ -759,37 +759,15 @@
 e%22, 
-categoryPatterMappingFileName
+args%5B2%5D
 );%0A 
@@ -811,40 +811,18 @@
 e%22, 
-categoryNamesFileName);%0A        
+args%5B3%5D);%0A
 %0A   
@@ -1251,32 +1251,33 @@
 Reducer.class);%0A
+%0A
         FileInpu
@@ -1386,24 +1386,16 @@
 s%5B5%5D));%0A
-        
 %0A       

Inlined some vars