http://git-wip-us.apache.org/repos/asf/ambari/blob/283256c8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/historyqueryset/OracleQuerySetAmbariDB.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/historyqueryset/OracleQuerySetAmbariDB.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/historyqueryset/OracleQuerySetAmbariDB.java deleted file mode 100644 index f3349c6..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/historyqueryset/OracleQuerySetAmbariDB.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * 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.ambariqueryset.hive.historyqueryset; - -/** - * - * Overriding methods for Oracle specific queries - */ - -public class OracleQuerySetAmbariDB extends QuerySetAmbariDB { - - @Override - protected String getSqlMaxDSidFromTableId(int id) { - return "select MAX(cast(ds_id as integer)) as max from ds_jobimpl_" + id + ""; - } - @Override - protected String getTableIdSqlFromInstanceName() { - return "select id from viewentity where class_name LIKE 'org.apache.ambari.view.hive.resources.jobs.viewJobs.JobImpl' and view_instance_name=?"; - } - @Override - protected String getSqlInsertHiveHistory(int id) { - return "INSERT INTO ds_jobimpl_" + id + " values (?,'','','','','default',?,0,'','',?,'admin',?,'','job','','','Unknown',?,'','Worksheet')"; - } - @Override - protected String getRevSql(int id,String maxcount){ - return "delete from ds_jobimpl_" + id + " where ds_id='" + maxcount + "'"; - } - -}
http://git-wip-us.apache.org/repos/asf/ambari/blob/283256c8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/historyqueryset/PostgressQuerySetAmbariDB.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/historyqueryset/PostgressQuerySetAmbariDB.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/historyqueryset/PostgressQuerySetAmbariDB.java deleted file mode 100644 index 5f4356b..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/historyqueryset/PostgressQuerySetAmbariDB.java +++ /dev/null @@ -1,22 +0,0 @@ -/** - * 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.ambariqueryset.hive.historyqueryset; - - -public class PostgressQuerySetAmbariDB extends QuerySetAmbariDB { -} http://git-wip-us.apache.org/repos/asf/ambari/blob/283256c8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/historyqueryset/QuerySetAmbariDB.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/historyqueryset/QuerySetAmbariDB.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/historyqueryset/QuerySetAmbariDB.java deleted file mode 100644 index 5be8cc1..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/historyqueryset/QuerySetAmbariDB.java +++ /dev/null @@ -1,79 +0,0 @@ -/** - * 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.ambariqueryset.hive.historyqueryset; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; - -/** - * History Query Prepared statemets - */ - -public abstract class QuerySetAmbariDB { - - public PreparedStatement getTableIdFromInstanceName(Connection connection, String instance) throws SQLException { - PreparedStatement prSt = connection.prepareStatement(getTableIdSqlFromInstanceName()); - prSt.setString(1, instance); - return prSt; - } - - public PreparedStatement getMaxDsIdFromTableId(Connection connection, int id) throws SQLException { - - PreparedStatement prSt = connection.prepareStatement(getSqlMaxDSidFromTableId(id)); - - return prSt; - } - - public PreparedStatement insertToHiveHistory(Connection connection, int id, String maxcount, long epochtime, String dirname) throws SQLException { - - String Logfile= dirname + "logs"; - String queryHqlFile= dirname + "query.hql"; - - PreparedStatement prSt = connection.prepareStatement(getSqlInsertHiveHistory(id)); - - prSt.setString(1, maxcount); - prSt.setLong(2, epochtime); - prSt.setString(3, Logfile); - prSt.setString(4, queryHqlFile); - prSt.setString(5, dirname); - - return prSt; - } - - public String RevertSql(int id,String maxcount) throws SQLException { - return getRevSql(id,maxcount); - } - - protected String getSqlMaxDSidFromTableId(int id) { - return "select MAX(cast(ds_id as integer)) as max from ds_jobimpl_" + id + ";"; - } - - protected String getTableIdSqlFromInstanceName() { - return "select id from viewentity where class_name LIKE 'org.apache.ambari.view.hive.resources.jobs.viewJobs.JobImpl' and view_instance_name=?;"; - } - - protected String getSqlInsertHiveHistory(int id) { - return "INSERT INTO ds_jobimpl_" + id + " values (?,'','','','','default',?,0,'','',?,'admin',?,'','job','','','Unknown',?,'','Worksheet');"; - } - - protected String getRevSql(int id,String maxcount){ - return "delete from ds_jobimpl_" + id + " where ds_id='" + maxcount + "';"; - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/283256c8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/instancedetail/MysqlQuerySetAmbariDB.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/instancedetail/MysqlQuerySetAmbariDB.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/instancedetail/MysqlQuerySetAmbariDB.java deleted file mode 100644 index b3a0323..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/instancedetail/MysqlQuerySetAmbariDB.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * 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.ambariqueryset.hive.instancedetail; - - -public class MysqlQuerySetAmbariDB extends QuerySetAmbariDB { - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/283256c8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/instancedetail/OracleQuerySetAmbariDB.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/instancedetail/OracleQuerySetAmbariDB.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/instancedetail/OracleQuerySetAmbariDB.java deleted file mode 100644 index bc41bf7..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/instancedetail/OracleQuerySetAmbariDB.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * 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.ambariqueryset.hive.instancedetail; - - -public class OracleQuerySetAmbariDB extends QuerySetAmbariDB { - - @Override - protected String getHiveInstanceSql(){ - return "select distinct(view_instance_name) as instancename from viewentity where view_name='HIVE{1.0.0}'"; - } - @Override - protected String getAllInstanceDetailSql(){ - return "select distinct(view_instance_name) as instancename from viewentity where view_name='HIVE{1.0.0}' or view_name='PIG{1.0.0}';"; - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/283256c8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/instancedetail/PostgressQuerySetAmbariDB.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/instancedetail/PostgressQuerySetAmbariDB.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/instancedetail/PostgressQuerySetAmbariDB.java deleted file mode 100644 index 3297f32..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/instancedetail/PostgressQuerySetAmbariDB.java +++ /dev/null @@ -1,22 +0,0 @@ -/** - * 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.ambariqueryset.hive.instancedetail; - - -public class PostgressQuerySetAmbariDB extends QuerySetAmbariDB { -} http://git-wip-us.apache.org/repos/asf/ambari/blob/283256c8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/instancedetail/QuerySetAmbariDB.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/instancedetail/QuerySetAmbariDB.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/instancedetail/QuerySetAmbariDB.java deleted file mode 100644 index da1c411..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/instancedetail/QuerySetAmbariDB.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * 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.ambariqueryset.hive.instancedetail; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; - -/** - * Service class to get instance detail - */ - -public abstract class QuerySetAmbariDB { - - public PreparedStatement getHiveInstanceDeatil(Connection connection) throws SQLException { - PreparedStatement prSt = connection.prepareStatement(getHiveInstanceSql()); - return prSt; - } - - public PreparedStatement getAllInstanceDeatil(Connection connection) throws SQLException { - PreparedStatement prSt = connection.prepareStatement(getAllInstanceDetailSql()); - return prSt; - } - - protected String getHiveInstanceSql(){ - return "select distinct(view_instance_name) as instancename from viewentity where view_name='HIVE{1.0.0}';"; - } - - protected String getAllInstanceDetailSql(){ - return "select distinct(view_instance_name) as instancename from viewentity where view_name='HIVE{1.0.0}' or view_name='PIG{1.0.0}';"; - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/283256c8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/savedqueryset/MysqlQuerySetAmbariDB.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/savedqueryset/MysqlQuerySetAmbariDB.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/savedqueryset/MysqlQuerySetAmbariDB.java deleted file mode 100644 index 2b40491..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/savedqueryset/MysqlQuerySetAmbariDB.java +++ /dev/null @@ -1,65 +0,0 @@ -/** - * 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.ambariqueryset.hive.savedqueryset; - -/** - * override methods specific to Mysql - */ - -public class MysqlQuerySetAmbariDB extends QuerySetAmbariDB { - - @Override - protected String getSqlMaxDSidFromTableIdSavedQuery(int id) { - return "select max( cast(ds_id as unsigned) ) as max from DS_SAVEDQUERY_" + id + ";"; - } - - @Override - protected String getTableIdSqlFromInstanceNameSavedQuery() { - return "select id from viewentity where class_name LIKE 'org.apache.ambari.view.hive.resources.savedQueries.SavedQuery' and view_instance_name=?;"; - } - - @Override - protected String getSqlMaxDSidFromTableIdHistoryQuery(int id) { - return "select MAX(cast(ds_id as integer)) as max from DS_JOBIMPL_" + id + ";"; - } - - @Override - protected String getTableIdSqlFromInstanceNameHistoryQuery() { - return "select id from viewentity where class_name LIKE 'org.apache.ambari.view.hive.resources.jobs.viewJobs.JobImpl' and view_instance_name=?;"; - } - - @Override - protected String getSqlInsertHiveHistory(int id) { - return "INSERT INTO DS_JOBIMPL_" + id + " values (?,'','','','','default',?,0,'','',?,'admin',?,'','job','','','Unknown',?,'','Worksheet');"; - } - - @Override - protected String getSqlInsertSavedQuery(int id) { - return "INSERT INTO DS_SAVEDQUERY_" + id + " values (?,?,'" + "admin" + "',?,?,?);"; - } - - @Override - protected String getRevSqlSavedQuery(int id, String maxcount) { - return "delete from DS_SAVEDQUERY_" + id + " where ds_id='" + maxcount + "';"; - } - - @Override - protected String getRevSqlHistoryQuery(int id, String maxcount) { - return "delete from DS_JOBIMPL_" + id + " where ds_id='" + maxcount + "';"; - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/283256c8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/savedqueryset/OracleQuerySetAmbariDB.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/savedqueryset/OracleQuerySetAmbariDB.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/savedqueryset/OracleQuerySetAmbariDB.java deleted file mode 100644 index 11f9170..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/savedqueryset/OracleQuerySetAmbariDB.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * 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.ambariqueryset.hive.savedqueryset; - -public class OracleQuerySetAmbariDB extends QuerySetAmbariDB { - - @Override - protected String getSqlMaxDSidFromTableIdSavedQuery(int id) { - return "select MAX(cast(ds_id as integer)) as max from ds_savedquery_" + id + ""; - } - - @Override - protected String getTableIdSqlFromInstanceNameSavedQuery() { - return "select id from viewentity where class_name LIKE 'org.apache.ambari.view.hive.resources.savedQueries.SavedQuery' and view_instance_name=?"; - } - - @Override - protected String getSqlMaxDSidFromTableIdHistoryQuery(int id) { - return "select MAX(cast(ds_id as integer)) as max from ds_jobimpl_" + id + ""; - } - @Override - protected String getTableIdSqlFromInstanceNameHistoryQuery() { - return "select id from viewentity where class_name LIKE 'org.apache.ambari.view.hive.resources.jobs.viewJobs.JobImpl' and view_instance_name=?"; - } - - @Override - protected String getSqlInsertHiveHistory(int id) { - return "INSERT INTO ds_jobimpl_" + id + " values (?,'','','','','default',?,0,'','',?,'admin',?,'','job','','','Unknown',?,'','Worksheet')"; - } - @Override - protected String getSqlInsertSavedQuery(int id) { - return "INSERT INTO ds_savedquery_" + id + " values (?,?,'" + "admin" + "',?,?,?)"; - } - - @Override - protected String getRevSqlSavedQuery(int id, String maxcount) { - return "delete from ds_savedquery_" + id + " where ds_id='" + maxcount + "'"; - } - @Override - protected String getRevSqlHistoryQuery(int id, String maxcount) { - return "delete from ds_jobimpl_" + id + " where ds_id='" + maxcount + "'"; - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/283256c8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/savedqueryset/PostgressQuerySetAmbariDB.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/savedqueryset/PostgressQuerySetAmbariDB.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/savedqueryset/PostgressQuerySetAmbariDB.java deleted file mode 100644 index 7c8eeab..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/savedqueryset/PostgressQuerySetAmbariDB.java +++ /dev/null @@ -1,22 +0,0 @@ -/** - * 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.ambariqueryset.hive.savedqueryset; - - -public class PostgressQuerySetAmbariDB extends QuerySetAmbariDB { -} http://git-wip-us.apache.org/repos/asf/ambari/blob/283256c8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/savedqueryset/QuerySetAmbariDB.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/savedqueryset/QuerySetAmbariDB.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/savedqueryset/QuerySetAmbariDB.java deleted file mode 100644 index 8ab13b2..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/hive/savedqueryset/QuerySetAmbariDB.java +++ /dev/null @@ -1,131 +0,0 @@ -/** - * 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.ambariqueryset.hive.savedqueryset; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; - -/** - * Prepared statement for Saved query - */ - -public abstract class QuerySetAmbariDB { - - public PreparedStatement getTableIdFromInstanceNameSavedquery(Connection connection, String instance) throws SQLException { - - PreparedStatement prSt = connection.prepareStatement(getTableIdSqlFromInstanceNameSavedQuery()); - prSt.setString(1, instance); - return prSt; - } - - public PreparedStatement getTableIdFromInstanceNameHistoryquery(Connection connection, String instance) throws SQLException { - - PreparedStatement prSt = connection.prepareStatement(getTableIdSqlFromInstanceNameHistoryQuery()); - prSt.setString(1, instance); - return prSt; - } - - public PreparedStatement getMaxDsIdFromTableIdHistoryquery(Connection connection, int id) throws SQLException { - - PreparedStatement prSt = connection.prepareStatement(getSqlMaxDSidFromTableIdHistoryQuery(id)); - return prSt; - } - - public PreparedStatement getMaxDsIdFromTableIdSavedquery(Connection connection, int id) throws SQLException { - - PreparedStatement prSt = connection.prepareStatement(getSqlMaxDSidFromTableIdSavedQuery(id)); - - return prSt; - } - - public PreparedStatement insertToHiveHistory(Connection connection, int id, String maxcount, long epochtime, String dirname) throws SQLException { - - String Logfile = dirname + "logs"; - String queryHqlFile = dirname + "query.hql"; - - PreparedStatement prSt = connection.prepareStatement(getSqlInsertHiveHistory(id)); - - prSt.setString(1, maxcount); - prSt.setLong(2, epochtime); - prSt.setString(3, Logfile); - prSt.setString(4, queryHqlFile); - prSt.setString(5, dirname); - - return prSt; - } - - public PreparedStatement insertToHiveSavedQuery(Connection connection, int id, String maxcount, String database, String dirname, String query, String name) throws SQLException { - - String Logfile = dirname + "logs"; - String queryHqlFile = dirname + "query.hql"; - - PreparedStatement prSt = connection.prepareStatement(getSqlInsertSavedQuery(id)); - - prSt.setString(1, maxcount); - prSt.setString(2, database); - prSt.setString(3, queryHqlFile); - prSt.setString(4, query); - prSt.setString(5, name); - - return prSt; - } - - public String revertSqlHistoryQuery(int id, String maxcount) throws SQLException { - - return getRevSqlHistoryQuery(id, maxcount); - } - - public String revertSqlSavedQuery(int id, String maxcount) throws SQLException { - - return getRevSqlSavedQuery(id, maxcount); - } - - protected String getSqlMaxDSidFromTableIdSavedQuery(int id) { - return "select MAX(cast(ds_id as integer)) as max from ds_savedquery_" + id + ";"; - } - - protected String getTableIdSqlFromInstanceNameSavedQuery() { - return "select id from viewentity where class_name LIKE 'org.apache.ambari.view.hive.resources.savedQueries.SavedQuery' and view_instance_name=?;"; - } - - protected String getSqlMaxDSidFromTableIdHistoryQuery(int id) { - return "select MAX(cast(ds_id as integer)) as max from ds_jobimpl_" + id + ";"; - } - - protected String getTableIdSqlFromInstanceNameHistoryQuery() { - return "select id from viewentity where class_name LIKE 'org.apache.ambari.view.hive.resources.jobs.viewJobs.JobImpl' and view_instance_name=?;"; - } - - protected String getSqlInsertHiveHistory(int id) { - return "INSERT INTO ds_jobimpl_" + id + " values (?,'','','','','default',?,0,'','',?,'admin',?,'','job','','','Unknown',?,'','Worksheet');"; - } - - protected String getSqlInsertSavedQuery(int id) { - return "INSERT INTO ds_savedquery_" + id + " values (?,?,'" + "admin" + "',?,?,?);"; - } - - protected String getRevSqlSavedQuery(int id, String maxcount) { - return "delete from ds_savedquery_" + id + " where ds_id='" + maxcount + "';"; - } - - protected String getRevSqlHistoryQuery(int id, String maxcount) { - return "delete from ds_jobimpl_" + id + " where ds_id='" + maxcount + "';"; - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/283256c8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/instancedetail/MysqlQuerySetAmbariDB.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/instancedetail/MysqlQuerySetAmbariDB.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/instancedetail/MysqlQuerySetAmbariDB.java deleted file mode 100644 index 429a598..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/instancedetail/MysqlQuerySetAmbariDB.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * 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.ambariqueryset.pig.instancedetail; - - -public class MysqlQuerySetAmbariDB extends QuerySetAmbariDB { - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/283256c8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/instancedetail/OracleQuerySetAmbariDB.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/instancedetail/OracleQuerySetAmbariDB.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/instancedetail/OracleQuerySetAmbariDB.java deleted file mode 100644 index e8b4265..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/instancedetail/OracleQuerySetAmbariDB.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * 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.ambariqueryset.pig.instancedetail; - -/** - * override method specific to Query. - */ -public class OracleQuerySetAmbariDB extends QuerySetAmbariDB { - - @Override - protected String getPigInstanceSql(){ - return "select distinct(view_instance_name) as instancename from viewentity where view_name='PIG{1.0.0}'"; - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/283256c8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/instancedetail/PostgressQuerySetAmbariDB.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/instancedetail/PostgressQuerySetAmbariDB.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/instancedetail/PostgressQuerySetAmbariDB.java deleted file mode 100644 index 8b7f27b..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/instancedetail/PostgressQuerySetAmbariDB.java +++ /dev/null @@ -1,22 +0,0 @@ -/** - * 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.ambariqueryset.pig.instancedetail; - - -public class PostgressQuerySetAmbariDB extends QuerySetAmbariDB { -} http://git-wip-us.apache.org/repos/asf/ambari/blob/283256c8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/instancedetail/QuerySetAmbariDB.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/instancedetail/QuerySetAmbariDB.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/instancedetail/QuerySetAmbariDB.java deleted file mode 100644 index 6d878fe..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/instancedetail/QuerySetAmbariDB.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * 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.ambariqueryset.pig.instancedetail; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; - -/** - * Prepared statement for Pig Instance details - */ - -public abstract class QuerySetAmbariDB { - - public PreparedStatement getAllPigInstance(Connection connection) throws SQLException { - PreparedStatement prSt = connection.prepareStatement(getPigInstanceSql()); - return prSt; - } - - protected String getPigInstanceSql(){ - return "select distinct(view_instance_name) as instancename from viewentity where view_name='PIG{1.0.0}';"; - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/283256c8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/jobqueryset/MysqlQuerySetAmbariDB.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/jobqueryset/MysqlQuerySetAmbariDB.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/jobqueryset/MysqlQuerySetAmbariDB.java deleted file mode 100644 index fdc2484..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/jobqueryset/MysqlQuerySetAmbariDB.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * 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.ambariqueryset.pig.jobqueryset; - -/** - * Override method specific to Mysql - */ - -public class MysqlQuerySetAmbariDB extends QuerySetAmbariDB { - - @Override - protected String getSqlMaxDSidFromTableId(int id) { - return "select max( cast(ds_id as unsigned) ) as max from DS_PIGJOB_" + id + ";"; - } - - @Override - protected String getTableIdSqlFromInstanceName() { - return "select id from viewentity where class_name LIKE 'org.apache.ambari.view.pig.resources.jobs.models.PigJob' and view_instance_name=?;"; - } - @Override - protected String getSqlinsertToPigJob(int id) { - return "INSERT INTO DS_PIGJOB_" + id + " values (?,?,0,'','f','','','admin',0,?,'',?,'','',?,?,'',?);"; - } - @Override - protected String getRevSql(int id, String maxcount) { - return "delete from DS_PIGJOB_" + id + " where ds_id='" + maxcount + "';"; - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/283256c8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/jobqueryset/OracleQuerySetAmbariDB.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/jobqueryset/OracleQuerySetAmbariDB.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/jobqueryset/OracleQuerySetAmbariDB.java deleted file mode 100644 index 2c27409..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/jobqueryset/OracleQuerySetAmbariDB.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * 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.ambariqueryset.pig.jobqueryset; - -/** - * Override methods for Oracle - */ -public class OracleQuerySetAmbariDB extends QuerySetAmbariDB { - - @Override - protected String getSqlMaxDSidFromTableId(int id) { - return "select MAX(cast(ds_id as integer)) as max from ds_pigjob_" + id + ""; - } - @Override - protected String getTableIdSqlFromInstanceName() { - return "select id from viewentity where class_name LIKE 'org.apache.ambari.view.pig.resources.jobs.models.PigJob' and view_instance_name=?"; - } - @Override - protected String getSqlinsertToPigJob(int id) { - return "INSERT INTO ds_pigjob_" + id + " values (?,?,0,'','f','','','admin',0,?,'',?,'','',?,?,'',?)"; - } - @Override - protected String getRevSql(int id, String maxcount) { - return "delete from ds_pigjob_" + id + " where ds_id='" + maxcount + "'"; - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/283256c8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/jobqueryset/PostgressQuerySetAmbariDB.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/jobqueryset/PostgressQuerySetAmbariDB.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/jobqueryset/PostgressQuerySetAmbariDB.java deleted file mode 100644 index 07a174c..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/jobqueryset/PostgressQuerySetAmbariDB.java +++ /dev/null @@ -1,22 +0,0 @@ -/** - * 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.ambariqueryset.pig.jobqueryset; - - -public class PostgressQuerySetAmbariDB extends QuerySetAmbariDB { -} http://git-wip-us.apache.org/repos/asf/ambari/blob/283256c8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/jobqueryset/QuerySetAmbariDB.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/jobqueryset/QuerySetAmbariDB.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/jobqueryset/QuerySetAmbariDB.java deleted file mode 100644 index ec70e45..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/jobqueryset/QuerySetAmbariDB.java +++ /dev/null @@ -1,80 +0,0 @@ -/** - * 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.ambariqueryset.pig.jobqueryset; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; - -/** - * Pig Job Prepare statement - */ - -public abstract class QuerySetAmbariDB { - - public PreparedStatement getTableIdFromInstanceName(Connection connection, String instance) throws SQLException { - - PreparedStatement prSt = connection.prepareStatement(getTableIdSqlFromInstanceName()); - prSt.setString(1, instance); - return prSt; - } - - public PreparedStatement getMaxDsIdFromTableId(Connection connection, int id) throws SQLException { - - PreparedStatement prSt = connection.prepareStatement(getSqlMaxDSidFromTableId(id)); - return prSt; - } - - public PreparedStatement insertToPigJob(String dirname, String maxcountforpigjob, long epochtime1, String title, Connection connection, int id, String status) throws SQLException { - - String pigScriptFile = dirname + "script.pig"; - - PreparedStatement prSt = connection.prepareStatement(getSqlinsertToPigJob(id)); - - prSt.setString(1, maxcountforpigjob); - prSt.setLong(2, epochtime1); - prSt.setString(3, pigScriptFile); - prSt.setString(4, maxcountforpigjob); - prSt.setString(5, status); - prSt.setString(6, dirname); - prSt.setString(7, title); - - return prSt; - } - - public String revertSql(int id, String maxcount) throws SQLException { - return getRevSql(id, maxcount); - } - - protected String getSqlMaxDSidFromTableId(int id) { - return "select MAX(cast(ds_id as integer)) as max from ds_pigjob_" + id + ";"; - } - - protected String getTableIdSqlFromInstanceName() { - return "select id from viewentity where class_name LIKE 'org.apache.ambari.view.pig.resources.jobs.models.PigJob' and view_instance_name=?;"; - } - - protected String getSqlinsertToPigJob(int id) { - return "INSERT INTO ds_pigjob_" + id + " values (?,?,0,'','f','','','admin',0,?,'',?,'','',?,?,'',?);"; - } - - protected String getRevSql(int id, String maxcount) { - return "delete from ds_pigjob_" + id + " where ds_id='" + maxcount + "';"; - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/283256c8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/savedscriptqueryset/MysqlQuerySetAmbariDB.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/savedscriptqueryset/MysqlQuerySetAmbariDB.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/savedscriptqueryset/MysqlQuerySetAmbariDB.java deleted file mode 100644 index a8c1c4d..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/savedscriptqueryset/MysqlQuerySetAmbariDB.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * 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.ambariqueryset.pig.savedscriptqueryset; - -/** - * over rides method for Mysql specific queries - */ - -public class MysqlQuerySetAmbariDB extends QuerySetAmbariDB { - - @Override - protected String getSqlMaxDSidFromTableId(int id) { - return "select max( cast(ds_id as unsigned) ) as max from DS_PIGSCRIPT_" + id + ";"; - } - @Override - protected String getTableIdSqlFromInstanceName() { - return "select id from viewentity where class_name LIKE 'org.apache.ambari.view.pig.resources.scripts.models.PigScript' and view_instance_name=?;"; - } - @Override - protected String getSqlinsertToPigScript(int id) { - return "INSERT INTO DS_PIGSCRIPT_" + id + " values (?,'1970-01-17 20:28:55.586000 +00:00:00',0,'admin',?,'','',?);"; - } - @Override - protected String getRevSql(int id,String maxcount){ - return "delete from DS_PIGSCRIPT_" + id + " where ds_id='" + maxcount + "';"; - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/283256c8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/savedscriptqueryset/OracleQuerySetAmbariDB.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/savedscriptqueryset/OracleQuerySetAmbariDB.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/savedscriptqueryset/OracleQuerySetAmbariDB.java deleted file mode 100644 index d7dfc0b..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/savedscriptqueryset/OracleQuerySetAmbariDB.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * 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.ambariqueryset.pig.savedscriptqueryset; - -public class OracleQuerySetAmbariDB extends QuerySetAmbariDB { - /* - * Overriding methods for Oracle specific queries - * */ - - protected String getSqlMaxDSidFromTableId(int id) { - return "select MAX(cast(ds_id as integer)) as max from ds_pigscript_" + id + ""; - } - - protected String getTableIdSqlFromInstanceName() { - return "select id from viewentity where class_name LIKE 'org.apache.ambari.view.pig.resources.scripts.models.PigScript' and view_instance_name=?"; - } - - protected String getSqlinsertToPigScript(int id) { - return "INSERT INTO ds_pigscript_" + id + " values (?,'1970-01-17 20:28:55.586000 +00:00:00','f','admin',?,'','',?)"; - } - - protected String getRevSql(int id, String maxcount) { - return "delete from ds_pigscript_" + id + " where ds_id='" + maxcount + "'"; - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/283256c8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/savedscriptqueryset/PostgressQuerySetAmbariDB.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/savedscriptqueryset/PostgressQuerySetAmbariDB.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/savedscriptqueryset/PostgressQuerySetAmbariDB.java deleted file mode 100644 index fc99751..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/savedscriptqueryset/PostgressQuerySetAmbariDB.java +++ /dev/null @@ -1,22 +0,0 @@ -/** - * 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.ambariqueryset.pig.savedscriptqueryset; - - -public class PostgressQuerySetAmbariDB extends QuerySetAmbariDB { -} http://git-wip-us.apache.org/repos/asf/ambari/blob/283256c8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/savedscriptqueryset/QuerySetAmbariDB.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/savedscriptqueryset/QuerySetAmbariDB.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/savedscriptqueryset/QuerySetAmbariDB.java deleted file mode 100644 index 4fc61fe..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/ambariqueryset/pig/savedscriptqueryset/QuerySetAmbariDB.java +++ /dev/null @@ -1,70 +0,0 @@ -/** - * 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.ambariqueryset.pig.savedscriptqueryset; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; - -/** - * Pig Script prepared statement - */ -public abstract class QuerySetAmbariDB { - - public PreparedStatement getTableIdFromInstanceName(Connection connection, String instance) throws SQLException { - PreparedStatement prSt = connection.prepareStatement(getTableIdSqlFromInstanceName()); - prSt.setString(1, instance); - return prSt; - } - - public PreparedStatement getMaxDsIdFromTableId(Connection connection, int id) throws SQLException { - - PreparedStatement prSt = connection.prepareStatement(getSqlMaxDSidFromTableId(id)); - return prSt; - } - - public PreparedStatement insertToPigScript(Connection connection, int id, String maxcount1, String dirname, String title) throws SQLException { - - PreparedStatement prSt = connection.prepareStatement(getSqlinsertToPigScript(id)); - prSt.setString(1, maxcount1); - prSt.setString(2, dirname); - prSt.setString(3, title); - - return prSt; - } - - public String revertSql(int id, String maxcount) throws SQLException { - return getRevSql(id, maxcount); - } - - protected String getSqlMaxDSidFromTableId(int id) { - return "select MAX(cast(ds_id as integer)) as max from ds_pigscript_" + id + ";"; - } - - protected String getTableIdSqlFromInstanceName() { - return "select id from viewentity where class_name LIKE 'org.apache.ambari.view.pig.resources.scripts.models.PigScript' and view_instance_name=?;"; - } - - protected String getSqlinsertToPigScript(int id) { - return "INSERT INTO ds_pigscript_" + id + " values (?,'1970-01-17 20:28:55.586000 +00:00:00','f','admin',?,'','',?);"; - } - - protected String getRevSql(int id, String maxcount) { - return "delete from ds_pigscript_" + id + " where ds_id='" + maxcount + "';"; - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/283256c8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/MysqlQuerySet.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/MysqlQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/MysqlQuerySet.java deleted file mode 100644 index d379f88..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/MysqlQuerySet.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * 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.historyqueryset; - - -public class MysqlQuerySet extends QuerySet { - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/283256c8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/OracleQuerySet.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/OracleQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/OracleQuerySet.java deleted file mode 100644 index 4afb222..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/OracleQuerySet.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * 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.historyqueryset; - - -public class OracleQuerySet extends QuerySet { - - @Override - protected String fetchuserIdfromUsernameSql() { - return "select id from auth_user where username=?"; - } - @Override - protected String fetchHueQueriesNoStartdateNoEnddateSql() { - return "select query from beeswax_queryhistory where owner_id =?"; - } - @Override - protected String fetchHueQueriesNoStartdateYesEnddateSql() { - return "select query from beeswax_queryhistory where owner_id =? AND submission_date <= date(?)"; - } - @Override - protected String fetchHueQueriesYesStartdateNoEnddateSql() { - return "select query from beeswax_queryhistory where owner_id =? AND submission_date >= date(?)"; - } - @Override - protected String fetchHueQueriesYesStartdateYesEnddateSql() { - return "select query from beeswax_queryhistory where owner_id =? AND submission_date >= date(?) AND submission_date <= date(?)"; - } - @Override - protected String fetchHueQueriesNoStartdateNoEnddateYesallUserSql() { - return "select query from beeswax_queryhistory"; - } - @Override - protected String fetchHueQueriesNoStartdateYesEnddateYesallUserSql() { - return "select query from beeswax_queryhistory where submission_date <= date(?)"; - } - @Override - protected String fetchHueQueriesYesStartdateNoEnddateYesallUserSql() { - return "select query from beeswax_queryhistory where submission_date >= date(?)"; - - } - @Override - protected String fetchHueQueriesYesStartdateYesEnddateYesallUserSql() { - return "select query from beeswax_queryhistory where submission_date >= date(?) AND submission_date <= date(?)"; - - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/283256c8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/PostgressQuerySet.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/PostgressQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/PostgressQuerySet.java deleted file mode 100644 index 829582a..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/PostgressQuerySet.java +++ /dev/null @@ -1,22 +0,0 @@ -/** - * 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.historyqueryset; - - -public class PostgressQuerySet extends QuerySet { -} http://git-wip-us.apache.org/repos/asf/ambari/blob/283256c8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/QuerySet.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/QuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/QuerySet.java deleted file mode 100644 index 8d2aad4..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/QuerySet.java +++ /dev/null @@ -1,130 +0,0 @@ -/** - * 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.historyqueryset; - -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 query from beeswax_queryhistory where owner_id =?;"; - } - - protected String fetchHueQueriesNoStartdateYesEnddateSql() { - return "select query from beeswax_queryhistory where owner_id =? AND submission_date <= date(?);"; - } - - protected String fetchHueQueriesYesStartdateNoEnddateSql() { - return "select query from beeswax_queryhistory where owner_id =? AND submission_date >= date(?);"; - } - - protected String fetchHueQueriesYesStartdateYesEnddateSql() { - return "select query from beeswax_queryhistory where owner_id =? AND submission_date >= date(?) AND submission_date <= date(?);"; - } - - protected String fetchHueQueriesNoStartdateNoEnddateYesallUserSql() { - return "select query from beeswax_queryhistory;"; - } - - protected String fetchHueQueriesNoStartdateYesEnddateYesallUserSql() { - return "select query from beeswax_queryhistory where submission_date <= date(?);"; - } - - protected String fetchHueQueriesYesStartdateNoEnddateYesallUserSql() { - return "select query from beeswax_queryhistory where submission_date >= date(?);"; - - } - - protected String fetchHueQueriesYesStartdateYesEnddateYesallUserSql() { - return "select query from beeswax_queryhistory where submission_date >= date(?) AND submission_date <= date(?);"; - - } - - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/283256c8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/SqliteQuerySet.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/SqliteQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/SqliteQuerySet.java deleted file mode 100644 index 417df3a..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/historyqueryset/SqliteQuerySet.java +++ /dev/null @@ -1,22 +0,0 @@ -/** - * 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.historyqueryset; - - -public class SqliteQuerySet extends QuerySet { -} http://git-wip-us.apache.org/repos/asf/ambari/blob/283256c8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/MysqlQuerySet.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/MysqlQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/MysqlQuerySet.java deleted file mode 100644 index d91633d..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/MysqlQuerySet.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * 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 MysqlQuerySet extends QuerySet { -} http://git-wip-us.apache.org/repos/asf/ambari/blob/283256c8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/OracleQuerySet.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/OracleQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/OracleQuerySet.java deleted file mode 100644 index 3190885..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/OracleQuerySet.java +++ /dev/null @@ -1,65 +0,0 @@ -/** - * 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 OracleQuerySet extends QuerySet { - - @Override - protected String fetchuserIdfromUsernameSql() { - return "select id from auth_user where username=?"; - - } - @Override - protected String fetchHueQueriesNoStartdateNoEnddateSql() { - return "select data,name,owner_id from beeswax_savedquery where name!='My saved query'and owner_id =?"; - } - @Override - protected String fetchHueQueriesNoStartdateYesEnddateSql() { - return "select data,name,owner_id from beeswax_savedquery where name!='My saved query'and owner_id =? AND mtime <= date(?)"; - } - @Override - protected String fetchHueQueriesYesStartdateNoEnddateSql() { - return "select data,name,owner_id from beeswax_savedquery where name!='My saved query'and owner_id =? AND mtime >= date(?)"; - - } - @Override - 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(?)"; - - } - @Override - protected String fetchHueQueriesNoStartdateNoEnddateYesallUserSql() { - return "select data,name,owner_id from beeswax_savedquery where name!='My saved query'"; - } - @Override - protected String fetchHueQueriesNoStartdateYesEnddateYesallUserSql() { - return "select data,name,owner_id from beeswax_savedquery where name!='My saved query' AND mtime <= date(?)"; - - } - @Override - protected String fetchHueQueriesYesStartdateNoEnddateYesallUserSql() { - return "select data,name,owner_id from beeswax_savedquery where name!='My saved query' AND mtime >= date(?)"; - - } - @Override - 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/283256c8/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/PostgressQuerySet.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/PostgressQuerySet.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/PostgressQuerySet.java deleted file mode 100644 index 83d32c7..0000000 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/datasource/queryset/huequeryset/hive/savedqueryset/PostgressQuerySet.java +++ /dev/null @@ -1,22 +0,0 @@ -/** - * 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 PostgressQuerySet extends QuerySet { -}