Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Allow storage to be constructed from file.

  • Loading branch information...
commit 2027db0ed648c951006c9a14ed945d6d164e90a7 1 parent 3309267
Graylin Kim GraylinKim authored

Showing 1 changed file with 14 additions and 6 deletions. Show diff stats Hide diff stats

  1. +14 6 src/main/java/gov/nysenate/openleg/util/Storage.java
20 src/main/java/gov/nysenate/openleg/util/Storage.java
@@ -19,7 +19,7 @@
19 19
20 20 public class Storage {
21 21
22   - private final String storage;
  22 + private final File storage;
23 23 private final Logger logger;
24 24 private final JsonFactory jsonFactory;
25 25 private final ObjectMapper objectMapper;
@@ -33,19 +33,27 @@
33 33
34 34 public static enum Status { NEW , MODIFIED, DELETED };
35 35
36   - public Storage(String filepath) {
37   - this(filepath, true);
  36 + public Storage(String storagePath) {
  37 + this(storagePath, true);
38 38 }
39 39
40   - public Storage(String filepath, Boolean autoFlush) {
41   - this.storage = filepath;
  40 + public Storage(File storageDir) {
  41 + this(storageDir, true);
  42 + }
  43 +
  44 + public Storage(String storagePath, Boolean autoFlush) {
  45 + this(new File(storagePath),autoFlush);
  46 + }
  47 +
  48 + public Storage(File storageDir, Boolean autoFlush) {
  49 + this.storage = storageDir;
42 50 this.logger = Logger.getLogger(this.getClass());
43 51 this.memory = new HashMap<String, Object>();
44 52 this.dirty = new HashSet<String>();
45 53 this.autoFlush = autoFlush;
46 54
47 55 this.objectMapper = new ObjectMapper();
48   - this.objectMapper.getSerializationConfig().enable(Feature.INDENT_OUTPUT);
  56 + this.objectMapper.enable(Feature.INDENT_OUTPUT);
49 57 this.jsonFactory = this.objectMapper.getJsonFactory();
50 58 this.prettyPrinter = new DefaultPrettyPrinter();
51 59

0 comments on commit 2027db0

Please sign in to comment.
Something went wrong with that request. Please try again.