Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7F87618401 for ; Fri, 15 Jan 2016 11:04:03 +0000 (UTC) Received: (qmail 20656 invoked by uid 500); 15 Jan 2016 11:04:03 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 20569 invoked by uid 500); 15 Jan 2016 11:04:03 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 20501 invoked by uid 99); 15 Jan 2016 11:04:03 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Jan 2016 11:04:03 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id CE02BE0418; Fri, 15 Jan 2016 11:04:02 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: anovikov@apache.org To: commits@ignite.apache.org Date: Fri, 15 Jan 2016 11:04:04 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [3/6] ignite git commit: IGNITE-843 WIP IGNITE-843 WIP Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/54a24746 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/54a24746 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/54a24746 Branch: refs/heads/ignite-843-rc2 Commit: 54a24746b936ae3bec3712061b54460ae989bf31 Parents: 16b51e5 Author: Andrey Authored: Fri Jan 15 16:03:43 2016 +0700 Committer: Andrey Committed: Fri Jan 15 16:03:43 2016 +0700 ---------------------------------------------------------------------- .../assembly/release-control-center-agent.xml | 5 +- modules/control-center-agent/demo/db-init.sql | 102 ++++ modules/control-center-agent/demo/demo-db.sql | 58 -- modules/control-center-agent/pom.xml | 2 +- .../apache/ignite/agent/AgentConfiguration.java | 238 -------- .../org/apache/ignite/agent/AgentLauncher.java | 165 ------ .../org/apache/ignite/agent/AgentSocket.java | 189 ------- .../org/apache/ignite/agent/AgentUtils.java | 115 ---- .../ignite/agent/demo/AgentMetadataDemo.java | 88 --- .../apache/ignite/agent/demo/AgentSqlDemo.java | 495 ----------------- .../org/apache/ignite/agent/demo/model/Car.java | 155 ------ .../apache/ignite/agent/demo/model/CarKey.java | 97 ---- .../apache/ignite/agent/demo/model/Country.java | 126 ----- .../ignite/agent/demo/model/CountryKey.java | 97 ---- .../ignite/agent/demo/model/Department.java | 184 ------- .../ignite/agent/demo/model/DepartmentKey.java | 97 ---- .../ignite/agent/demo/model/Employee.java | 358 ------------ .../ignite/agent/demo/model/EmployeeKey.java | 97 ---- .../apache/ignite/agent/demo/model/Parking.java | 126 ----- .../ignite/agent/demo/model/ParkingKey.java | 97 ---- .../handlers/DatabaseMetadataExtractor.java | 205 ------- .../ignite/agent/handlers/RestExecutor.java | 195 ------- .../org/apache/ignite/agent/remote/Remote.java | 37 -- .../ignite/agent/remote/RemoteHandler.java | 252 --------- .../ignite/agent/remote/WebSocketSender.java | 39 -- .../console/agent/AgentConfiguration.java | 255 +++++++++ .../ignite/console/agent/AgentLauncher.java | 164 ++++++ .../ignite/console/agent/AgentSocket.java | 189 +++++++ .../apache/ignite/console/agent/AgentUtils.java | 115 ++++ .../handlers/DatabaseMetadataExtractor.java | 205 +++++++ .../console/agent/handlers/RestExecutor.java | 195 +++++++ .../ignite/console/agent/remote/Remote.java | 37 ++ .../console/agent/remote/RemoteHandler.java | 252 +++++++++ .../console/agent/remote/WebSocketSender.java | 39 ++ .../ignite/console/demo/AgentMetadataDemo.java | 88 +++ .../ignite/console/demo/AgentSqlDemo.java | 551 +++++++++++++++++++ .../apache/ignite/console/demo/model/Car.java | 137 +++++ .../ignite/console/demo/model/Country.java | 137 +++++ .../ignite/console/demo/model/Department.java | 137 +++++ .../ignite/console/demo/model/Employee.java | 341 ++++++++++++ .../ignite/console/demo/model/Parking.java | 137 +++++ .../src/main/js/agents/agent-manager.js | 15 +- .../src/main/js/agents/agent-server.js | 27 +- .../control-center-web/src/main/js/app/index.js | 2 + .../main/js/app/modules/QueryNotebooks/index.js | 111 ++++ .../app/modules/states/configuration/index.js | 10 +- .../main/js/app/modules/states/login/index.js | 7 +- .../src/main/js/app/modules/states/sql/index.js | 21 +- .../src/main/js/controllers/common-module.js | 13 +- .../src/main/js/controllers/sql-controller.js | 121 ++-- .../src/main/js/gulpfile.js/tasks/copy.js | 2 +- .../src/main/js/routes/agent.js | 23 +- .../src/main/js/routes/notebooks.js | 4 +- .../main/js/views/templates/agent-download.jade | 1 - 54 files changed, 3337 insertions(+), 3618 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/54a24746/modules/control-center-agent/assembly/release-control-center-agent.xml ---------------------------------------------------------------------- diff --git a/modules/control-center-agent/assembly/release-control-center-agent.xml b/modules/control-center-agent/assembly/release-control-center-agent.xml index cebc757..90a9415 100644 --- a/modules/control-center-agent/assembly/release-control-center-agent.xml +++ b/modules/control-center-agent/assembly/release-control-center-agent.xml @@ -38,8 +38,9 @@ ${basedir} / - jdbc-drivers/*.* - demo/*.* + jdbc-drivers/README* + demo/README* + demo/*.sql README* LICENSE* NOTICE* http://git-wip-us.apache.org/repos/asf/ignite/blob/54a24746/modules/control-center-agent/demo/db-init.sql ---------------------------------------------------------------------- diff --git a/modules/control-center-agent/demo/db-init.sql b/modules/control-center-agent/demo/db-init.sql new file mode 100644 index 0000000..0688ea0 --- /dev/null +++ b/modules/control-center-agent/demo/db-init.sql @@ -0,0 +1,102 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one or more +-- contributor license agreements. See the NOTICE file distributed with +-- this work for additional information regarding copyright ownership. +-- The ASF licenses this file to You under the Apache License, Version 2.0 +-- (the "License"); you may not use this file except in compliance with +-- the License. You may obtain a copy of the License at +-- +-- 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. +-- + +CREATE TABLE COUNTRY ( + ID INTEGER NOT NULL PRIMARY KEY, + NAME VARCHAR(50), + POPULATION INTEGER NOT NULL +); + +CREATE TABLE DEPARTMENT ( + ID INTEGER NOT NULL PRIMARY KEY, + COUNTRY_ID INTEGER NOT NULL, + NAME VARCHAR(50) NOT NULL +); + +CREATE TABLE EMPLOYEE ( + ID INTEGER NOT NULL PRIMARY KEY, + DEPARTMENT_ID INTEGER NOT NULL, + MANAGER_ID INTEGER, + FIRST_NAME VARCHAR(50) NOT NULL, + LAST_NAME VARCHAR(50) NOT NULL, + EMAIL VARCHAR(50) NOT NULL, + PHONE_NUMBER VARCHAR(50), + HIRE_DATE DATE NOT NULL, + JOB VARCHAR(50) NOT NULL, + SALARY DOUBLE +); + +CREATE INDEX EMP_SALARY ON EMPLOYEE (SALARY ASC); +CREATE INDEX EMP_NAMES ON EMPLOYEE (FIRST_NAME ASC, LAST_NAME ASC); + +CREATE SCHEMA CARS; + +CREATE TABLE CARS.PARKING ( + ID INTEGER NOT NULL PRIMARY KEY, + NAME VARCHAR(50) NOT NULL, + CAPACITY INTEGER NOT NULL +); + +CREATE TABLE CARS.CAR ( + ID INTEGER NOT NULL PRIMARY KEY, + PARKING_ID INTEGER NOT NULL, + NAME VARCHAR(50) NOT NULL +); + +INSERT INTO COUNTRY(ID, NAME, POPULATION) VALUES(0, 'Country #1', 10000000); +INSERT INTO COUNTRY(ID, NAME, POPULATION) VALUES(1, 'Country #2', 20000000); +INSERT INTO COUNTRY(ID, NAME, POPULATION) VALUES(2, 'Country #3', 30000000); + +INSERT INTO DEPARTMENT(ID, COUNTRY_ID, NAME) VALUES(0, 0, 'Department #1'); +INSERT INTO DEPARTMENT(ID, COUNTRY_ID, NAME) VALUES(1, 0, 'Department #2'); +INSERT INTO DEPARTMENT(ID, COUNTRY_ID, NAME) VALUES(2, 2, 'Department #3'); +INSERT INTO DEPARTMENT(ID, COUNTRY_ID, NAME) VALUES(3, 1, 'Department #4'); +INSERT INTO DEPARTMENT(ID, COUNTRY_ID, NAME) VALUES(4, 1, 'Department #5'); +INSERT INTO DEPARTMENT(ID, COUNTRY_ID, NAME) VALUES(5, 1, 'Department #6'); + +INSERT INTO EMPLOYEE(ID, DEPARTMENT_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, JOB, SALARY) VALUES(0, 0, 'First name manager #1', 'Last name manager #1', 'Email manager #1', 'Phone number manager #1', '2014-01-01', 'Job manager #1', 1100.00); +INSERT INTO EMPLOYEE(ID, DEPARTMENT_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, JOB, SALARY) VALUES(1, 1, 'First name manager #2', 'Last name manager #2', 'Email manager #2', 'Phone number manager #2', '2014-01-01', 'Job manager #2', 2100.00); +INSERT INTO EMPLOYEE(ID, DEPARTMENT_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, JOB, SALARY) VALUES(2, 2, 'First name manager #3', 'Last name manager #3', 'Email manager #3', 'Phone number manager #3', '2014-01-01', 'Job manager #3', 3100.00); +INSERT INTO EMPLOYEE(ID, DEPARTMENT_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, JOB, SALARY) VALUES(3, 3, 'First name manager #4', 'Last name manager #4', 'Email manager #4', 'Phone number manager #4', '2014-01-01', 'Job manager #4', 1500.00); +INSERT INTO EMPLOYEE(ID, DEPARTMENT_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, JOB, SALARY) VALUES(4, 4, 'First name manager #5', 'Last name manager #5', 'Email manager #5', 'Phone number manager #5', '2014-01-01', 'Job manager #5', 1700.00); +INSERT INTO EMPLOYEE(ID, DEPARTMENT_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, JOB, SALARY) VALUES(5, 5, 'First name manager #6', 'Last name manager #6', 'Email manager #6', 'Phone number manager #6', '2014-01-01', 'Job manager #6', 1300.00); + +INSERT INTO EMPLOYEE(ID, DEPARTMENT_ID, MANAGER_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, JOB, SALARY) VALUES(101, 0, 0, 'First name employee #1', 'Last name employee #1', 'Email employee #1', 'Phone number employee #1', '2014-01-01', 'Job employee #1', 600.00); +INSERT INTO EMPLOYEE(ID, DEPARTMENT_ID, MANAGER_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, JOB, SALARY) VALUES(102, 0, 0, 'First name employee #2', 'Last name employee #2', 'Email employee #2', 'Phone number employee #2', '2014-01-01', 'Job employee #2', 1600.00); +INSERT INTO EMPLOYEE(ID, DEPARTMENT_ID, MANAGER_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, JOB, SALARY) VALUES(103, 1, 1, 'First name employee #3', 'Last name employee #3', 'Email employee #3', 'Phone number employee #3', '2014-01-01', 'Job employee #3', 2600.00); +INSERT INTO EMPLOYEE(ID, DEPARTMENT_ID, MANAGER_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, JOB, SALARY) VALUES(104, 2, 2, 'First name employee #4', 'Last name employee #4', 'Email employee #4', 'Phone number employee #4', '2014-01-01', 'Job employee #4', 1000.00); +INSERT INTO EMPLOYEE(ID, DEPARTMENT_ID, MANAGER_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, JOB, SALARY) VALUES(105, 2, 2, 'First name employee #5', 'Last name employee #5', 'Email employee #5', 'Phone number employee #5', '2014-01-01', 'Job employee #5', 1200.00); +INSERT INTO EMPLOYEE(ID, DEPARTMENT_ID, MANAGER_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, JOB, SALARY) VALUES(106, 2, 2, 'First name employee #6', 'Last name employee #6', 'Email employee #6', 'Phone number employee #6', '2014-01-01', 'Job employee #6', 800.00); +INSERT INTO EMPLOYEE(ID, DEPARTMENT_ID, MANAGER_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, JOB, SALARY) VALUES(107, 3, 3, 'First name employee #7', 'Last name employee #7', 'Email employee #7', 'Phone number employee #7', '2014-01-01', 'Job employee #7', 1400.00); +INSERT INTO EMPLOYEE(ID, DEPARTMENT_ID, MANAGER_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, JOB, SALARY) VALUES(108, 4, 4, 'First name employee #8', 'Last name employee #8', 'Email employee #8', 'Phone number employee #8', '2014-01-01', 'Job employee #8', 800.00); +INSERT INTO EMPLOYEE(ID, DEPARTMENT_ID, MANAGER_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, JOB, SALARY) VALUES(109, 4, 4, 'First name employee #9', 'Last name employee #9', 'Email employee #9', 'Phone number employee #9', '2014-01-01', 'Job employee #9', 1490.00); +INSERT INTO EMPLOYEE(ID, DEPARTMENT_ID, MANAGER_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, JOB, SALARY) VALUES(110, 4, 4, 'First name employee #10', 'Last name employee #12', 'Email employee #10', 'Phone number employee #10', '2014-01-01', 'Job employee #10', 1600.00); +INSERT INTO EMPLOYEE(ID, DEPARTMENT_ID, MANAGER_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, JOB, SALARY) VALUES(111, 5, 5, 'First name employee #11', 'Last name employee #11', 'Email employee #11', 'Phone number employee #11', '2014-01-01', 'Job employee #11', 400.00); + +INSERT INTO CARS.PARKING(ID, NAME, CAPACITY) VALUES(0, 'Parking #1', 10); +INSERT INTO CARS.PARKING(ID, NAME, CAPACITY) VALUES(1, 'Parking #2', 20); +INSERT INTO CARS.PARKING(ID, NAME, CAPACITY) VALUES(2, 'Parking #3', 30); + +INSERT INTO CARS.CAR(ID, PARKING_ID, NAME) VALUES(0, 0, 'Car #1'); +INSERT INTO CARS.CAR(ID, PARKING_ID, NAME) VALUES(1, 0, 'Car #2'); +INSERT INTO CARS.CAR(ID, PARKING_ID, NAME) VALUES(2, 0, 'Car #3'); +INSERT INTO CARS.CAR(ID, PARKING_ID, NAME) VALUES(3, 1, 'Car #4'); +INSERT INTO CARS.CAR(ID, PARKING_ID, NAME) VALUES(4, 1, 'Car #5'); +INSERT INTO CARS.CAR(ID, PARKING_ID, NAME) VALUES(5, 2, 'Car #6'); +INSERT INTO CARS.CAR(ID, PARKING_ID, NAME) VALUES(6, 2, 'Car #7'); +INSERT INTO CARS.CAR(ID, PARKING_ID, NAME) VALUES(7, 2, 'Car #8'); +INSERT INTO CARS.CAR(ID, PARKING_ID, NAME) VALUES(8, 2, 'Car #9'); http://git-wip-us.apache.org/repos/asf/ignite/blob/54a24746/modules/control-center-agent/demo/demo-db.sql ---------------------------------------------------------------------- diff --git a/modules/control-center-agent/demo/demo-db.sql b/modules/control-center-agent/demo/demo-db.sql deleted file mode 100644 index a7deafa..0000000 --- a/modules/control-center-agent/demo/demo-db.sql +++ /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 - * - * 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. - */ - -CREATE TABLE COUNTRY ( - ID INTEGER NOT NULL PRIMARY KEY, - COUNTRY_NAME VARCHAR(100) -); - -CREATE TABLE DEPARTMENT ( - DEPARTMENT_ID INTEGER NOT NULL PRIMARY KEY, - DEPARTMENT_NAME VARCHAR(50) NOT NULL, - COUNTRY_ID INTEGER, - MANAGER_ID INTEGER -); - -CREATE TABLE EMPLOYEE ( - EMPLOYEE_ID INTEGER NOT NULL PRIMARY KEY, - FIRST_NAME VARCHAR(20) NOT NULL, - LAST_NAME VARCHAR(30) NOT NULL, - EMAIL VARCHAR(25) NOT NULL, - PHONE_NUMBER VARCHAR(20), - HIRE_DATE DATE NOT NULL, - JOB VARCHAR(50) NOT NULL, - SALARY DOUBLE, - MANAGER_ID INTEGER, - DEPARTMENT_ID INTEGER -); - -CREATE INDEX EMP_SALARY_A ON EMPLOYEE (SALARY ASC); -CREATE INDEX EMP_SALARY_B ON EMPLOYEE (SALARY DESC); -CREATE INDEX EMP_NAMES ON EMPLOYEE (FIRST_NAME ASC, LAST_NAME ASC); - -CREATE SCHEMA CARS; - -CREATE TABLE CARS.PARKING ( - PARKING_ID INTEGER NOT NULL PRIMARY KEY, - PARKING_NAME VARCHAR(50) NOT NULL -); - -CREATE TABLE CARS.CAR ( - CAR_ID INTEGER NOT NULL PRIMARY KEY, - PARKING_ID INTEGER NOT NULL, - CAR_NAME VARCHAR(50) NOT NULL -); http://git-wip-us.apache.org/repos/asf/ignite/blob/54a24746/modules/control-center-agent/pom.xml ---------------------------------------------------------------------- diff --git a/modules/control-center-agent/pom.xml b/modules/control-center-agent/pom.xml index 0db5d36..b90cec0 100644 --- a/modules/control-center-agent/pom.xml +++ b/modules/control-center-agent/pom.xml @@ -98,7 +98,7 @@ - org.apache.ignite.agent.AgentLauncher + org.apache.ignite.console.agent.AgentLauncher http://git-wip-us.apache.org/repos/asf/ignite/blob/54a24746/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentConfiguration.java b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentConfiguration.java deleted file mode 100644 index cb08fe7..0000000 --- a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentConfiguration.java +++ /dev/null @@ -1,238 +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 - * - * 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.ignite.agent; - -import com.beust.jcommander.Parameter; -import java.io.File; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.Reader; -import java.net.URL; -import java.util.Properties; - -/** - * Agent configuration. - */ -public class AgentConfiguration { - /** Default server port. */ - public static final int DFLT_SERVER_PORT = 3001; - - /** Default Ignite node HTTP port. */ - public static final int DFLT_NODE_PORT = 8080; - - /** Default path to agent property file. */ - public static final String DFLT_CFG_PATH = "default.properties"; - - /** Default server URI. */ - private static final String DFLT_SERVER_URI = "wss://localhost:3001"; - - /** Default Ignite node HTTP URI. */ - private static final String DFLT_NODE_URI = "http://localhost:8080"; - - /** */ - @Parameter(names = {"-t", "--token"}, description = "User's security token used to establish connection to Ignite Console.") - private String tok; - - /** */ - @Parameter(names = {"-s", "--server-uri"}, description = "URI for connect to Ignite Console via web-socket protocol" + - " " + - " Default value: " + DFLT_SERVER_URI) - private String srvUri; - - /** */ - @Parameter(names = {"-n", "--node-uri"}, description = "URI for connect to Ignite node REST server" + - " " + - " Default value: " + DFLT_NODE_URI) - private String nodeUri; - - /** */ - @Parameter(names = {"-c", "--config"}, description = "Path to agent property file" + - " " + - " Default value: " + DFLT_CFG_PATH) - private String cfgPath; - - /** */ - @Parameter(names = {"-d", "--driver-folder"}, description = "Path to folder with JDBC drivers" + - " " + - " Default value: ./jdbc-drivers") - private String driversFolder; - - /** */ - @Parameter(names = { "-h", "--help" }, help = true, description = "Print this help message") - private Boolean help; - - /** - * @return Token. - */ - public String token() { - return tok; - } - - /** - * @param tok Token. - */ - public void token(String tok) { - this.tok = tok; - } - - /** - * @return Server URI. - */ - public String serverUri() { - return srvUri; - } - - /** - * @param srvUri URI. - */ - public void serverUri(String srvUri) { - this.srvUri = srvUri; - } - - /** - * @return Node URI. - */ - public String nodeUri() { - return nodeUri; - } - - /** - * @param nodeUri Node URI. - */ - public void nodeUri(String nodeUri) { - this.nodeUri = nodeUri; - } - - /** - * @return Configuration path. - */ - public String configPath() { - return cfgPath == null ? DFLT_CFG_PATH : cfgPath; - } - - /** - * @return Configured drivers folder. - */ - public String driversFolder() { - return driversFolder; - } - - /** - * @param driversFolder Driver folder. - */ - public void driversFolder(String driversFolder) { - this.driversFolder = driversFolder; - } - - /** - * @return {@code true} If agent options usage should be printed. - */ - public Boolean help() { - return help != null ? help : false; - } - - /** - * @param cfgUrl URL. - */ - public void load(URL cfgUrl) throws IOException { - Properties props = new Properties(); - - try (Reader reader = new InputStreamReader(cfgUrl.openStream())) { - props.load(reader); - } - - String val = (String)props.remove("token"); - - if (val != null) - token(val); - - val = (String)props.remove("server-uri"); - - if (val != null) - serverUri(val); - - val = (String)props.remove("node-uri"); - - if (val != null) - nodeUri(val); - - val = (String)props.remove("driver-folder"); - - if (val != null) - driversFolder(val); - } - - /** - * @param cmd Command. - */ - public void merge(AgentConfiguration cmd) { - if (tok == null) - token(cmd.token()); - - if (srvUri == null) - serverUri(cmd.serverUri()); - - if (srvUri == null) - serverUri(DFLT_SERVER_URI); - - if (nodeUri == null) - nodeUri(cmd.nodeUri()); - - if (nodeUri == null) - nodeUri(DFLT_NODE_URI); - - if (driversFolder == null) - driversFolder(cmd.driversFolder()); - } - - /** {@inheritDoc} */ - @Override public String toString() { - StringBuilder sb = new StringBuilder(); - - if (tok != null && tok.length() > 0) { - sb.append("User's security token : "); - - if (tok.length() > 4) { - sb.append(new String(new char[tok.length() - 4]).replace("\0", "*")); - - sb.append(tok.substring(tok.length() - 4)); - } - else - sb.append(new String(new char[tok.length()]).replace("\0", "*")); - - sb.append('\n'); - } - - sb.append("URI to Ignite node REST server: ").append(nodeUri == null ? DFLT_NODE_URI : nodeUri).append('\n'); - sb.append("URI to Ignite Console server : ").append(srvUri == null ? DFLT_SERVER_URI : srvUri).append('\n'); - sb.append("Path to agent property file : ").append(configPath()).append('\n'); - - String drvFld = driversFolder(); - - if (drvFld == null) { - File agentHome = AgentUtils.getAgentHome(); - - if (agentHome != null) - drvFld = new File(agentHome, "jdbc-drivers").getPath(); - } - - sb.append("Path to JDBC drivers folder : ").append(drvFld); - - return sb.toString(); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/54a24746/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentLauncher.java ---------------------------------------------------------------------- diff --git a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentLauncher.java b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentLauncher.java deleted file mode 100644 index bc1cea7..0000000 --- a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentLauncher.java +++ /dev/null @@ -1,165 +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 - * - * 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.ignite.agent; - -import com.beust.jcommander.JCommander; -import java.io.File; -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.Arrays; - -import com.beust.jcommander.ParameterException; -import org.apache.ignite.agent.handlers.RestExecutor; -import org.apache.log4j.Logger; -import org.eclipse.jetty.util.ssl.SslContextFactory; -import org.eclipse.jetty.websocket.client.WebSocketClient; - -import static org.apache.ignite.agent.AgentConfiguration.DFLT_SERVER_PORT; -import static org.apache.ignite.agent.AgentUtils.resolvePath; - -/** - * Control Center Agent launcher. - */ -public class AgentLauncher { - /** */ - private static final Logger log = Logger.getLogger(AgentLauncher.class.getName()); - - /** */ - private static final int RECONNECT_INTERVAL = 3000; - - /** - * @param args Args. - */ - @SuppressWarnings("BusyWait") - public static void main(String[] args) throws Exception { - log.info("Starting Apache Ignite Web Console Agent..."); - - AgentConfiguration cfg = new AgentConfiguration(); - - JCommander jCommander = new JCommander(cfg); - - String osName = System.getProperty("os.name").toLowerCase(); - - jCommander.setProgramName("ignite-web-agent." + (osName.contains("win") ? "bat" : "sh")); - - try { - jCommander.parse(args); - } - catch (ParameterException pe) { - log.error("Failed to parse command line parameters: " + Arrays.toString(args), pe); - - jCommander.usage(); - - return; - } - - String prop = cfg.configPath(); - - AgentConfiguration propCfg = new AgentConfiguration(); - - try { - File f = resolvePath(prop); - - if (f == null) - log.warn("Failed to find agent property file: '" + prop + "'"); - else - propCfg.load(f.toURI().toURL()); - } - catch (IOException ignore) { - if (!AgentConfiguration.DFLT_CFG_PATH.equals(prop)) - log.warn("Failed to load agent property file: '" + prop + "'", ignore); - } - - cfg.merge(propCfg); - - if (cfg.help()) { - jCommander.usage(); - - return; - } - - System.out.println(); - System.out.println("Agent configuration:"); - System.out.println(cfg); - System.out.println(); - - if (cfg.token() == null) { - String webHost; - - try { - webHost = new URI(cfg.serverUri()).getHost(); - } - catch (URISyntaxException e) { - log.error("Failed to parse Ignite Web Console uri", e); - - return; - } - - System.out.println("Security token is required to establish connection to the web console."); - System.out.println(String.format("It is available on the Profile page: https://%s/profile", webHost)); - - System.out.print("Enter security token: "); - - cfg.token(System.console().readLine().trim()); - } - - RestExecutor restExecutor = new RestExecutor(cfg); - - restExecutor.start(); - - try { - SslContextFactory sslCtxFactory = new SslContextFactory(); - - // Workaround for use self-signed certificate: - if (Boolean.getBoolean("trust.all")) - sslCtxFactory.setTrustAll(true); - - WebSocketClient client = new WebSocketClient(sslCtxFactory); - - client.setMaxIdleTimeout(Long.MAX_VALUE); - - client.start(); - - try { - while (!Thread.interrupted()) { - AgentSocket agentSock = new AgentSocket(cfg, restExecutor); - - log.info("Connecting to: " + cfg.serverUri()); - - URI uri = URI.create(cfg.serverUri()); - - if (uri.getPort() == -1) - uri = URI.create(cfg.serverUri() + ":" + DFLT_SERVER_PORT); - - client.connect(agentSock, uri); - - agentSock.waitForClose(); - - Thread.sleep(RECONNECT_INTERVAL); - } - } - finally { - client.stop(); - } - } - finally { - restExecutor.stop(); - } - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/54a24746/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentSocket.java ---------------------------------------------------------------------- diff --git a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentSocket.java b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentSocket.java deleted file mode 100644 index 271a08e..0000000 --- a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentSocket.java +++ /dev/null @@ -1,189 +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 - * - * 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.ignite.agent; - -import com.google.gson.Gson; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import java.io.IOException; -import java.net.ConnectException; -import java.util.concurrent.CountDownLatch; -import javax.net.ssl.SSLHandshakeException; -import org.apache.ignite.agent.handlers.DatabaseMetadataExtractor; -import org.apache.ignite.agent.handlers.RestExecutor; -import org.apache.ignite.agent.remote.Remote; -import org.apache.ignite.agent.remote.RemoteHandler; -import org.apache.ignite.agent.remote.WebSocketSender; -import org.apache.log4j.Logger; -import org.eclipse.jetty.websocket.api.Session; -import org.eclipse.jetty.websocket.api.annotations.OnWebSocketClose; -import org.eclipse.jetty.websocket.api.annotations.OnWebSocketConnect; -import org.eclipse.jetty.websocket.api.annotations.OnWebSocketError; -import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage; -import org.eclipse.jetty.websocket.api.annotations.WebSocket; - -/** - * Handler for web-socket connection. - */ -@WebSocket -public class AgentSocket implements WebSocketSender { - /** */ - public static final Gson GSON = new Gson(); - - /** */ - public static final JsonParser PARSER = new JsonParser(); - - /** */ - private static final Logger log = Logger.getLogger(AgentSocket.class.getName()); - - /** */ - private final CountDownLatch closeLatch = new CountDownLatch(1); - - /** */ - private final AgentConfiguration cfg; - - /** */ - private final RestExecutor restExecutor; - - /** */ - private RemoteHandler remote; - - /** */ - private Session ses; - - /** - * @param cfg Config. - */ - public AgentSocket(AgentConfiguration cfg, RestExecutor restExecutor) { - this.cfg = cfg; - this.restExecutor = restExecutor; - } - - /** - * @param statusCode Status code. - * @param reason Reason. - */ - @OnWebSocketClose - public void onClose(int statusCode, String reason) { - log.warn(String.format("Connection closed: %d - %s.", statusCode, reason)); - - if (remote != null) - remote.close(); - - closeLatch.countDown(); - } - - /** - * @param ses Session. - */ - @OnWebSocketConnect - public void onConnect(Session ses) { - log.info("Connection established."); - - this.ses = ses; - - remote = RemoteHandler.wrap(this, this, restExecutor, new DatabaseMetadataExtractor(cfg)); - - JsonObject authMsg = new JsonObject(); - - authMsg.addProperty("type", "AuthMessage"); - authMsg.addProperty("token", cfg.token()); - - send(authMsg); - } - - /** - * @param msg Message. - * @return Whether or not message was sent. - */ - @Override public boolean send(JsonObject msg) { - return send(GSON.toJson(msg)); - } - - /** - * @param msg Message. - * @return Whether or not message was sent. - */ - @Override public boolean send(String msg) { - try { - ses.getRemote().sendString(msg); - - return true; - } - catch (IOException ignored) { - log.error("Failed to send message to Control Center."); - - return false; - } - } - - /** - * @param ses Session. - * @param error Error. - */ - @OnWebSocketError - public void onError(Session ses, Throwable error) { - if (error instanceof ConnectException) - log.warn(error.getMessage()); - else if (error instanceof SSLHandshakeException) { - log.error("Failed to establish SSL connection to Ignite Console. Start agent with " + - "\"-Dtrust.all=true\" to skip certificate validation in case of using self-signed certificate.", error); - - System.exit(1); - } - else - log.error("Connection error.", error); - - if (remote != null) - remote.close(); - - closeLatch.countDown(); - } - - /** - * @param msg Message. - */ - @OnWebSocketMessage - public void onMessage(String msg) { - JsonElement jsonElement = PARSER.parse(msg); - - remote.onMessage((JsonObject)jsonElement); - } - - /** - * @param errorMsg Authentication failed message or {@code null} if authentication success. - */ - @Remote - public void authResult(String errorMsg) { - if (errorMsg != null) { - onClose(401, "Authentication failed: " + errorMsg); - - System.exit(1); - } - - log.info("Authentication success."); - } - - /** - * Await socket close. - */ - public void waitForClose() throws InterruptedException { - closeLatch.await(); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/54a24746/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentUtils.java ---------------------------------------------------------------------- diff --git a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentUtils.java b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentUtils.java deleted file mode 100644 index acce22d..0000000 --- a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentUtils.java +++ /dev/null @@ -1,115 +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 - * - * 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.ignite.agent; - -import org.apache.log4j.Logger; - -import java.io.File; -import java.net.URI; -import java.net.URISyntaxException; -import java.security.ProtectionDomain; - -/** - * Utility methods. - */ -public class AgentUtils { - /** */ - private static final Logger log = Logger.getLogger(AgentUtils.class.getName()); - - /** - * Default constructor. - */ - private AgentUtils() { - // No-op. - } - - /** - * @param path Path to normalize. - * @return Normalized file path. - */ - public static String normalizePath(String path) { - return path != null ? path.replace('\\', '/') : null; - } - - /** - * @return App folder. - */ - public static File getAgentHome() { - try { - ProtectionDomain domain = AgentLauncher.class.getProtectionDomain(); - - // Should not happen, but to make sure our code is not broken. - if (domain == null || domain.getCodeSource() == null || domain.getCodeSource().getLocation() == null) { - log.warn("Failed to resolve agent jar location!"); - - return null; - } - - // Resolve path to class-file. - URI classesUri = domain.getCodeSource().getLocation().toURI(); - - boolean win = System.getProperty("os.name").toLowerCase().contains("win"); - - // Overcome UNC path problem on Windows (http://www.tomergabel.com/JavaMishandlesUNCPathsOnWindows.aspx) - if (win && classesUri.getAuthority() != null) - classesUri = new URI(classesUri.toString().replace("file://", "file:/")); - - return new File(classesUri).getParentFile(); - } - catch (URISyntaxException | SecurityException ignored) { - log.warn("Failed to resolve agent jar location!"); - - return null; - } - } - - /** - * Gets file associated with path. - *

