Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Track upstream changes
See #2.

This batch of changes establishes a development line running against the
upcoming 0.10 release of the upstream product.
  • Loading branch information
iay committed Aug 27, 2020
1 parent 27eff23 commit 15f1b98
Showing 24 changed files with 84 additions and 147 deletions.
2 changes: 1 addition & 1 deletion .classpath
@@ -29,7 +29,7 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
10 changes: 6 additions & 4 deletions .settings/org.eclipse.jdt.core.prefs
@@ -11,9 +11,9 @@ org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@@ -25,6 +25,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
@@ -51,6 +52,7 @@ org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
@@ -73,8 +75,8 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=di
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=11
org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
28 changes: 19 additions & 9 deletions pom.xml
@@ -5,8 +5,8 @@

<parent>
<groupId>net.shibboleth</groupId>
<artifactId>parent-v3</artifactId>
<version>10</version>
<artifactId>parent</artifactId>
<version>11.1.0-SNAPSHOT</version>
</parent>

<groupId>uk.org.iay.incommon</groupId>
@@ -21,10 +21,10 @@
<inceptionYear>2017</inceptionYear>

<properties>
<mda.version>0.9.2</mda.version>
<ukf-mda.version>0.9.4</ukf-mda.version>
<java-support.version>7.2.0</java-support.version>
<spring-extensions.version>5.2.0</spring-extensions.version>
<mda.version>0.10.0-SNAPSHOT</mda.version>
<ukf-mda.version>0.10.0-SNAPSHOT</ukf-mda.version>
<java-support.version>8.0.0</java-support.version>
<spring-extensions.version>6.0.0</spring-extensions.version>
<checkstyle.version>7.6</checkstyle.version>
</properties>

