From ebc282a22ddc2cb97bc1af4fe3fa0fedc290fe1b Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Fri, 6 Oct 2006 02:52:03 +0000 Subject: Removed RepositoryReference class. --- .../java/com/amazon/carbonado/repo/indexed/IndexedRepository.java | 7 ++++--- .../amazon/carbonado/repo/indexed/IndexedRepositoryBuilder.java | 4 +++- src/main/java/com/amazon/carbonado/repo/jdbc/JDBCRepository.java | 7 ++++--- .../java/com/amazon/carbonado/repo/jdbc/JDBCRepositoryBuilder.java | 5 ++++- .../java/com/amazon/carbonado/repo/logging/LoggingRepository.java | 7 ++++--- .../amazon/carbonado/repo/logging/LoggingRepositoryBuilder.java | 4 +++- .../carbonado/repo/replicated/ReplicatedRepositoryBuilder.java | 4 +++- 7 files changed, 25 insertions(+), 13 deletions(-) (limited to 'src/main/java/com/amazon/carbonado/repo') diff --git a/src/main/java/com/amazon/carbonado/repo/indexed/IndexedRepository.java b/src/main/java/com/amazon/carbonado/repo/indexed/IndexedRepository.java index 4d6e371..59a359b 100644 --- a/src/main/java/com/amazon/carbonado/repo/indexed/IndexedRepository.java +++ b/src/main/java/com/amazon/carbonado/repo/indexed/IndexedRepository.java @@ -23,11 +23,12 @@ import java.util.Arrays; import java.util.Map; import java.util.IdentityHashMap; +import java.util.concurrent.atomic.AtomicReference; + import com.amazon.carbonado.Cursor; import com.amazon.carbonado.IsolationLevel; import com.amazon.carbonado.MalformedTypeException; import com.amazon.carbonado.Repository; -import static com.amazon.carbonado.RepositoryBuilder.RepositoryReference; import com.amazon.carbonado.RepositoryException; import com.amazon.carbonado.Storable; import com.amazon.carbonado.Storage; @@ -56,12 +57,12 @@ class IndexedRepository implements Repository, StorableInfoCapability, IndexEntryAccessCapability { - private final RepositoryReference mRootRef; + private final AtomicReference mRootRef; private final Repository mRepository; private final String mName; private final Map, IndexedStorage> mStorages; - IndexedRepository(RepositoryReference rootRef, String name, Repository repository) { + IndexedRepository(AtomicReference rootRef, String name, Repository repository) { mRootRef = rootRef; mRepository = repository; mName = name; diff --git a/src/main/java/com/amazon/carbonado/repo/indexed/IndexedRepositoryBuilder.java b/src/main/java/com/amazon/carbonado/repo/indexed/IndexedRepositoryBuilder.java index f3ec04b..a1aa45e 100644 --- a/src/main/java/com/amazon/carbonado/repo/indexed/IndexedRepositoryBuilder.java +++ b/src/main/java/com/amazon/carbonado/repo/indexed/IndexedRepositoryBuilder.java @@ -20,6 +20,8 @@ package com.amazon.carbonado.repo.indexed; import java.util.Collection; +import java.util.concurrent.atomic.AtomicReference; + import com.amazon.carbonado.ConfigurationException; import com.amazon.carbonado.Repository; import com.amazon.carbonado.RepositoryBuilder; @@ -48,7 +50,7 @@ public class IndexedRepositoryBuilder extends AbstractRepositoryBuilder { public IndexedRepositoryBuilder() { } - public Repository build(RepositoryReference rootRef) throws RepositoryException { + public Repository build(AtomicReference rootRef) throws RepositoryException { assertReady(); Repository wrapped; diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCRepository.java b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCRepository.java index 97be915..bcdd0c4 100644 --- a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCRepository.java +++ b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCRepository.java @@ -24,6 +24,8 @@ import java.sql.SQLException; import java.util.Map; import java.util.IdentityHashMap; +import java.util.concurrent.atomic.AtomicReference; + import javax.sql.DataSource; import org.apache.commons.logging.Log; @@ -39,7 +41,6 @@ import com.amazon.carbonado.SupportException; import com.amazon.carbonado.MalformedTypeException; import com.amazon.carbonado.PersistException; import com.amazon.carbonado.Repository; -import static com.amazon.carbonado.RepositoryBuilder.RepositoryReference; import com.amazon.carbonado.RepositoryException; import com.amazon.carbonado.Transaction; import com.amazon.carbonado.UnsupportedTypeException; @@ -134,7 +135,7 @@ public class JDBCRepository private final String mName; final boolean mIsMaster; - private final RepositoryReference mRootRef; + private final AtomicReference mRootRef; private final String mDatabaseProductName; private final DataSource mDataSource; private final String mCatalog; @@ -176,7 +177,7 @@ public class JDBCRepository * database independent */ @SuppressWarnings("unchecked") - JDBCRepository(RepositoryReference rootRef, + JDBCRepository(AtomicReference rootRef, String name, boolean isMaster, DataSource dataSource, String catalog, String schema) throws RepositoryException diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCRepositoryBuilder.java b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCRepositoryBuilder.java index 507d70a..3a797e8 100644 --- a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCRepositoryBuilder.java +++ b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCRepositoryBuilder.java @@ -21,9 +21,12 @@ package com.amazon.carbonado.repo.jdbc; import java.sql.SQLException; import java.util.Collection; +import java.util.concurrent.atomic.AtomicReference; + import javax.sql.DataSource; import com.amazon.carbonado.ConfigurationException; +import com.amazon.carbonado.Repository; import com.amazon.carbonado.RepositoryException; import com.amazon.carbonado.spi.AbstractRepositoryBuilder; @@ -66,7 +69,7 @@ public class JDBCRepositoryBuilder extends AbstractRepositoryBuilder { public JDBCRepositoryBuilder() { } - public JDBCRepository build(RepositoryReference rootRef) throws RepositoryException { + public JDBCRepository build(AtomicReference rootRef) throws RepositoryException { assertReady(); JDBCRepository repo = new JDBCRepository (rootRef, getName(), isMaster(), getDataSource(), mCatalog, mSchema); 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 e44e3b7..3f17d17 100644 --- a/src/main/java/com/amazon/carbonado/repo/logging/LoggingRepository.java +++ b/src/main/java/com/amazon/carbonado/repo/logging/LoggingRepository.java @@ -21,9 +21,10 @@ package com.amazon.carbonado.repo.logging; import java.util.IdentityHashMap; import java.util.Map; +import java.util.concurrent.atomic.AtomicReference; + import com.amazon.carbonado.IsolationLevel; import com.amazon.carbonado.Repository; -import static com.amazon.carbonado.RepositoryBuilder.RepositoryReference; import com.amazon.carbonado.RepositoryException; import com.amazon.carbonado.Storable; import com.amazon.carbonado.Storage; @@ -38,14 +39,14 @@ import com.amazon.carbonado.capability.Capability; * @author Brian S O'Neill */ class LoggingRepository implements Repository, LogAccessCapability { - private final RepositoryReference mRootRef; + private final AtomicReference mRootRef; private final Repository mRepo; private final Log mLog; // Map of storages by storable class private final Map, LoggingStorage> mStorages; - LoggingRepository(RepositoryReference rootRef, Repository actual, Log log) { + LoggingRepository(AtomicReference rootRef, Repository actual, Log log) { mRootRef = rootRef; mRepo = actual; mLog = log; diff --git a/src/main/java/com/amazon/carbonado/repo/logging/LoggingRepositoryBuilder.java b/src/main/java/com/amazon/carbonado/repo/logging/LoggingRepositoryBuilder.java index 5f06cd5..956c947 100644 --- a/src/main/java/com/amazon/carbonado/repo/logging/LoggingRepositoryBuilder.java +++ b/src/main/java/com/amazon/carbonado/repo/logging/LoggingRepositoryBuilder.java @@ -20,6 +20,8 @@ package com.amazon.carbonado.repo.logging; import java.util.Collection; +import java.util.concurrent.atomic.AtomicReference; + import com.amazon.carbonado.ConfigurationException; import com.amazon.carbonado.Repository; import com.amazon.carbonado.RepositoryBuilder; @@ -56,7 +58,7 @@ public class LoggingRepositoryBuilder extends AbstractRepositoryBuilder { public LoggingRepositoryBuilder() { } - public Repository build(RepositoryReference rootRef) throws RepositoryException { + public Repository build(AtomicReference rootRef) throws RepositoryException { if (mName == null) { if (mRepoBuilder != null) { mName = mRepoBuilder.getName(); diff --git a/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepositoryBuilder.java b/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepositoryBuilder.java index 8d5cc75..2a09c19 100644 --- a/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepositoryBuilder.java +++ b/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepositoryBuilder.java @@ -19,6 +19,8 @@ package com.amazon.carbonado.repo.replicated; import java.util.Collection; +import java.util.concurrent.atomic.AtomicReference; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -53,7 +55,7 @@ public class ReplicatedRepositoryBuilder extends AbstractRepositoryBuilder { public ReplicatedRepositoryBuilder() { } - public Repository build(RepositoryReference rootRef) throws RepositoryException { + public Repository build(AtomicReference rootRef) throws RepositoryException { assertReady(); Repository replica, master; -- cgit v1.2.3