From 4dc6e25edab334e13ce06d649ac6e11755ed6ffb Mon Sep 17 00:00:00 2001
From: ChengJie1053 <18033291053@163.com>
Date: Tue, 12 Sep 2023 15:36:59 +0800
Subject: [PATCH] [WIP][Feature] Add nebula engine to linkis
---
linkis-engineconn-plugins/nebula/pom.xml | 111 +++++
.../nebula/src/main/assembly/distribution.xml | 71 +++
.../nebula/NebulaEngineConnPlugin.java | 72 +++
.../NebulaProcessEngineConnLaunchBuilder.java | 30 ++
.../nebula/conf/NebulaConfiguration.java | 63 +++
.../nebula/conf/NebulaEngineConf.java | 53 ++
.../errorcode/NebulaErrorCodeSummary.java | 47 ++
.../exception/NebulaClientException.java | 27 +
.../NebulaStateInvalidException.java | 27 +
.../executor/NebulaEngineConnExecutor.java | 468 ++++++++++++++++++
.../nebula/utils/NebulaSQLHook.java | 34 ++
.../resources/linkis-engineconn.properties | 23 +
.../nebula/src/main/resources/log4j2.xml | 91 ++++
.../factory/NebulaEngineConnFactory.scala | 44 ++
pom.xml | 1 +
15 files changed, 1162 insertions(+)
create mode 100644 linkis-engineconn-plugins/nebula/pom.xml
create mode 100644 linkis-engineconn-plugins/nebula/src/main/assembly/distribution.xml
create mode 100644 linkis-engineconn-plugins/nebula/src/main/java/org/apache/linkis/engineplugin/nebula/NebulaEngineConnPlugin.java
create mode 100644 linkis-engineconn-plugins/nebula/src/main/java/org/apache/linkis/engineplugin/nebula/builder/NebulaProcessEngineConnLaunchBuilder.java
create mode 100644 linkis-engineconn-plugins/nebula/src/main/java/org/apache/linkis/engineplugin/nebula/conf/NebulaConfiguration.java
create mode 100644 linkis-engineconn-plugins/nebula/src/main/java/org/apache/linkis/engineplugin/nebula/conf/NebulaEngineConf.java
create mode 100644 linkis-engineconn-plugins/nebula/src/main/java/org/apache/linkis/engineplugin/nebula/errorcode/NebulaErrorCodeSummary.java
create mode 100644 linkis-engineconn-plugins/nebula/src/main/java/org/apache/linkis/engineplugin/nebula/exception/NebulaClientException.java
create mode 100644 linkis-engineconn-plugins/nebula/src/main/java/org/apache/linkis/engineplugin/nebula/exception/NebulaStateInvalidException.java
create mode 100644 linkis-engineconn-plugins/nebula/src/main/java/org/apache/linkis/engineplugin/nebula/executor/NebulaEngineConnExecutor.java
create mode 100644 linkis-engineconn-plugins/nebula/src/main/java/org/apache/linkis/engineplugin/nebula/utils/NebulaSQLHook.java
create mode 100644 linkis-engineconn-plugins/nebula/src/main/resources/linkis-engineconn.properties
create mode 100644 linkis-engineconn-plugins/nebula/src/main/resources/log4j2.xml
create mode 100644 linkis-engineconn-plugins/nebula/src/main/scala/org/apache/linkis/engineplugin/nebula/factory/NebulaEngineConnFactory.scala
diff --git a/linkis-engineconn-plugins/nebula/pom.xml b/linkis-engineconn-plugins/nebula/pom.xml
new file mode 100644
index 0000000000..6b7cc32d81
--- /dev/null
+++ b/linkis-engineconn-plugins/nebula/pom.xml
@@ -0,0 +1,111 @@
+
+
+
+ 4.0.0
+
+ org.apache.linkis
+ linkis
+ ${revision}
+ ../../pom.xml
+
+
+ linkis-engineplugin-nebula
+
+
+
+ org.apache.linkis
+ linkis-engineconn-plugin-core
+ ${project.version}
+
+
+
+ org.apache.linkis
+ linkis-computation-engineconn
+ ${project.version}
+
+
+
+ org.apache.linkis
+ linkis-storage
+ ${project.version}
+ provided
+
+
+
+ org.apache.linkis
+ linkis-rpc
+ ${project.version}
+ provided
+
+
+
+ org.apache.linkis
+ linkis-common
+ ${project.version}
+ provided
+
+
+
+
+ com.vesoft
+ client
+ ${nebula.version}
+
+
+
+
+
+
+
+
+ net.alchim31.maven
+ scala-maven-plugin
+
+
+
+ org.apache.maven.plugins
+ maven-assembly-plugin
+ false
+
+ false
+ out
+ false
+ false
+
+ src/main/assembly/distribution.xml
+
+
+
+
+ make-assembly
+
+ single
+
+ package
+
+
+ src/main/assembly/distribution.xml
+
+
+
+
+
+
+
+
+
diff --git a/linkis-engineconn-plugins/nebula/src/main/assembly/distribution.xml b/linkis-engineconn-plugins/nebula/src/main/assembly/distribution.xml
new file mode 100644
index 0000000000..eaa9c296f1
--- /dev/null
+++ b/linkis-engineconn-plugins/nebula/src/main/assembly/distribution.xml
@@ -0,0 +1,71 @@
+
+
+
+
+ linkis-engineplugin-nebula
+
+ dir
+ zip
+
+ true
+ nebula
+
+
+
+
+
+ /dist/${nebula.version}/lib
+ true
+ true
+ false
+ false
+ true
+
+
+
+
+
+
+
+ ${basedir}/src/main/resources
+
+ linkis-engineconn.properties
+ log4j2.xml
+
+ 0777
+ dist/${nebula.version}/conf
+ unix
+
+
+
+ ${basedir}/target
+
+ *.jar
+
+
+ *doc.jar
+
+ 0777
+ plugin/${nebula.version}
+
+
+
+
+
+
diff --git a/linkis-engineconn-plugins/nebula/src/main/java/org/apache/linkis/engineplugin/nebula/NebulaEngineConnPlugin.java b/linkis-engineconn-plugins/nebula/src/main/java/org/apache/linkis/engineplugin/nebula/NebulaEngineConnPlugin.java
new file mode 100644
index 0000000000..a22d2c8a84
--- /dev/null
+++ b/linkis-engineconn-plugins/nebula/src/main/java/org/apache/linkis/engineplugin/nebula/NebulaEngineConnPlugin.java
@@ -0,0 +1,72 @@
+/*
+ * 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.linkis.engineplugin.nebula;
+
+import org.apache.linkis.engineplugin.nebula.builder.NebulaProcessEngineConnLaunchBuilder;
+import org.apache.linkis.engineplugin.nebula.factory.NebulaEngineConnFactory;
+import org.apache.linkis.manager.engineplugin.common.EngineConnPlugin;
+import org.apache.linkis.manager.engineplugin.common.creation.EngineConnFactory;
+import org.apache.linkis.manager.engineplugin.common.launch.EngineConnLaunchBuilder;
+import org.apache.linkis.manager.engineplugin.common.resource.EngineResourceFactory;
+import org.apache.linkis.manager.engineplugin.common.resource.GenericEngineResourceFactory;
+import org.apache.linkis.manager.label.entity.Label;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class NebulaEngineConnPlugin implements EngineConnPlugin {
+ private Object resourceLocker = new Object();
+ private Object engineFactoryLocker = new Object();
+ private volatile EngineResourceFactory engineResourceFactory;
+ private volatile EngineConnFactory engineFactory;
+ private List