forked from hugegraph/hugegraph-sync
bump up common 1.7.8 (#1058)
include: guava 25.1 and cassandra-driver 3.6.0 Change-Id: Iaa420dc5233887a5b7054d7ea9f683cb5627903c
This commit is contained in:
parent
42cf6382d7
commit
3de3d357e9
|
|
@ -30,11 +30,11 @@ import javax.ws.rs.core.MultivaluedMap;
|
|||
import javax.ws.rs.core.Response;
|
||||
|
||||
import com.baidu.hugegraph.api.filter.CompressInterceptor;
|
||||
import com.baidu.hugegraph.rest.RestClient;
|
||||
import com.baidu.hugegraph.rest.AbstractRestClient;
|
||||
import com.baidu.hugegraph.testutil.Whitebox;
|
||||
import com.baidu.hugegraph.util.E;
|
||||
|
||||
public class GremlinClient extends RestClient {
|
||||
public class GremlinClient extends AbstractRestClient {
|
||||
|
||||
private final WebTarget webTarget;
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@
|
|||
<dependency>
|
||||
<groupId>com.datastax.cassandra</groupId>
|
||||
<artifactId>cassandra-driver-core</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<version>3.6.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
<dependency>
|
||||
<groupId>com.baidu.hugegraph</groupId>
|
||||
<artifactId>hugegraph-common</artifactId>
|
||||
<version>1.7.6</version>
|
||||
<version>1.7.8</version>
|
||||
</dependency>
|
||||
|
||||
<!-- tinkerpop -->
|
||||
|
|
@ -50,15 +50,16 @@
|
|||
<artifactId>gremlin-driver</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.caffinitas.ohc</groupId>
|
||||
<artifactId>ohc-core</artifactId>
|
||||
<version>0.7.0</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -1,95 +0,0 @@
|
|||
/*
|
||||
* Copyright 2017 HugeGraph Authors
|
||||
*
|
||||
* 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 com.baidu.hugegraph.util;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import com.baidu.hugegraph.date.SafeDateFormat;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
public final class DateUtil {
|
||||
|
||||
public static final Date DATE_ZERO = new Date(0L);
|
||||
|
||||
private static final Map<String, String> VALID_DFS = ImmutableMap.of(
|
||||
"^\\d{4}-\\d{1,2}-\\d{1,2}",
|
||||
"yyyy-MM-dd",
|
||||
"^\\d{4}-\\d{1,2}-\\d{1,2}\\s\\d{2}:\\d{2}:\\d{2}",
|
||||
"yyyy-MM-dd HH:mm:ss",
|
||||
"^\\d{4}-\\d{1,2}-\\d{1,2}\\s\\d{2}:\\d{2}:\\d{2}\\.\\d{1,3}",
|
||||
"yyyy-MM-dd HH:mm:ss.SSS"
|
||||
);
|
||||
|
||||
private static final Map<String, SafeDateFormat> DATE_FORMATS =
|
||||
new ConcurrentHashMap<>();
|
||||
|
||||
public static Date parse(String value) {
|
||||
for (Map.Entry<String, String> entry : VALID_DFS.entrySet()) {
|
||||
if (value.matches(entry.getKey())) {
|
||||
try {
|
||||
return parse(value, entry.getValue());
|
||||
} catch (ParseException e) {
|
||||
throw new IllegalArgumentException(String.format(
|
||||
"%s, expect format: %s",
|
||||
e.getMessage(), entry.getValue()));
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException(String.format(
|
||||
"Expected date format is: %s, but got '%s'",
|
||||
VALID_DFS.values(), value));
|
||||
}
|
||||
|
||||
public static Date parse(String value, String df) throws ParseException {
|
||||
SafeDateFormat dateFormat = getDateFormat(df);
|
||||
return dateFormat.parse(value);
|
||||
}
|
||||
|
||||
public static Date now() {
|
||||
return new Date();
|
||||
}
|
||||
|
||||
private static SafeDateFormat getDateFormat(String df) {
|
||||
SafeDateFormat dateFormat = DATE_FORMATS.get(df);
|
||||
if (dateFormat == null) {
|
||||
dateFormat = new SafeDateFormat(df);
|
||||
/*
|
||||
* Specify whether or not date/time parsing is to be lenient.
|
||||
* With lenient parsing, the parser may use heuristics to interpret
|
||||
* inputs that do not precisely match this object's format.
|
||||
* With strict parsing, inputs must match this object's format.
|
||||
*/
|
||||
dateFormat.setLenient(false);
|
||||
SafeDateFormat previous = DATE_FORMATS.putIfAbsent(df, dateFormat);
|
||||
if (previous != null) {
|
||||
dateFormat = previous;
|
||||
}
|
||||
}
|
||||
return dateFormat;
|
||||
}
|
||||
|
||||
public static Object toPattern(String df) {
|
||||
SafeDateFormat dateFormat = getDateFormat(df);
|
||||
return dateFormat.toPattern();
|
||||
}
|
||||
}
|
||||
|
|
@ -64,11 +64,6 @@
|
|||
<artifactId>hugegraph-postgresql</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.airlift</groupId>
|
||||
<artifactId>airline</artifactId>
|
||||
<version>0.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.tinkerpop</groupId>
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import javax.ws.rs.core.MultivaluedMap;
|
|||
import javax.ws.rs.core.Response;
|
||||
|
||||
import com.baidu.hugegraph.config.HugeConfig;
|
||||
import com.baidu.hugegraph.rest.AbstractRestClient;
|
||||
import com.baidu.hugegraph.rest.RestClient;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
|
|
@ -60,7 +61,7 @@ public class PaloHttpClient {
|
|||
this.client.put(path, body, headers, params);
|
||||
}
|
||||
|
||||
private static class Client extends RestClient {
|
||||
private static class Client extends AbstractRestClient {
|
||||
|
||||
private static final int SECOND = 1000;
|
||||
|
||||
|
|
|
|||
2
pom.xml
2
pom.xml
|
|
@ -100,7 +100,7 @@
|
|||
<junit.version>4.12</junit.version>
|
||||
<tinkerpop.version>3.4.3</tinkerpop.version>
|
||||
<commons.io.version>2.4</commons.io.version>
|
||||
<guava.version>19.0</guava.version>
|
||||
<guava.version>25.1-jre</guava.version>
|
||||
<httpclient.version>4.5.2</httpclient.version>
|
||||
<jersey.version>2.25.1</jersey.version>
|
||||
<metrics.version>3.1.0</metrics.version>
|
||||
|
|
|
|||
Loading…
Reference in New Issue