<commit_before>package de.predic8.routes;

import de.predic8.Endpoints;
import de.predic8.util.*;
import org.apache.camel.builder.RouteBuilder;

public class ArchiverRoutes extends RouteBuilder {

    public void configure() throws Exception {

        //from("file:document-archive/in?noop=true").routeId("Archiver")
        from("file:document-archive/in?readLock=changed").routeId("ArchiverRoute")
                .log("Got File: ${in.header.CamelFileName}")
                .setProperty("fileName").simple("/${date:now:yyyy}/${date:now:MM}/${date:now:HH-mm-ss-S}_${in.header.CamelFileName}")
                .process(new NormalizeFileName())
                .process(new CreateMessageDigest())
                .to(Endpoints.archiveFolder)
                .to("direct:get-last-hash")
                .process(new AddHashedBodyToDigest())
                .setProperty("entry").simple("${date:now:yyyy-MM-dd HH:mm:ss} ${property.fileName} ${property.digest}")
                .setBody().simple("${property.entry}\n")
                .transform(body().append("\n"))
                .to(Endpoints.logFile)
                .to(Endpoints.notifyFile)
                .setBody().simple("${property.entry}")
                .to("direct:twitter");
                /* SEND HASH TO TWITTER
                .to("direct:twitter")
                */

        from("direct:get-last-hash").routeId("LastHash")
                .process(new LogExists())
                .choice()
                    .when(exchangeProperty("fileExists"))
                        .process(new GetLastHash())
                    .otherwise()
                        .setBody().simple("123")
                    .end();
        /*
        from("direct:twitter").routeId("twitterRoute")
                .to(String.format("twitter://timeline/user?consumerKey=%s&consumerSecret=%s&accessToken=%s&accessTokenSecret=%s"
                        , PropertyFile.getInstance("twitter_consumerKey")
                        , PropertyFile.getInstance("twitter_consumerSecret")
                        , PropertyFile.getInstance("twitter_accessToken")
                        , PropertyFile.getInstance("twitter_accessTokenSecret")));
        */
    }
}<commit_msg>minor changes<commit_after>package de.predic8.routes;

import de.predic8.Endpoints;
import de.predic8.util.*;
import org.apache.camel.builder.RouteBuilder;

public class ArchiverRoutes extends RouteBuilder {

    public void configure() throws Exception {

        //from("file:document-archive/in?noop=true").routeId("Archiver")
        from("file:document-archive/in?readLock=changed").routeId("ArchiverRoute")
                .log("Got File: ${in.header.CamelFileName}")
                .setProperty("fileName").simple("/${date:now:yyyy}/${date:now:MM}/${date:now:HH-mm-ss-S}_${in.header.CamelFileName}")
                .process(new NormalizeFileName())
                .process(new CreateMessageDigest())
                .to(Endpoints.archiveFolder)
                .to("direct:get-last-hash")
                .process(new AddHashedBodyToDigest())
                .setProperty("entry").simple("${date:now:yyyy-MM-dd HH:mm:ss} ${property.fileName} ${property.digest}")
                .setBody().simple("${property.entry}\n")
                .transform(body().append("\n"))
                .to(Endpoints.logFile)
                .to(Endpoints.notifyFile)
                .setBody().simple("${property.entry}");
                /* SEND HASH TO TWITTER
                .to("direct:twitter")
                */

        from("direct:get-last-hash").routeId("LastHash")
                .process(new LogExists())
                .choice()
                    .when(exchangeProperty("fileExists"))
                        .process(new GetLastHash())
                    .otherwise()
                        .setBody().simple("123")
                    .end();

        from("direct:twitter").routeId("twitterRoute")
                .to(String.format("twitter://timeline/user?consumerKey=%s&consumerSecret=%s&accessToken=%s&accessTokenSecret=%s"
                        , PropertyFile.getInstance("twitter_consumerKey")
                        , PropertyFile.getInstance("twitter_consumerSecret")
                        , PropertyFile.getInstance("twitter_accessToken")
                        , PropertyFile.getInstance("twitter_accessTokenSecret")));

    }
}
{'fraction_non_alphanumeric': 0.14716636197440586, 'fraction_numerical': 0.002742230347349177, 'mean_word_length': 2.0020576131687244, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1785288', 'n_tokens_mistral': 1204, 'n_tokens_neox': 1121, 'n_words': 126}