This is an automated email from the ASF dual-hosted git repository.

coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/master by this push:
     new a5161fd  CXF-8260 - Remove HBase search component
a5161fd is described below

commit a5161fdc753d099cccd47adb5b1100c69fe5dfe8
Author: Colm O hEigeartaigh <[email protected]>
AuthorDate: Fri Apr 17 10:10:06 2020 +0100

    CXF-8260 - Remove HBase search component
---
 distribution/javadoc/pom.xml                       |   4 -
 parent/pom.xml                                     |  24 ----
 rt/rs/extensions/search/pom.xml                    |  12 --
 .../jaxrs/ext/search/hbase/HBaseQueryVisitor.java  | 142 ---------------------
 .../jaxrs/ext/search/hbase/HBaseVisitorTest.java   |  85 ------------
 5 files changed, 267 deletions(-)

diff --git a/distribution/javadoc/pom.xml b/distribution/javadoc/pom.xml
index 8c0d262..85eb061 100644
--- a/distribution/javadoc/pom.xml
+++ b/distribution/javadoc/pom.xml
@@ -318,10 +318,6 @@
             <artifactId>logback-classic</artifactId>
             <version>${cxf.logback.classic.version}</version>
         </dependency>
-        <dependency>
-            <groupId>org.apache.hbase</groupId>
-            <artifactId>hbase-client</artifactId>
-        </dependency>
     </dependencies>
     <build>
         <plugins>
diff --git a/parent/pom.xml b/parent/pom.xml
index 46042ce..73ad505 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -1342,30 +1342,6 @@
                 </exclusions>
             </dependency>
             <dependency>
-                <groupId>org.apache.hbase</groupId>
-                <artifactId>hbase-client</artifactId>
-                <version>2.2.2</version>
-                <exclusions>
-                    <exclusion>
-                        <groupId>org.mortbay.jetty</groupId>
-                        <artifactId>jetty</artifactId>
-                    </exclusion>
-                    <exclusion>
-                        <groupId>org.mortbay.jetty</groupId>
-                        <artifactId>jetty-sslengine</artifactId>
-                    </exclusion>
-                    <exclusion>
-                        <groupId>org.mortbay.jetty</groupId>
-                        <artifactId>jetty-util</artifactId>
-                    </exclusion>
-                    <exclusion>
-                        <groupId>commons-httpclient</groupId>
-                        <artifactId>commons-httpclient</artifactId>
-                    </exclusion>
-                </exclusions>
-            </dependency>
-
-            <dependency>
                 <groupId>junit</groupId>
                 <artifactId>junit</artifactId>
                 <version>${cxf.junit.version}</version>
diff --git a/rt/rs/extensions/search/pom.xml b/rt/rs/extensions/search/pom.xml
index b4f109f..c8f244c 100644
--- a/rt/rs/extensions/search/pom.xml
+++ b/rt/rs/extensions/search/pom.xml
@@ -86,18 +86,6 @@
             <optional>true</optional>
         </dependency>
         <dependency>
-           <groupId>org.apache.hbase</groupId>
-           <artifactId>hbase-client</artifactId>
-           <optional>true</optional>
-           <scope>provided</scope>
-           <exclusions>
-               <exclusion>
-                    <groupId>jdk.tools</groupId>
-                    <artifactId>jdk.tools</artifactId>
-               </exclusion>
-            </exclusions>
-        </dependency>
-        <dependency>
             <groupId>org.apache.tika</groupId>
             <artifactId>tika-parsers</artifactId>
             <scope>test</scope>
diff --git 
a/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/hbase/HBaseQueryVisitor.java
 
