aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-base
diff options
context:
space:
mode:
authorMartin Stockhammer <martin_s@apache.org>2019-05-08 19:38:23 +0200
committerMartin Stockhammer <martin_s@apache.org>2019-05-08 19:38:23 +0200
commit8335c602150386736a55dd0313f6b3c1f8292316 (patch)
tree3996c0664733a4f39170e7cb54e26da920186058 /archiva-modules/archiva-base
parenta13bfb5a01af459e734d2f5b4b36d227a8a03a91 (diff)
downloadarchiva-8335c602150386736a55dd0313f6b3c1f8292316.tar.gz
archiva-8335c602150386736a55dd0313f6b3c1f8292316.zip
Moving filter API to common module
Diffstat (limited to 'archiva-modules/archiva-base')
-rw-r--r--archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/filter/AllFilter.java30
-rw-r--r--archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/filter/ExcludesFilter.java39
-rw-r--r--archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/filter/Filter.java25
-rw-r--r--archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/filter/IncludesFilter.java39
4 files changed, 133 insertions, 0 deletions
diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/filter/AllFilter.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/filter/AllFilter.java
new file mode 100644
index 000000000..289472704
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/filter/AllFilter.java
@@ -0,0 +1,30 @@
+package org.apache.archiva.filter;
+
+/*
+ * 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.
+ */
+
+public class AllFilter<T>
+ implements Filter<T>
+{
+ @Override
+ public boolean accept( T value )
+ {
+ return true;
+ }
+} \ No newline at end of file
diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/filter/ExcludesFilter.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/filter/ExcludesFilter.java
new file mode 100644
index 000000000..ff24d7d54
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/filter/ExcludesFilter.java
@@ -0,0 +1,39 @@
+package org.apache.archiva.filter;
+
+/*
+ * 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;
+
+public class ExcludesFilter<T>
+ implements Filter<T>
+{
+ private Collection<T> excludes;
+
+ public ExcludesFilter( Collection<T> excludes )
+ {
+ this.excludes = excludes;
+ }
+
+ @Override
+ public boolean accept( T value )
+ {
+ return !excludes.contains( value );
+ }
+}
diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/filter/Filter.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/filter/Filter.java
new file mode 100644
index 000000000..689586f84
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/filter/Filter.java
@@ -0,0 +1,25 @@
+package org.apache.archiva.filter;
+
+/*
+ * 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.
+ */
+
+public interface Filter<T>
+{
+ boolean accept( T value );
+}
diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/filter/IncludesFilter.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/filter/IncludesFilter.java
new file mode 100644
index 000000000..841e48fd7
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/filter/IncludesFilter.java
@@ -0,0 +1,39 @@
+package org.apache.archiva.filter;
+
+/*
+ * 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;
+
+public class IncludesFilter<T>
+ implements Filter<T>
+{
+ private Collection<T> includes;
+
+ public IncludesFilter( Collection<T> includes )
+ {
+ this.includes = includes;
+ }
+
+ @Override
+ public boolean accept( T value )
+ {
+ return includes.contains( value );
+ }
+} \ No newline at end of file