[MSHARED-424] Add Filter mechanism which can be passed to Sonatype/Eclipse Aether
git-svn-id: https://svn.apache.org/repos/asf/maven/shared/trunk@1685235 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/maven/shared/artifact/filter/resolve/AndFilter.java b/src/main/java/org/apache/maven/shared/artifact/filter/resolve/AndFilter.java
new file mode 100644
index 0000000..972646e
--- /dev/null
+++ b/src/main/java/org/apache/maven/shared/artifact/filter/resolve/AndFilter.java
@@ -0,0 +1,70 @@
+package org.apache.maven.shared.artifact.filter.resolve;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * A filter that combines zero or more other filters using a logical {@code AND}.
+ *
+ * @author Robert Scholte
+ * @since 3.0
+ *
+ * @see org.sonatype.aether.util.filter.AndDependencyFilter
+ * @see org.eclipse.aether.util.filter.AndDependencyFilter
+ */
+public class AndFilter
+ implements TransformableFilter
+{
+ private final Collection<TransformableFilter> filters;
+
+ /**
+ * The default constructor specifying a collection of filters which all must be matched.
+ *
+ * @param filters the filters, may not be {@code null}
+ */
+ public AndFilter( Collection<TransformableFilter> filters )
+ {
+ this.filters = Collections.unmodifiableCollection( filters );
+ }
+
+ /**
+ * Get the filters
+ *
+ * @return the filters, never {@code null}
+ */
+ public Collection<TransformableFilter> getFilters()
+ {
+ return filters;
+ }
+
+ /**
+ * Transform this filter to a tool specific implementation
+ *
+ * @param transformer the transformer, may not be {@code null}
+ */
+ @Override
+ public <T> T transform( FilterTransformer<T> transformer )
+ {
+ return transformer.transform( this );
+ }
+
+}
diff --git a/src/main/java/org/apache/maven/shared/artifact/filter/resolve/ExclusionsFilter.java b/src/main/java/org/apache/maven/shared/artifact/filter/resolve/ExclusionsFilter.java
new file mode 100644
index 0000000..92385f9
--- /dev/null
+++ b/src/main/java/org/apache/maven/shared/artifact/filter/resolve/ExclusionsFilter.java
@@ -0,0 +1,65 @@
+package org.apache.maven.shared.artifact.filter.resolve;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * A simple filter to exclude artifacts based on either artifact id or group id and artifact id.
+ *
+ * @author Robert Scholte
+ * @since 3.0
+ *
+ * @see org.sonatype.aether.util.filter.ExclusionsDependencyFilter
+ * @see org.eclipse.aether.util.filter.ExclusionsDependencyFilter
+ */
+public class ExclusionsFilter
+ implements TransformableFilter
+{
+ private final Collection<String> excludes;
+
+ /**
+ * The default constructor specifying a collection of keys which must be excluded.
+ *
+ * @param excludes the keys to exclude, may not be {@code null}
+ * @see Artifact#getDependencyConflictId()
+ */
+ public ExclusionsFilter( Collection<String> excludes )
+ {
+ this.excludes = Collections.unmodifiableCollection( excludes );
+ }
+
+ public final Collection<String> getExcludes()
+ {
+ return excludes;
+ }
+
+ /**
+ * Transform this filter to a tool specific implementation
+ *
+ * @param transformer the transformer, may not be {@code null}
+ */
+ @Override
+ public <T> T transform( FilterTransformer<T> transformer )
+ {
+ return transformer.transform( this );
+ }
+}
diff --git a/src/main/java/org/apache/maven/shared/artifact/filter/resolve/FilterTransformer.java b/src/main/java/org/apache/maven/shared/artifact/filter/resolve/FilterTransformer.java
new file mode 100644
index 0000000..ad662e8
--- /dev/null
+++ b/src/main/java/org/apache/maven/shared/artifact/filter/resolve/FilterTransformer.java
@@ -0,0 +1,80 @@
+package org.apache.maven.shared.artifact.filter.resolve;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Provide a mechanism to transform a Filter to a tool specific equivalent using the visitor pattern.
+ * For example: Aether has its own set of filters.
+ *
+ * @author Robert Scholte
+ *
+ * @param <T> the tool specific filter
+ * @since 3.0
+ */
+public interface FilterTransformer<T>
+{
+ /**
+ * Transform the scopeFilter to T specific implementation
+ *
+ * @param scopeFilter the filter
+ * @return the transformed filter, never {@code null}
+ */
+ T transform( ScopeFilter scopeFilter );
+
+ /**
+ * Transform the andFilter to T specific implementation
+ *
+ * @param andFilter the filter
+ * @return the transformed filter, never {@code null}
+ */
+ T transform( AndFilter andFilter );
+
+ /**
+ * Transform the exclusionsFilter to T specific implementation
+ *
+ * @param exclusionsFilter the filter
+ * @return the transformed filter, never {@code null}
+ */
+ T transform( ExclusionsFilter exclusionsFilter );
+
+ /**
+ * Transform the orFilter to T specific implementation
+ *
+ * @param orFilter the filter
+ * @return the transformed filter, never {@code null}
+ */
+ T transform( OrFilter orFilter );
+
+ /**
+ * Transform the patternExclusionsFilter to T specific implementation
+ *
+ * @param patternExclusionsFilter the filter
+ * @return the transformed filter, never {@code null}
+ */
+ T transform( PatternExclusionsFilter patternExclusionsFilter );
+
+ /**
+ * Transform the paternInclusionsFilter to T specific implementation
+ *
+ * @param patternInclusionsFilter the filter
+ * @return the transformed filter, never {@code null}
+ */
+ T transform( PatternInclusionsFilter patternInclusionsFilter );
+}
diff --git a/src/main/java/org/apache/maven/shared/artifact/filter/resolve/OrFilter.java b/src/main/java/org/apache/maven/shared/artifact/filter/resolve/OrFilter.java
new file mode 100644
index 0000000..60647ac
--- /dev/null
+++ b/src/main/java/org/apache/maven/shared/artifact/filter/resolve/OrFilter.java
@@ -0,0 +1,69 @@
+package org.apache.maven.shared.artifact.filter.resolve;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * A filter that combines zero or more other filters using a logical {@code OR}.
+ *
+ * @author Robert Scholte
+ * @since 3.0
+ *
+ * @see org.sonatype.aether.util.filter.OrDependencyFilter
+ * @see org.eclipse.aether.util.filter.OrDependencyFilter
+ */
+public class OrFilter implements TransformableFilter
+{
+
+ private final Collection<TransformableFilter> filters;
+
+ /**
+ * The default constructor specifying a collection of filters of which at least one must match.
+ *
+ * @param filters the filters, may not be {@code null}
+ */
+ public OrFilter( Collection<TransformableFilter> filters )
+ {
+ this.filters = Collections.unmodifiableCollection( filters );
+ }
+
+ /**
+ * Get the filters
+ *
+ * @return the filters, never {@code null}
+ */
+ public Collection<TransformableFilter> getFilters()
+ {
+ return filters;
+ }
+
+ /**
+ * Transform this filter to a tool specific implementation
+ *
+ * @param transformer the transformer, may not be {@code null}
+ */
+ @Override
+ public <T> T transform( FilterTransformer<T> transformer )
+ {
+ return transformer.transform( this );
+ }
+}
diff --git a/src/main/java/org/apache/maven/shared/artifact/filter/resolve/PatternExclusionsFilter.java b/src/main/java/org/apache/maven/shared/artifact/filter/resolve/PatternExclusionsFilter.java
new file mode 100644
index 0000000..eaabed3
--- /dev/null
+++ b/src/main/java/org/apache/maven/shared/artifact/filter/resolve/PatternExclusionsFilter.java
@@ -0,0 +1,83 @@
+package org.apache.maven.shared.artifact.filter.resolve;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * A simple filter to exclude artifacts from a list of patterns. The artifact pattern syntax is of the form:
+ *
+ * <pre>
+ * [groupId]:[artifactId]:[extension]:[version]
+ * </pre>
+ * <p>
+ * Where each pattern segment is optional and supports full and partial <code>*</code> wildcards. An empty pattern
+ * segment is treated as an implicit wildcard. Version can be a range in case a {@code VersionScheme} is specified.
+ * </p>
+ * <p>
+ * For example, <code>org.apache.*</code> would match all artifacts whose group id started with
+ * <code>org.apache.</code> , and <code>:::*-SNAPSHOT</code> would match all snapshot artifacts.
+ * </p>
+ *
+ * @author Robert Scholte
+ * @since 3.0
+ *
+ * @see org.sonatype.aether.util.filter.PatternExclusionsDependencyFilter
+ * @see org.eclipse.aether.util.filter.PatternExclusionsDependencyFilter
+ * @see org.sonatype.aether.version.VersionScheme
+ * @see org.eclipse.aether.version.VersionScheme
+ */
+public class PatternExclusionsFilter implements TransformableFilter
+{
+
+ private final Collection<String> excludes;
+
+ /**
+ * The default constructor specifying a collection of pattern based keys which must be excluded.
+ *
+ * @param excludes the excludes, must not be {@code null}
+ */
+ public PatternExclusionsFilter( Collection<String> excludes )
+ {
+ this.excludes = Collections.unmodifiableCollection( excludes );
+ }
+
+ /**
+ * Get the excludes
+ *
+ * @return the excluded keys, never {@code null}
+ */
+ public final Collection<String> getExcludes()
+ {
+ return excludes;
+ }
+
+ /**
+ * Transform this filter to a tool specific implementation
+ *
+ * @param transformer the transformer, must not be {@code null}
+ */
+ @Override
+ public <T> T transform( FilterTransformer<T> transformer )
+ {
+ return transformer.transform( this );
+ }
+}
diff --git a/src/main/java/org/apache/maven/shared/artifact/filter/resolve/PatternInclusionsFilter.java b/src/main/java/org/apache/maven/shared/artifact/filter/resolve/PatternInclusionsFilter.java
new file mode 100644
index 0000000..63d6c4e
--- /dev/null
+++ b/src/main/java/org/apache/maven/shared/artifact/filter/resolve/PatternInclusionsFilter.java
@@ -0,0 +1,83 @@
+package org.apache.maven.shared.artifact.filter.resolve;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * A simple filter to include artifacts from a list of patterns. The artifact pattern syntax is of the form:
+ *
+ * <pre>
+ * [groupId]:[artifactId]:[extension]:[version]
+ * </pre>
+ * <p>
+ * Where each pattern segment is optional and supports full and partial <code>*</code> wildcards. An empty pattern
+ * segment is treated as an implicit wildcard. Version can be a range in case a {@code VersionScheme} is specified.
+ * </p>
+ * <p>
+ * For example, <code>org.apache.*</code> would match all artifacts whose group id started with
+ * <code>org.apache.</code> , and <code>:::*-SNAPSHOT</code> would match all snapshot artifacts.
+ * </p>
+ *
+ * @author Robert Scholte
+ * @since 3.0
+ *
+ * @see org.sonatype.aether.util.filter.PatternInclusionsDependencyFilter
+ * @see org.eclipse.aether.util.filter.PatternInclusionsDependencyFilter
+ * @see org.sonatype.aether.version.VersionScheme
+ * @see org.eclipse.aether.version.VersionScheme
+ */
+public class PatternInclusionsFilter implements TransformableFilter
+{
+
+ private final Collection<String> includes;
+
+ /**
+ * The default constructor specifying a collection of pattern based keys which must be included.
+ *
+ * @param includes the includes
+ */
+ public PatternInclusionsFilter( Collection<String> includes )
+ {
+ this.includes = Collections.unmodifiableCollection( includes );
+ }
+
+ /**
+ * Get the includes
+ *
+ * @return the includes,
+ */
+ public final Collection<String> getIncludes()
+ {
+ return includes;
+ }
+
+ /**
+ * Transform this filter to a tool specific implementation
+ *
+ * @param transformer the transformer, must not be {@code null}
+ */
+ @Override
+ public <T> T transform( FilterTransformer<T> transformer )
+ {
+ return transformer.transform( this );
+ }
+}
diff --git a/src/main/java/org/apache/maven/shared/artifact/filter/resolve/ScopeFilter.java b/src/main/java/org/apache/maven/shared/artifact/filter/resolve/ScopeFilter.java
new file mode 100644
index 0000000..50450b9
--- /dev/null
+++ b/src/main/java/org/apache/maven/shared/artifact/filter/resolve/ScopeFilter.java
@@ -0,0 +1,102 @@
+package org.apache.maven.shared.artifact.filter.resolve;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * Filter based on scope. <em>Note:<em> There's no logic for inherited scoped
+ *
+ * @author Robert Scholte
+ * @since 3.0
+ *
+ * @see org.sonatype.aether.util.filter.ScopeDependencyFilter
+ * @see org.eclipse.aether.util.filter.ScopeDependencyFilter
+ */
+public class ScopeFilter implements TransformableFilter
+{
+ private final Collection<String> excluded;
+
+ private final Collection<String> included;
+
+ /**
+ *
+ * @param included specific scopes to include or {@null} to include all
+ * @param excluded specific scopes to exclude or {@null} to exclude none
+ */
+ public ScopeFilter( Collection<String> included, Collection<String> excluded )
+ {
+ this.included = ( included == null ? null : Collections.unmodifiableCollection( included ) );
+ this.excluded = ( excluded == null ? null : Collections.unmodifiableCollection( excluded ) );
+ }
+
+ /**
+ * Construct a ScopeFilter based on included scopes
+ *
+ * @param included the scopes to include, may be {@code null}
+ * @return the filter, never {@code null}
+ */
+ public static ScopeFilter including( Collection<String> included )
+ {
+ return new ScopeFilter( included, null );
+ }
+
+ /**
+ * Construct a ScopeFilter based on excluded scopes
+ *
+ * @param excluded the scopes to exclude, may be {@code null}
+ * @return the filter, never {@code null}
+ */
+ public static ScopeFilter excluding( Collection<String> excluded )
+ {
+ return new ScopeFilter( null, excluded );
+ }
+
+ /**
+ * Get the excluded scopes
+ *
+ * @return the scopes to exclude, may be {@code null}
+ */
+ public final Collection<String> getExcluded()
+ {
+ return excluded;
+ }
+
+ /**
+ * Get the included scopes
+ *
+ * @return the scopes to include, may be {@code null}
+ */
+ public final Collection<String> getIncluded()
+ {
+ return included;
+ }
+
+ /**
+ * Transform this filter to a tool specific implementation
+ *
+ * @param transformer the transformer, must not be {@code null}
+ */
+ public <T> T transform ( FilterTransformer<T> transformer )
+ {
+ return transformer.transform( this );
+ }
+}
diff --git a/src/main/java/org/apache/maven/shared/artifact/filter/resolve/TransformableFilter.java b/src/main/java/org/apache/maven/shared/artifact/filter/resolve/TransformableFilter.java
new file mode 100644
index 0000000..18cd50c
--- /dev/null
+++ b/src/main/java/org/apache/maven/shared/artifact/filter/resolve/TransformableFilter.java
@@ -0,0 +1,44 @@
+package org.apache.maven.shared.artifact.filter.resolve;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * The element interface of the visitor pattern for transforming filters.
+ *
+ * @author Robert Scholte
+ * @since 3.0
+ */
+public interface TransformableFilter
+{
+ /**
+ * Subclasses should include the following code:
+ * <pre>
+ * @Override
+ * public abstract <T> T transform( FilterTransformer<T> transformer )
+ * {
+ * return transformer.transform( this );
+ * }
+ * </pre>
+ *
+ * @param transformer the tool specific transformer, may not be {@code null}
+ * @return the transformed value, never {@code null}
+ */
+ <T> T transform( FilterTransformer<T> transformer );
+}
diff --git a/src/main/java/org/apache/maven/shared/artifact/filter/resolve/transform/EclipseAetherFilterTransformer.java b/src/main/java/org/apache/maven/shared/artifact/filter/resolve/transform/EclipseAetherFilterTransformer.java
new file mode 100644
index 0000000..7108c73
--- /dev/null
+++ b/src/main/java/org/apache/maven/shared/artifact/filter/resolve/transform/EclipseAetherFilterTransformer.java
@@ -0,0 +1,94 @@
+package org.apache.maven.shared.artifact.filter.resolve.transform;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.maven.shared.artifact.filter.resolve.AndFilter;
+import org.apache.maven.shared.artifact.filter.resolve.ExclusionsFilter;
+import org.apache.maven.shared.artifact.filter.resolve.FilterTransformer;
+import org.apache.maven.shared.artifact.filter.resolve.OrFilter;
+import org.apache.maven.shared.artifact.filter.resolve.PatternExclusionsFilter;
+import org.apache.maven.shared.artifact.filter.resolve.PatternInclusionsFilter;
+import org.apache.maven.shared.artifact.filter.resolve.ScopeFilter;
+import org.apache.maven.shared.artifact.filter.resolve.TransformableFilter;
+import org.eclipse.aether.graph.DependencyFilter;
+import org.eclipse.aether.util.filter.AndDependencyFilter;
+import org.eclipse.aether.util.filter.ExclusionsDependencyFilter;
+import org.eclipse.aether.util.filter.PatternExclusionsDependencyFilter;
+import org.eclipse.aether.util.filter.PatternInclusionsDependencyFilter;
+import org.eclipse.aether.util.filter.ScopeDependencyFilter;
+
+/**
+ * FilterTransformer implementation for Eclipses Aether
+ *
+ * @author Robert Scholte
+ * @since 3.0
+ */
+class EclipseAetherFilterTransformer
+ implements FilterTransformer<DependencyFilter>
+{
+ @Override
+ public AndDependencyFilter transform( AndFilter andFilter )
+ {
+ Collection<DependencyFilter> filters = new ArrayList<DependencyFilter>();
+ for ( TransformableFilter filter : andFilter.getFilters() )
+ {
+ filters.add( filter.transform( this ) );
+ }
+ return new AndDependencyFilter( filters );
+ }
+
+ @Override
+ public ExclusionsDependencyFilter transform( ExclusionsFilter filter )
+ {
+ return new ExclusionsDependencyFilter( filter.getExcludes() );
+ }
+
+ @Override
+ public AndDependencyFilter transform( OrFilter orFilter )
+ {
+ Collection<DependencyFilter> filters = new ArrayList<DependencyFilter>();
+ for ( TransformableFilter filter : orFilter.getFilters() )
+ {
+ filters.add( filter.transform( this ) );
+ }
+ return new AndDependencyFilter( filters );
+ }
+
+ @Override
+ public ScopeDependencyFilter transform( ScopeFilter filter )
+ {
+ return new ScopeDependencyFilter( filter.getIncluded(), filter.getExcluded() );
+ }
+
+ @Override
+ public DependencyFilter transform( PatternExclusionsFilter filter )
+ {
+ return new PatternExclusionsDependencyFilter( filter.getExcludes() );
+ }
+
+ @Override
+ public DependencyFilter transform( PatternInclusionsFilter filter )
+ {
+ return new PatternInclusionsDependencyFilter( filter.getIncludes() );
+ }
+}
diff --git a/src/main/java/org/apache/maven/shared/artifact/filter/resolve/transform/SonatypeAetherFilterTransformer.java b/src/main/java/org/apache/maven/shared/artifact/filter/resolve/transform/SonatypeAetherFilterTransformer.java
new file mode 100644
index 0000000..39ba59a
--- /dev/null
+++ b/src/main/java/org/apache/maven/shared/artifact/filter/resolve/transform/SonatypeAetherFilterTransformer.java
@@ -0,0 +1,95 @@
+package org.apache.maven.shared.artifact.filter.resolve.transform;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.maven.shared.artifact.filter.resolve.AndFilter;
+import org.apache.maven.shared.artifact.filter.resolve.ExclusionsFilter;
+import org.apache.maven.shared.artifact.filter.resolve.FilterTransformer;
+import org.apache.maven.shared.artifact.filter.resolve.OrFilter;
+import org.apache.maven.shared.artifact.filter.resolve.PatternExclusionsFilter;
+import org.apache.maven.shared.artifact.filter.resolve.PatternInclusionsFilter;
+import org.apache.maven.shared.artifact.filter.resolve.ScopeFilter;
+import org.apache.maven.shared.artifact.filter.resolve.TransformableFilter;
+import org.sonatype.aether.graph.DependencyFilter;
+import org.sonatype.aether.util.filter.AndDependencyFilter;
+import org.sonatype.aether.util.filter.ExclusionsDependencyFilter;
+import org.sonatype.aether.util.filter.OrDependencyFilter;
+import org.sonatype.aether.util.filter.PatternExclusionsDependencyFilter;
+import org.sonatype.aether.util.filter.PatternInclusionsDependencyFilter;
+import org.sonatype.aether.util.filter.ScopeDependencyFilter;
+
+/**
+ * FilterTransformer implementation for Sonatypes Aether
+ *
+ * @author Robert Scholte
+ * @since 3.0
+ */
+class SonatypeAetherFilterTransformer
+ implements FilterTransformer<DependencyFilter>
+{
+ @Override
+ public AndDependencyFilter transform( AndFilter filter )
+ {
+ Collection<DependencyFilter> filters = new ArrayList<DependencyFilter>( filter.getFilters().size() );
+ for ( TransformableFilter dependencyFilter : filter.getFilters() )
+ {
+ filters.add( dependencyFilter.transform( this ) );
+ }
+ return new AndDependencyFilter( filters );
+ }
+
+ @Override
+ public ExclusionsDependencyFilter transform( ExclusionsFilter filter )
+ {
+ return new ExclusionsDependencyFilter( filter.getExcludes() );
+ }
+
+ @Override
+ public OrDependencyFilter transform( OrFilter filter )
+ {
+ Collection<DependencyFilter> filters = new ArrayList<DependencyFilter>( filter.getFilters().size() );
+ for ( TransformableFilter dependencyFilter : filter.getFilters() )
+ {
+ filters.add( dependencyFilter.transform( this ) );
+ }
+ return new OrDependencyFilter( filters );
+ }
+
+ @Override
+ public ScopeDependencyFilter transform( ScopeFilter filter )
+ {
+ return new ScopeDependencyFilter( filter.getIncluded(), filter.getExcluded() );
+ }
+
+ @Override
+ public DependencyFilter transform( PatternExclusionsFilter filter )
+ {
+ return new PatternExclusionsDependencyFilter( filter.getExcludes() );
+ }
+
+ @Override
+ public DependencyFilter transform( PatternInclusionsFilter filter )
+ {
+ return new PatternInclusionsDependencyFilter( filter.getIncludes() );
+ }
+}