diff options
author | Brian S. O'Neill <bronee@gmail.com> | 2006-10-08 01:26:37 +0000 |
---|---|---|
committer | Brian S. O'Neill <bronee@gmail.com> | 2006-10-08 01:26:37 +0000 |
commit | 81475fd493bcc3d5fe750b54ce8d8fa9fb812c9c (patch) | |
tree | 239c821b3947939ba4401744b1d75c53ce82ec3e /src/main/java/com/amazon/carbonado/spi | |
parent | 6dd20a4b23592c0a9a6be23a2123fef410981a2e (diff) |
Finished support for trigger factories
Diffstat (limited to 'src/main/java/com/amazon/carbonado/spi')
6 files changed, 14 insertions, 21 deletions
diff --git a/src/main/java/com/amazon/carbonado/spi/AbstractRepositoryBuilder.java b/src/main/java/com/amazon/carbonado/spi/AbstractRepositoryBuilder.java index d74c70a..ed4eaf3 100644 --- a/src/main/java/com/amazon/carbonado/spi/AbstractRepositoryBuilder.java +++ b/src/main/java/com/amazon/carbonado/spi/AbstractRepositoryBuilder.java @@ -21,6 +21,7 @@ package com.amazon.carbonado.spi; import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
@@ -39,10 +40,10 @@ import com.amazon.carbonado.TriggerFactory; * @author Brian S O'Neill
*/
public abstract class AbstractRepositoryBuilder implements RepositoryBuilder {
- private final List<TriggerFactory> mTriggerFactories;
+ private final Collection<TriggerFactory> mTriggerFactories;
protected AbstractRepositoryBuilder() {
- mTriggerFactories = new ArrayList<TriggerFactory>(2);
+ mTriggerFactories = new LinkedHashSet<TriggerFactory>(2);
}
public Repository build() throws ConfigurationException, RepositoryException {
@@ -53,6 +54,14 @@ public abstract class AbstractRepositoryBuilder implements RepositoryBuilder { mTriggerFactories.add(factory);
}
+ public Iterable<TriggerFactory> getTriggerFactories() {
+ if (mTriggerFactories == null || mTriggerFactories.size() == 0) {
+ return Collections.emptyList();
+ } else {
+ return new ArrayList<TriggerFactory>(mTriggerFactories);
+ }
+ }
+
/**
* Throw a configuration exception if the configuration is not filled out
* sufficiently and correctly such that a repository could be instantiated
@@ -91,15 +100,4 @@ public abstract class AbstractRepositoryBuilder implements RepositoryBuilder { messages.add("name missing");
}
}
-
- /**
- * Returns all the TriggerFactories which were added.
- */
- protected Iterable<TriggerFactory> getTriggerFactories() {
- if (mTriggerFactories == null || mTriggerFactories.size() == 0) {
- return Collections.emptyList();
- } else {
- return new ArrayList<TriggerFactory>(mTriggerFactories);
- }
- }
}
diff --git a/src/main/java/com/amazon/carbonado/spi/CommonMethodNames.java b/src/main/java/com/amazon/carbonado/spi/CommonMethodNames.java index c79e502..8a011c9 100644 --- a/src/main/java/com/amazon/carbonado/spi/CommonMethodNames.java +++ b/src/main/java/com/amazon/carbonado/spi/CommonMethodNames.java @@ -83,6 +83,5 @@ public class CommonMethodNames { EXIT_METHOD_NAME = "exit";
/** WrappedStorage.Support API method name */
- @Deprecated
public static final String CREATE_WRAPPED_SUPPORT_METHOD_NAME = "createSupport";
}
diff --git a/src/main/java/com/amazon/carbonado/spi/StorableGenerator.java b/src/main/java/com/amazon/carbonado/spi/StorableGenerator.java index f69d4dd..ecd344d 100644 --- a/src/main/java/com/amazon/carbonado/spi/StorableGenerator.java +++ b/src/main/java/com/amazon/carbonado/spi/StorableGenerator.java @@ -357,7 +357,6 @@ public final class StorableGenerator<S extends Storable> { * @throws IllegalArgumentException if type is null
*/
@SuppressWarnings("unchecked")
- @Deprecated
public static <S extends Storable> Class<? extends S> getWrappedClass(Class<S> type)
throws IllegalArgumentException
{
diff --git a/src/main/java/com/amazon/carbonado/spi/WrappedQuery.java b/src/main/java/com/amazon/carbonado/spi/WrappedQuery.java index 531f38f..ec3ae34 100644 --- a/src/main/java/com/amazon/carbonado/spi/WrappedQuery.java +++ b/src/main/java/com/amazon/carbonado/spi/WrappedQuery.java @@ -36,7 +36,6 @@ import com.amazon.carbonado.filter.FilterValues; * @author Don Schneider
* @author Brian S O'Neill
*/
-@Deprecated
public abstract class WrappedQuery<S extends Storable> implements Query<S> {
// The query to which this query will delegate
diff --git a/src/main/java/com/amazon/carbonado/spi/WrappedStorage.java b/src/main/java/com/amazon/carbonado/spi/WrappedStorage.java index 629cb53..1cefc73 100644 --- a/src/main/java/com/amazon/carbonado/spi/WrappedStorage.java +++ b/src/main/java/com/amazon/carbonado/spi/WrappedStorage.java @@ -25,6 +25,7 @@ import com.amazon.carbonado.Repository; import com.amazon.carbonado.Storable;
import com.amazon.carbonado.Storage;
import com.amazon.carbonado.Trigger;
+import com.amazon.carbonado.TriggerFactory;
import com.amazon.carbonado.filter.Filter;
import com.amazon.carbonado.filter.FilterValues;
@@ -39,7 +40,6 @@ import com.amazon.carbonado.util.QuickConstructorGenerator; *
* @author Brian S O'Neill
*/
-@Deprecated
public abstract class WrappedStorage<S extends Storable> implements Storage<S> {
private final Storage<S> mStorage;
private final WrappedStorableFactory<S> mFactory;
@@ -48,14 +48,13 @@ public abstract class WrappedStorage<S extends Storable> implements Storage<S> { /**
* @param storage storage to wrap
*/
- public WrappedStorage(Storage<S> storage) {
+ public WrappedStorage(Storage<S> storage, Iterable<TriggerFactory> triggerFactories) {
mStorage = storage;
Class<? extends S> wrappedClass = StorableGenerator
.getWrappedClass(storage.getStorableType());
mFactory = QuickConstructorGenerator
.getInstance(wrappedClass, WrappedStorableFactory.class);
- // FIXME: wrong, just deprecate this class
- mTriggerManager = new TriggerManager<S>(null, null);
+ mTriggerManager = new TriggerManager<S>(storage.getStorableType(), triggerFactories);
}
public Class<S> getStorableType() {
diff --git a/src/main/java/com/amazon/carbonado/spi/WrappedSupport.java b/src/main/java/com/amazon/carbonado/spi/WrappedSupport.java index fa57c60..24e2c02 100644 --- a/src/main/java/com/amazon/carbonado/spi/WrappedSupport.java +++ b/src/main/java/com/amazon/carbonado/spi/WrappedSupport.java @@ -27,7 +27,6 @@ import com.amazon.carbonado.Storable; *
* @author Brian S O'Neill
*/
-@Deprecated
public interface WrappedSupport<S extends Storable> extends TriggerSupport<S> {
/**
* @see Storable#load
|