b/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/hbase/HBaseQueryVisitor.java
deleted file mode 100644
index 64aeb4f..0000000
--- 
a/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/hbase/HBaseQueryVisitor.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/**
- * 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.
- */
-package org.apache.cxf.jaxrs.ext.search.hbase;
-
-import java.nio.charset.StandardCharsets;
-import java.util.ArrayDeque;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Deque;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.cxf.jaxrs.ext.search.ConditionType;
-import org.apache.cxf.jaxrs.ext.search.PrimitiveStatement;
-import org.apache.cxf.jaxrs.ext.search.SearchCondition;
-import org.apache.cxf.jaxrs.ext.search.visitor.AbstractSearchConditionVisitor;
-import org.apache.hadoop.hbase.filter.BinaryComparator;
-import org.apache.hadoop.hbase.filter.ByteArrayComparable;
-import org.apache.hadoop.hbase.filter.CompareFilter;
-import org.apache.hadoop.hbase.filter.Filter;
-import org.apache.hadoop.hbase.filter.FilterList;
-import org.apache.hadoop.hbase.filter.RegexStringComparator;
-import org.apache.hadoop.hbase.filter.SingleColumnValueFilter;
-
-public class HBaseQueryVisitor<T> extends AbstractSearchConditionVisitor<T, 
Filter> {
-
-    private final Deque<List<Filter>> queryStack = new ArrayDeque<>();
-    private String family;
-    private Map<String, String> familyMap;
-    public HBaseQueryVisitor(String family) {
-        this(family, Collections.<String, String>emptyMap());
-    }
-    public HBaseQueryVisitor(String family, Map<String, String> fieldsMap) {
-        super(fieldsMap);
-        this.family = family;
-        queryStack.push(new ArrayList<>());
-    }
-    public HBaseQueryVisitor(Map<String, String> familyMap) {
-        this(familyMap, Collections.<String, String>emptyMap());
-    }
-    public HBaseQueryVisitor(Map<String, String> familyMap,
-                             Map<String, String> fieldsMap) {
-        super(fieldsMap);
-        this.familyMap = familyMap;
-        queryStack.push(new ArrayList<>());
-    }
-
-    public void visit(SearchCondition<T> sc) {
-        PrimitiveStatement statement = sc.getStatement();
-        if (statement != null) {
-            if (statement.getProperty() != null) {
-                queryStack.peek().add(buildSimpleQuery(sc.getConditionType(),
-                                         statement.getProperty(),
-                                         statement.getValue()));
-            }
-        } else {
-            queryStack.push(new ArrayList<>());
-            for (SearchCondition<T> condition : sc.getSearchConditions()) {
-                condition.accept(this);
-            }
-            boolean orCondition = sc.getConditionType() == ConditionType.OR;
-            List<Filter> queries = queryStack.pop();
-            queryStack.peek().add(createCompositeQuery(queries, orCondition));
-        }
-    }
-
-    public Filter getQuery() {
-        List<Filter> queries = queryStack.peek();
-        return queries.isEmpty() ? null : queries.get(0);
-    }
-
-    @SuppressWarnings("deprecation")
-    private Filter buildSimpleQuery(ConditionType ct, String name, Object 
value) {
-        name = super.getRealPropertyName(name);
-        validatePropertyValue(name, value);
-        Class<?> clazz = getPrimitiveFieldClass(name, value.getClass());
-        CompareFilter.CompareOp compareOp = null;
-        boolean regexCompRequired = false;
-        switch (ct) {
-        case EQUALS:
-            compareOp = CompareFilter.CompareOp.EQUAL;
-            regexCompRequired = String.class == clazz && 
value.toString().endsWith("*");
-            break;
-        case NOT_EQUALS:
-            compareOp = CompareFilter.CompareOp.NOT_EQUAL;
-            regexCompRequired = String.class == clazz && 
value.toString().endsWith("*");
-            break;
-        case GREATER_THAN:
-            compareOp = CompareFilter.CompareOp.GREATER;
-            break;
-        case GREATER_OR_EQUALS:
-            compareOp = CompareFilter.CompareOp.GREATER_OR_EQUAL;
-            break;
-        case LESS_THAN:
-            compareOp = CompareFilter.CompareOp.LESS;
-            break;
-        case LESS_OR_EQUALS:
-            compareOp = CompareFilter.CompareOp.LESS_OR_EQUAL;
-            break;
-        default:
-            break;
-        }
-        String qualifier = name;
-        String theFamily = family != null ? family : familyMap.get(qualifier);
-        ByteArrayComparable byteArrayComparable = regexCompRequired
-            ? new RegexStringComparator(value.toString().replace("*", "."))
-            : new 
BinaryComparator(value.toString().getBytes(StandardCharsets.UTF_8));
-
-        return new 
SingleColumnValueFilter(theFamily.getBytes(StandardCharsets.UTF_8),
-                                           
qualifier.getBytes(StandardCharsets.UTF_8),
-                                           compareOp,
-                                           byteArrayComparable);
-    }
-
-    private Filter createCompositeQuery(List<Filter> queries, boolean 
orCondition) {
-
-        FilterList.Operator oper = orCondition ? 
FilterList.Operator.MUST_PASS_ONE
-            : FilterList.Operator.MUST_PASS_ALL;
-        FilterList list = new FilterList(oper);
-        for (Filter query : queries) {
-            list.addFilter(query);
-        }
-        return list;
-    }
-
-}
diff --git 
a/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/hbase/HBaseVisitorTest.java
 
