falcon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject [1/2] falcon git commit: FALCON-2066 Extend support for Import and Export of various database types
Date Tue, 19 Jul 2016 18:43:54 GMT
Repository: falcon
Updated Branches:
  refs/heads/master 9a4c18c7d -> 292dfed34


http://git-wip-us.apache.org/repos/asf/falcon/blob/292dfed3/oozie/src/main/java/org/apache/falcon/oozie/ImportExportCommon.java
----------------------------------------------------------------------
diff --git a/oozie/src/main/java/org/apache/falcon/oozie/ImportExportCommon.java b/oozie/src/main/java/org/apache/falcon/oozie/ImportExportCommon.java
index fafd56e..3e8ca73 100644
--- a/oozie/src/main/java/org/apache/falcon/oozie/ImportExportCommon.java
+++ b/oozie/src/main/java/org/apache/falcon/oozie/ImportExportCommon.java
@@ -27,6 +27,7 @@ import org.apache.falcon.entity.v0.cluster.Cluster;
 import org.apache.falcon.entity.v0.datasource.Credential;
 import org.apache.falcon.entity.v0.datasource.Credentialtype;
 import org.apache.falcon.entity.v0.datasource.Datasource;
+import org.apache.falcon.entity.v0.datasource.DatasourceType;
 import org.apache.falcon.entity.v0.feed.Feed;
 import org.apache.falcon.oozie.sqoop.ACTION;
 import org.apache.falcon.oozie.workflow.WORKFLOWAPP;
@@ -60,9 +61,8 @@ public final class ImportExportCommon {
     private ImportExportCommon() {
     }
 
-    static StringBuilder buildUserPasswordArg(StringBuilder builder, StringBuilder sqoopOpts,
Datasource db)
+    static StringBuilder buildUserPasswordArg(StringBuilder builder, StringBuilder sqoopOpts,
Credential cred)
         throws FalconException {
-        Credential cred = DatasourceHelper.getReadPasswordInfo(db);
         builder.append("--username").append(ARG_SEPARATOR)
                 .append(cred.getUserName())
                 .append(ARG_SEPARATOR);
@@ -111,4 +111,22 @@ public final class ImportExportCommon {
         return Splitter.on(";").withKeyValueSeparator("=").split(partitionStr);
     }
 
+    public static StringBuilder buildDriverArgs(StringBuilder builder, Datasource db)
+        throws FalconException {
+        if ((db.getType() == DatasourceType.GENERIC) && (db.getDriver() != null)
+                && (db.getDriver().getClazz() != null)) {
+            builder.append("--driver").append(ImportExportCommon.ARG_SEPARATOR).append(db.getDriver().getClazz());
+        }
+        return builder;
+    }
+
+    public static StringBuilder buildConnectArg(StringBuilder builder, String endPoint) throws
FalconException {
+        return builder.append("--connect").append(ImportExportCommon.ARG_SEPARATOR)
+                .append(endPoint);
+    }
+
+    public static StringBuilder buildTableArg(StringBuilder builder, String tableName) throws
FalconException {
+        return builder.append("--table").append(ImportExportCommon.ARG_SEPARATOR)
+                .append(tableName);
+    }
 }

http://git-wip-us.apache.org/repos/asf/falcon/blob/292dfed3/oozie/src/main/java/org/apache/falcon/oozie/OozieOrchestrationWorkflowBuilder.java
----------------------------------------------------------------------
diff --git a/oozie/src/main/java/org/apache/falcon/oozie/OozieOrchestrationWorkflowBuilder.java
b/oozie/src/main/java/org/apache/falcon/oozie/OozieOrchestrationWorkflowBuilder.java
index 0801899..5ad3d03 100644
--- a/oozie/src/main/java/org/apache/falcon/oozie/OozieOrchestrationWorkflowBuilder.java
+++ b/oozie/src/main/java/org/apache/falcon/oozie/OozieOrchestrationWorkflowBuilder.java
@@ -29,7 +29,6 @@ import org.apache.falcon.entity.HiveUtil;
 import org.apache.falcon.entity.v0.Entity;
 import org.apache.falcon.entity.v0.cluster.Cluster;
 import org.apache.falcon.entity.v0.cluster.ClusterLocationType;
-import org.apache.falcon.entity.v0.datasource.DatasourceType;
 import org.apache.falcon.entity.v0.feed.Feed;
 import org.apache.falcon.entity.v0.process.Process;
 import org.apache.falcon.hadoop.HadoopClientFactory;
@@ -150,26 +149,10 @@ public abstract class OozieOrchestrationWorkflowBuilder<T extends
Entity> extend
                 }
 
             case IMPORT:
-                DatasourceType dsType = EntityUtil.getImportDatasourceType(cluster, feed);
-                if ((dsType == DatasourceType.MYSQL)
-                    || (dsType == DatasourceType.ORACLE)
-                    || (dsType == DatasourceType.HSQL)) {
-                    return new DatabaseImportWorkflowBuilder(feed);
-                } else {
-                    LOG.info("Import policy not implemented for DataSourceType : " + dsType);
-                }
-                break;
+                return new DatabaseImportWorkflowBuilder(feed);
 
             case EXPORT:
-                dsType = EntityUtil.getExportDatasourceType(cluster, feed);
-                if ((dsType == DatasourceType.MYSQL)
-                        || (dsType == DatasourceType.ORACLE)
-                        || (dsType == DatasourceType.HSQL)) {
-                    return new DatabaseExportWorkflowBuilder(feed);
-                } else {
-                    LOG.info("Export policy not implemented for DataSourceType : " + dsType);
-                }
-                break;
+                return new DatabaseExportWorkflowBuilder(feed);
 
             default:
                 throw new IllegalArgumentException("Unhandled type " + entity.getEntityType()


Mime
View raw message