XemDB 0.3 - Lightweight FlatFile-Wrapper

Discussion in 'Inactive/Unsupported Plugins' started by Smex, Feb 22, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    Smex

    [​IMG]

    XemDB is a lightweight flatfile wrapper, which allows you to do following things:
    • Creating a flatfile which gets handled as a database
    • Creating entries consisting of an index and a value
    • Reading out the value of an entry
    • Deleting entries or clearing the entire file
    • Getting all values of the database
    • Checking if an index exists in the database
    We initialize a XemDB object like so: XemDB db = new XemDB("PATH","NAME");
    This project will be recently updated.
    Code:java
    1.  
    2.  
    3. public static void main(String[] args) {
    4. XemDB db = new XemDB("plugins", "XemDB");
    5. XemDB db2 = new XemDB("plugins", "XemDB2");
    6.  
    7. // Clearing
    8. db.clear();
    9. db2.clear();
    10. System.out.println();
    11.  
    12. // XemDB 1
    13.  
    14. // Adding first entry
    15. db.addEntry("DB", "Database-1");
    16. // Removing the first entry
    17. db.removeEntry("DB");
    18. System.out.println("Entry with index \"DB\" is now " + db.getValue("XemsDoom"));
    19.  
    20. // Adding second entry
    21. db.addEntry("DB1-Entry", "DB1-Value1");
    22. System.out.println(db.getValue("DB1-Entry"));
    23.  
    24. // Adding third entry
    25. db.addEntry("DB1-Entry2", "DB1-Value2");
    26. System.out.println(db.getValue("DB1-Entry2"));
    27.  
    28. // Overriding existing third entry
    29. db.addEntry("DB1-Entry2", "DB1-Value2-Overrided");
    30. System.out.println(db.getValue("DB1-Entry2"));
    31.  
    32. if(db.hasIndex("DB1-Entry2"))
    33. System.out.println("True");
    34.  
    35. if(!db.hasIndex("DB1-Entry3"))
    36. System.out.println("false");
    37.  
    38. // Getting all values of the db and print them out
    39. System.out.println(db.getAllValues().toString());
    40.  
    41. // XemDB 2
    42. System.out.println();
    43.  
    44. // Adding first entry
    45. db2.addEntry("DB2", "Database-2");
    46. // Removing the first entry
    47. db2.removeEntry("DB2");
    48. System.out.println("Entry with index \"DB2\" is now " + db2.getValue("DB2"));
    49.  
    50. // Adding second entry
    51. db2.addEntry("DB2-Entry", "DB2-Value1");
    52. System.out.println(db2.getValue("DB2-Entry"));
    53.  
    54. // Adding third entry
    55. db2.addEntry("DB2-Entry2", "DB2-Value2");
    56. System.out.println(db2.getValue("DB2-Entry2"));
    57.  
    58. // Overriding existing value of third entry
    59. db2.addEntry("DB2-Entry2", "DB2-Value2-Overrided");
    60. System.out.println(db2.getValue("DB2-Entry2"));
    61.  
    62. if(db2.hasIndex("DB2-Entry2"))
    63. System.out.println("True");
    64.  
    65. if(!db2.hasIndex("DB1-Entry3"))
    66. System.out.println("false");
    67.  
    68. System.out.println(db2.getAllValues().toString());
    69. System.out.println(db2.getAllEntries().toString());
    70. System.out.println(db.getAllIndices().toString());
    71.  
    72. }
    73.  

    Download 0.3
     
  2. Offline

    heisan213

    Hmmm, me gusta :D Imma try this out!
     
  3. Offline

    Tauryuu

    Nice, I could finally find an alternative way of storing data :D
     
  4. Offline

    TnT

    Locked per plugin dev's request.
     
Thread Status:
Not open for further replies.

Share This Page