<commit_before>package nu.postnummeruppror.insamlingsappen;

import nu.postnummeruppror.insamlingsappen.domain.Root;
import org.prevayler.Prevayler;
import org.prevayler.PrevaylerFactory;

import java.io.File;
import java.io.IOException;

/**
 * @author kalle
 * @since 2014-09-06 00:42
 */
public class Insamlingsappen {

  /**
   * För att teststarta tjänsten
   */
  public static void main(String[] args) throws Exception {
    Insamlingsappen.getInstance().open();
    try {
      // foo
    } finally {
      Insamlingsappen.getInstance().close();
    }
  }

  private static Insamlingsappen instance = new Insamlingsappen();

  public static Insamlingsappen getInstance() {
    return instance;
  }

  private Insamlingsappen() {
  }

  private Prevayler<Root> prevayler;

  public void open() throws Exception {
    PrevaylerFactory<Root> prevaylerFactory = new PrevaylerFactory<>();
    File prevalenceDirectory = new File("data/prevalence");
    if (!prevalenceDirectory.exists() && !prevalenceDirectory.mkdirs()) {
      throw new IOException("Could not mkdirs " + prevalenceDirectory.getAbsolutePath());
    }
    prevaylerFactory.configurePrevalenceDirectory(new File("data/prevalence").getAbsolutePath());
    prevayler = prevaylerFactory.create();
  }<commit_msg>Switched from BDB to Prevayler. Hopefully works.<commit_after>package nu.postnummeruppror.insamlingsappen;

import nu.postnummeruppror.insamlingsappen.domain.Root;
import org.prevayler.Prevayler;
import org.prevayler.PrevaylerFactory;

import java.io.File;
import java.io.IOException;

/**
 * @author kalle
 * @since 2014-09-06 00:42
 */
public class Insamlingsappen {

  /**
   * För att teststarta tjänsten
   */
  public static void main(String[] args) throws Exception {
    Insamlingsappen.getInstance().open();
    try {
      // foo
    } finally {
      Insamlingsappen.getInstance().close();
    }
  }

  private static Insamlingsappen instance = new Insamlingsappen();

  public static Insamlingsappen getInstance() {
    return instance;
  }

  private Insamlingsappen() {
  }

  private Prevayler<Root> prevayler;

  public void open() throws Exception {
    PrevaylerFactory<Root> prevaylerFactory = new PrevaylerFactory<>();
    File prevalenceDirectory = new File("data/prevalence");
    if (!prevalenceDirectory.exists() && !prevalenceDirectory.mkdirs()) {
      throw new IOException("Could not mkdirs " + prevalenceDirectory.getAbsolutePath());
    }
    prevaylerFactory.configurePrevalenceDirectory(new File("data/prevalence").getAbsolutePath());
    prevaylerFactory.configurePrevalentSystem(new Root());
    prevayler = prevaylerFactory.create();
  }
{'fraction_non_alphanumeric': 0.1109433962264151, 'fraction_numerical': 0.009056603773584906, 'mean_word_length': 4.259920634920635, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '830615', 'n_tokens_mistral': 832, 'n_tokens_neox': 801, 'n_words': 166}