[java-metadata-aggregator COMMIT] in /trunk: aggregator-parent/doc/RELEASE-NOTES.txt aggregator-pipeline/src/main/jav...
noreply at shibboleth.net
noreply at shibboleth.net
Wed May 28 11:55:25 EDT 2014
Author: iay
Date: Wed May 28 11:55:25 2014
New Revision: 366
URL: http://svn.shibboleth.net/view/java-metadata-aggregator?rev=366&view=rev
Log:
MDA-132: generic conditional execution of stages
Added:
trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/pipeline/AtLeastCollectionPredicate.java (with props)
trunk/aggregator-pipeline/src/test/java/net/shibboleth/metadata/pipeline/AtLeastCollectionPredicateTest.java (with props)
trunk/aggregator-pipeline/src/test/java/net/shibboleth/metadata/pipeline/BaseStageTest.java (with props)
Modified:
trunk/aggregator-parent/doc/RELEASE-NOTES.txt
trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/pipeline/BaseStage.java
trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/pipeline/CompositeStage.java
trunk/aggregator-pipeline/src/test/java/net/shibboleth/metadata/pipeline/CountingStage.java
trunk/aggregator-pipeline/src/test/java/net/shibboleth/metadata/pipeline/SimplePipelineTest.java
Modified: trunk/aggregator-parent/doc/RELEASE-NOTES.txt
URL: http://svn.shibboleth.net/view/java-metadata-aggregator/trunk/aggregator-parent/doc/RELEASE-NOTES.txt?rev=366&r1=365&r2=366&view=diff
==============================================================================
--- trunk/aggregator-parent/doc/RELEASE-NOTES.txt (original)
+++ trunk/aggregator-parent/doc/RELEASE-NOTES.txt Wed May 28 11:55:25 2014
@@ -10,6 +10,18 @@
a much older "endorsed" version. This will affect any configurations
which depended on Xerces or Xalan specific extensions; re-endorse
the implementation of your choice if this is an issue.
+
+ * All provided stages now implement a new collectionPredicate property.
+ This can be set to a Predicate<Collection<Item<T>>> which will be
+ applied to each collection passed to the stage. If the
+ collectionPredicate returns true, the stage is executed as normal; this
+ is the default. If the collectionPredicate returns false, the stage is
+ skipped. This can be used used to perform lightweight conditional
+ operations such as forming an EntitiesDescriptor from a collection only
+ if the collection contains at least two items. The
+ AtLeastCollectionPredicate class has been added to address this specific
+ use case. Conditional evaluation of a series of stages with the same
+ collectionPredicate can be simplified by use of a CompositeStage.
* This release bundles a new version of the Shibboleth spring-extensions
package, which provides a new IdentifiableBeanPostProcessor class.
@@ -40,10 +52,15 @@
* PushDownCacheDurationStage removed
* PushDownValidUntilStage removed
* SetPublicationInfo removed
- * XMLSignatureSigningStage's deriveKeyNames property
+ * XMLSignatureSigningStage's deriveKeyNames property removed
+ * new property collectionPredicate added on all stages
+ * new AtLeastCollectionPredicate class added
** Bug
* [MDA-130] - NPE in DOMResourceStage if resource reading fails
+
+** New Feature
+ * [MDA-132] - generic conditional execution of stages
** Task
* [MDA-122] - remove unimplemented stages and properties
Modified: trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/pipeline/BaseStage.java
URL: http://svn.shibboleth.net/view/java-metadata-aggregator/trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/pipeline/BaseStage.java?rev=366&r1=365&r2=366&view=diff
==============================================================================
--- trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/pipeline/BaseStage.java (original)
+++ trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/pipeline/BaseStage.java Wed May 28 11:55:25 2014
@@ -23,6 +23,9 @@
import javax.annotation.Nonnull;
import javax.annotation.concurrent.ThreadSafe;
+import com.google.common.base.Predicate;
+import com.google.common.base.Predicates;
+
import net.shibboleth.metadata.Item;
import net.shibboleth.metadata.util.ItemMetadataSupport;
import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
@@ -38,6 +41,36 @@
public abstract class BaseStage<T> extends AbstractIdentifiableInitializableComponent implements Stage<T> {
/**
+ * The {@link Predicate} applied to the supplied item collection to determine whether the stage will be executed.
+ * Default value: always <code>true</code>.
+ */
+ @Nonnull
+ private Predicate<Collection<Item<T>>> collectionPredicate = Predicates.alwaysTrue();
+
+ /**
+ * Sets the {@link Predicate} applied to the supplied item collection to determine whether
+ * the stage will be executed.
+ *
+ * @param pred the {@link Predicate} applied to the supplied item collection to determine
+ * whether the stage will be executed
+ */
+ public void setCollectionPredicate(@Nonnull Predicate<Collection<Item<T>>> pred) {
+ collectionPredicate = pred;
+ }
+
+ /**
[... 108 lines stripped ...]
More information about the commits
mailing list