Эх сурвалжийг харах

HUE-2745 [dbms] Add licenses and basi makefile

Romain Rigaux 10 жил өмнө
parent
commit
31a626ff08

+ 28 - 0
desktop/libs/librdbms/Makefile

@@ -34,3 +34,31 @@ default::
 env-install: compile ext-env-install
 env-install: compile ext-env-install
 	@echo '--- Installing $(APP_NAME) into virtual-env'
 	@echo '--- Installing $(APP_NAME) into virtual-env'
 	@$(ENV_PYTHON) setup.py develop -N -q
 	@$(ENV_PYTHON) setup.py develop -N -q
+
+
+###################################
+# Build DBProxy plugin
+###################################
+
+PLUGIN_DIR := $(realpath .)
+PLUGIN_JAVA_LIB := $(PLUGIN_DIR)/java-lib
+PLUGIN_JAVA_DIR := $(PLUGIN_DIR)/java
+BLD_DIR_PLUGINS := $(PLUGIN_DIR)/java/target
+
+compile: $(DESKTOP_PLUGIN_JAR)
+
+# Build the plugin jar iff the source is present
+ifneq (,$(wildcard $(PLUGIN_JAVA_DIR)))
+$(DESKTOP_PLUGIN_JAR): $(shell find $(PLUGIN_JAVA_DIR) -type f)
+  mkdir -p $(PLUGIN_JAVA_LIB)
+  @echo "--- Building DBProxy plugin"
+  cd $(PLUGIN_JAVA_DIR) && mvn clean install -DskipTests $(MAVEN_OPTIONS)
+  cp $(BLD_DIR_PLUGINS)/dbproxy-$(MAVEN_VERSION).jar $(DESKTOP_PLUGIN_JAR)
+
+clean::
+  rm -rf $(PLUGIN_JAVA_LIB)
+  cd $(PLUGIN_JAVA_DIR) && mvn clean $(MAVEN_OPTIONS) ||:
+else
+$(DESKTOP_PLUGIN_JAR):
+  $(error Cannot build DBProxy plugin without source)
+endif

+ 18 - 6
desktop/libs/librdbms/java/pom.xml

@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+   Licensed to Cloudera, Inc. 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.
+-->
+
 <project xmlns="http://maven.apache.org/POM/4.0.0"
 <project xmlns="http://maven.apache.org/POM/4.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
@@ -14,12 +32,6 @@
             <artifactId>py4j</artifactId>
             <artifactId>py4j</artifactId>
             <version>0.8.2.1</version>
             <version>0.8.2.1</version>
         </dependency>
         </dependency>
-
-        <dependency>
-            <groupId>mysql</groupId>
-            <artifactId>mysql-connector-java</artifactId>
-            <version>5.1.34</version>
-        </dependency>
     </dependencies>
     </dependencies>
 
 
     <build>
     <build>

+ 18 - 1
desktop/libs/librdbms/java/query.py

@@ -1,3 +1,20 @@
+#!/usr/bin/env python
+# Licensed to Cloudera, Inc. under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  Cloudera, Inc. 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.
+
 from py4j.java_gateway import JavaGateway
 from py4j.java_gateway import JavaGateway
 
 
 gateway = JavaGateway()
 gateway = JavaGateway()
@@ -19,7 +36,7 @@ try:
       md = rs.getMetaData()
       md = rs.getMetaData()
 
 
       for i in xrange(md.getColumnCount()):
       for i in xrange(md.getColumnCount()):
-         print md.getColumnTypeName(i + 1)
+        print md.getColumnTypeName(i + 1)
 
 
       while rs.next():
       while rs.next():
         username = rs.getString("username")
         username = rs.getString("username")

+ 18 - 0
desktop/libs/librdbms/java/src/main/java/com/cloudera/hue/dbproxy/DBProxy.java

@@ -1,3 +1,21 @@
+/**
+ * Licensed to Cloudera, Inc. under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  Cloudera, Inc. 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.cloudera.hue.dbproxy;
 package com.cloudera.hue.dbproxy;
 
 
 import py4j.GatewayServer;
 import py4j.GatewayServer;