<commit_before>/**
 * File:   Core.java
 * Author: <NAME>
 * Date:   4 janv. 2012
 */
package org.psem2m.sca.converter.core;

import java.io.File;

import org.psem2m.composer.config.impl.JsonComposerConfigHandler;
import org.psem2m.composer.model.ComponentsSetBean;
import org.psem2m.sca.converter.model.Composite;

/**
 * @author <NAME>
 * 
 */
public class Core {

    public static final String OUTPUT_FOLDER = "/home/tcalmant/Bureau/";
    public static final String OUTPUT_PSEM2M = "psem2m.js";
    public static final String OUTPUT_TUSCANY = "tuscany.js";

    public static final String PSEM2M_FOLDER = "/home/tcalmant/programmation/workspaces/jvm-forker/org.psem2m.composer.demo.sca/src.old/";
    public static final String PSEM2M_ROOT = "application.composite";

    public static final String TUSCANY_FOLDER = "/home/tcalmant/Téléchargements/tuscany-sca-2.0-Beta3-src/samples/applications/store/src/main/resources/";
    public static final String TUSCANY_ROOT = "store.composite";

    /**
     * @param args
     */
    public static void main(final String[] args) throws Exception {

        final boolean tuscany = true;

        final File sca_folder;
        final File root_file;
        if (tuscany) {
            sca_folder = new File(TUSCANY_FOLDER);
            root_file = new File(sca_folder, TUSCANY_ROOT);

        } else {
            sca_folder = new File(PSEM2M_FOLDER);
            root_file = new File(sca_folder, PSEM2M_ROOT);
        }

        final SCAParser parser = new SCAParser();
        final SCA2Composer converter = new SCA2Composer();

        // Parse the document
        System.out.println("Parse : " + sca_folder);
        final Composite scaComposite = parser.parse(sca_folder, root_file);
        System.err.flush();
        System.out.flush();

        System.out.println("To PSEM2M...");
        System.out.flush();
        System.err.flush();

        final ComponentsSetBean composet = converter
                .convertToComposer(scaComposite);

        System.err.flush();

        System.out.println("------------  SCA  ---------------------------");
        System.out.println(scaComposite);

        System.out.println("------------  PSEM2M  ------------------------");
        System.out.println(composet.toCompleteString());

        File file;
        if (tuscany) {
            file = new File(OUTPUT_FOLDER, OUTPUT_TUSCANY);

        } else {
            file = new File(OUTPUT_FOLDER, OUTPUT_PSEM2M);
        }

        final JsonComposerConfigHandler config = new JsonComposerConfigHandler();
        config.write(composet, file.getAbsolutePath());
    }
}
<commit_msg>Véritable point d'entrée ajouté au convertisseur<commit_after>/**
 * File:   Core.java
 * Author: <NAME>
 * Date:   4 janv. 2012
 */
package org.psem2m.sca.converter.core;

import java.io.File;

import org.psem2m.composer.config.IComposerConfigHandler;
import org.psem2m.composer.config.impl.JsonComposerConfigHandler;
import org.psem2m.composer.model.ComponentsSetBean;
import org.psem2m.sca.converter.model.Composite;

/**
 * Converter entry point (for stand-alone execution mode)
 * 
 * @author <NAME>
 */
public class Core {

    public static final String OUTPUT_FOLDER = "/home/tcalmant/Bureau/";
    public static final String OUTPUT_PSEM2M = "psem2m.js";
    public static final String OUTPUT_TUSCANY = "tuscany.js";

    public static final String PSEM2M_FOLDER = "/home/tcalmant/programmation/workspaces/jvm-forker/org.psem2m.composer.demo.sca/src.old/";
    public static final String PSEM2M_ROOT = "application.composite";

    public static final String TUSCANY_FOLDER = "/home/tcalmant/Téléchargements/tuscany-sca-2.0-Beta3-src/samples/applications/store/src/main/resources/";
    public static final String TUSCANY_ROOT = "store.composite";

    /**
     * Converter entry point
     * 
     * @param aArgs
     *            Arguments
     */
    public static void main(final String[] aArgs) throws Exception {

        if (aArgs.length < 2) {
            System.out
                    .println("Usage : converter root_file.composite [folder]");
            return;
        }

        // Given folder or root file ones
        final File rootFolder;
        if (aArgs.length >= 2) {
            rootFolder = new File(aArgs[1]);
            if (!rootFolder.isDirectory()) {
                System.err.println("Invalid directory : " + rootFolder);
                return;
            }

        } else {
            // Use the file parent as root folder
            rootFolder = new File(".").getAbsoluteFile();
        }

        // Root file
        final File rootCompositeFile = new File(rootFolder, aArgs[0]);

        final SCAParser parser = new SCAParser();
        final SCA2Composer converter = new SCA2Composer();

        // Parse the document
        System.out.println("Parse : " + rootFolder);
        final Composite scaComposite = parser.parse(rootFolder,
                rootCompositeFile);

        final ComponentsSetBean composet = converter
                .convertToComposer(scaComposite);

        final IComposerConfigHandler config = new JsonComposerConfigHandler();
        config.write(composet, null);
    }
}

{'fraction_non_alphanumeric': 0.11929080747735595, 'fraction_numerical': 0.009250337251878975, 'mean_word_length': 2.428005284015852, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, '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': '4232503', 'n_tokens_mistral': 1669, 'n_tokens_neox': 1593, 'n_words': 336}