6340919966e2c925fecad4720704120dcec5709a
[odlparent.git] / karaf-plugin / src / main / java / org / opendaylight / odlparent / KarafFeaturesDependencyFilter.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.odlparent;
10
11 import java.util.List;
12
13 import org.eclipse.aether.graph.DependencyFilter;
14 import org.eclipse.aether.graph.DependencyNode;
15
16 public class KarafFeaturesDependencyFilter implements DependencyFilter {
17
18     /**
19      * Accepts only Karaf features.
20      *
21      * @param node The dependency node.
22      * @param parents The parents (ignored).
23      * @return {@code true} if the dependency is a Karaf feature, {@code false} otherwise.
24      */
25     @Override
26     public boolean accept(DependencyNode node, List<DependencyNode> parents) {
27         return node != null
28                 && node.getArtifact() != null
29                 && node.getDependency() != null
30                 && node.getDependency().getScope() != null
31                 && node.getArtifact().getClassifier().equals("features")
32                 && node.getArtifact().getExtension().equals("xml");
33     }
34
35 }