- * First check if path is relative to agent home. - * If not, check if path is absolute. - * If all checks fail, then {@code null} is returned. - *

- * - * @param path Path to resolve. - * @return Resolved path as file, or {@code null} if path cannot be resolved. - */ - public static File resolvePath(String path) { - assert path != null; - - File home = getAgentHome(); - - if (home != null) { - File file = new File(home, normalizePath(path)); - - if (file.exists()) - return file; - } - - /* - * 2. Check given path as absolute. - */ - - File file = new File(path); - - if (file.exists()) - return file; - - return null; - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/54a24746/modules/control-center-agent/src/main/java/org/apache/ignite/agent/demo/AgentMetadataDemo.java ---------------------------------------------------------------------- diff --git a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/demo/AgentMetadataDemo.java b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/demo/AgentMetadataDemo.java deleted file mode 100644 index 30237cf..0000000 --- a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/demo/AgentMetadataDemo.java +++ /dev/null @@ -1,88 +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 - * - * 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.ignite.agent.demo; - -import java.io.File; -import java.io.FileReader; -import java.sql.Connection; -import java.sql.DriverManager; -import java.util.concurrent.atomic.AtomicBoolean; - -import org.apache.log4j.Logger; -import org.h2.tools.RunScript; -import org.h2.tools.Server; - -import static org.apache.ignite.agent.AgentUtils.resolvePath; - -/** - * Demo for metadata load from database. - * - * H2 database will be started and several tables will be created. - */ -public class AgentMetadataDemo { - /** */ - private static final Logger log = Logger.getLogger(AgentMetadataDemo.class.getName()); - - /** */ - private static final AtomicBoolean initLatch = new AtomicBoolean(); - - /** - * @param jdbcUrl Connection url. - * @return true if url is used for test-drive. - */ - public static boolean isTestDriveUrl(String jdbcUrl) { - return "jdbc:h2:mem:demo-db".equals(jdbcUrl); - } - - /** - * Start H2 database and populate it with several tables. - */ - public static void testDrive() { - if (initLatch.compareAndSet(false, true)) { - log.info("DEMO: Prepare in-memory H2 database..."); - - try { - Connection conn = DriverManager.getConnection("jdbc:h2:mem:demo-db;DB_CLOSE_DELAY=-1", "sa", ""); - - File sqlScript = resolvePath("demo/demo-db.sql"); - - if (sqlScript == null) { - log.error("DEMO: Failed to find demo database init script file: demo/demo-db.sql"); - log.error("DEMO: Failed to start demo for metadata"); - - return; - } - - RunScript.execute(conn, new FileReader(sqlScript)); - - log.info("DEMO: Sample tables created."); - - conn.close(); - - Server.createTcpServer("-tcpDaemon").start(); - - log.info("DEMO: TcpServer stared."); - - log.info("DEMO: JDBC URL for test drive metadata load: jdbc:h2:mem:demo-db"); - } - catch (Exception e) { - log.error("DEMO: Failed to start test drive for metadata!", e); - } - } - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/54a24746/modules/control-center-agent/src/main/java/org/apache/ignite/agent/demo/AgentSqlDemo.java ---------------------------------------------------------------------- diff --git a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/demo/AgentSqlDemo.java b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/demo/AgentSqlDemo.java deleted file mode 100644 index 06da854..0000000 --- a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/demo/AgentSqlDemo.java +++ /dev/null @@ -1,495 +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 - * - * 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.ignite.agent.demo; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Random; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledThreadPoolExecutor; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.Ignition; -import org.apache.ignite.agent.AgentConfiguration; -import org.apache.ignite.agent.demo.model.Car; -import org.apache.ignite.agent.demo.model.CarKey; -import org.apache.ignite.agent.demo.model.Country; -import org.apache.ignite.agent.demo.model.CountryKey; -import org.apache.ignite.agent.demo.model.Department; -import org.apache.ignite.agent.demo.model.DepartmentKey; -import org.apache.ignite.agent.demo.model.Employee; -import org.apache.ignite.agent.demo.model.EmployeeKey; -import org.apache.ignite.agent.demo.model.Parking; -import org.apache.ignite.agent.demo.model.ParkingKey; -import org.apache.ignite.cache.QueryEntity; -import org.apache.ignite.cache.QueryIndex; -import org.apache.ignite.cache.QueryIndexType; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.internal.IgniteNodeAttributes; -import org.apache.ignite.internal.util.typedef.F; -import org.apache.ignite.logger.NullLogger; -import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; -import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; -import org.apache.log4j.Logger; - -/** - * Demo for SQL. - * - * Cache will be created and populated with data to query. - */ -public class AgentSqlDemo { - /** */ - private static final Logger log = Logger.getLogger(AgentMetadataDemo.class.getName()); - - /** */ - private static final AtomicBoolean initLatch = new AtomicBoolean(); - - /** */ - private static final String EMPLOYEE_CACHE_NAME = "demo-employee"; - - /** */ - private static final String CAR_CACHE_NAME = "demo-car"; - - /** */ - private static final Random rnd = new Random(); - - /** Countries count. */ - private static final int CNTR_CNT = 10; - - /** Departments count */ - private static final int DEP_CNT = 100; - - /** Employees count. */ - private static final int EMPL_CNT = 1000; - - /** Countries count. */ - private static final int CAR_CNT = 100; - - /** Departments count */ - private static final int PARK_CNT = 10; - - /** Counter for threads in pool. */ - private static final AtomicInteger THREAD_CNT = new AtomicInteger(0); - - /** - * Configure cacheEmployee. - * - * @param name Cache name. - */ - private static CacheConfiguration cacheEmployee(String name) { - CacheConfiguration ccfg = new CacheConfiguration<>(name); - - // Configure cacheEmployee types. - Collection queryEntities = new ArrayList<>(); - - // COUNTRY. - QueryEntity type = new QueryEntity(); - - queryEntities.add(type); - - type.setKeyType(CountryKey.class.getName()); - type.setValueType(Country.class.getName()); - - // Query fields for COUNTRY. - LinkedHashMap qryFlds = new LinkedHashMap<>(); - - qryFlds.put("id", "java.lang.Integer"); - qryFlds.put("countryName", "java.lang.String"); - - type.setFields(qryFlds); - - // Indexes for COUNTRY. - type.setIndexes(Collections.singletonList(new QueryIndex("id"))); - - ccfg.setQueryEntities(queryEntities); - - // DEPARTMENT. - type = new QueryEntity(); - - queryEntities.add(type); - - type.setKeyType(DepartmentKey.class.getName()); - type.setValueType(Department.class.getName()); - - // Query fields for DEPARTMENT. - qryFlds = new LinkedHashMap<>(); - - qryFlds.put("departmentId", "java.lang.Integer"); - qryFlds.put("departmentName", "java.lang.String"); - qryFlds.put("countryId", "java.lang.Integer"); - qryFlds.put("managerId", "java.lang.Integer"); - - type.setFields(qryFlds); - - // Indexes for DEPARTMENT. - type.setIndexes(Collections.singletonList(new QueryIndex("departmentId"))); - - ccfg.setQueryEntities(queryEntities); - - // EMPLOYEE. - type = new QueryEntity(); - - queryEntities.add(type); - - type.setKeyType(EmployeeKey.class.getName()); - type.setValueType(Employee.class.getName()); - - // Query fields for EMPLOYEE. - qryFlds = new LinkedHashMap<>(); - - qryFlds.put("employeeId", "java.lang.Integer"); - qryFlds.put("firstName", "java.lang.String"); - qryFlds.put("lastName", "java.lang.String"); - qryFlds.put("email", "java.lang.String"); - qryFlds.put("phoneNumber", "java.lang.String"); - qryFlds.put("hireDate", "java.sql.Date"); - qryFlds.put("job", "java.lang.String"); - qryFlds.put("salary", "java.lang.Double"); - qryFlds.put("managerId", "java.lang.Integer"); - qryFlds.put("departmentId", "java.lang.Integer"); - - type.setFields(qryFlds); - - // Indexes for EMPLOYEE. - Collection indexes = new ArrayList<>(); - - indexes.add(new QueryIndex("employeeId")); - indexes.add(new QueryIndex("salary", false)); - - // Group indexes for EMPLOYEE. - LinkedHashMap grpItems = new LinkedHashMap<>(); - - grpItems.put("firstName", Boolean.FALSE); - grpItems.put("lastName", Boolean.TRUE); - - QueryIndex grpIdx = new QueryIndex(grpItems, QueryIndexType.SORTED); - - grpIdx.setName("EMP_NAMES"); - - indexes.add(grpIdx); - - type.setIndexes(indexes); - - ccfg.setQueryEntities(queryEntities); - - return ccfg; - } - - /** - * Configure cacheEmployee. - * - * @param name Cache name. - */ - private static CacheConfiguration cacheCar(String name) { - CacheConfiguration ccfg = new CacheConfiguration<>(name); - - // Configure cacheEmployee types. - Collection queryEntities = new ArrayList<>(); - - // CAR. - QueryEntity type = new QueryEntity(); - - queryEntities.add(type); - - type.setKeyType(CarKey.class.getName()); - type.setValueType(Car.class.getName()); - - // Query fields for CAR. - LinkedHashMap qryFlds = new LinkedHashMap<>(); - - qryFlds.put("carId", "java.lang.Integer"); - qryFlds.put("parkingId", "java.lang.Integer"); - qryFlds.put("carName", "java.lang.String"); - - type.setFields(qryFlds); - - // Indexes for CAR. - type.setIndexes(Collections.singletonList(new QueryIndex("carId"))); - - ccfg.setQueryEntities(queryEntities); - - // PARKING. - type = new QueryEntity(); - - queryEntities.add(type); - - type.setKeyType(ParkingKey.class.getName()); - type.setValueType(Parking.class.getName()); - - // Query fields for PARKING. - qryFlds = new LinkedHashMap<>(); - - qryFlds.put("parkingId", "java.lang.Integer"); - qryFlds.put("parkingName", "java.lang.String"); - - type.setFields(qryFlds); - - // Indexes for PARKING. - type.setIndexes(Collections.singletonList(new QueryIndex("parkingId"))); - - ccfg.setQueryEntities(queryEntities); - - return ccfg; - } - - /** - * @param val Value to round. - * @param places Numbers after point. - * @return Rounded value; - */ - private static double round(double val, int places) { - if (places < 0) - throw new IllegalArgumentException(); - - long factor = (long) Math.pow(10, places); - - val *= factor; - - long tmp = Math.round(val); - - return (double) tmp / factor; - } - - /** - * @param ignite Ignite. - * @param name Cache name. - * @param range Time range in milliseconds. - */ - private static void populateCacheEmployee(Ignite ignite, String name, long range) { - log.trace("DEMO: Start population cache: '" + name + "' with data..."); - - IgniteCache cacheCountry = ignite.cache(name); - - for (int i = 0; i < CNTR_CNT; i++) - cacheCountry.put(new CountryKey(i), new Country(i, "State " + (i + 1))); - - IgniteCache cacheDepartment = ignite.cache(name); - - for (int i = 0; i < DEP_CNT; i++) { - Integer mgrId = (i == 0 || rnd.nextBoolean()) ? null : rnd.nextInt(i); - - cacheDepartment.put(new DepartmentKey(i), - new Department(i, "Department " + (i + 1), rnd.nextInt(CNTR_CNT), mgrId)); - } - - IgniteCache cacheEmployee = ignite.cache(name); - - for (int i = 0; i < EMPL_CNT; i++) { - Integer mgrId = (i == 0 || rnd.nextBoolean()) ? null : rnd.nextInt(i); - - double r = rnd.nextDouble(); - - cacheEmployee.put(new EmployeeKey(i), - new Employee(i, "first name " + (i + 1), "last name " + (i + 1), "email " + (i + 1), - "phone number " + (i + 1), new java.sql.Date((long)(r * range)), "job " + (i + 1), - round(r * 5000, 2) , mgrId, rnd.nextInt(DEP_CNT))); - } - - log.trace("DEMO: Finished population cache: '" + name + "' with data."); - } - - /** - * @param ignite Ignite. - * @param name Cache name. - */ - private static void populateCacheCar(Ignite ignite, String name) { - log.trace("DEMO: Start population cache: '" + name + "' with data..."); - - IgniteCache cacheParking = ignite.cache(name); - - for (int i = 0; i < PARK_CNT; i++) - cacheParking.put(new ParkingKey(i), new Parking(i, "Parking " + (i + 1))); - - IgniteCache cacheCar = ignite.cache(name); - - for (int i = 0; i < CAR_CNT; i++) - cacheCar.put(new CarKey(i), new Car(i, rnd.nextInt(PARK_CNT), "Car " + (i + 1))); - - - log.trace("DEMO: Finished population cache: '" + name + "' with data."); - } - - /** - * Creates a thread pool that can schedule commands to run after a given delay, or to execute periodically. - * - * @param corePoolSize Number of threads to keep in the pool, even if they are idle. - * @param threadName Part of thread name that would be used by thread factory. - * @return Newly created scheduled thread pool. - */ - private static ScheduledExecutorService newScheduledThreadPool(int corePoolSize, final String threadName) { - ScheduledExecutorService srvc = Executors.newScheduledThreadPool(corePoolSize, new ThreadFactory() { - @Override public Thread newThread(Runnable r) { - Thread thread = new Thread(r, String.format("%s-%d", threadName, THREAD_CNT.getAndIncrement())); - - thread.setDaemon(true); - - return thread; - } - }); - - ScheduledThreadPoolExecutor executor = (ScheduledThreadPoolExecutor) srvc; - - // Setting up shutdown policy. - executor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false); - executor.setContinueExistingPeriodicTasksAfterShutdownPolicy(false); - - return srvc; - } - - /** - * Starts read and write from cache in background. - * - * @param ignite Ignite. - * @param n - maximum count read/write key - */ - private static void startLoad(final Ignite ignite, final int n) { - final long diff = new java.util.Date().getTime(); - - populateCacheEmployee(ignite, EMPLOYEE_CACHE_NAME, diff); - - populateCacheCar(ignite, CAR_CACHE_NAME); - - ScheduledExecutorService cachePool = newScheduledThreadPool(2, "demo-sql-load-cache-tasks"); - - cachePool.scheduleWithFixedDelay(new Runnable() { - @Override public void run() { - try { - IgniteCache cache = ignite.cache(EMPLOYEE_CACHE_NAME); - - if (cache != null) - for (int i = 0; i < n; i++) { - Integer employeeId = rnd.nextInt(EMPL_CNT); - - Integer mgrId = (i == 0 || rnd.nextBoolean()) ? null : rnd.nextInt(employeeId); - - double r = rnd.nextDouble(); - - cache.put(new EmployeeKey(employeeId), - new Employee(employeeId, "first name " + (i + 1), "last name " + (i + 1), - "email " + (i + 1), "phone number " + (i + 1), - new java.sql.Date((long)(r * diff)), "job " + (i + 1), - round(r * 5000, 2), mgrId, rnd.nextInt(DEP_CNT))); - - if (rnd.nextBoolean()) - cache.remove(new EmployeeKey(rnd.nextInt(EMPL_CNT))); - } - } - catch (IllegalStateException ignored) { - // No-op. - } - catch (Throwable e) { - if (!e.getMessage().contains("cache is stopped")) - ignite.log().error("Cache write task execution error", e); - } - } - }, 10, 3, TimeUnit.SECONDS); - - cachePool.scheduleWithFixedDelay(new Runnable() { - @Override public void run() { - try { - IgniteCache cache = ignite.cache(CAR_CACHE_NAME); - - if (cache != null) - for (int i = 0; i < n; i++) { - Integer carId = rnd.nextInt(CAR_CNT); - - cache.put(new CarKey(carId), new Car(carId, rnd.nextInt(PARK_CNT), "Car " + (i + 1))); - - if (rnd.nextBoolean()) - cache.remove(new CarKey(rnd.nextInt(CAR_CNT))); - } - } - catch (IllegalStateException ignored) { - } - catch (Throwable e) { - if (!e.getMessage().contains("cache is stopped")) - ignite.log().error("Cache write task execution error", e); - } - } - }, 10, 3, TimeUnit.SECONDS); - } - - /** - * Start ignite node with cacheEmployee and populate it with data. - */ - public static boolean testDrive(AgentConfiguration acfg) { - if (initLatch.compareAndSet(false, true)) { - log.info("DEMO: Starting embedded node for sql test-drive..."); - - try { - IgniteConfiguration cfg = new IgniteConfiguration(); - - cfg.setLocalHost("127.0.0.1"); - - cfg.setMetricsLogFrequency(0); - - cfg.setGridLogger(new NullLogger()); - - // Configure discovery SPI. - TcpDiscoverySpi discoSpi = new TcpDiscoverySpi(); - - TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder(); - - ipFinder.setAddresses(Collections.singleton("127.0.0.1:47500..47501")); - - discoSpi.setIpFinder(ipFinder); - - cfg.setDiscoverySpi(discoSpi); - - cfg.setCacheConfiguration(cacheEmployee(EMPLOYEE_CACHE_NAME), cacheCar(CAR_CACHE_NAME)); - - log.trace("DEMO: Start embedded node with indexed enabled caches..."); - - IgniteEx ignite = (IgniteEx)Ignition.start(cfg); - - String host = ((Collection) - ignite.localNode().attribute(IgniteNodeAttributes.ATTR_REST_JETTY_ADDRS)).iterator().next(); - - Integer port = ignite.localNode().attribute(IgniteNodeAttributes.ATTR_REST_JETTY_PORT); - - if (F.isEmpty(host) || port == null) { - log.error("DEMO: Failed to start embedded node with rest!"); - - return false; - } - - acfg.nodeUri(String.format("http://%s:%d", "0.0.0.0".equals(host) ? "127.0.0.1" : host, port)); - - log.info("DEMO: Embedded node for sql test-drive successfully started"); - - startLoad(ignite, 20); - } - catch (Exception e) { - log.error("DEMO: Failed to start embedded node for sql test-drive!", e); - - return false; - } - } - - return true; - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/54a24746/modules/control-center-agent/src/main/java/org/apache/ignite/agent/demo/model/Car.java ---------------------------------------------------------------------- diff --git a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/demo/model/Car.java b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/demo/model/Car.java deleted file mode 100644 index c7f9dc5..0000000 --- a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/demo/model/Car.java +++ /dev/null @@ -1,155 +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 - * - * 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.ignite.agent.demo.model; - -import java.io.Serializable; - -/** - * Car definition. - * - * Code generated by Apache Ignite Schema Import utility: 08/24/2015. - */ -public class Car implements Serializable { - /** */ - private static final long serialVersionUID = 0L; - - /** Value for carId. */ - private int carId; - - /** Value for parkingId. */ - private int parkingId; - - /** Value for carName. */ - private String carName; - - /** - * Empty constructor. - */ - public Car() { - // No-op. - } - - /** - * Full constructor. - */ - public Car( - int carId, - int parkingId, - String carName - ) { - this.carId = carId; - this.parkingId = parkingId; - this.carName = carName; - } - - /** - * Gets carId. - * - * @return Value for carId. - */ - public int getCarId() { - return carId; - } - - /** - * Sets carId. - * - * @param carId New value for carId. - */ - public void setCarId(int carId) { - this.carId = carId; - } - - /** - * Gets parkingId. - * - * @return Value for parkingId. - */ - public int getParkingId() { - return parkingId; - } - - /** - * Sets parkingId. - * - * @param parkingId New value for parkingId. - */ - public void setParkingId(int parkingId) { - this.parkingId = parkingId; - } - - /** - * Gets carName. - * - * @return Value for carName. - */ - public String getCarName() { - return carName; - } - - /** - * Sets carName. - * - * @param carName New value for carName. - */ - public void setCarName(String carName) { - this.carName = carName; - } - - /** {@inheritDoc} */ - @Override public boolean equals(Object o) { - if (this == o) - return true; - - if (!(o instanceof Car)) - return false; - - Car that = (Car)o; - - if (carId != that.carId) - return false; - - if (parkingId != that.parkingId) - return false; - - if (carName != null ? !carName.equals(that.carName) : that.carName != null) - return false; - - return true; - } - - /** {@inheritDoc} */ - @Override public int hashCode() { - int res = carId; - - res = 31 * res + parkingId; - - res = 31 * res + (carName != null ? carName.hashCode() : 0); - - return res; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return "Car [carId=" + carId + - ", parkingId=" + parkingId + - ", carName=" + carName + - "]"; - } -} - http://git-wip-us.apache.org/repos/asf/ignite/blob/54a24746/modules/control-center-agent/src/main/java/org/apache/ignite/agent/demo/model/CarKey.java ---------------------------------------------------------------------- diff --git a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/demo/model/CarKey.java b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/demo/model/CarKey.java deleted file mode 100644 index 70a7a8e..0000000 --- a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/demo/model/CarKey.java +++ /dev/null @@ -1,97 +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 - * - * 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.ignite.agent.demo.model; - -import java.io.Serializable; - -/** - * CarKey definition. - * - * Code generated by Apache Ignite Schema Import utility: 08/24/2015. - */ -public class CarKey implements Serializable { - /** */ - private static final long serialVersionUID = 0L; - - /** Value for carId. */ - private int carId; - - /** - * Empty constructor. - */ - public CarKey() { - // No-op. - } - - /** - * Full constructor. - */ - public CarKey( - int carId - ) { - this.carId = carId; - } - - /** - * Gets carId. - * - * @return Value for carId. - */ - public int getCarId() { - return carId; - } - - /** - * Sets carId. - * - * @param carId New value for carId. - */ - public void setCarId(int carId) { - this.carId = carId; - } - - /** {@inheritDoc} */ - @Override public boolean equals(Object o) { - if (this == o) - return true; - - if (!(o instanceof CarKey)) - return false; - - CarKey that = (CarKey)o; - - if (carId != that.carId) - return false; - - return true; - } - - /** {@inheritDoc} */ - @Override public int hashCode() { - int res = carId; - - return res; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return "CarKey [carId=" + carId + - "]"; - } -} - http://git-wip-us.apache.org/repos/asf/ignite/blob/54a24746/modules/control-center-agent/src/main/java/org/apache/ignite/agent/demo/model/Country.java ---------------------------------------------------------------------- diff --git a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/demo/model/Country.java b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/demo/model/Country.java deleted file mode 100644 index 2dbb23b..0000000 --- a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/demo/model/Country.java +++ /dev/null @@ -1,126 +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 - * - * 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.ignite.agent.demo.model; - -import java.io.Serializable; - -/** - * Country definition. - * - * Code generated by Apache Ignite Schema Import utility: 08/24/2015. - */ -public class Country implements Serializable { - /** */ - private static final long serialVersionUID = 0L; - - /** Value for id. */ - private int id; - - /** Value for countryName. */ - private String countryName; - - /** - * Empty constructor. - */ - public Country() { - // No-op. - } - - /** - * Full constructor. - */ - public Country( - int id, - String countryName - ) { - this.id = id; - this.countryName = countryName; - } - - /** - * Gets id. - * - * @return Value for id. - */ - public int getId() { - return id; - } - - /** - * Sets id. - * - * @param id New value for id. - */ - public void setId(int id) { - this.id = id; - } - - /** - * Gets countryName. - * - * @return Value for countryName. - */ - public String getCountryName() { - return countryName; - } - - /** - * Sets countryName. - * - * @param countryName New value for countryName. - */ - public void setCountryName(String countryName) { - this.countryName = countryName; - } - - /** {@inheritDoc} */ - @Override public boolean equals(Object o) { - if (this == o) - return true; - - if (!(o instanceof Country)) - return false; - - Country that = (Country)o; - - if (id != that.id) - return false; - - if (countryName != null ? !countryName.equals(that.countryName) : that.countryName != null) - return false; - - return true; - } - - /** {@inheritDoc} */ - @Override public int hashCode() { - int res = id; - - res = 31 * res + (countryName != null ? countryName.hashCode() : 0); - - return res; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return "Country [id=" + id + - ", countryName=" + countryName + - "]"; - } -} - http://git-wip-us.apache.org/repos/asf/ignite/blob/54a24746/modules/control-center-agent/src/main/java/org/apache/ignite/agent/demo/model/CountryKey.java ---------------------------------------------------------------------- diff --git a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/demo/model/CountryKey.java b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/demo/model/CountryKey.java deleted file mode 100644 index c8a998f..0000000 --- a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/demo/model/CountryKey.java +++ /dev/null @@ -1,97 +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 - * - * 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.ignite.agent.demo.model; - -import java.io.Serializable; - -/** - * CountryKey definition. - * - * Code generated by Apache Ignite Schema Import utility: 08/24/2015. - */ -public class CountryKey implements Serializable { - /** */ - private static final long serialVersionUID = 0L; - - /** Value for id. */ - private int id; - - /** - * Empty constructor. - */ - public CountryKey() { - // No-op. - } - - /** - * Full constructor. - */ - public CountryKey( - int id - ) { - this.id = id; - } - - /** - * Gets id. - * - * @return Value for id. - */ - public int getId() { - return id; - } - - /** - * Sets id. - * - * @param id New value for id. - */ - public void setId(int id) { - this.id = id; - } - - /** {@inheritDoc} */ - @Override public boolean equals(Object o) { - if (this == o) - return true; - - if (!(o instanceof CountryKey)) - return false; - - CountryKey that = (CountryKey)o; - - if (id != that.id) - return false; - - return true; - } - - /** {@inheritDoc} */ - @Override public int hashCode() { - int res = id; - - return res; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return "CountryKey [id=" + id + - "]"; - } -} - http://git-wip-us.apache.org/repos/asf/ignite/blob/54a24746/modules/control-center-agent/src/main/java/org/apache/ignite/agent/demo/model/Department.java ---------------------------------------------------------------------- diff --git a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/demo/model/Department.java b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/demo/model/Department.java deleted file mode 100644 index 5e48b42..0000000 --- a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/demo/model/Department.java +++ /dev/null @@ -1,184 +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 - * - * 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.ignite.agent.demo.model; - -import java.io.Serializable; - -/** - * Department definition. - * - * Code generated by Apache Ignite Schema Import utility: 08/24/2015. - */ -public class Department implements Serializable { - /** */ - private static final long serialVersionUID = 0L; - - /** Value for departmentId. */ - private int departmentId; - - /** Value for departmentName. */ - private String departmentName; - - /** Value for countryId. */ - private Integer countryId; - - /** Value for managerId. */ - private Integer managerId; - - /** - * Empty constructor. - */ - public Department() { - // No-op. - } - - /** - * Full constructor. - */ - public Department( - int departmentId, - String departmentName, - Integer countryId, - Integer managerId - ) { - this.departmentId = departmentId; - this.departmentName = departmentName; - this.countryId = countryId; - this.managerId = managerId; - } - - /** - * Gets departmentId. - * - * @return Value for departmentId. - */ - public int getDepartmentId() { - return departmentId; - } - - /** - * Sets departmentId. - * - * @param departmentId New value for departmentId. - */ - public void setDepartmentId(int departmentId) { - this.departmentId = departmentId; - } - - /** - * Gets departmentName. - * - * @return Value for departmentName. - */ - public String getDepartmentName() { - return departmentName; - } - - /** - * Sets departmentName. - * - * @param departmentName New value for departmentName. - */ - public void setDepartmentName(String departmentName) { - this.departmentName = departmentName; - } - - /** - * Gets countryId. - * - * @return Value for countryId. - */ - public Integer getCountryId() { - return countryId; - } - - /** - * Sets countryId. - * - * @param countryId New value for countryId. - */ - public void setCountryId(Integer countryId) { - this.countryId = countryId; - } - - /** - * Gets managerId. - * - * @return Value for managerId. - */ - public Integer getManagerId() { - return managerId; - } - - /** - * Sets managerId. - * - * @param managerId New value for managerId. - */ - public void setManagerId(Integer managerId) { - this.managerId = managerId; - } - - /** {@inheritDoc} */ - @Override public boolean equals(Object o) { - if (this == o) - return true; - - if (!(o instanceof Department)) - return false; - - Department that = (Department)o; - - if (departmentId != that.departmentId) - return false; - - if (departmentName != null ? !departmentName.equals(that.departmentName) : that.departmentName != null) - return false; - - if (countryId != null ? !countryId.equals(that.countryId) : that.countryId != null) - return false; - - if (managerId != null ? !managerId.equals(that.managerId) : that.managerId != null) - return false; - - return true; - } - - /** {@inheritDoc} */ - @Override public int hashCode() { - int res = departmentId; - - res = 31 * res + (departmentName != null ? departmentName.hashCode() : 0); - - res = 31 * res + (countryId != null ? countryId.hashCode() : 0); - - res = 31 * res + (managerId != null ? managerId.hashCode() : 0); - - return res; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return "Department [departmentId=" + departmentId + - ", departmentName=" + departmentName + - ", countryId=" + countryId + - ", managerId=" + managerId + - "]"; - } -} - http://git-wip-us.apache.org/repos/asf/ignite/blob/54a24746/modules/control-center-agent/src/main/java/org/apache/ignite/agent/demo/model/DepartmentKey.java ---------------------------------------------------------------------- diff --git a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/demo/model/DepartmentKey.java b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/demo/model/DepartmentKey.java deleted file mode 100644 index a8dc1b8..0000000 --- a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/demo/model/DepartmentKey.java +++ /dev/null @@ -1,97 +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 - * - * 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.ignite.agent.demo.model; - -import java.io.Serializable; - -/** - * DepartmentKey definition. - * - * Code generated by Apache Ignite Schema Import utility: 08/24/2015. - */ -public class DepartmentKey implements Serializable { - /** */ - private static final long serialVersionUID = 0L; - - /** Value for departmentId. */ - private int departmentId; - - /** - * Empty constructor. - */ - public DepartmentKey() { - // No-op. - } - - /** - * Full constructor. - */ - public DepartmentKey( - int departmentId - ) { - this.departmentId = departmentId; - } - - /** - * Gets departmentId. - * - * @return Value for departmentId. - */ - public int getDepartmentId() { - return departmentId; - } - - /** - * Sets departmentId. - * - * @param departmentId New value for departmentId. - */ - public void setDepartmentId(int departmentId) { - this.departmentId = departmentId; - } - - /** {@inheritDoc} */ - @Override public boolean equals(Object o) { - if (this == o) - return true; - - if (!(o instanceof DepartmentKey)) - return false; - - DepartmentKey that = (DepartmentKey)o; - - if (departmentId != that.departmentId) - return false; - - return true; - } - - /** {@inheritDoc} */ - @Override public int hashCode() { - int res = departmentId; - - return res; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return "DepartmentKey [departmentId=" + departmentId + - "]"; - } -} -