[java-opensaml COMMIT] in /trunk/opensaml-saml-impl/src: main/java/org/opensaml/saml/metadata/resolver/index/impl/End...
noreply at shibboleth.net
noreply at shibboleth.net
Wed Oct 5 20:21:07 EDT 2016
Author: putmanb
Date: Wed Oct 5 20:21:06 2016
New Revision: 4517
URL: http://svn.shibboleth.net/view/java-opensaml?rev=4517&view=rev
Log:
Work on OSJ-129: Create metadata index impl for endpoints
Refactor to use predicate for indexed endpoint selection.
Add c14n of the indexed location value to the index key impl.
Unit tests of key, default predicate, and entity descriptor indexing.
Added:
trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/metadata/resolver/index/impl/EndpointMetadataIndexTest.java (with props)
Modified:
trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/index/impl/EndpointMetadataIndex.java
Modified: trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/index/impl/EndpointMetadataIndex.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/index/impl/EndpointMetadataIndex.java?rev=4517&r1=4516&r2=4517&view=diff
==============================================================================
--- trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/index/impl/EndpointMetadataIndex.java (original)
+++ trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/index/impl/EndpointMetadataIndex.java Wed Oct 5 20:21:06 2016
@@ -17,8 +17,8 @@
package org.opensaml.saml.metadata.resolver.index.impl;
+import java.net.MalformedURLException;
import java.util.Collections;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Objects;
@@ -27,14 +27,6 @@
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.xml.namespace.QName;
-
-import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
-import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
-import net.shibboleth.utilities.java.support.annotation.constraint.NotLive;
-import net.shibboleth.utilities.java.support.annotation.constraint.Unmodifiable;
-import net.shibboleth.utilities.java.support.logic.Constraint;
-import net.shibboleth.utilities.java.support.primitive.StringSupport;
-import net.shibboleth.utilities.java.support.resolver.CriteriaSet;
import org.opensaml.saml.metadata.resolver.index.MetadataIndex;
import org.opensaml.saml.metadata.resolver.index.MetadataIndexKey;
@@ -45,6 +37,18 @@
import org.slf4j.LoggerFactory;
import com.google.common.base.MoreObjects;
+import com.google.common.base.Predicate;
+import com.google.common.base.Predicates;
+
+import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
+import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
+import net.shibboleth.utilities.java.support.annotation.constraint.NotLive;
+import net.shibboleth.utilities.java.support.annotation.constraint.Unmodifiable;
+import net.shibboleth.utilities.java.support.logic.Constraint;
+import net.shibboleth.utilities.java.support.net.SimpleURLCanonicalizer;
+import net.shibboleth.utilities.java.support.net.URLBuilder;
+import net.shibboleth.utilities.java.support.primitive.StringSupport;
+import net.shibboleth.utilities.java.support.resolver.CriteriaSet;
/**
* An implementation of {@link MetadataIndex} which indexes entities by their role endpoint locations.
@@ -60,27 +64,28 @@
/** Logger. */
private Logger log = LoggerFactory.getLogger(EndpointMetadataIndex.class);
- /** The indexable endpoint types. */
- private Map<QName, Set<QName>> endpointTypes;
+ /** The predicate which selects which endpoints to index. */
+ private Predicate<Endpoint> endpointSelectionPredicate;
/**
* Constructor.
*
* <p>
- * All endpoints in all roles will be indexed.
+ * All entity descriptor endpoints will be indexed.
* </p>
*/
public EndpointMetadataIndex() {
- endpointTypes = Collections.emptyMap();
+ endpointSelectionPredicate = Predicates.alwaysTrue();
}
/**
* Constructor.
*
- * @param indexableTypes the map of indexable endpoint types, keyed by role descriptor type
+ * @param endpointPredicate the predicate which selects which endpoints to index
*/
- public EndpointMetadataIndex(Map<QName, Set<QName>> indexableTypes) {
- endpointTypes = new HashMap<>(Constraint.isNotNull(indexableTypes, "Map of indexable types may not be null"));
+ public EndpointMetadataIndex(Predicate<Endpoint> endpointPredicate) {
+ endpointSelectionPredicate = Constraint.isNotNull(endpointPredicate,
+ "Endpoint selection predicate may not be null");
}
/** {@inheritDoc} */
@@ -93,21 +98,23 @@
if (roleType == null) {
roleType = role.getElementQName();
}
+
for (Endpoint endpoint : role.getEndpoints()) {
QName endpointType = endpoint.getSchemaType();
if (endpointType == null) {
endpointType = endpoint.getElementQName();
}
[... 223 lines stripped ...]
More information about the commits
mailing list