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

noreply at shibboleth.net noreply at shibboleth.net
Wed Dec 28 16:13:39 GMT 2011


Author: lajoie
Date: Wed Dec 28 16:13:39 2011
New Revision: 170

URL: http://svn.shibboleth.net/view/java-metadata-aggregator?rev=170&view=rev
Log:
Remove ItemSelectionStrategy in favor of Predicate

Removed:
    trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/AlwaysItemSelectionStrategy.java
    trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/ItemSelectionStrategy.java
Modified:
    trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/dom/XPathItemSelectionStrategy.java
    trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/pipeline/PipelineDemultiplexerStage.java
    trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/pipeline/SplitMergeStage.java
    trunk/aggregator-pipeline/src/test/java/net/shibboleth/metadata/dom/XPathItemSelectionStrategyTest.java
    trunk/aggregator-pipeline/src/test/java/net/shibboleth/metadata/pipeline/PipelineDemultiplexerStageTest.java
    trunk/aggregator-pipeline/src/test/java/net/shibboleth/metadata/pipeline/SplitMergeStageTest.java

Modified: trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/dom/XPathItemSelectionStrategy.java
URL: http://svn.shibboleth.net/view/java-metadata-aggregator/trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/dom/XPathItemSelectionStrategy.java?rev=170&r1=169&r2=170&view=diff
==============================================================================
--- trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/dom/XPathItemSelectionStrategy.java (original)
+++ trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/dom/XPathItemSelectionStrategy.java Wed Dec 28 16:13:39 2011
@@ -25,16 +25,17 @@
 import javax.xml.xpath.XPathFactory;
 
 import net.jcip.annotations.ThreadSafe;
-import net.shibboleth.metadata.ItemSelectionStrategy;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Predicate;
 
 /**
  * Item selection strategy which selects items on the basis of a boolean XPath expression.
  */
 @ThreadSafe
-public class XPathItemSelectionStrategy implements ItemSelectionStrategy<DomElementItem> {
+public class XPathItemSelectionStrategy implements Predicate<DomElementItem> {
 
     /** Class logger. */
     private final Logger log = LoggerFactory.getLogger(XPathItemSelectionStrategy.class);
@@ -70,7 +71,7 @@
     }
 
     /** {@inheritDoc} */
-    public synchronized boolean isSelectedItem(DomElementItem item) {
+    public synchronized boolean apply(DomElementItem item) {
         try {
             return (Boolean) compiledExpression.evaluate(item.unwrap(), XPathConstants.BOOLEAN);
         } catch (XPathExpressionException e) {

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=170&r1=169&r2=170&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:13:39 2011
@@ -27,18 +27,19 @@
 
 import net.shibboleth.metadata.Item;
 import net.shibboleth.metadata.ItemCollectionFactory;
-import net.shibboleth.metadata.ItemSelectionStrategy;
 import net.shibboleth.metadata.SimpleItemCollectionFactory;
 import net.shibboleth.utilities.java.support.collection.Pair;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Predicate;
 
 /**
  * A stage which, given an item collection and a list of {@link Pipeline} and {@link ItemSelectionStrategy} pairs, sends
  * the collection of item copies selected by the selection strategy to the associated pipeline. This stage is similar to
- * {@link SplitMergeStage} but a given item, or more precisely a copy of it, may end up going to more than one
- * pipeline (or no pipeline).
+ * {@link SplitMergeStage} but a given item, or more precisely a copy of it, may end up going to more than one pipeline
+ * (or no pipeline).
  * 
  * <p>
  * This stage requires the following properties be set prior to initialization:
@@ -51,7 +52,7 @@
  * threads.
  * 
  * If no {@link ItemCollectionFactory} is given, then {@link SimpleItemCollectionFactory} is used.
-
+ * 
  * @param <ItemType> type of items upon which this stage operates
  */
 public class PipelineDemultiplexerStage<ItemType extends Item<?>> extends BaseStage<ItemType> {
@@ -69,7 +70,7 @@
     private ItemCollectionFactory<ItemType> collectionFactory;
 
     /** The pipelines through which items are sent and the selection strategy used for that pipeline. */
-    private List<Pair<Pipeline<ItemType>, ItemSelectionStrategy<ItemType>>> pipelineAndStrategies;
+    private List<Pair<Pipeline<ItemType>, Predicate<ItemType>>> pipelineAndStrategies;
 
     /**

[... 389 lines stripped ...]


More information about the commits mailing list