From 8809341248c62b15b78d7e6d8e06ab2ec3793c8e Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Wed, 28 Mar 2007 22:00:24 +0000 Subject: Merged 1.2-dev to trunk. --- .../java/com/amazon/carbonado/repo/logging/LoggingRepository.java | 8 ++++---- .../java/com/amazon/carbonado/repo/logging/LoggingStorage.java | 8 ++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'src/main/java/com/amazon/carbonado/repo/logging') diff --git a/src/main/java/com/amazon/carbonado/repo/logging/LoggingRepository.java b/src/main/java/com/amazon/carbonado/repo/logging/LoggingRepository.java index 611df4f..89e6e21 100644 --- a/src/main/java/com/amazon/carbonado/repo/logging/LoggingRepository.java +++ b/src/main/java/com/amazon/carbonado/repo/logging/LoggingRepository.java @@ -31,7 +31,7 @@ import com.amazon.carbonado.TriggerFactory; import com.amazon.carbonado.capability.Capability; -import com.amazon.carbonado.spi.StorageCollection; +import com.amazon.carbonado.spi.StoragePool; /** * @@ -44,7 +44,7 @@ class LoggingRepository implements Repository, LogAccessCapability { private final Repository mRepo; private final Log mLog; - private final StorageCollection mStorages; + private final StoragePool mStoragePool; LoggingRepository(AtomicReference rootRef, Iterable triggerFactories, @@ -55,7 +55,7 @@ class LoggingRepository implements Repository, LogAccessCapability { mRepo = actual; mLog = log; - mStorages = new StorageCollection() { + mStoragePool = new StoragePool() { protected Storage createStorage(Class type) throws RepositoryException { @@ -71,7 +71,7 @@ class LoggingRepository implements Repository, LogAccessCapability { public Storage storageFor(Class type) throws SupportException, RepositoryException { - return mStorages.storageFor(type); + return mStoragePool.get(type); } public Transaction enterTransaction() { diff --git a/src/main/java/com/amazon/carbonado/repo/logging/LoggingStorage.java b/src/main/java/com/amazon/carbonado/repo/logging/LoggingStorage.java index 3f807c2..de1118f 100644 --- a/src/main/java/com/amazon/carbonado/repo/logging/LoggingStorage.java +++ b/src/main/java/com/amazon/carbonado/repo/logging/LoggingStorage.java @@ -41,6 +41,14 @@ class LoggingStorage extends WrappedStorage { mRepo = repo; } + public void truncate() throws PersistException { + Log log = mRepo.getLog(); + if (log.isEnabled()) { + log.write("Storage.truncate() on " + getStorableType().getClass()); + } + super.truncate(); + } + protected S wrap(S storable) { return super.wrap(storable); } -- cgit v1.2.3