http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/StatementExecutor.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/StatementExecutor.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/StatementExecutor.java new file mode 100644 index 0000000..03332d9 --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/StatementExecutor.java @@ -0,0 +1,150 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.hive20.actor; + +import akka.actor.ActorRef; +import akka.actor.Props; +import com.google.common.base.Optional; +import org.apache.ambari.view.hive20.ConnectionDelegate; +import org.apache.ambari.view.hive20.actor.message.GetColumnMetadataJob; +import org.apache.ambari.view.hive20.actor.message.HiveMessage; +import org.apache.ambari.view.hive20.actor.message.ResultInformation; +import org.apache.ambari.view.hive20.actor.message.RunStatement; +import org.apache.ambari.view.hive20.actor.message.StartLogAggregation; +import org.apache.ambari.view.hive20.actor.message.job.Failure; +import org.apache.ambari.view.hive20.actor.message.job.UpdateYarnAtsGuid; +import org.apache.ambari.view.hive20.persistence.Storage; +import org.apache.ambari.view.utils.hdfs.HdfsApi; +import org.apache.hive.jdbc.HiveConnection; +import org.apache.hive.jdbc.HiveStatement; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.UUID; + +/** + * Executes a single statement and returns the ResultSet if the statements generates ResultSet. + * Also, starts logAggregation and YarnAtsGuidFetcher if they are required. + */ +public class StatementExecutor extends HiveActor { + + private final Logger LOG = LoggerFactory.getLogger(getClass()); + + private final HdfsApi hdfsApi; + private final HiveConnection connection; + protected final Storage storage; + private final ConnectionDelegate connectionDelegate; + private ActorRef logAggregator; + private ActorRef guidFetcher; + + + public StatementExecutor(HdfsApi hdfsApi, Storage storage, HiveConnection connection, ConnectionDelegate connectionDelegate) { + this.hdfsApi = hdfsApi; + this.storage = storage; + this.connection = connection; + this.connectionDelegate = connectionDelegate; + } + + @Override + public void handleMessage(HiveMessage hiveMessage) { + Object message = hiveMessage.getMessage(); + if (message instanceof RunStatement) { + runStatement((RunStatement) message); + } else if (message instanceof GetColumnMetadataJob) { + getColumnMetaData((GetColumnMetadataJob) message); + } + } + + private void runStatement(RunStatement message) { + try { + HiveStatement statement = connectionDelegate.createStatement(connection); + if (message.shouldStartLogAggregation()) { + startLogAggregation(statement, message.getStatement(), message.getLogFile().get()); + } + + if (message.shouldStartGUIDFetch() && message.getJobId().isPresent()) { + startGUIDFetch(message.getId(), statement, message.getJobId().get()); + } + LOG.info("Statement executor is executing statement: {}, Statement id: {}, JobId: {}", message.getStatement(), message.getId(), message.getJobId().or("SYNC JOB")); + Optional<ResultSet> resultSetOptional = connectionDelegate.execute(message.getStatement()); + LOG.info("Finished executing statement: {}, Statement id: {}, JobId: {}", message.getStatement(), message.getId(), message.getJobId().or("SYNC JOB")); + + if (resultSetOptional.isPresent()) { + sender().tell(new ResultInformation(message.getId(), resultSetOptional.get()), self()); + } else { + sender().tell(new ResultInformation(message.getId()), self()); + } + } catch (SQLException e) { + LOG.error("Failed to execute statement: {}. {}", message.getStatement(), e); + sender().tell(new ResultInformation(message.getId(), new Failure("Failed to execute statement: " + message.getStatement(), e)), self()); + } finally { + stopLogAggregation(); + stopGUIDFetch(); + } + } + + private void startGUIDFetch(int statementId, HiveStatement statement, String jobId) { + if (guidFetcher == null) { + guidFetcher = getContext().actorOf(Props.create(YarnAtsGUIDFetcher.class, sender()) + .withDispatcher("akka.actor.misc-dispatcher"), "YarnAtsGUIDFetcher:" + UUID.randomUUID().toString()); + } + LOG.info("Fetching guid for Job Id: {}", jobId); + guidFetcher.tell(new UpdateYarnAtsGuid(statementId, statement, jobId), self()); + } + + private void stopGUIDFetch() { + if (guidFetcher != null) { + getContext().stop(guidFetcher); + } + guidFetcher = null; + } + + private void startLogAggregation(HiveStatement statement, String sqlStatement, String logFile) { + if (logAggregator == null) { + logAggregator = getContext().actorOf( + Props.create(LogAggregator.class, hdfsApi, statement, logFile) + .withDispatcher("akka.actor.misc-dispatcher"), "LogAggregator:" + UUID.randomUUID().toString()); + } + LOG.info("Fetching query logs for statement: {}", sqlStatement); + logAggregator.tell(new StartLogAggregation(sqlStatement), getSelf()); + } + + private void stopLogAggregation() { + if (logAggregator != null) { + getContext().stop(logAggregator); + } + logAggregator = null; + } + + + private void getColumnMetaData(GetColumnMetadataJob message) { + try { + ResultSet resultSet = connectionDelegate.getColumnMetadata(connection, message); + sender().tell(new ResultInformation(-1, resultSet), self()); + } catch (SQLException e) { + LOG.error("Failed to get column metadata for databasePattern: {}, tablePattern: {}, ColumnPattern {}. {}", + message.getSchemaPattern(), message.getTablePattern(), message.getColumnPattern(), e); + sender().tell(new ResultInformation(-1, + new Failure("Failed to get column metadata for databasePattern: " + message.getSchemaPattern() + + ", tablePattern: " + message.getTablePattern() + ", ColumnPattern: " + message.getColumnPattern(), e)), self()); + } + } +}
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/TableChangeNotifier.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/TableChangeNotifier.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/TableChangeNotifier.java new file mode 100644 index 0000000..0581618 --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/TableChangeNotifier.java @@ -0,0 +1,95 @@ +/** + * 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.hive20.actor; + +import akka.actor.Props; +import org.apache.ambari.view.hive20.actor.message.HiveMessage; +import org.apache.ambari.view.hive20.internal.dto.TableInfo; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + */ +public class TableChangeNotifier extends HiveActor { + private final Logger LOG = LoggerFactory.getLogger(getClass()); + + @Override + public void handleMessage(HiveMessage hiveMessage) { + Object message = hiveMessage.getMessage(); + if(message instanceof TableUpdated) { + handleTableUpdated((TableUpdated) message); + } else if(message instanceof TableAdded) { + handleTableAdded((TableAdded) message); + } else if(message instanceof TableRemoved) { + handleTableRemoved((TableRemoved) message); + } + } + + private void handleTableUpdated(TableUpdated message) { + LOG.info("Tables updated for table name: {}", message.getTableInfo().getName()); + } + + private void handleTableAdded(TableAdded message) { + LOG.info("Tables added for table name: {}", message.getTableInfo().getName()); + } + + private void handleTableRemoved(TableRemoved message) { + LOG.info("Tables removed for table name: {}", message.getTableName()); + } + + public static Props props() { + return Props.create(TableChangeNotifier.class); + } + + + public static class TableAdded { + private final TableInfo tableInfo; + public TableAdded(TableInfo tableInfo) { + this.tableInfo = tableInfo; + } + + public TableInfo getTableInfo() { + return tableInfo; + } + } + + public static class TableRemoved { + private final String tableName; + public TableRemoved(String tableName) { + this.tableName = tableName; + } + + public String getTableName() { + return tableName; + } + } + + + public static class TableUpdated { + private final TableInfo tableInfo; + public TableUpdated(TableInfo tableInfo) { + this.tableInfo = tableInfo; + } + + public TableInfo getTableInfo() { + return tableInfo; + } + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/YarnAtsGUIDFetcher.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/YarnAtsGUIDFetcher.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/YarnAtsGUIDFetcher.java new file mode 100644 index 0000000..e98864e --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/YarnAtsGUIDFetcher.java @@ -0,0 +1,71 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.hive20.actor; + +import akka.actor.ActorRef; +import org.apache.ambari.view.hive20.actor.message.HiveMessage; +import org.apache.ambari.view.hive20.actor.message.job.SaveGuidToDB; +import org.apache.ambari.view.hive20.actor.message.job.UpdateYarnAtsGuid; +import org.apache.hive.jdbc.HiveStatement; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import scala.concurrent.duration.Duration; + +import java.util.concurrent.TimeUnit; + + +/** + * Queries YARN/ATS time to time to fetch the status of the ExecuteJob and updates database + */ +public class YarnAtsGUIDFetcher extends HiveActor { + + private final Logger LOG = LoggerFactory.getLogger(getClass()); + + private final ActorRef jdbcConnectorActor; + + public YarnAtsGUIDFetcher(ActorRef jdbcConnectorActor) { + this.jdbcConnectorActor = jdbcConnectorActor; + } + + @Override + public void handleMessage(HiveMessage hiveMessage) { + Object message = hiveMessage.getMessage(); + if(message instanceof UpdateYarnAtsGuid) { + updateGuid((UpdateYarnAtsGuid) message); + } + } + + private void updateGuid(UpdateYarnAtsGuid message) { + HiveStatement statement = message.getStatement(); + String jobId = message.getJobId(); + String yarnAtsGuid = statement.getYarnATSGuid(); + + LOG.info("Fetched guid: {}, for job id: {}", yarnAtsGuid, jobId); + + // If ATS GUID is not yet generated, we will retry after 1 second + if(yarnAtsGuid == null) { + LOG.info("Retrying to fetch guid"); + getContext().system().scheduler() + .scheduleOnce(Duration.create(1, TimeUnit.SECONDS), getSelf(), message, getContext().dispatcher(), null); + } else { + jdbcConnectorActor.tell(new SaveGuidToDB(message.getStatementId(), yarnAtsGuid, jobId), self()); + LOG.info("Message send to save GUID for Statement Id: {}, Job id: {}, Guid: {}", message.getStatementId(), message.getJobId(), yarnAtsGuid); + } + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/Connect.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/Connect.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/Connect.java new file mode 100644 index 0000000..a7804b9 --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/Connect.java @@ -0,0 +1,77 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.hive20.actor.message; + +import com.google.common.base.Optional; +import org.apache.ambari.view.hive20.AuthParams; +import org.apache.ambari.view.hive20.internal.Connectable; +import org.apache.ambari.view.hive20.internal.HiveConnectionWrapper; + +/** + * Connect message to be sent to the Connection Actor with the connection parameters + */ +public class Connect { + + private final HiveJob.Type type; + private final String jobId; + private final String username; + private final String password; + private final String jdbcUrl; + + + private Connect(HiveJob.Type type, String jobId, String username, String password, String jdbcUrl) { + this.type = type; + this.jobId = jobId; + this.username = username; + this.password = password; + this.jdbcUrl = jdbcUrl; + } + + public Connect(String jobId, String username, String password, String jdbcUrl) { + this(HiveJob.Type.ASYNC, jobId, username, password, jdbcUrl); + } + + public Connect(String username, String password, String jdbcUrl) { + this(HiveJob.Type.SYNC, null, username, password, jdbcUrl); + } + + public Connectable getConnectable(AuthParams authParams){ + return new HiveConnectionWrapper(getJdbcUrl(),username,password, authParams); + } + + public String getUsername() { + return username; + } + + public String getPassword() { + return password; + } + + public String getJdbcUrl() { + return jdbcUrl; + } + + public HiveJob.Type getType() { + return type; + } + + public Optional<String> getJobId() { + return Optional.fromNullable(jobId); + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/CursorReset.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/CursorReset.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/CursorReset.java new file mode 100644 index 0000000..0cf0e30 --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/CursorReset.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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.hive20.actor.message; + +public class CursorReset { +} http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/ExecuteJob.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/ExecuteJob.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/ExecuteJob.java new file mode 100644 index 0000000..1955a19 --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/ExecuteJob.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.hive20.actor.message; + +public class ExecuteJob { + public final static String SYNC_JOB_MARKER = "SYNC"; + private final Connect connect; + private final HiveJob job; + + public ExecuteJob(Connect connect, HiveJob job) { + this.connect = connect; + this.job = job; + } + + public Connect getConnect() { + return connect; + } + + public HiveJob getJob() { + return job; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/ExecuteQuery.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/ExecuteQuery.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/ExecuteQuery.java new file mode 100644 index 0000000..e44c35c --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/ExecuteQuery.java @@ -0,0 +1,23 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.hive20.actor.message; + +public class ExecuteQuery { + +} http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/FetchError.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/FetchError.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/FetchError.java new file mode 100644 index 0000000..d23c53d --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/FetchError.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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.hive20.actor.message; + +/** + * + * Fetch the result for + * + */ +public class FetchError { + private final String jobId; + private final String username; + + public FetchError(String jobId, String username) { + this.jobId = jobId; + this.username = username; + } + + public String getJobId() { + return jobId; + } + + public String getUsername() { + return username; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/FetchResult.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/FetchResult.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/FetchResult.java new file mode 100644 index 0000000..f642fc7 --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/FetchResult.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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.hive20.actor.message; + +/** + * + * Fetch the result for + * + */ +public class FetchResult { + private final String jobId; + private final String username; + + public FetchResult(String jobId, String username) { + this.jobId = jobId; + this.username = username; + } + + public String getJobId() { + return jobId; + } + + public String getUsername() { + return username; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/GetColumnMetadataJob.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/GetColumnMetadataJob.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/GetColumnMetadataJob.java new file mode 100644 index 0000000..a6ced40 --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/GetColumnMetadataJob.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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.hive20.actor.message; + +public class GetColumnMetadataJob extends HiveJob { + private final String schemaPattern; + private final String tablePattern; + private final String columnPattern; + + public GetColumnMetadataJob(String username, + String schemaPattern, String tablePattern, String columnPattern) { + super(Type.SYNC, username); + this.schemaPattern = schemaPattern; + this.tablePattern = tablePattern; + this.columnPattern = columnPattern; + } + + public GetColumnMetadataJob(String username, + String tablePattern, String columnPattern) { + this(username, "*", tablePattern, columnPattern); + } + + public GetColumnMetadataJob(String username, + String columnPattern) { + this(username, "*", "*", columnPattern); + } + + public GetColumnMetadataJob(String username) { + this(username, "*", "*", "*"); + } + + public String getSchemaPattern() { + return schemaPattern; + } + + public String getTablePattern() { + return tablePattern; + } + + public String getColumnPattern() { + return columnPattern; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/GetMoreLogs.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/GetMoreLogs.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/GetMoreLogs.java new file mode 100644 index 0000000..5d9ae3a --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/GetMoreLogs.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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.hive20.actor.message; + + +public class GetMoreLogs {} http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/HiveJob.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/HiveJob.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/HiveJob.java new file mode 100644 index 0000000..b5538b1 --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/HiveJob.java @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.hive20.actor.message; + +public abstract class HiveJob { + + private final String username; + private final Type type; + + public HiveJob(Type type, String username) { + this.type = type; + this.username = username; + } + + public String getUsername() { + return username; + } + + + + + public Type getType() { + return type; + } + + + public enum Type { + SYNC, + ASYNC + } + +} http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/HiveMessage.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/HiveMessage.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/HiveMessage.java new file mode 100644 index 0000000..87acacd --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/HiveMessage.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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.hive20.actor.message; + + +import java.util.UUID; + +/** + * Message wrapper, Each message has a unique ID + */ +public class HiveMessage { + + private String id = UUID.randomUUID().toString(); + + private Object message; + + public HiveMessage(Object message) { + this.message = message; + } + + + public Object getMessage() { + return message; + } + + public String getId() { + return id; + } + + @Override + public String toString() { + return "HiveMessage{" + + "message=" + message + + ", id='" + id + '\'' + + '}'; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/JobRejected.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/JobRejected.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/JobRejected.java new file mode 100644 index 0000000..7dda74f --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/JobRejected.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.hive20.actor.message; + +public class JobRejected { + + private final String username; + private final String jobId; + private final String message; + + public JobRejected(String username, String jobId, String message) { + this.username = username; + this.jobId = jobId; + this.message = message; + } + + public String getUsername() { + return username; + } + + public String getJobId() { + return jobId; + } + + public String getMessage() { + return message; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/JobSubmitted.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/JobSubmitted.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/JobSubmitted.java new file mode 100644 index 0000000..b248325 --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/JobSubmitted.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.hive20.actor.message; + +public class JobSubmitted { + + private final String username; + private final String jobId; + + public JobSubmitted(String username, String jobId) { + this.username = username; + this.jobId = jobId; + } + + public String getUsername() { + return username; + } + + public String getJobId() { + return jobId; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/LogAggregationFinished.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/LogAggregationFinished.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/LogAggregationFinished.java new file mode 100644 index 0000000..d375833 --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/LogAggregationFinished.java @@ -0,0 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.hive20.actor.message; + +public class LogAggregationFinished {} http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/Ping.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/Ping.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/Ping.java new file mode 100644 index 0000000..c8449dc --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/Ping.java @@ -0,0 +1,40 @@ +/** + * 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.hive20.actor.message; + +/** + * Ping message + */ +public class Ping { + private final String username; + private final String instanceName; + + public Ping(String username, String instanceName) { + this.username = username; + this.instanceName = instanceName; + } + + public String getUsername() { + return username; + } + + public String getInstanceName() { + return instanceName; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/RegisterActor.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/RegisterActor.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/RegisterActor.java new file mode 100644 index 0000000..9bd071a --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/RegisterActor.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.hive20.actor.message; + +import akka.actor.ActorRef; + +public class RegisterActor { + + private ActorRef actorRef; + + public RegisterActor(ActorRef actorRef) { + this.actorRef = actorRef; + } + + public ActorRef getActorRef() { + return actorRef; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/ResetCursor.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/ResetCursor.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/ResetCursor.java new file mode 100644 index 0000000..3b9a323 --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/ResetCursor.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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.hive20.actor.message; + +public class ResetCursor { +} http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/ResultInformation.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/ResultInformation.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/ResultInformation.java new file mode 100644 index 0000000..5b5e17c --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/ResultInformation.java @@ -0,0 +1,83 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.hive20.actor.message; + +import com.google.common.base.Optional; +import org.apache.ambari.view.hive20.actor.message.job.Failure; + +import java.sql.ResultSet; + +/** + * Message used to send execution complete message. + * It may contain a ResultSet if the execution returns a ResultSet. + */ +public class ResultInformation { + /** + * Execution id to identify the result correspondence of the result with the request + */ + private final int id; + + /** + * If the execution returns a ResultSet then this will refer to the ResultSet + */ + private final ResultSet resultSet; + + private final Failure failure; + + private final boolean cancelled; + + private ResultInformation(int id, ResultSet resultSet, Failure failure, boolean cancelled) { + this.id = id; + this.resultSet = resultSet; + this.failure = failure; + this.cancelled = cancelled; + } + + public ResultInformation(int id, ResultSet resultSet) { + this(id, resultSet, null, false); + } + + public ResultInformation(int id) { + this(id, null, null, false); + } + + public ResultInformation(int id, Failure failure) { + this(id, null, failure, false); + } + + public ResultInformation(int id, boolean cancelled) { + this(id, null, null, cancelled); + } + + public int getId() { + return id; + } + + public Optional<ResultSet> getResultSet() { + return Optional.fromNullable(resultSet); + } + + public Optional<Failure> getFailure() { + return Optional.fromNullable(failure); + } + + public boolean isCancelled() { + return cancelled; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/ResultNotReady.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/ResultNotReady.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/ResultNotReady.java new file mode 100644 index 0000000..0c8ddb5 --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/ResultNotReady.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.hive20.actor.message; + +/** + * In case of a async execution, this is used to tell that the result has not completed and is not ready to be + * returned back + */ +public class ResultNotReady { + private final String jobId; + private final String username; + public ResultNotReady(String jobId, String username) { + this.jobId = jobId; + this.username = username; + } + + public String getJobId() { + return jobId; + } + + public String getUsername() { + return username; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/ResultReady.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/ResultReady.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/ResultReady.java new file mode 100644 index 0000000..ac1c3e1 --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/ResultReady.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.hive20.actor.message; + +import akka.actor.ActorRef; +import com.google.common.base.Optional; + +/** + * Fetch the result for + */ +public class ResultReady extends FetchResult { + private final ActorRef result; + + + public ResultReady(String jobId, String username, ActorRef result) { + super(jobId, username); + this.result = result; + } + + public ResultReady(String jobId, String username) { + this(jobId, username, null); + } + + public Optional<ActorRef> getResult() { + return Optional.fromNullable(result); + } +} + http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/RunStatement.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/RunStatement.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/RunStatement.java new file mode 100644 index 0000000..69dd4a8 --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/RunStatement.java @@ -0,0 +1,73 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.hive20.actor.message; + +import com.google.common.base.Optional; + +/** + * Message sent by JdbcConnector to StatementExecutor to run a statement + */ +public class RunStatement { + /** + * This is the execution id meant to identify the executing statement sequence + */ + private final int id; + private final String statement; + private final String logFile; + private final String jobId; + private final boolean startLogAggregation; + private final boolean startGUIDFetch; + + public RunStatement(int id, String statement, String jobId, boolean startLogAggregation, String logFile, boolean startGUIDFetch) { + this.id = id; + this.statement = statement; + this.jobId = jobId; + this.logFile = logFile; + this.startLogAggregation = startLogAggregation; + this.startGUIDFetch = startGUIDFetch; + } + + public RunStatement(int id, String statement) { + this(id, statement, null, false, null, false); + } + + public int getId() { + return id; + } + + public String getStatement() { + return statement; + } + + public Optional<String> getLogFile() { + return Optional.fromNullable(logFile); + } + + public boolean shouldStartLogAggregation() { + return startLogAggregation; + } + + public boolean shouldStartGUIDFetch() { + return startGUIDFetch; + } + + public Optional<String> getJobId() { + return Optional.fromNullable(jobId); + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/SQLStatementJob.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/SQLStatementJob.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/SQLStatementJob.java new file mode 100644 index 0000000..22633b1 --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/SQLStatementJob.java @@ -0,0 +1,64 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.hive20.actor.message; + +import com.google.common.base.Optional; +import org.apache.commons.lang.StringUtils; + +import java.util.Arrays; +import java.util.Collection; + + +public class SQLStatementJob extends HiveJob { + + public static final String SEMICOLON = ";"; + private String[] statements; + + private final String jobId; + private final String logFile; + + public SQLStatementJob(Type type, String[] statements, String username, String jobId, String logFile) { + super(type, username); + this.statements = new String[statements.length]; + this.jobId = jobId; + this.logFile = logFile; + for (int i = 0; i < statements.length; i++) { + this.statements[i] = clean(statements[i]); + } + } + public SQLStatementJob(Type type, String[] statements, String username) { + this(type, statements, username, null, null); + } + + private String clean(String statement) { + return StringUtils.trim(statement); + } + + public Collection<String> getStatements() { + return Arrays.asList(statements); + } + + public Optional<String> getJobId() { + return Optional.fromNullable(jobId); + } + + public Optional<String> getLogFile() { + return Optional.fromNullable(logFile); + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/StartLogAggregation.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/StartLogAggregation.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/StartLogAggregation.java new file mode 100644 index 0000000..922ad1d --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/StartLogAggregation.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.hive20.actor.message; + +public class StartLogAggregation { + private String statement; + + public StartLogAggregation() { + } + + public StartLogAggregation(String statement) { + this.statement = statement; + } + + public String getStatement() { + return statement; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/AsyncExecutionFailed.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/AsyncExecutionFailed.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/AsyncExecutionFailed.java new file mode 100644 index 0000000..968167e --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/AsyncExecutionFailed.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.hive20.actor.message.job; + +public class AsyncExecutionFailed extends ExecutionFailed { + private final String jobId; + private final String username; + + public AsyncExecutionFailed(String jobId,String username, String message, Throwable error) { + super(message, error); + this.jobId = jobId; + this.username = username; + } + + public AsyncExecutionFailed(String jobId,String username, String message) { + super(message); + this.jobId = jobId; + this.username = username; + } + + + + public String getJobId() { + return jobId; + } + + public String getUsername() { + return username; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/CancelJob.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/CancelJob.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/CancelJob.java new file mode 100644 index 0000000..694fc29 --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/CancelJob.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.hive20.actor.message.job; + +/** + * Message to cancel the currently running job. This is used for stopping execution of a job from api + */ +public class CancelJob { + private final String jobId; + private final String username; + + public CancelJob(String jobId, String username) { + this.jobId = jobId; + this.username = username; + } + + public String getJobId() { + return jobId; + } + + public String getUsername() { + return username; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/ExecuteNextStatement.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/ExecuteNextStatement.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/ExecuteNextStatement.java new file mode 100644 index 0000000..ac48767 --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/ExecuteNextStatement.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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.hive20.actor.message.job; + +public class ExecuteNextStatement { +} http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/ExecutionFailed.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/ExecutionFailed.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/ExecutionFailed.java new file mode 100644 index 0000000..15bcbf5 --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/ExecutionFailed.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.hive20.actor.message.job; + +public class ExecutionFailed extends Failure { + + public ExecutionFailed(String message, Throwable error) { + super(message, error); + } + + public ExecutionFailed(String message) { + super(message, new Exception(message)); + } + +} http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/Failure.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/Failure.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/Failure.java new file mode 100644 index 0000000..1efb132 --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/Failure.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.hive20.actor.message.job; + +public class Failure { + private final Throwable error; + private final String message; + + public Failure(String message, Throwable error) { + this.message = message; + this.error = error; + } + + public Throwable getError() { + return error; + } + + public String getMessage() { + return message; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/FetchFailed.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/FetchFailed.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/FetchFailed.java new file mode 100644 index 0000000..c86867a --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/FetchFailed.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.hive20.actor.message.job; + +public class FetchFailed extends Failure{ + + public FetchFailed(String message, Throwable error) { + super(message, error); + } + + public FetchFailed(String message) { + this(message, new Exception(message)); + } + +} http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/Next.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/Next.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/Next.java new file mode 100644 index 0000000..0fc99ac --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/Next.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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.hive20.actor.message.job; + +public class Next { +} http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/NoMoreItems.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/NoMoreItems.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/NoMoreItems.java new file mode 100644 index 0000000..639ac05 --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/NoMoreItems.java @@ -0,0 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.hive20.actor.message.job; + +public class NoMoreItems {} http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/NoResult.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/NoResult.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/NoResult.java new file mode 100644 index 0000000..7b43ae8 --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/NoResult.java @@ -0,0 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.hive20.actor.message.job; + +public class NoResult {} http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/Result.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/Result.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/Result.java new file mode 100644 index 0000000..f8c3ba0 --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/Result.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.hive20.actor.message.job; + +import com.google.common.collect.ImmutableList; +import org.apache.ambari.view.hive20.client.ColumnDescription; +import org.apache.ambari.view.hive20.client.Row; + +import java.util.List; + +public class Result { + private final List<ColumnDescription> columns; + private final List<Row> rows; + + public Result(List<Row> rows, List<ColumnDescription> columns) { + this.rows = ImmutableList.copyOf(rows); + this.columns = columns; + } + + public List<Row> getRows() { + return rows; + } + + public List<ColumnDescription> getColumns() { + return columns; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/ResultSetHolder.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/ResultSetHolder.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/ResultSetHolder.java new file mode 100644 index 0000000..8089d26 --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/ResultSetHolder.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.hive20.actor.message.job; + +import akka.actor.ActorRef; + +public class ResultSetHolder { + private final ActorRef iterator; + + public ResultSetHolder(ActorRef iterator) { + this.iterator = iterator; + } + + public ActorRef getIterator() { + return iterator; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/SaveDagInformation.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/SaveDagInformation.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/SaveDagInformation.java new file mode 100644 index 0000000..0c16c99 --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/SaveDagInformation.java @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.hive20.actor.message.job; + +/** + * Message to save the Dag Information like the dagName, dagId and ApplicationId + */ +public class SaveDagInformation { + private final String jobId; + private final String dagName; + private final String dagId; + private final String applicationId; + + public SaveDagInformation(String jobId, String dagName, String dagId, String applicationId) { + this.jobId = jobId; + this.dagName = dagName; + this.dagId = dagId; + this.applicationId = applicationId; + } + + public String getJobId() { + return jobId; + } + + public String getDagName() { + return dagName; + } + + public String getDagId() { + return dagId; + } + + public String getApplicationId() { + return applicationId; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/SaveGuidToDB.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/SaveGuidToDB.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/SaveGuidToDB.java new file mode 100644 index 0000000..a55b02d --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/SaveGuidToDB.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.hive20.actor.message.job; + +/** + * Message to ask JdbcConnector for job to update the GUID for the current statement in the database for the job. + */ +public class SaveGuidToDB { + private final int statementId; + private final String guid; + private final String jobId; + + public SaveGuidToDB(int statementId, String guid, String jobId) { + this.statementId = statementId; + this.guid = guid; + this.jobId = jobId; + } + + public int getStatementId() { + return statementId; + } + + public String getGuid() { + return guid; + } + + public String getJobId() { + return jobId; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/UpdateYarnAtsGuid.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/UpdateYarnAtsGuid.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/UpdateYarnAtsGuid.java new file mode 100644 index 0000000..0af95ef --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/job/UpdateYarnAtsGuid.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.hive20.actor.message.job; + +import org.apache.hive.jdbc.HiveStatement; + +public class UpdateYarnAtsGuid { + private final int statementId; + private final HiveStatement statement; + private final String jobId; + public UpdateYarnAtsGuid(int statementId, HiveStatement statement, String jobId) { + this.statementId = statementId; + this.statement = statement; + this.jobId = jobId; + } + + public int getStatementId() { + return statementId; + } + + public HiveStatement getStatement() { + return statement; + } + + public String getJobId() { + return jobId; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/lifecycle/CleanUp.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/lifecycle/CleanUp.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/lifecycle/CleanUp.java new file mode 100644 index 0000000..d16364e --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/lifecycle/CleanUp.java @@ -0,0 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.hive20.actor.message.lifecycle; + +public class CleanUp {} http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/lifecycle/DestroyConnector.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/lifecycle/DestroyConnector.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/lifecycle/DestroyConnector.java new file mode 100644 index 0000000..1f22a3b --- /dev/null +++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/actor/message/lifecycle/DestroyConnector.java @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.hive20.actor.message.lifecycle; + +public class DestroyConnector { + private final String username; + private final String jobId; + private final boolean forAsync; + + public DestroyConnector(String username, String jobId, boolean forAsync) { + this.username = username; + this.jobId = jobId; + this.forAsync = forAsync; + } + + public String getUsername() { + return username; + } + + public String getJobId() { + return jobId; + } + + public boolean isForAsync() { + return forAsync; + } + + @Override + public String toString() { + return "DestroyConnector{" + + "username='" + username + '\'' + + ", jobId='" + jobId + '\'' + + ", forAsync=" + forAsync + + '}'; + } +}
