diff --git a/ogm/tugraph-db-rpc-driver/pom.xml b/ogm/tugraph-db-rpc-driver/pom.xml
index 942a275..8a4fcb8 100644
--- a/ogm/tugraph-db-rpc-driver/pom.xml
+++ b/ogm/tugraph-db-rpc-driver/pom.xml
@@ -42,11 +42,6 @@
tugraph-db-ogm-api
${ogm.api.version}
-
- org.neo4j.driver
- neo4j-java-driver
- 4.4.5
-
com.antgroup.tugraph
tugraph-db-java-rpc-client
diff --git a/ogm/tugraph-db-rpc-driver/src/main/java/com/antgroup/tugraph/ogm/drivers/rpc/driver/RpcDriver.java b/ogm/tugraph-db-rpc-driver/src/main/java/com/antgroup/tugraph/ogm/drivers/rpc/driver/RpcDriver.java
index e5e5d1a..355aecc 100644
--- a/ogm/tugraph-db-rpc-driver/src/main/java/com/antgroup/tugraph/ogm/drivers/rpc/driver/RpcDriver.java
+++ b/ogm/tugraph-db-rpc-driver/src/main/java/com/antgroup/tugraph/ogm/drivers/rpc/driver/RpcDriver.java
@@ -21,8 +21,6 @@
import java.net.URI;
import java.util.Locale;
-import java.util.Optional;
-import java.util.concurrent.TimeUnit;
import java.util.function.BiFunction;
import java.util.function.Function;
@@ -30,8 +28,7 @@
import com.antgroup.tugraph.ogm.drivers.rpc.transaction.RpcTransaction;
import com.antgroup.tugraph.TuGraphDbRpcClient;
-import org.neo4j.driver.*;
-import org.neo4j.driver.exceptions.ServiceUnavailableException;
+import com.antgroup.tugraph.ogm.drivers.rpc.exception.ServiceUnavailableException;
import com.antgroup.tugraph.ogm.config.Configuration;
import com.antgroup.tugraph.ogm.config.Credentials;
import com.antgroup.tugraph.ogm.config.UsernamePasswordCredentials;
@@ -59,7 +56,6 @@ public class RpcDriver extends AbstractConfigurableDriver {
private TuGraphDbRpcClient rpcClient;
private Credentials credentials;
- private Config driverConfig;
/**
* The database to use (Use Tugraph default).
*/
@@ -80,7 +76,6 @@ public void configure(Configuration newConfiguration) {
super.configure(newConfiguration);
- this.driverConfig = buildDriverConfig();
this.credentials = this.configuration.getCredentials();
this.database = this.configuration.getDatabase();
@@ -161,55 +156,4 @@ public Request request(Transaction transaction) {
return new RpcRequest(rpcClient, this.parameterConversion, getCypherModification(), database);
}
- public T unwrap(Class clazz) {
-
- if (clazz == Driver.class) {
- return (T) rpcClient;
- } else {
- return super.unwrap(clazz);
- }
- }
-
- private Optional getRpcLogging() {
-
- Object possibleLogging = customPropertiesSupplier.get().get(CONFIG_PARAMETER_RPC_LOGGING);
- if (possibleLogging != null && !(possibleLogging instanceof Logging)) {
- LOGGER.warn("Invalid object of type {} for {}, not changing log.", possibleLogging.getClass(),
- CONFIG_PARAMETER_RPC_LOGGING);
- possibleLogging = null;
- }
-
- LOGGER.debug("Using {} for rpc logging.", possibleLogging == null ? "default" : possibleLogging.getClass());
-
- return Optional.ofNullable((Logging) possibleLogging);
- }
-
- private Config buildDriverConfig() {
-
- // Done outside the try/catch and explicity catch the illegalargument exception of singleURI
- // so that exception semantics are not changed since we introduced that feature.
-
- URI singleUri = getSingleURI(configuration.getURI());
- if (!isCorrectScheme(singleUri.getScheme())) {
- throw new IllegalArgumentException(
- "Rpc uri is incorrect!");
- }
-
- try {
- Config.ConfigBuilder configBuilder = Config.builder();
- configBuilder.withMaxConnectionPoolSize(configuration.getConnectionPoolSize());
-
- if (configuration.getConnectionLivenessCheckTimeout() != null) {
- configBuilder.withConnectionLivenessCheckTimeout(configuration.getConnectionLivenessCheckTimeout(),
- TimeUnit.MILLISECONDS);
- }
-
- getRpcLogging().ifPresent(configBuilder::withLogging);
-
- return configBuilder.build();
- } catch (Exception e) {
- throw new ConnectionException("Unable to build driver configuration", e);
- }
- }
-
}
diff --git a/ogm/tugraph-db-rpc-driver/src/main/java/com/antgroup/tugraph/ogm/drivers/rpc/driver/RpcDriverExceptionTranslator.java b/ogm/tugraph-db-rpc-driver/src/main/java/com/antgroup/tugraph/ogm/drivers/rpc/driver/RpcDriverExceptionTranslator.java
index 8ec3a0a..1d03a64 100644
--- a/ogm/tugraph-db-rpc-driver/src/main/java/com/antgroup/tugraph/ogm/drivers/rpc/driver/RpcDriverExceptionTranslator.java
+++ b/ogm/tugraph-db-rpc-driver/src/main/java/com/antgroup/tugraph/ogm/drivers/rpc/driver/RpcDriverExceptionTranslator.java
@@ -19,7 +19,7 @@
*/
package com.antgroup.tugraph.ogm.drivers.rpc.driver;
-import org.neo4j.driver.exceptions.ServiceUnavailableException;
+import com.antgroup.tugraph.ogm.drivers.rpc.exception.ServiceUnavailableException;
import com.antgroup.tugraph.ogm.driver.ExceptionTranslator;
import com.antgroup.tugraph.ogm.exception.ConnectionException;
diff --git a/ogm/tugraph-db-rpc-driver/src/main/java/com/antgroup/tugraph/ogm/drivers/rpc/exception/ClientException.java b/ogm/tugraph-db-rpc-driver/src/main/java/com/antgroup/tugraph/ogm/drivers/rpc/exception/ClientException.java
new file mode 100644
index 0000000..24a7479
--- /dev/null
+++ b/ogm/tugraph-db-rpc-driver/src/main/java/com/antgroup/tugraph/ogm/drivers/rpc/exception/ClientException.java
@@ -0,0 +1,34 @@
+/*
+ * Modifications Copyright 2022 "Ant Group"
+ * Copyright (c) 2002-2022 "Neo4j,"
+ * Neo4j Sweden AB [http://neo4j.com]
+ *
+ * This file is part of Neo4j.
+ *
+ * Licensed 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.antgroup.tugraph.ogm.drivers.rpc.exception;
+
+public class ClientException extends TuGraphException {
+ public ClientException(String message) {
+ super(message);
+ }
+
+ public ClientException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ClientException(String code, String message) {
+ super(code, message);
+ }
+}
diff --git a/ogm/tugraph-db-rpc-driver/src/main/java/com/antgroup/tugraph/ogm/drivers/rpc/exception/DatabaseException.java b/ogm/tugraph-db-rpc-driver/src/main/java/com/antgroup/tugraph/ogm/drivers/rpc/exception/DatabaseException.java
new file mode 100644
index 0000000..ee0dc76
--- /dev/null
+++ b/ogm/tugraph-db-rpc-driver/src/main/java/com/antgroup/tugraph/ogm/drivers/rpc/exception/DatabaseException.java
@@ -0,0 +1,26 @@
+/*
+ * Modifications Copyright 2022 "Ant Group"
+ * Copyright (c) 2002-2022 "Neo4j,"
+ * Neo4j Sweden AB [http://neo4j.com]
+ *
+ * This file is part of Neo4j.
+ *
+ * Licensed 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.antgroup.tugraph.ogm.drivers.rpc.exception;
+
+public class DatabaseException extends TuGraphException {
+ public DatabaseException(String code, String message) {
+ super(code, message);
+ }
+}
diff --git a/ogm/tugraph-db-rpc-driver/src/main/java/com/antgroup/tugraph/ogm/drivers/rpc/exception/ServiceUnavailableException.java b/ogm/tugraph-db-rpc-driver/src/main/java/com/antgroup/tugraph/ogm/drivers/rpc/exception/ServiceUnavailableException.java
new file mode 100644
index 0000000..f37b4ea
--- /dev/null
+++ b/ogm/tugraph-db-rpc-driver/src/main/java/com/antgroup/tugraph/ogm/drivers/rpc/exception/ServiceUnavailableException.java
@@ -0,0 +1,30 @@
+/*
+ * Modifications Copyright 2022 "Ant Group"
+ * Copyright (c) 2002-2022 "Neo4j,"
+ * Neo4j Sweden AB [http://neo4j.com]
+ *
+ * This file is part of Neo4j.
+ *
+ * Licensed 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.antgroup.tugraph.ogm.drivers.rpc.exception;
+
+public class ServiceUnavailableException extends TuGraphException {
+ public ServiceUnavailableException(String message) {
+ super(message);
+ }
+
+ public ServiceUnavailableException(String message, Throwable throwable) {
+ super(message, throwable);
+ }
+}
diff --git a/ogm/tugraph-db-rpc-driver/src/main/java/com/antgroup/tugraph/ogm/drivers/rpc/exception/TransientException.java b/ogm/tugraph-db-rpc-driver/src/main/java/com/antgroup/tugraph/ogm/drivers/rpc/exception/TransientException.java
new file mode 100644
index 0000000..8be1c92
--- /dev/null
+++ b/ogm/tugraph-db-rpc-driver/src/main/java/com/antgroup/tugraph/ogm/drivers/rpc/exception/TransientException.java
@@ -0,0 +1,26 @@
+/*
+ * Modifications Copyright 2022 "Ant Group"
+ * Copyright (c) 2002-2022 "Neo4j,"
+ * Neo4j Sweden AB [http://neo4j.com]
+ *
+ * This file is part of Neo4j.
+ *
+ * Licensed 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.antgroup.tugraph.ogm.drivers.rpc.exception;
+
+public class TransientException extends TuGraphException {
+ public TransientException(String code, String message) {
+ super(code, message);
+ }
+}
diff --git a/ogm/tugraph-db-rpc-driver/src/main/java/com/antgroup/tugraph/ogm/drivers/rpc/exception/TuGraphException.java b/ogm/tugraph-db-rpc-driver/src/main/java/com/antgroup/tugraph/ogm/drivers/rpc/exception/TuGraphException.java
new file mode 100644
index 0000000..3890e5a
--- /dev/null
+++ b/ogm/tugraph-db-rpc-driver/src/main/java/com/antgroup/tugraph/ogm/drivers/rpc/exception/TuGraphException.java
@@ -0,0 +1,52 @@
+/*
+ * Modifications Copyright 2022 "Ant Group"
+ * Copyright (c) 2002-2022 "Neo4j,"
+ * Neo4j Sweden AB [http://neo4j.com]
+ *
+ * This file is part of Neo4j.
+ *
+ * Licensed 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.antgroup.tugraph.ogm.drivers.rpc.exception;
+
+public class TuGraphException extends RuntimeException {
+ private static final long serialVersionUID = -80579062276712566L;
+ private final String code;
+
+ public TuGraphException(String message) {
+ this("N/A", message);
+ }
+
+ public TuGraphException(String message, Throwable cause) {
+ this("N/A", message, cause);
+ }
+
+ public TuGraphException(String code, String message) {
+ this(code, message, (Throwable) null);
+ }
+
+ public TuGraphException(String code, String message, Throwable cause) {
+ super(message, cause);
+ this.code = code;
+ }
+
+ /** @deprecated */
+ @Deprecated
+ public String tugraphErrorCode() {
+ return this.code;
+ }
+
+ public String code() {
+ return this.code;
+ }
+}
diff --git a/ogm/tugraph-db-rpc-driver/src/main/java/com/antgroup/tugraph/ogm/drivers/rpc/request/RpcRequest.java b/ogm/tugraph-db-rpc-driver/src/main/java/com/antgroup/tugraph/ogm/drivers/rpc/request/RpcRequest.java
index 36b9968..c800195 100644
--- a/ogm/tugraph-db-rpc-driver/src/main/java/com/antgroup/tugraph/ogm/drivers/rpc/request/RpcRequest.java
+++ b/ogm/tugraph-db-rpc-driver/src/main/java/com/antgroup/tugraph/ogm/drivers/rpc/request/RpcRequest.java
@@ -34,9 +34,9 @@
import com.antgroup.tugraph.ogm.drivers.rpc.response.RowModelResponse;
import com.antgroup.tugraph.TuGraphDbRpcClient;
-import org.neo4j.driver.exceptions.ClientException;
-import org.neo4j.driver.exceptions.DatabaseException;
-import org.neo4j.driver.exceptions.TransientException;
+import com.antgroup.tugraph.ogm.drivers.rpc.exception.ClientException;
+import com.antgroup.tugraph.ogm.drivers.rpc.exception.DatabaseException;
+import com.antgroup.tugraph.ogm.drivers.rpc.exception.TransientException;
import com.antgroup.tugraph.ogm.driver.ParameterConversion;
import com.antgroup.tugraph.ogm.exception.CypherException;
import com.antgroup.tugraph.ogm.model.GraphModel;
diff --git a/ogm/tugraph-db-rpc-driver/src/main/java/com/antgroup/tugraph/ogm/drivers/rpc/response/RpcResponse.java b/ogm/tugraph-db-rpc-driver/src/main/java/com/antgroup/tugraph/ogm/drivers/rpc/response/RpcResponse.java
index ff1f9aa..fc4b2be 100644
--- a/ogm/tugraph-db-rpc-driver/src/main/java/com/antgroup/tugraph/ogm/drivers/rpc/response/RpcResponse.java
+++ b/ogm/tugraph-db-rpc-driver/src/main/java/com/antgroup/tugraph/ogm/drivers/rpc/response/RpcResponse.java
@@ -21,7 +21,7 @@
import java.util.ArrayList;
-import org.neo4j.driver.exceptions.ClientException;
+import com.antgroup.tugraph.ogm.drivers.rpc.exception.ClientException;
import com.antgroup.tugraph.ogm.exception.CypherException;
import com.antgroup.tugraph.ogm.response.Response;