@@ -64,9 +64,9 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>uk.org.ukfederation</groupId>
<artifactId>ukf-mda</artifactId>
<version>${ukf-mda.version}</version>
<groupId>net.shibboleth.metadata</groupId>
<artifactId>aggregator-pipeline</artifactId>
<version>${mda.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
@@ -90,6 +90,16 @@
<artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>

<!-- Managed Dependencies -->

@@ -15,7 +15,6 @@
package uk.org.iay.incommon.mda.dom.saml;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

@@ -28,8 +27,8 @@

import net.shibboleth.metadata.Item;
import net.shibboleth.metadata.ItemId;
import net.shibboleth.metadata.dom.saml.EntitiesDescriptorAssemblerStage.ItemOrderingStrategy;
import net.shibboleth.metadata.dom.saml.mdrpi.RegistrationAuthority;
import net.shibboleth.metadata.pipeline.ItemOrderingStrategy;
import net.shibboleth.metadata.pipeline.StageProcessingException;
import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;

@@ -43,24 +42,29 @@
*
* The registrar and entityID values used for ordering are required to be
* present in the item's item metadata.
*
* @param <T> type of item to be handled
*/
@ThreadSafe
public class InCommonEntityOrderingStrategy implements ItemOrderingStrategy {
public class InCommonEntityOrderingStrategy<T> implements ItemOrderingStrategy<T> {

/** Class logger. */
private final Logger log = LoggerFactory.getLogger(InCommonEntityOrderingStrategy.class);

/** The registrar whose entities should always appear first, in the provided order. */

private final String distinguishedRegistrar;

/**
* Helper class which wraps an {@link Element} {@link Item} but extracts any
* Helper class which wraps an {@link Item} but extracts any
* associated {@link RegistrationAuthority} and {@link ItemId} for simpler comparisons.
*
* @param <T> type of item to be handled
*/
private static class OrderableItem implements Comparable<OrderableItem> {
private static class OrderableItem<T> implements Comparable<OrderableItem> {

/** The wrapped {@link Element} {@link Item}. */
private final Item<Element> item;
private final Item<T> item;

/** The registrar for this entity. */
private final String registrar;
@@ -75,7 +79,7 @@ private static class OrderableItem implements Comparable<OrderableItem> {
* @param reg the registrar for this entity
* @param entity the entityID for this entity
*/
public OrderableItem(@Nonnull final Item<Element> domItem,
public OrderableItem(@Nonnull final Item<T> domItem,
@Nonnull final String reg, @Nonnull final String entity) {
item = domItem;
registrar = reg;
@@ -99,7 +103,7 @@ public int compareTo(@Nonnull final OrderableItem o) {
*
* @return the wrapped {@link Element} {@link Item}.
*/
public Item<Element> unwrap() {
public Item<T> unwrap() {
return item;
}
}
@@ -114,20 +118,20 @@ public InCommonEntityOrderingStrategy(@Nonnull final String registrar) {
}

@Override
public List<Item<Element>> order(@Nonnull @NonnullElements final Collection<Item<Element>> items) {
public List<Item<T>> order(@Nonnull @NonnullElements final List<Item<T>> items) {

// Collect the results here
final List<Item<Element>> results = new ArrayList<>(items.size());
final List<Item<T>> results = new ArrayList<>(items.size());

/*
* Construct an orderable list wrapping the original items.
*
* Any belonging to the distinguished registrar are instead put straight in the
* results list.
*/
final List<OrderableItem> orderableList = new ArrayList<>(items.size());
final List<OrderableItem<T>> orderableList = new ArrayList<>(items.size());
try {
for (Item<Element> item : items) {
for (final Item<T> item : items) {
final List<RegistrationAuthority> registrars = item.getItemMetadata().get(RegistrationAuthority.class);
final String registrar;
if (registrars.size() == 0) {
@@ -150,7 +154,7 @@ public List<Item<Element>> order(@Nonnull @NonnullElements final Collection<Item

orderableList.add(new OrderableItem(item, registrar, entityID));
}
} catch (StageProcessingException e) {
} catch (final StageProcessingException e) {
/*
* If the ordering operation fails because we can't create an OrderableItem
* for each original item, it's probably because we are missing some item
@@ -169,7 +173,7 @@ public List<Item<Element>> order(@Nonnull @NonnullElements final Collection<Item
Collections.sort(orderableList);

// Add the ordered results into the results collection
for (OrderableItem result : orderableList) {
for (final OrderableItem result : orderableList) {
results.add(result.unwrap());
}

@@ -20,7 +20,10 @@

import org.w3c.dom.Element;

import net.shibboleth.metadata.Item;
import net.shibboleth.metadata.dom.AbstractDOMValidationStage;
import net.shibboleth.metadata.dom.DOMTraversalContext;
import net.shibboleth.metadata.dom.SimpleDOMTraversalContext;
import net.shibboleth.metadata.pipeline.StageProcessingException;
import net.shibboleth.metadata.validate.Validator;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
@@ -35,7 +38,7 @@
* A separate collection of validators is used for the case of the <code>regexp</code>
* attribute being <code>true</code> and <code>false</code>.
*/
public class ScopeValidationStage extends AbstractDOMValidationStage<String> {
public class ScopeValidationStage extends AbstractDOMValidationStage<String, DOMTraversalContext> {

/** The sequence of validators to apply to <code>regexp</code> scopes. */
@Nonnull
@@ -61,12 +64,17 @@ public List<Validator<String>> getRegexpValidators() {
}

@Override
protected boolean applicable(@Nonnull final Element element) {
protected DOMTraversalContext buildContext(@Nonnull final Item<Element> item) {
return new SimpleDOMTraversalContext(item);
}

@Override
protected boolean applicable(@Nonnull final Element element, @Nonnull final DOMTraversalContext context) {
return ElementSupport.isElementNamed(element, ShibbolethMetadataSupport.SCOPE_NAME);
}

@Override
protected void visit(@Nonnull final Element element, @Nonnull final TraversalContext context)
protected void visit(@Nonnull final Element element, @Nonnull final DOMTraversalContext context)
throws StageProcessingException {
final String text = element.getTextContent();
final Boolean isRegexp = AttributeSupport.getAttributeValueAsBoolean(
@@ -20,6 +20,7 @@

import net.shibboleth.metadata.Item;
import net.shibboleth.metadata.pipeline.StageProcessingException;
import net.shibboleth.metadata.validate.BaseValidator;
import net.shibboleth.metadata.validate.Validator;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;

@@ -47,7 +48,7 @@
* @param <V> type of the original value
* @param <A> type of the new value to which validators should be applied
*/
public abstract class BaseAsValidator<V, A> extends BaseLocalValidator implements Validator<V> {
public abstract class BaseAsValidator<V, A> extends BaseValidator implements Validator<V> {

/** The validator sequence to apply. */
@Nonnull

This file was deleted.

@@ -17,6 +17,7 @@
import javax.annotation.Nonnull;

import net.shibboleth.metadata.Item;
import net.shibboleth.metadata.validate.BaseValidator;
import net.shibboleth.metadata.validate.Validator;

/**
@@ -29,7 +30,7 @@
*
* @param <V> type of the object to be validated
*/
public class RejectAllValidator<V> extends BaseLocalValidator implements Validator<V> {
public class RejectAllValidator<V> extends BaseValidator implements Validator<V> {

@Override
public Action validate(@Nonnull final V e, @Nonnull final Item<?> item, @Nonnull final String stageId) {
@@ -25,6 +25,7 @@

import net.shibboleth.metadata.Item;
import net.shibboleth.metadata.pipeline.StageProcessingException;
import net.shibboleth.metadata.validate.BaseValidator;
import net.shibboleth.metadata.validate.Validator;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
import net.shibboleth.utilities.java.support.component.ComponentSupport;
@@ -39,7 +40,7 @@
*
* @param <V> type of the object to be validated
*/
public class ValidatorSequence<V> extends BaseLocalValidator implements Validator<V> {
public class ValidatorSequence<V> extends BaseValidator implements Validator<V> {

/** The list of validators to apply. */
@Nonnull

0 comments on commit 15f1b98

Please sign in to comment.