String> hm = new HashMap<String, String>(); hm.add(“key”, “value”); hm.get(“key”); // return “value” • Used to implement a basic key-value database with ArrayList as value • All data in store are saved to a static HashMap in FileStorage class
use Java’s serializable format. • Just implement interface “Serializable” in classes and let Java do it magic. • HashMap, array, primitive types, ArrayList are implementors of Serializable interface • Read more: http://pagist.info/6f66495127be09d45180 (available in my Facebook)
…. • GET http://api.openkeyval.org/STOREGUI_default_data Return the data given (try this URL in your browser) • storedata.txt is sent to OpenKeyVal using base64 encoding to make it plain text
need to pass store instance around, just Store.getInstance() everywhere • Fixed a whole lot of bugs dealing with data inconsistent in pages. • Shopping cart’s singleton is required to save development time due to existing code structure