<commit_before>import {Injectable} from "angular2/core";
import {ProjectConfiguration} from "./../model/project-configuration";
import {Messages} from "./messages";
import {Http} from "angular2/http";
import {M} from "./../m";


/**
 * @author <NAME>
 */
@Injectable()
export class ConfigLoader {

    private static PROJECT_CONFIGURATION_PATH='config/Configuration.json';
    
    constructor(
        private http: Http,
        private messages: Messages){
    }

    public getProjectConfiguration() : Promise<ProjectConfiguration> {

        return new Promise<ProjectConfiguration>((resolve, reject) => {
            this.http.get(ConfigLoader.PROJECT_CONFIGURATION_PATH).
            subscribe(data_=>{

                var data;
                try {
                    data=JSON.parse(data_['_body'])
                } catch (e) {
                    this.messages.add(M.PARSE_GENERIC_ERROR, 'danger')
                    reject(e.message);
                }

                try {
                    resolve(new ProjectConfiguration(data))
                } catch (e) {
                    this.messages.add(e, 'danger')
                    reject(e)
                }
            });<commit_msg>fix compile errors in config loader<commit_after>import {Injectable} from "angular2/core";
import {ProjectConfiguration} from "./../model/project-configuration";
import {Messages} from "./messages";
import {Http} from "angular2/http";
import {M} from "./../m";


/**
 * @author <NAME>
 */
@Injectable()
export class ConfigLoader {

    private static PROJECT_CONFIGURATION_PATH='config/Configuration.json';
    
    constructor(
        private http: Http,
        private messages: Messages){
    }

    public getProjectConfiguration() : Promise<ProjectConfiguration> {

        return new Promise<ProjectConfiguration>((resolve, reject) => {
            this.http.get(ConfigLoader.PROJECT_CONFIGURATION_PATH).
            subscribe(data_=>{

                var data;
                try {
                    data=JSON.parse(data_['_body'])
                } catch (e) {
                    this.messages.add(M.PARSE_GENERIC_ERROR)
                    reject(e.message);
                }

                try {
                    resolve(new ProjectConfiguration(data))
                } catch (e) {
                    this.messages.add(e)
                    reject(e)
                }
            });
{'fraction_non_alphanumeric': 0.11662531017369727, 'fraction_numerical': 0.0016542597187758478, 'mean_word_length': 1.7868663594470047, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6317879', 'n_tokens_mistral': 642, 'n_tokens_neox': 603, 'n_words': 127}