b/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/hbase/HBaseVisitorTest.java
deleted file mode 100644
index 1cc0493..0000000
--- 
a/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/hbase/HBaseVisitorTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * 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.
- */
-package org.apache.cxf.jaxrs.ext.search.hbase;
-
-import org.apache.cxf.jaxrs.ext.search.SearchBean;
-import org.apache.cxf.jaxrs.ext.search.SearchCondition;
-import org.apache.cxf.jaxrs.ext.search.fiql.FiqlParser;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
-import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.client.Connection;
-import org.apache.hadoop.hbase.client.ConnectionFactory;
-import org.apache.hadoop.hbase.client.Result;
-import org.apache.hadoop.hbase.client.ResultScanner;
-import org.apache.hadoop.hbase.client.Scan;
-import org.apache.hadoop.hbase.client.Table;
-import org.apache.hadoop.hbase.filter.Filter;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class HBaseVisitorTest {
-    public static final byte[] BOOK_FAMILY = "book".getBytes();
-    public static final byte[] NAME_QUALIFIER = "name".getBytes();
-
-    Table table;
-    @Before
-    public void setUp() throws Exception {
-        try {
-            Configuration hBaseConfig = HBaseConfiguration.create();
-            Connection connection = 
ConnectionFactory.createConnection(hBaseConfig);
-            table = connection.getTable(TableName.valueOf("books"));
-        } catch (Throwable t) {
-            t.printStackTrace();
-        }
-    }
-
-    @Test
-    @Ignore("Enable as soon as it is understood how to run HBase tests in 
process")
-    public void testScanWithFilterVisitor() throws Exception {
-        Scan scan = new Scan();
-
-        SearchCondition<SearchBean> sc = new 
FiqlParser<>(SearchBean.class).parse("name==CXF");
-        HBaseQueryVisitor<SearchBean> visitor = new 
HBaseQueryVisitor<>("book");
-        sc.accept(visitor);
-        Filter filter = visitor.getQuery();
-        scan.setFilter(filter);
-        try (ResultScanner rs = table.getScanner(scan)) {
-            int count = 0;
-            for (Result r = rs.next(); r != null; r = rs.next()) {
-                assertEquals("row2", new String(r.getRow()));
-                assertEquals("CXF", new String(r.getValue(BOOK_FAMILY, 
NAME_QUALIFIER)));
-                count++;
-            }
-            assertEquals(1, count);
-        }
-    }
-
-    @After
-    public void tearDown() throws Exception {
-        if (table != null) {
-            table.close();
-        }
-    }
-}
\ No newline at end of file

Reply via email to