ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbhowm...@apache.org
Subject [08/10] ambari git commit: AMBARI-17079. Moved Hue to Ambari migrator to standard view architecture (Pradarttana Panda via dipayanb)
Date Thu, 30 Jun 2016 06:55:59 GMT
http://git-wip-us.apache.org/repos/asf/ambari/blob/c86672cb/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/QuerySet.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/QuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/QuerySet.java
new file mode 100644
index 0000000..c81d51a
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/QuerySet.java
@@ -0,0 +1,134 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.hive.savedqueryset;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+
+
+public  abstract class QuerySet {
+
+
+  public PreparedStatement getUseridfromUserName(Connection connection, String username) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchuserIdfromUsernameSql());
+    prSt.setString(1, username);
+    return prSt;
+  }
+
+  public PreparedStatement getQueriesNoStartDateNoEndDate(Connection connection, int id) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateNoEnddateSql());
+    prSt.setInt(1, id);
+    return prSt;
+  }
+
+  public PreparedStatement getQueriesNoStartDateYesEndDate(Connection connection, int id, String enddate) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateYesEnddateSql());
+    prSt.setInt(1, id);
+    prSt.setString(2, enddate);
+    return prSt;
+  }
+
+  public PreparedStatement getQueriesYesStartDateNoEndDate(Connection connection, int id, String startdate) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateNoEnddateSql());
+    prSt.setInt(1, id);
+    prSt.setString(2, startdate);
+    return prSt;
+  }
+
+  public PreparedStatement getQueriesYesStartDateYesEndDate(Connection connection, int id, String startdate, String endate) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateYesEnddateSql());
+    prSt.setInt(1, id);
+    prSt.setString(2, startdate);
+    prSt.setString(3, endate);
+    return prSt;
+  }
+
+  /**
+   * for all user
+   */
+  public PreparedStatement getQueriesNoStartDateNoEndDateAllUser(Connection connection) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateNoEnddateYesallUserSql());
+    return prSt;
+  }
+
+  public PreparedStatement getQueriesNoStartDateYesEndDateAllUser(Connection connection, String enddate) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateYesEnddateYesallUserSql());
+    prSt.setString(1, enddate);
+    return prSt;
+  }
+
+  public PreparedStatement getQueriesYesStartDateNoEndDateAllUser(Connection connection, String startdate) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateNoEnddateYesallUserSql());
+    prSt.setString(1, startdate);
+    return prSt;
+  }
+
+  public PreparedStatement getQueriesYesStartDateYesEndDateAllUser(Connection connection, String startdate, String endate) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateYesEnddateYesallUserSql());
+    prSt.setString(1, startdate);
+    prSt.setString(2, endate);
+    return prSt;
+  }
+
+
+  protected String fetchuserIdfromUsernameSql() {
+    return "select id from auth_user where username=?;";
+
+  }
+
+  protected String fetchHueQueriesNoStartdateNoEnddateSql() {
+    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query'and owner_id =?;";
+  }
+
+  protected String fetchHueQueriesNoStartdateYesEnddateSql() {
+    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query'and owner_id =? AND mtime <= date(?);";
+  }
+
+  protected String fetchHueQueriesYesStartdateNoEnddateSql() {
+    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query'and owner_id =? AND mtime >= date(?);";
+
+  }
+
+  protected String fetchHueQueriesYesStartdateYesEnddateSql() {
+    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query'and owner_id =? AND mtime >= date(?) AND mtime <= date(?);";
+
+  }
+
+  protected String fetchHueQueriesNoStartdateNoEnddateYesallUserSql() {
+    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query';";
+  }
+
+  protected String fetchHueQueriesNoStartdateYesEnddateYesallUserSql() {
+    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query' AND mtime <= date(?);";
+
+  }
+
+  protected String fetchHueQueriesYesStartdateNoEnddateYesallUserSql() {
+    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query' AND mtime >= date(?);";
+
+  }
+
+  protected String fetchHueQueriesYesStartdateYesEnddateYesallUserSql() {
+    return "select data,name,owner_id from beeswax_savedquery where name!='My saved query' AND mtime >= date(?) AND mtime <= date(?);";
+
+  }
+
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c86672cb/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/SqliteQuerySet.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/SqliteQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/SqliteQuerySet.java
new file mode 100644
index 0000000..3460353
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/SqliteQuerySet.java
@@ -0,0 +1,22 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.hive.savedqueryset;
+
+
+public class SqliteQuerySet extends QuerySet {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c86672cb/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/MysqlQuerySet.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/MysqlQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/MysqlQuerySet.java
new file mode 100644
index 0000000..a9e2ef5
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/MysqlQuerySet.java
@@ -0,0 +1,22 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.jobqueryset;
+
+
+public class MysqlQuerySet extends QuerySet {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c86672cb/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/OracleQuerySet.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/OracleQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/OracleQuerySet.java
new file mode 100644
index 0000000..4f9e749
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/OracleQuerySet.java
@@ -0,0 +1,65 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.jobqueryset;
+
+
+public class OracleQuerySet extends QuerySet {
+  @Override
+  protected String fetchuserIdfromUsernameSql() {
+    return   "select id from auth_user where username=?";
+
+  }
+  @Override
+  protected String fetchHueQueriesNoStartdateNoEnddateSql() {
+    return "select status,start_time,statusdir,script_title,user_id from pig_job where user_id =?";
+  }
+  @Override
+  protected String fetchHueQueriesNoStartdateYesEnddateSql() {
+    return "select status,start_time,statusdir,script_title,user_id from pig_job where user_id =?  AND start_time <= date(?)";
+
+  }
+  @Override
+  protected String fetchHueQueriesYesStartdateNoEnddateSql() {
+    return "select status,start_time,statusdir,script_title,user_id from pig_job where user_id =? AND start_time >= date(?)";
+
+  }
+  @Override
+  protected String fetchHueQueriesYesStartdateYesEnddateSql() {
+    return "select status,start_time,statusdir,script_title,user_id from pig_job where user_id =? AND start_time >= date(?) AND start_time <= date(?)";
+
+  }
+  @Override
+  protected String fetchHueQueriesNoStartdateNoEnddateYesallUserSql() {
+    return "select status,start_time,statusdir,script_title,user_id from pig_job ";
+  }
+  @Override
+  protected String fetchHueQueriesNoStartdateYesEnddateYesallUserSql() {
+    return "select status,start_time,statusdir,script_title,user_id from pig_job where  start_time <= date(?)";
+
+  }
+  @Override
+  protected String fetchHueQueriesYesStartdateNoEnddateYesallUserSql() {
+    return "select status,start_time,statusdir,script_title,user_id from pig_job where  start_time >= date(?)";
+
+  }
+  @Override
+  protected String fetchHueQueriesYesStartdateYesEnddateYesallUserSql() {
+    return "select status,start_time,statusdir,script_title,user_id from pig_job where  start_time >= date(?) AND start_time <= date(?)";
+
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c86672cb/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/PostgressQuerySet.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/PostgressQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/PostgressQuerySet.java
new file mode 100644
index 0000000..84a66f1
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/PostgressQuerySet.java
@@ -0,0 +1,22 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.jobqueryset;
+
+
+public class PostgressQuerySet extends QuerySet {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c86672cb/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/QuerySet.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/QuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/QuerySet.java
new file mode 100644
index 0000000..b9bdf9a
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/QuerySet.java
@@ -0,0 +1,132 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.jobqueryset;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+
+
+public abstract class QuerySet {
+
+  public PreparedStatement getUseridfromUserName(Connection connection, String username) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchuserIdfromUsernameSql());
+    prSt.setString(1, username);
+    return prSt;
+  }
+
+  public PreparedStatement getQueriesNoStartDateNoEndDate(Connection connection, int id) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateNoEnddateSql());
+    prSt.setInt(1, id);
+    return prSt;
+  }
+
+  public PreparedStatement getQueriesNoStartDateYesEndDate(Connection connection, int id, String enddate) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateYesEnddateSql());
+    prSt.setInt(1, id);
+    prSt.setString(2, enddate);
+    return prSt;
+  }
+
+  public PreparedStatement getQueriesYesStartDateNoEndDate(Connection connection, int id, String startdate) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateNoEnddateSql());
+    prSt.setInt(1, id);
+    prSt.setString(2, startdate);
+    return prSt;
+  }
+
+  public PreparedStatement getQueriesYesStartDateYesEndDate(Connection connection, int id, String startdate, String endate) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateYesEnddateSql());
+    prSt.setInt(1, id);
+    prSt.setString(2, startdate);
+    prSt.setString(3, endate);
+    return prSt;
+  }
+
+  /**
+   * for all user
+   */
+  public PreparedStatement getQueriesNoStartDateNoEndDateAllUser(Connection connection) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateNoEnddateYesallUserSql());
+    return prSt;
+  }
+
+  public PreparedStatement getQueriesNoStartDateYesEndDateAllUser(Connection connection, String enddate) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateYesEnddateYesallUserSql());
+    prSt.setString(1, enddate);
+    return prSt;
+  }
+
+  public PreparedStatement getQueriesYesStartDateNoEndDateAllUser(Connection connection, String startdate) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateNoEnddateYesallUserSql());
+    prSt.setString(1, startdate);
+    return prSt;
+  }
+
+  public PreparedStatement getQueriesYesStartDateYesEndDateAllUser(Connection connection, String startdate, String endate) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateYesEnddateYesallUserSql());
+    prSt.setString(1, startdate);
+    prSt.setString(2, endate);
+    return prSt;
+  }
+
+  protected String fetchuserIdfromUsernameSql() {
+    return "select id from auth_user where username=?;";
+
+  }
+
+  protected String fetchHueQueriesNoStartdateNoEnddateSql() {
+    return "select status,start_time,statusdir,script_title,user_id from pig_job where user_id =?;";
+  }
+
+  protected String fetchHueQueriesNoStartdateYesEnddateSql() {
+    return "select status,start_time,statusdir,script_title,user_id from pig_job where user_id =?  AND start_time <= date(?);";
+
+  }
+
+  protected String fetchHueQueriesYesStartdateNoEnddateSql() {
+    return "select status,start_time,statusdir,script_title,user_id from pig_job where user_id =? AND start_time >= date(?);";
+
+  }
+
+  protected String fetchHueQueriesYesStartdateYesEnddateSql() {
+    return "select status,start_time,statusdir,script_title,user_id from pig_job where user_id =? AND start_time >= date(?) AND start_time <= date(?);";
+
+  }
+
+  protected String fetchHueQueriesNoStartdateNoEnddateYesallUserSql() {
+    return "select status,start_time,statusdir,script_title,user_id from pig_job ;";
+  }
+
+  protected String fetchHueQueriesNoStartdateYesEnddateYesallUserSql() {
+    return "select status,start_time,statusdir,script_title,user_id from pig_job where  start_time <= date(?);";
+
+  }
+
+  protected String fetchHueQueriesYesStartdateNoEnddateYesallUserSql() {
+    return "select status,start_time,statusdir,script_title,user_id from pig_job where  start_time >= date(?);";
+
+  }
+
+  protected String fetchHueQueriesYesStartdateYesEnddateYesallUserSql() {
+    return "select status,start_time,statusdir,script_title,user_id from pig_job where  start_time >= date(?) AND start_time <= date(?);";
+
+  }
+
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c86672cb/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/SqliteQuerySet.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/SqliteQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/SqliteQuerySet.java
new file mode 100644
index 0000000..af216fe
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/jobqueryset/SqliteQuerySet.java
@@ -0,0 +1,22 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.jobqueryset;
+
+
+public class SqliteQuerySet extends QuerySet {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c86672cb/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/MysqlQuerySet.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/MysqlQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/MysqlQuerySet.java
new file mode 100644
index 0000000..6c27993
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/MysqlQuerySet.java
@@ -0,0 +1,22 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.savedscriptqueryset;
+
+
+public class MysqlQuerySet extends QuerySet {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c86672cb/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/OracleQuerySet.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/OracleQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/OracleQuerySet.java
new file mode 100644
index 0000000..70e46d7
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/OracleQuerySet.java
@@ -0,0 +1,60 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.savedscriptqueryset;
+
+
+public class OracleQuerySet extends QuerySet {
+
+  @Override
+  protected String fetchuserIdfromUsernameSql() {
+    return "select id from auth_user where username=?";
+  }
+  @Override
+  protected String fetchHueQueriesNoStartdateNoEnddateSql() {
+    return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 AND user_id =?";
+  }
+  @Override
+  protected String fetchHueQueriesNoStartdateYesEnddateSql() {
+    return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 AND user_id =? AND  date_created <= date(?)";
+  }
+  @Override
+  protected String fetchHueQueriesYesStartdateNoEnddateSql() {
+    return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 AND user_id =? AND date_created >= date(?)";
+  }
+  @Override
+  protected String fetchHueQueriesYesStartdateYesEnddateSql() {
+    return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 AND user_id =? AND date_created >= date(?) AND date_created <= date(?)";
+  }
+  @Override
+  protected String fetchHueQueriesNoStartdateNoEnddateYesallUserSql() {
+    return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 ";
+  }
+  @Override
+  protected String fetchHueQueriesNoStartdateYesEnddateYesallUserSql() {
+    return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1  AND  date_created <= date(?)";
+  }
+  @Override
+  protected String fetchHueQueriesYesStartdateNoEnddateYesallUserSql() {
+    return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1  AND date_created >= date(?)";
+  }
+  @Override
+  protected String fetchHueQueriesYesStartdateYesEnddateYesallUserSql() {
+    return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1  AND date_created >= date(?) AND date_created <= date(?)";
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c86672cb/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/PostgressQuerySet.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/PostgressQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/PostgressQuerySet.java
new file mode 100644
index 0000000..90939f1
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/PostgressQuerySet.java
@@ -0,0 +1,67 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.savedscriptqueryset;
+
+
+public class PostgressQuerySet extends QuerySet {
+
+  @Override
+  protected String fetchuserIdfromUsernameSql() {
+    return "select id from auth_user where username=?;";
+
+  }
+  @Override
+  protected String fetchHueQueriesNoStartdateNoEnddateSql() {
+    return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved='true' AND user_id =?;";
+  }
+  @Override
+  protected String fetchHueQueriesNoStartdateYesEnddateSql() {
+    return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved='true' AND user_id =? AND  date_created <= date(?);";
+
+  }
+  @Override
+  protected String fetchHueQueriesYesStartdateNoEnddateSql() {
+    return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved='true' AND user_id =? AND date_created >= date(?);";
+
+
+  }
+  @Override
+  protected String fetchHueQueriesYesStartdateYesEnddateSql() {
+    return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved='true' AND user_id =? AND date_created >= date(?) AND date_created <= date(?);";
+
+  }
+  @Override
+  protected String fetchHueQueriesNoStartdateNoEnddateYesallUserSql() {
+    return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved='true' ;";
+  }
+  @Override
+  protected String fetchHueQueriesNoStartdateYesEnddateYesallUserSql() {
+    return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved='true'  AND  date_created <= date(?);";
+
+  }
+  @Override
+  protected String fetchHueQueriesYesStartdateNoEnddateYesallUserSql() {
+    return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved='true'  AND date_created >= date(?);";
+
+  }
+  @Override
+  protected String fetchHueQueriesYesStartdateYesEnddateYesallUserSql() {
+    return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved='true'  AND date_created >= date(?) AND date_created <= date(?);";
+
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c86672cb/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/QuerySet.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/QuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/QuerySet.java
new file mode 100644
index 0000000..eebf242
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/QuerySet.java
@@ -0,0 +1,135 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.savedscriptqueryset;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+
+
+public abstract class QuerySet {
+
+  public PreparedStatement getUseridfromUserName(Connection connection,String username) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchuserIdfromUsernameSql());
+    prSt.setString(1, username);
+    return prSt;
+  }
+
+  public PreparedStatement getQueriesNoStartDateNoEndDate(Connection connection,int id) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateNoEnddateSql());
+    prSt.setInt(1, id);
+    return prSt;
+  }
+
+  public PreparedStatement getQueriesNoStartDateYesEndDate(Connection connection,int id,String enddate) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateYesEnddateSql());
+    prSt.setInt(1, id);
+    prSt.setString(2, enddate);
+    return prSt;
+  }
+
+  public PreparedStatement getQueriesYesStartDateNoEndDate(Connection connection,int id,String startdate) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateNoEnddateSql());
+    prSt.setInt(1, id);
+    prSt.setString(2, startdate);
+    return prSt;
+  }
+
+  public PreparedStatement getQueriesYesStartDateYesEndDate(Connection connection,int id,String startdate,String endate) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateYesEnddateSql());
+    prSt.setInt(1, id);
+    prSt.setString(2, startdate);
+    prSt.setString(3, endate);
+    return prSt;
+  }
+
+  /**
+   * for all user
+   * */
+  public PreparedStatement getQueriesNoStartDateNoEndDateAllUser(Connection connection) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateNoEnddateYesallUserSql());
+    return prSt;
+  }
+
+  public PreparedStatement getQueriesNoStartDateYesEndDateAllUser(Connection connection,String enddate) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesNoStartdateYesEnddateYesallUserSql());
+    prSt.setString(1, enddate);
+    return prSt;
+  }
+
+  public PreparedStatement getQueriesYesStartDateNoEndDateAllUser(Connection connection,String startdate) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateNoEnddateYesallUserSql());
+    prSt.setString(1, startdate);
+    return prSt;
+  }
+
+  public PreparedStatement getQueriesYesStartDateYesEndDateAllUser(Connection connection,String startdate,String endate) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchHueQueriesYesStartdateYesEnddateYesallUserSql());
+    prSt.setString(1, startdate);
+    prSt.setString(2, endate);
+    return prSt;
+  }
+
+
+  protected String fetchuserIdfromUsernameSql() {
+    return "select id from auth_user where username=?;";
+
+  }
+
+  protected String fetchHueQueriesNoStartdateNoEnddateSql() {
+    return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 AND user_id =?;";
+  }
+
+  protected String fetchHueQueriesNoStartdateYesEnddateSql() {
+    return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 AND user_id =? AND  date_created <= date(?);";
+
+  }
+
+  protected String fetchHueQueriesYesStartdateNoEnddateSql() {
+    return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 AND user_id =? AND date_created >= date(?);";
+
+
+  }
+
+  protected String fetchHueQueriesYesStartdateYesEnddateSql() {
+    return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 AND user_id =? AND date_created >= date(?) AND date_created <= date(?);";
+
+  }
+
+  protected String fetchHueQueriesNoStartdateNoEnddateYesallUserSql() {
+    return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 ;";
+  }
+
+  protected String fetchHueQueriesNoStartdateYesEnddateYesallUserSql() {
+    return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1  AND  date_created <= date(?);";
+
+  }
+
+  protected String fetchHueQueriesYesStartdateNoEnddateYesallUserSql() {
+    return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1  AND date_created >= date(?);";
+
+  }
+
+  protected String fetchHueQueriesYesStartdateYesEnddateYesallUserSql() {
+    return "select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1  AND date_created >= date(?) AND date_created <= date(?);";
+
+  }
+
+
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c86672cb/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/SqliteQuerySet.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/SqliteQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/SqliteQuerySet.java
new file mode 100644
index 0000000..2b1a283
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/pig/savedscriptqueryset/SqliteQuerySet.java
@@ -0,0 +1,24 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.savedscriptqueryset;
+
+
+public class SqliteQuerySet extends QuerySet {
+
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c86672cb/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/userdetails/MysqlQuerySet.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/userdetails/MysqlQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/userdetails/MysqlQuerySet.java
new file mode 100644
index 0000000..dc4e4e4
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/userdetails/MysqlQuerySet.java
@@ -0,0 +1,24 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.userdetails;
+
+
+public class MysqlQuerySet extends QuerySet {
+
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c86672cb/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/userdetails/OracleQuerySet.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/userdetails/OracleQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/userdetails/OracleQuerySet.java
new file mode 100644
index 0000000..04ffe70
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/userdetails/OracleQuerySet.java
@@ -0,0 +1,28 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.userdetails;
+
+
+public class OracleQuerySet extends QuerySet {
+
+
+  @Override
+  protected String fetchUserDetailSql() {
+    return "select * from auth_user";
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c86672cb/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/userdetails/PostgressQuerySet.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/userdetails/PostgressQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/userdetails/PostgressQuerySet.java
new file mode 100644
index 0000000..7277211
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/userdetails/PostgressQuerySet.java
@@ -0,0 +1,22 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.userdetails;
+
+
+public class PostgressQuerySet extends QuerySet {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c86672cb/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/userdetails/QuerySet.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/userdetails/QuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/userdetails/QuerySet.java
new file mode 100644
index 0000000..677b119
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/userdetails/QuerySet.java
@@ -0,0 +1,42 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.userdetails;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+
+
+public abstract class QuerySet {
+
+
+  public PreparedStatement getUserDetails(Connection connection) throws SQLException {
+    PreparedStatement prSt = connection.prepareStatement(fetchUserDetailSql());
+    return prSt;
+  }
+
+
+
+  protected String fetchUserDetailSql() {
+    return "select * from auth_user;";
+  }
+
+
+
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c86672cb/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/userdetails/SqliteQuerySet.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/userdetails/SqliteQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/userdetails/SqliteQuerySet.java
new file mode 100644
index 0000000..7260b6a
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/userdetails/SqliteQuerySet.java
@@ -0,0 +1,22 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.userdetails;
+
+
+public class SqliteQuerySet extends QuerySet {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c86672cb/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/CreateJobId.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/CreateJobId.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/CreateJobId.java
new file mode 100644
index 0000000..24f12bf
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/CreateJobId.java
@@ -0,0 +1,85 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.ambari.view.huetoambarimigration.migration;
+
+import com.google.inject.Inject;
+import org.apache.ambari.view.ViewContext;
+import org.apache.ambari.view.huetoambarimigration.resources.scripts.models.JobReturnIdModel;
+import org.apache.ambari.view.huetoambarimigration.resources.PersonalCRUDResourceManager;
+import org.apache.ambari.view.huetoambarimigration.resources.scripts.MigrationResourceManager;
+import org.apache.ambari.view.huetoambarimigration.resources.scripts.models.MigrationResponse;
+import org.json.simple.JSONObject;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+
+@Path("/returnjobids")
+
+public class CreateJobId {
+
+
+
+
+  @Inject
+  ViewContext view;
+
+
+  protected MigrationResourceManager resourceManager = null;
+
+  public synchronized PersonalCRUDResourceManager<MigrationResponse> getResourceManager() {
+    if (resourceManager == null) {
+      resourceManager = new MigrationResourceManager(view);
+    }
+    return resourceManager;
+  }
+
+  @GET
+  @Produces(MediaType.APPLICATION_JSON)
+  public Response getIdOfMigrationObject(@QueryParam("username") String username,@QueryParam("instance") String instance,@QueryParam("startdate") String startdate,@QueryParam("enddate") String enddate,@QueryParam("jobtype") String jobtype) throws IOException, InvocationTargetException, IllegalAccessException {
+
+    System.out.println("username is "+username+ "instance is "+ instance);
+    MigrationResponse migrationresult=new MigrationResponse();
+
+    migrationresult.setIntanceName(instance);
+    migrationresult.setUserNameofhue(username);
+    migrationresult.setProgressPercentage(0);
+    migrationresult.setJobtype(jobtype);
+
+    getResourceManager().create(migrationresult);
+
+    JSONObject response = new JSONObject();
+
+    JobReturnIdModel model=new JobReturnIdModel();
+
+    model.setIdforJob(migrationresult.getId());
+    model.setId(0);
+
+    response.put("returnjobid",model);
+
+    return Response.ok(response).build();
+
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c86672cb/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/CreateJobIdRevertChange.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/CreateJobIdRevertChange.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/CreateJobIdRevertChange.java
new file mode 100644
index 0000000..325e880
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/CreateJobIdRevertChange.java
@@ -0,0 +1,84 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.ambari.view.huetoambarimigration.migration;
+
+import com.google.inject.Inject;
+import org.apache.ambari.view.ViewContext;
+import org.apache.ambari.view.huetoambarimigration.resources.scripts.models.JobReturnIdModel;
+import org.apache.ambari.view.huetoambarimigration.resources.PersonalCRUDResourceManager;
+import org.apache.ambari.view.huetoambarimigration.resources.scripts.MigrationResourceManager;
+import org.apache.ambari.view.huetoambarimigration.resources.scripts.models.MigrationResponse;
+import org.json.simple.JSONObject;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+
+@Path("/returnjobidforrevertchanges")
+
+public class CreateJobIdRevertChange {
+
+
+
+
+  @Inject
+  ViewContext view;
+
+
+  protected MigrationResourceManager resourceManager = null;
+
+  public synchronized PersonalCRUDResourceManager<MigrationResponse> getResourceManager() {
+    if (resourceManager == null) {
+      resourceManager = new MigrationResourceManager(view);
+    }
+    return resourceManager;
+  }
+
+  @GET
+  @Produces(MediaType.APPLICATION_JSON)
+  public Response getIdOfMigrationObject(@QueryParam("instance") String instance,@QueryParam("revertdate") String revertdate) throws IOException, InvocationTargetException, IllegalAccessException {
+
+
+    MigrationResponse migrationresult=new MigrationResponse();
+
+    migrationresult.setIntanceName(instance);
+    migrationresult.setProgressPercentage(0);
+    migrationresult.setJobtype("revertchange");
+
+    getResourceManager().create(migrationresult);
+
+    JSONObject response = new JSONObject();
+
+    JobReturnIdModel model=new JobReturnIdModel();
+
+    model.setIdforJob(migrationresult.getId());
+    model.setId(0);
+
+    response.put("returnjobidforrevertchanges",model);
+
+    return Response.ok(response).build();
+
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c86672cb/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/InitiateJobMigration.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/InitiateJobMigration.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/InitiateJobMigration.java
new file mode 100644
index 0000000..b1131bb
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/InitiateJobMigration.java
@@ -0,0 +1,102 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.ambari.view.huetoambarimigration.migration;
+
+import com.google.inject.Inject;
+import org.apache.ambari.view.ViewContext;
+import org.apache.ambari.view.huetoambarimigration.migration.hive.historyquery.HiveHistoryStartJob;
+import org.apache.ambari.view.huetoambarimigration.resources.PersonalCRUDResourceManager;
+import org.apache.ambari.view.huetoambarimigration.resources.scripts.MigrationResourceManager;
+import org.apache.ambari.view.huetoambarimigration.resources.scripts.models.MigrationResponse;
+import org.apache.ambari.view.huetoambarimigration.migration.hive.savedquery.HiveSavedQueryStartJob;
+import org.apache.ambari.view.huetoambarimigration.migration.pig.pigjob.PigJobStartJob;
+import org.apache.ambari.view.huetoambarimigration.migration.pig.pigscript.PigSavedScriptStartJob;
+import org.json.simple.JSONObject;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+
+@Path("/startmigrations")
+
+public class InitiateJobMigration implements Runnable {
+
+  MigrationResponse migrationresult = new MigrationResponse();
+
+  public void run() {
+
+  }
+
+
+  @Inject
+  ViewContext view;
+
+
+  protected MigrationResourceManager resourceManager = null;
+
+  public synchronized PersonalCRUDResourceManager<MigrationResponse> getResourceManager() {
+    if (resourceManager == null) {
+      resourceManager = new MigrationResourceManager(view);
+    }
+    return resourceManager;
+  }
+
+  @GET
+  @Produces(MediaType.APPLICATION_JSON)
+
+  public Response inititateJOb(@QueryParam("username") String username, @QueryParam("instance") String instance, @QueryParam("startdate") String startdate, @QueryParam("enddate") String enddate, @QueryParam("jobid") String jobid, @QueryParam("jobtype") String jobtype) throws IOException, InvocationTargetException, IllegalAccessException {
+
+    System.out.println("username is " + username + "instance is " + instance);
+
+    JSONObject response = new JSONObject();
+
+    if (jobtype.contains("hivehistoryquerymigration")) {
+
+      new HiveHistoryStartJob(username, instance, startdate, enddate, jobid, view).start();
+    } else if (jobtype.contains("hivesavedquerymigration")) {
+
+      new HiveSavedQueryStartJob(username, instance, startdate, enddate, jobid, view).start();
+
+    } else if (jobtype.contains("pigjobmigration")) {
+
+      new PigJobStartJob(username, instance, startdate, enddate, jobid, view).start();
+
+    } else if (jobtype.contains("pigsavedscriptmigration")) {
+
+      new PigSavedScriptStartJob(username, instance, startdate, enddate, jobid, view).start();
+
+    }
+
+
+    migrationresult.setId(jobid);
+    migrationresult.setProgressPercentage(0);
+
+
+    response.put("startmigration", migrationresult);
+
+    return Response.ok(response).build();
+
+  }
+
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c86672cb/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/InitiateJobMigrationforRevertchange.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/InitiateJobMigrationforRevertchange.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/InitiateJobMigrationforRevertchange.java
new file mode 100644
index 0000000..d323f73
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/InitiateJobMigrationforRevertchange.java
@@ -0,0 +1,85 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.ambari.view.huetoambarimigration.migration;
+
+import com.google.inject.Inject;
+import org.apache.ambari.view.ViewContext;
+import org.apache.ambari.view.huetoambarimigration.resources.PersonalCRUDResourceManager;
+import org.apache.ambari.view.huetoambarimigration.resources.scripts.MigrationResourceManager;
+import org.apache.ambari.view.huetoambarimigration.resources.scripts.models.MigrationResponse;
+import org.apache.ambari.view.huetoambarimigration.migration.revertchange.RevertChangeStartJob;
+import org.json.simple.JSONObject;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+
+@Path("/startrevertchanges")
+
+public class InitiateJobMigrationforRevertchange implements Runnable{
+
+  MigrationResponse migrationresult=new MigrationResponse();
+
+  public void run(){
+
+  }
+
+
+  @Inject
+  ViewContext view;
+
+
+  protected MigrationResourceManager resourceManager = null;
+
+  public synchronized PersonalCRUDResourceManager<MigrationResponse> getResourceManager() {
+    if (resourceManager == null) {
+      resourceManager = new MigrationResourceManager(view);
+    }
+    return resourceManager;
+  }
+
+  @GET
+  @Produces(MediaType.APPLICATION_JSON)
+
+  public Response RevertChangeJob(@QueryParam("instance") String instance,@QueryParam("revertdate") String revertdate,@QueryParam("jobid") String jobid) throws IOException, InvocationTargetException, IllegalAccessException {
+
+    JSONObject response = new JSONObject();
+
+    new RevertChangeStartJob(instance,revertdate,jobid, view).start();
+
+    migrationresult.setId(jobid);
+    migrationresult.setProgressPercentage(0);
+    migrationresult.setJobtype("revertchange");
+    migrationresult.setIntanceName(instance);
+
+    new RevertChangeStartJob(instance,revertdate,jobid, view).start();
+
+    response.put("startrevertchanges",migrationresult);
+
+    return Response.ok(response).build();
+
+  }
+
+
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c86672cb/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/configuration/AllInstanceDetailsAmbari.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/configuration/AllInstanceDetailsAmbari.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/configuration/AllInstanceDetailsAmbari.java
new file mode 100644
index 0000000..d93f370
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/configuration/AllInstanceDetailsAmbari.java
@@ -0,0 +1,59 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.ambari.view.huetoambarimigration.migration.configuration;
+
+
+import com.google.inject.Inject;
+import org.apache.ambari.view.ViewContext;
+import org.json.simple.JSONObject;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.beans.PropertyVetoException;
+import java.io.IOException;
+import java.sql.SQLException;
+
+/**
+ * sevice class for fetching
+ * all the instace details
+ */
+
+@Path("/allinstancedetails")
+
+public class AllInstanceDetailsAmbari {
+
+  @Inject
+  ViewContext view;
+
+  @GET
+  @Produces(MediaType.APPLICATION_JSON)
+  public Response instancelist() throws IOException, PropertyVetoException, SQLException {
+
+    HiveInstanceDetailsUtility instance = new HiveInstanceDetailsUtility();
+
+    JSONObject response = new JSONObject();
+    response.put("allinstancedetails", instance.getAllInstancedetails(view));
+    return Response.ok(response).build();
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c86672cb/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/configuration/AmbariDatabaseCheck.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/configuration/AmbariDatabaseCheck.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/configuration/AmbariDatabaseCheck.java
new file mode 100644
index 0000000..08d148b
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/configuration/AmbariDatabaseCheck.java
@@ -0,0 +1,62 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.ambari.view.huetoambarimigration.migration.configuration;
+
+
+import com.google.inject.Inject;
+import org.apache.ambari.view.ViewContext;
+import org.apache.ambari.view.huetoambarimigration.utils.ServiceFormattedException;
+import org.json.simple.JSONObject;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.io.IOException;
+
+/**
+ * Service class to check ambari database
+ */
+
+@Path("/ambaridatabases")
+
+public class AmbariDatabaseCheck {
+
+  @Inject
+  ViewContext view;
+
+  @GET
+  @Produces(MediaType.APPLICATION_JSON)
+  public Response ambariDatabase() throws IOException {
+    JSONObject response = new JSONObject();
+    try {
+      response.put("ambaridatabase", ConfigurationCheckImplementation.checkAmbariDatbaseConection(view.getProperties().get("ambaridrivername"), view.getProperties().get("ambarijdbcurl"), view.getProperties().get("ambaridbusername"), view.getProperties().get("ambaridbpassword")));
+      return Response.ok(response).build();
+    } catch (WebApplicationException ex) {
+      throw ex;
+    } catch (Exception ex) {
+      throw new ServiceFormattedException(ex.getMessage(), ex);
+    }
+
+  }
+
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c86672cb/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/configuration/AmbariWebHdfsCheck.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/configuration/AmbariWebHdfsCheck.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/configuration/AmbariWebHdfsCheck.java
new file mode 100644
index 0000000..0bc7e4b
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/configuration/AmbariWebHdfsCheck.java
@@ -0,0 +1,60 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.ambari.view.huetoambarimigration.migration.configuration;
+
+
+import com.google.inject.Inject;
+import org.apache.ambari.view.ViewContext;
+import org.apache.ambari.view.huetoambarimigration.utils.ServiceFormattedException;
+import org.json.simple.JSONObject;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.io.IOException;
+import java.net.URISyntaxException;
+
+/**
+ * Service class Ambari Webhdfs Check
+ */
+@Path("/ambariwebhdfsurls")
+public class AmbariWebHdfsCheck {
+
+  @Inject
+  ViewContext view;
+
+  @GET
+  @Produces(MediaType.APPLICATION_JSON)
+  public Response ambariWebHdfs() throws IOException, URISyntaxException {
+    JSONObject response = new JSONObject();
+    try {
+      response.put("ambariwebhdfsurl", ConfigurationCheckImplementation.checkNamenodeURIConnectionforambari(view.getProperties().get("namenode_URI_Ambari")));
+      return Response.ok(response).build();
+    } catch (WebApplicationException ex) {
+      throw ex;
+    } catch (Exception ex) {
+      throw new ServiceFormattedException(ex.getMessage(), ex);
+    }
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c86672cb/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/configuration/CheckProgresStatus.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/configuration/CheckProgresStatus.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/configuration/CheckProgresStatus.java
new file mode 100644
index 0000000..8d70ddb
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/configuration/CheckProgresStatus.java
@@ -0,0 +1,70 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.ambari.view.huetoambarimigration.migration.configuration;
+
+import com.google.inject.Inject;
+import org.apache.ambari.view.ViewContext;
+import org.apache.ambari.view.huetoambarimigration.persistence.utils.ItemNotFound;
+import org.apache.ambari.view.huetoambarimigration.resources.PersonalCRUDResourceManager;
+import org.apache.ambari.view.huetoambarimigration.resources.scripts.MigrationResourceManager;
+import org.apache.ambari.view.huetoambarimigration.resources.scripts.models.MigrationResponse;
+import org.json.simple.JSONObject;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+
+/**
+ * Service class to check progress
+ */
+
+@Path("/checkprogresses")
+
+public class CheckProgresStatus {
+
+  @Inject
+  ViewContext view;
+
+  protected MigrationResourceManager resourceManager = null;
+
+  public synchronized PersonalCRUDResourceManager<MigrationResponse> getResourceManager() {
+    if (resourceManager == null) {
+      resourceManager = new MigrationResourceManager(view);
+    }
+    return resourceManager;
+  }
+
+  @GET
+  @Produces(MediaType.APPLICATION_JSON)
+
+  public Response checkProgressStatus(@QueryParam("jobid") String jobid) throws IOException, InvocationTargetException, IllegalAccessException, ItemNotFound {
+
+    MigrationResponse mr = null;
+    mr = getResourceManager().read(jobid);
+    JSONObject object = new JSONObject();
+    object.put("checkprogress", mr);
+    return Response.ok(object).build();
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c86672cb/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/configuration/ConfigurationCheckImplementation.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/configuration/ConfigurationCheckImplementation.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/configuration/ConfigurationCheckImplementation.java
new file mode 100644
index 0000000..e61b2ab
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/configuration/ConfigurationCheckImplementation.java
@@ -0,0 +1,134 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.ambari.view.huetoambarimigration.migration.configuration;
+
+import org.apache.ambari.view.huetoambarimigration.datasource.DataSourceAmbariDatabase;
+import org.apache.ambari.view.huetoambarimigration.datasource.DataSourceHueDatabase;
+import org.apache.ambari.view.huetoambarimigration.resources.scripts.models.ConfigurationModel;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.hdfs.web.WebHdfsFileSystem;
+import org.apache.log4j.Logger;
+
+import java.beans.PropertyVetoException;
+import java.io.IOException;
+import java.net.*;
+import java.sql.Connection;
+import java.sql.SQLException;
+
+/**
+ * Configuration check Implenetation class
+ */
+
+public class ConfigurationCheckImplementation {
+
+  static final Logger logger = Logger.getLogger(ConfigurationCheckImplementation.class);
+
+  private static String homeDir = System.getProperty("java.io.tmpdir") + "/";
+
+  public static ConfigurationModel checkConfigurationForHue(String hueURL) throws IOException {
+
+    URL url = null;
+    int resonseCode = 0;
+    ConfigurationModel hueHttpUrl = new ConfigurationModel();
+    hueHttpUrl.setId(1);
+    hueHttpUrl.setConfigParameter("hueHtttpUrl");
+    url = new URL(hueURL);
+
+    HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+    connection.setRequestMethod("GET");  //OR  huc.setRequestMethod ("HEAD");
+    connection.connect();
+    resonseCode = connection.getResponseCode();
+    if (resonseCode == 200) {
+      hueHttpUrl.setConfigStatus("Success");
+    } else {
+      hueHttpUrl.setConfigStatus("Failed");
+    }
+    return hueHttpUrl;
+  }
+
+  public static ConfigurationModel checkHueDatabaseConnection(String hueDBDRiver, String hueJdbcUrl, String huedbUsername, String huedbPassword) throws IOException, PropertyVetoException, SQLException {
+
+    ConfigurationModel configmodelHueDB = new ConfigurationModel();
+    configmodelHueDB.setId(4);
+    configmodelHueDB.setConfigParameter("huedb");
+    Connection con = DataSourceHueDatabase.getInstance(hueDBDRiver, hueJdbcUrl, huedbUsername, huedbPassword).getConnection();
+    configmodelHueDB.setConfigStatus("Success");
+    return configmodelHueDB;
+  }
+
+  public static ConfigurationModel checkAmbariDatbaseConection(String ambariDBDriver, String ambariDBJdbcUrl, String ambariDbUsername, String ambariDbPassword) throws IOException, PropertyVetoException, SQLException {
+
+    ConfigurationModel configmodelAmbariDB = new ConfigurationModel();
+    configmodelAmbariDB.setId(5);
+    configmodelAmbariDB.setConfigParameter("ambaridb");
+    Connection con = DataSourceAmbariDatabase.getInstance(ambariDBDriver, ambariDBJdbcUrl, ambariDbUsername, ambariDbPassword).getConnection();
+    configmodelAmbariDB.setConfigStatus("Success");
+    return configmodelAmbariDB;
+  }
+
+  public static String getHomeDir() {
+    return homeDir;
+  }
+
+  public static ConfigurationModel checkNamenodeURIConnectionforambari(String ambariServerNameNode) throws Exception {
+
+    ConfigurationModel configmodelWebhdfsAmbari = new ConfigurationModel();
+    configmodelWebhdfsAmbari.setId(6);
+    configmodelWebhdfsAmbari.setConfigParameter("ambariwebhdfsurl");
+    Configuration conf = new Configuration();
+    conf.set("fs.hdfs.impl",
+      org.apache.hadoop.hdfs.DistributedFileSystem.class.getName());
+    conf.set("fs.file.impl",
+      org.apache.hadoop.fs.LocalFileSystem.class.getName()
+    );
+    FileSystem fileSystem = FileSystem.get(new URI(ambariServerNameNode), conf);
+
+    if (fileSystem instanceof WebHdfsFileSystem) {
+      configmodelWebhdfsAmbari.setConfigStatus("Success");
+    } else {
+      configmodelWebhdfsAmbari.setConfigStatus("Failed");
+      throw new Exception();
+    }
+    return configmodelWebhdfsAmbari;
+  }
+
+  public static ConfigurationModel checkNamenodeURIConnectionforHue(String hueServerNamenodeURI) throws Exception {
+
+    ConfigurationModel configmodelWebhdfsHue = new ConfigurationModel();
+    configmodelWebhdfsHue.setId(7);
+    configmodelWebhdfsHue.setConfigParameter("huewebhdfsurl");
+    Configuration conf = new Configuration();
+    conf.set("fs.hdfs.impl",
+      org.apache.hadoop.hdfs.DistributedFileSystem.class.getName()
+    );
+    conf.set("fs.file.impl",
+      org.apache.hadoop.fs.LocalFileSystem.class.getName()
+    );
+    FileSystem fileSystem = FileSystem.get(new URI(hueServerNamenodeURI), conf);
+
+    if (fileSystem instanceof WebHdfsFileSystem) {
+      configmodelWebhdfsHue.setConfigStatus("Success");
+    } else {
+      configmodelWebhdfsHue.setConfigStatus("Failed");
+      throw new Exception();
+    }
+    return configmodelWebhdfsHue;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c86672cb/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/configuration/HiveInstanceDetailsAmbari.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/configuration/HiveInstanceDetailsAmbari.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/configuration/HiveInstanceDetailsAmbari.java
new file mode 100644
index 0000000..e898a6d
--- /dev/null
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/configuration/HiveInstanceDetailsAmbari.java
@@ -0,0 +1,53 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.ambari.view.huetoambarimigration.migration.configuration;
+
+import com.google.inject.Inject;
+import org.apache.ambari.view.ViewContext;
+import org.json.simple.JSONObject;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.beans.PropertyVetoException;
+import java.io.IOException;
+import java.sql.SQLException;
+
+/**
+ * Service class to fetch hiveinstalcedetail
+ */
+
+@Path("/hiveinstancedetails")
+
+public class HiveInstanceDetailsAmbari {
+
+  @Inject
+  ViewContext view;
+
+  @GET
+  @Produces(MediaType.APPLICATION_JSON)
+  public Response instancelist() throws IOException, PropertyVetoException, SQLException {
+    HiveInstanceDetailsUtility instance=new HiveInstanceDetailsUtility();
+    JSONObject response = new JSONObject();
+    response.put("hiveinstancedetails",instance.getInstancedetails(view));
+    return Response.ok(response).build();
+  }
+
+}


Mime
View raw message