code: public void store() {
  
          // TODO : Should we keep reference to Objects rather than recreating
          // everytime?
          try {
              XMLObjectWriter writer = XMLObjectWriter.newInstance(new FileOutputStream(persistFile.toString()));
              writer.setBinding(binding);
              writer.setIndentation(TAB_INDENT);
  
              writer.write(longMessageRules, LONG_MESSAGE_RULE, LongMessageRuleMap.class);
              writer.write(saps, MTP3_SERVICE_ACCESS_POINT, Mtp3ServiceAccessPointMap.class);
  
              writer.close();
          } catch (Exception e) {
              logger.error("Error while persisting the Rule state in file", e);
          }
      }
docs: Persist