@@ -0,0 +1,870 @@
+package transaction;%0A%0A/**%0A * A lock used in %7B@link Transaction%7Ds in order to lock resources and modify a temporary value before committing or discarding changes%0A * @author Balazs Pete%0A *%0A * @param %3CT%3E The class of the stored object%0A */%0Apublic class Vault%3CT%3E extends Lock%3CT%3E %7B%0A%0A%09private T base = null;%0A%09%0A%09/**%0A%09 * Create a new %7B@link Value%7D with its value%0A%09 * @param data The value to store in the vault%0A%09 */%0A%09public Vault(T data) %7B%0A%09%09super(null);%0A%09%09base = data;%0A%09%7D%0A%0A%09@Override%0A%09public T getReadable() %7B%0A%09%09if (lockedData == null) %7B%0A%09%09%09lockedData = cloner.deepClone(base);%0A%09%09%7D%0A%09%09%0A%09%09return super.getReadable();%0A%09%7D%0A%09%0A%09/**%0A%09 * Commit the changes %0A%09 */%0A%09public void commit() %7B%0A%09%09if (rwl.isWriteLockedByCurrentThread()) %7B%0A%09%09%09base = cloner.deepClone(lockedData);%0A%09%09%7D%0A%09%09%0A%09%09lockedData = null;%0A%09%7D%0A%09%0A%09/**%0A%09 * Discard the changes%0A%09 */%0A%09public void abort() %7B%0A%09%09lockedData = null;%0A%09%7D%0A%7D%0A

Add concept of a Vault