[java-metadata-aggregator COMMIT] in /trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata: ItemCollection...

noreply at shibboleth.net noreply at shibboleth.net
Wed Dec 28 16:19:15 GMT 2011


Author: lajoie
Date: Wed Dec 28 16:19:15 2011
New Revision: 171

URL: http://svn.shibboleth.net/view/java-metadata-aggregator?rev=171&view=rev
Log:
Remove ItemCollectionFactory in favor of Supplier

Removed:
    trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/ItemCollectionFactory.java
Modified:
    trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/SimpleItemCollectionFactory.java
    trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/pipeline/PipelineDemultiplexerStage.java
    trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/pipeline/PipelineMergeStage.java
    trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/pipeline/SplitMergeStage.java

Modified: trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/SimpleItemCollectionFactory.java
URL: http://svn.shibboleth.net/view/java-metadata-aggregator/trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/SimpleItemCollectionFactory.java?rev=171&r1=170&r2=171&view=diff
==============================================================================
--- trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/SimpleItemCollectionFactory.java (original)
+++ trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/SimpleItemCollectionFactory.java Wed Dec 28 16:19:15 2011
@@ -20,15 +20,17 @@
 import java.util.ArrayList;
 import java.util.Collection;
 
+import com.google.common.base.Supplier;
+
 /**
  * Implementation {@link net.shibboleth.metadata.ItemCollectionFactory} that produces {@link ArrayList} instances.
  * 
  * @param <ItemType> the type of items the produced collection will contain
  */
-public class SimpleItemCollectionFactory<ItemType extends Item> implements ItemCollectionFactory<ItemType> {
+public class SimpleItemCollectionFactory<ItemType extends Item> implements Supplier<Collection<ItemType>> {
 
     /** {@inheritDoc} */
-    public Collection<ItemType> newCollection() {
+    public Collection<ItemType> get() {
         return new ArrayList<ItemType>();
     }
 }

Modified: trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/pipeline/PipelineDemultiplexerStage.java
URL: http://svn.shibboleth.net/view/java-metadata-aggregator/trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/pipeline/PipelineDemultiplexerStage.java?rev=171&r1=170&r2=171&view=diff
==============================================================================
--- trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/pipeline/PipelineDemultiplexerStage.java (original)
+++ trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/pipeline/PipelineDemultiplexerStage.java Wed Dec 28 16:19:15 2011
@@ -26,7 +26,6 @@
 import java.util.concurrent.Future;
 
 import net.shibboleth.metadata.Item;
-import net.shibboleth.metadata.ItemCollectionFactory;
 import net.shibboleth.metadata.SimpleItemCollectionFactory;
 import net.shibboleth.utilities.java.support.collection.Pair;
 
@@ -34,6 +33,7 @@
 import org.slf4j.LoggerFactory;
 
 import com.google.common.base.Predicate;
+import com.google.common.base.Supplier;
 
 /**
  * A stage which, given an item collection and a list of {@link Pipeline} and {@link ItemSelectionStrategy} pairs, sends
@@ -67,7 +67,7 @@
     private boolean waitingForPipelines;
 
     /** Factory used to create the Item collection that is then given to the pipelines. */
-    private ItemCollectionFactory<ItemType> collectionFactory;
+    private Supplier<Collection<ItemType>> collectionFactory;
 
     /** The pipelines through which items are sent and the selection strategy used for that pipeline. */
     private List<Pair<Pipeline<ItemType>, Predicate<ItemType>>> pipelineAndStrategies;
@@ -121,7 +121,7 @@
      * 
      * @return factory used to create the Item collection that is then given to the pipelines
      */
-    public ItemCollectionFactory getCollectionFactory() {
+    public Supplier<Collection<ItemType>> getCollectionFactory() {
         return collectionFactory;
     }
 
@@ -130,7 +130,7 @@
      * 
      * @param factory factory used to create the Item collection that is then given to the pipelines
      */
-    public synchronized void setCollectionFactory(ItemCollectionFactory<ItemType> factory) {
+    public synchronized void setCollectionFactory(Supplier<Collection<ItemType>> factory) {
         if (isInitialized()) {
             return;
         }
@@ -171,7 +171,7 @@
         for (Pair<Pipeline<ItemType>, Predicate<ItemType>> pipelineAndStrategy : pipelineAndStrategies) {
             pipeline = pipelineAndStrategy.getFirst();
             selectionStrategy = pipelineAndStrategy.getSecond();
-            selectedItems = collectionFactory.newCollection();
+            selectedItems = collectionFactory.get();
 
             for (ItemType item : itemCollection) {
                 if (selectionStrategy.apply(item)) {

Modified: trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/pipeline/PipelineMergeStage.java

[... 146 lines stripped ...]


More information about the commits mailing list