Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 247B5200B92 for ; Tue, 13 Sep 2016 11:53:03 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 23427160AD3; Tue, 13 Sep 2016 09:53:03 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 8A8A6160ADD for ; Tue, 13 Sep 2016 11:52:58 +0200 (CEST) Received: (qmail 98256 invoked by uid 500); 13 Sep 2016 09:52:57 -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 96368 invoked by uid 99); 13 Sep 2016 09:52:55 -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; Tue, 13 Sep 2016 09:52:55 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 530DCE094C; Tue, 13 Sep 2016 09:52:55 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: vozerov@apache.org To: commits@ignite.apache.org Date: Tue, 13 Sep 2016 09:53:37 -0000 Message-Id: <5c481360fc544650bc6ce42c8f229e7e@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [45/69] [abbrv] ignite git commit: Web Console beta-3. archived-at: Tue, 13 Sep 2016 09:53:03 -0000 http://git-wip-us.apache.org/repos/asf/ignite/blob/6af6560a/modules/web-agent/src/main/java/org/apache/ignite/console/demo/AgentClusterDemo.java ---------------------------------------------------------------------- diff --git a/modules/web-agent/src/main/java/org/apache/ignite/console/demo/AgentClusterDemo.java b/modules/web-agent/src/main/java/org/apache/ignite/console/demo/AgentClusterDemo.java deleted file mode 100644 index bf0903a..0000000 --- a/modules/web-agent/src/main/java/org/apache/ignite/console/demo/AgentClusterDemo.java +++ /dev/null @@ -1,638 +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.console.demo; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.Random; -import java.util.Set; -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.cache.CacheAtomicityMode; -import org.apache.ignite.cache.QueryEntity; -import org.apache.ignite.cache.QueryIndex; -import org.apache.ignite.cache.QueryIndexType; -import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.console.agent.AgentConfiguration; -import org.apache.ignite.console.demo.model.Car; -import org.apache.ignite.console.demo.model.Country; -import org.apache.ignite.console.demo.model.Department; -import org.apache.ignite.console.demo.model.Employee; -import org.apache.ignite.console.demo.model.Parking; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.internal.util.typedef.F; -import org.apache.ignite.logger.log4j.Log4JLogger; -import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi; -import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; -import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; -import org.apache.ignite.transactions.Transaction; -import org.apache.log4j.Logger; - -import static org.apache.ignite.IgniteSystemProperties.IGNITE_ATOMIC_CACHE_DELETE_HISTORY_SIZE; -import static org.apache.ignite.IgniteSystemProperties.IGNITE_PERFORMANCE_SUGGESTIONS_DISABLED; -import static org.apache.ignite.IgniteSystemProperties.IGNITE_UPDATE_NOTIFIER; -import static org.apache.ignite.IgniteSystemProperties.IGNITE_JETTY_PORT; -import static org.apache.ignite.IgniteSystemProperties.IGNITE_NO_ASCII; -import static org.apache.ignite.events.EventType.EVTS_DISCOVERY; -import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_REST_JETTY_ADDRS; -import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_REST_JETTY_PORT; -import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; -import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; - -/** - * Demo for cluster features like SQL and Monitoring. - * - * Cache will be created and populated with data to query. - */ -public class AgentClusterDemo { - /** */ - private static final Logger log = Logger.getLogger(AgentClusterDemo.class.getName()); - - /** */ - private static final AtomicBoolean initLatch = new AtomicBoolean(); - - /** */ - private static final int NODE_CNT = 3; - - /** */ - private static final String COUNTRY_CACHE_NAME = "CountryCache"; - - /** */ - private static final String DEPARTMENT_CACHE_NAME = "DepartmentCache"; - - /** */ - private static final String EMPLOYEE_CACHE_NAME = "EmployeeCache"; - - /** */ - private static final String PARKING_CACHE_NAME = "ParkingCache"; - - /** */ - private static final String CAR_CACHE_NAME = "CarCache"; - - /** */ - private static final Set DEMO_CACHES = new HashSet<>(Arrays.asList(COUNTRY_CACHE_NAME, - DEPARTMENT_CACHE_NAME, EMPLOYEE_CACHE_NAME, PARKING_CACHE_NAME, CAR_CACHE_NAME)); - - /** */ - 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); - - /** - * Create base cache configuration. - * - * @param name cache name. - * @return Cache configuration with basic properties set. - */ - private static CacheConfiguration cacheConfiguration(String name) { - CacheConfiguration ccfg = new CacheConfiguration<>(name); - - ccfg.setAffinity(new RendezvousAffinityFunction(false, 32)); - ccfg.setStartSize(100); - ccfg.setStatisticsEnabled(true); - - return ccfg; - } - - /** - * Configure cacheCountry. - */ - private static CacheConfiguration cacheCountry() { - CacheConfiguration ccfg = cacheConfiguration(COUNTRY_CACHE_NAME); - - // Configure cacheCountry types. - Collection qryEntities = new ArrayList<>(); - - // COUNTRY. - QueryEntity type = new QueryEntity(); - - qryEntities.add(type); - - type.setKeyType(Integer.class.getName()); - type.setValueType(Country.class.getName()); - - // Query fields for COUNTRY. - LinkedHashMap qryFlds = new LinkedHashMap<>(); - - qryFlds.put("id", "java.lang.Integer"); - qryFlds.put("name", "java.lang.String"); - qryFlds.put("population", "java.lang.Integer"); - - type.setFields(qryFlds); - - ccfg.setQueryEntities(qryEntities); - - return ccfg; - } - - /** - * Configure cacheEmployee. - */ - private static CacheConfiguration cacheDepartment() { - CacheConfiguration ccfg = cacheConfiguration(DEPARTMENT_CACHE_NAME); - - // Configure cacheDepartment types. - Collection qryEntities = new ArrayList<>(); - - // DEPARTMENT. - QueryEntity type = new QueryEntity(); - - qryEntities.add(type); - - type.setKeyType(Integer.class.getName()); - type.setValueType(Department.class.getName()); - - // Query fields for DEPARTMENT. - LinkedHashMap qryFlds = new LinkedHashMap<>(); - - qryFlds.put("id", "java.lang.Integer"); - qryFlds.put("countryId", "java.lang.Integer"); - qryFlds.put("name", "java.lang.String"); - - type.setFields(qryFlds); - - ccfg.setQueryEntities(qryEntities); - - return ccfg; - } - - /** - * Configure cacheEmployee. - */ - private static CacheConfiguration cacheEmployee() { - CacheConfiguration ccfg = cacheConfiguration(EMPLOYEE_CACHE_NAME); - - ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); - ccfg.setBackups(1); - - // Configure cacheEmployee types. - Collection qryEntities = new ArrayList<>(); - - // EMPLOYEE. - QueryEntity type = new QueryEntity(); - - qryEntities.add(type); - - type.setKeyType(Integer.class.getName()); - type.setValueType(Employee.class.getName()); - - // Query fields for EMPLOYEE. - LinkedHashMap qryFlds = new LinkedHashMap<>(); - - qryFlds.put("id", "java.lang.Integer"); - qryFlds.put("departmentId", "java.lang.Integer"); - qryFlds.put("managerId", "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"); - - type.setFields(qryFlds); - - // Indexes for EMPLOYEE. - Collection indexes = new ArrayList<>(); - - QueryIndex idx = new QueryIndex(); - - idx.setName("EMP_NAMES"); - idx.setIndexType(QueryIndexType.SORTED); - LinkedHashMap indFlds = new LinkedHashMap<>(); - - indFlds.put("firstName", Boolean.FALSE); - indFlds.put("lastName", Boolean.FALSE); - - idx.setFields(indFlds); - - indexes.add(idx); - indexes.add(new QueryIndex("salary", QueryIndexType.SORTED, false, "EMP_SALARY")); - - type.setIndexes(indexes); - - ccfg.setQueryEntities(qryEntities); - - return ccfg; - } - - /** - * Configure cacheEmployee. - */ - private static CacheConfiguration cacheParking() { - CacheConfiguration ccfg = cacheConfiguration(PARKING_CACHE_NAME); - - // Configure cacheParking types. - Collection qryEntities = new ArrayList<>(); - - // PARKING. - QueryEntity type = new QueryEntity(); - - qryEntities.add(type); - - type.setKeyType(Integer.class.getName()); - type.setValueType(Parking.class.getName()); - - // Query fields for PARKING. - LinkedHashMap qryFlds = new LinkedHashMap<>(); - - qryFlds.put("id", "java.lang.Integer"); - qryFlds.put("name", "java.lang.String"); - qryFlds.put("capacity", "java.lang.Integer"); - - type.setFields(qryFlds); - - ccfg.setQueryEntities(qryEntities); - - return ccfg; - } - - /** - * Configure cacheEmployee. - */ - private static CacheConfiguration cacheCar() { - CacheConfiguration ccfg = cacheConfiguration(CAR_CACHE_NAME); - - // Configure cacheCar types. - Collection qryEntities = new ArrayList<>(); - - // CAR. - QueryEntity type = new QueryEntity(); - - qryEntities.add(type); - - type.setKeyType(Integer.class.getName()); - type.setValueType(Car.class.getName()); - - // Query fields for CAR. - LinkedHashMap qryFlds = new LinkedHashMap<>(); - - qryFlds.put("id", "java.lang.Integer"); - qryFlds.put("parkingId", "java.lang.Integer"); - qryFlds.put("name", "java.lang.String"); - - type.setFields(qryFlds); - - ccfg.setQueryEntities(qryEntities); - - return ccfg; - } - - /** - * Configure node. - * @param gridIdx Grid name index. - * @param client If {@code true} then start client node. - * @return IgniteConfiguration - */ - private static IgniteConfiguration igniteConfiguration(int gridIdx, boolean client) { - IgniteConfiguration cfg = new IgniteConfiguration(); - - cfg.setGridName((client ? "demo-server-" : "demo-client-") + gridIdx); - cfg.setLocalHost("127.0.0.1"); - cfg.setIncludeEventTypes(EVTS_DISCOVERY); - - TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder(); - - ipFinder.setAddresses(Collections.singletonList("127.0.0.1:60900.." + (60900 + NODE_CNT - 1))); - - // Configure discovery SPI. - TcpDiscoverySpi discoSpi = new TcpDiscoverySpi(); - - discoSpi.setLocalPort(60900); - discoSpi.setIpFinder(ipFinder); - - cfg.setDiscoverySpi(discoSpi); - - TcpCommunicationSpi commSpi = new TcpCommunicationSpi(); - - commSpi.setSharedMemoryPort(-1); - commSpi.setLocalPort(60800); - - cfg.setCommunicationSpi(commSpi); - cfg.setGridLogger(new Log4JLogger(log)); - cfg.setMetricsLogFrequency(0); - cfg.getConnectorConfiguration().setPort(60700); - - if (client) - cfg.setClientMode(true); - - cfg.setCacheConfiguration(cacheCountry(), cacheDepartment(), cacheEmployee(), cacheParking(), cacheCar()); - - return cfg; - } - - /** - * @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 range Time range in milliseconds. - */ - private static void populateCacheEmployee(Ignite ignite, long range) { - if (log.isDebugEnabled()) - log.debug("DEMO: Start employees population with data..."); - - IgniteCache cacheCountry = ignite.cache(COUNTRY_CACHE_NAME); - - for (int i = 0, n = 1; i < CNTR_CNT; i++, n++) - cacheCountry.put(i, new Country(i, "Country #" + n, n * 10000000)); - - IgniteCache cacheDepartment = ignite.cache(DEPARTMENT_CACHE_NAME); - - IgniteCache cacheEmployee = ignite.cache(EMPLOYEE_CACHE_NAME); - - for (int i = 0, n = 1; i < DEP_CNT; i++, n++) { - cacheDepartment.put(i, new Department(n, rnd.nextInt(CNTR_CNT), "Department #" + n)); - - double r = rnd.nextDouble(); - - cacheEmployee.put(i, new Employee(i, rnd.nextInt(DEP_CNT), null, "First name manager #" + n, - "Last name manager #" + n, "Email manager #" + n, "Phone number manager #" + n, - new java.sql.Date((long)(r * range)), "Job manager #" + n, 1000 + round(r * 4000, 2))); - } - - for (int i = 0, n = 1; i < EMPL_CNT; i++, n++) { - Integer depId = rnd.nextInt(DEP_CNT); - - double r = rnd.nextDouble(); - - cacheEmployee.put(i, new Employee(i, depId, depId, "First name employee #" + n, - "Last name employee #" + n, "Email employee #" + n, "Phone number employee #" + n, - new java.sql.Date((long)(r * range)), "Job employee #" + n, 500 + round(r * 2000, 2))); - } - - if (log.isDebugEnabled()) - log.debug("DEMO: Finished employees population."); - } - - /** - * @param ignite Ignite. - */ - private static void populateCacheCar(Ignite ignite) { - if (log.isDebugEnabled()) - log.debug("DEMO: Start cars population..."); - - IgniteCache cacheParking = ignite.cache(PARKING_CACHE_NAME); - - for (int i = 0, n = 1; i < PARK_CNT; i++, n++) - cacheParking.put(i, new Parking(i, "Parking #" + n, n * 10)); - - IgniteCache cacheCar = ignite.cache(CAR_CACHE_NAME); - - for (int i = 0, n = 1; i < CAR_CNT; i++, n++) - cacheCar.put(i, new Car(i, rnd.nextInt(PARK_CNT), "Car #" + n)); - - if (log.isDebugEnabled()) - log.debug("DEMO: Finished cars population."); - } - - /** - * 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 cnt - maximum count read/write key - */ - private static void startLoad(final Ignite ignite, final int cnt) { - final long diff = new java.util.Date().getTime(); - - populateCacheEmployee(ignite, diff); - populateCacheCar(ignite); - - ScheduledExecutorService cachePool = newScheduledThreadPool(2, "demo-sql-load-cache-tasks"); - - cachePool.scheduleWithFixedDelay(new Runnable() { - @Override public void run() { - try { - for (String cacheName : ignite.cacheNames()) { - if (!DEMO_CACHES.contains(cacheName)) { - IgniteCache otherCache = ignite.cache(cacheName); - - if (otherCache != null) { - for (int i = 0, n = 1; i < cnt; i++, n++) { - Integer key = rnd.nextInt(1000); - - String val = otherCache.get(key); - - if (val == null) - otherCache.put(key, "other-" + key); - else if (rnd.nextInt(100) < 30) - otherCache.remove(key); - } - } - } - } - - IgniteCache cacheEmployee = ignite.cache(EMPLOYEE_CACHE_NAME); - - if (cacheEmployee != null) - try(Transaction tx = ignite.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - for (int i = 0, n = 1; i < cnt; i++, n++) { - Integer id = rnd.nextInt(EMPL_CNT); - - Integer depId = rnd.nextInt(DEP_CNT); - - double r = rnd.nextDouble(); - - cacheEmployee.put(id, new Employee(id, depId, depId, "First name employee #" + n, - "Last name employee #" + n, "Email employee #" + n, "Phone number employee #" + n, - new java.sql.Date((long)(r * diff)), "Job employee #" + n, 500 + round(r * 2000, 2))); - - if (rnd.nextBoolean()) - cacheEmployee.remove(rnd.nextInt(EMPL_CNT)); - - cacheEmployee.get(rnd.nextInt(EMPL_CNT)); - } - - if (rnd.nextInt(100) > 20) - tx.commit(); - } - } - 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 < cnt; i++) { - Integer carId = rnd.nextInt(CAR_CNT); - - cache.put(carId, new Car(carId, rnd.nextInt(PARK_CNT), "Car #" + (i + 1))); - - if (rnd.nextBoolean()) - cache.remove(rnd.nextInt(CAR_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); - } - - /** - * 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 nodes for demo..."); - - System.setProperty(IGNITE_ATOMIC_CACHE_DELETE_HISTORY_SIZE, "1"); - System.setProperty(IGNITE_PERFORMANCE_SUGGESTIONS_DISABLED, "true"); - System.setProperty(IGNITE_UPDATE_NOTIFIER, "false"); - - System.setProperty(IGNITE_JETTY_PORT, "60800"); - System.setProperty(IGNITE_NO_ASCII, "true"); - - try { - IgniteEx ignite = (IgniteEx)Ignition.start(igniteConfiguration(0, false)); - - final AtomicInteger cnt = new AtomicInteger(0); - - final ScheduledExecutorService execSrv = Executors.newSingleThreadScheduledExecutor(); - - execSrv.scheduleAtFixedRate(new Runnable() { - @Override public void run() { - int idx = cnt.incrementAndGet(); - - try { - Ignition.start(igniteConfiguration(idx, idx == NODE_CNT)); - } - catch (Throwable e) { - log.error("DEMO: Failed to start embedded node: " + e.getMessage()); - } - finally { - if (idx == NODE_CNT) - execSrv.shutdown(); - } - } - }, 10, 10, TimeUnit.SECONDS); - - if (log.isDebugEnabled()) - log.debug("DEMO: Started embedded nodes with indexed enabled caches..."); - - Collection jettyAddrs = ignite.localNode().attribute(ATTR_REST_JETTY_ADDRS); - - String host = jettyAddrs == null ? null : jettyAddrs.iterator().next(); - - Integer port = ignite.localNode().attribute(ATTR_REST_JETTY_PORT); - - if (F.isEmpty(host) || port == null) { - log.error("DEMO: Failed to start embedded node with rest!"); - - return false; - } - - acfg.demoNodeUri(String.format("http://%s:%d", host, port)); - - log.info("DEMO: Embedded nodes for sql and monitoring demo successfully started"); - - startLoad(ignite, 20); - } - catch (Exception e) { - log.error("DEMO: Failed to start embedded node for sql and monitoring demo!", e); - - return false; - } - } - - return true; - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/6af6560a/modules/web-agent/src/main/java/org/apache/ignite/console/demo/AgentMetadataDemo.java ---------------------------------------------------------------------- diff --git a/modules/web-agent/src/main/java/org/apache/ignite/console/demo/AgentMetadataDemo.java b/modules/web-agent/src/main/java/org/apache/ignite/console/demo/AgentMetadataDemo.java deleted file mode 100644 index 4683dd8..0000000 --- a/modules/web-agent/src/main/java/org/apache/ignite/console/demo/AgentMetadataDemo.java +++ /dev/null @@ -1,92 +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.console.demo; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.SQLException; -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.console.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 Connection testDrive() throws SQLException { - 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/db-init.sql"); - - //noinspection ConstantConditions - 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 (SQLException e) { - log.error("DEMO: Failed to start test drive for metadata!", e); - - throw e; - } - catch (FileNotFoundException | NullPointerException e) { - log.error("DEMO: Failed to find demo database init script file: demo/db-init.sql"); - - throw new SQLException("Failed to start demo for metadata", e); - } - } - - return DriverManager.getConnection("jdbc:h2:mem:demo-db;DB_CLOSE_DELAY=-1", "sa", ""); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/6af6560a/modules/web-agent/src/main/java/org/apache/ignite/console/demo/model/Car.java ---------------------------------------------------------------------- diff --git a/modules/web-agent/src/main/java/org/apache/ignite/console/demo/model/Car.java b/modules/web-agent/src/main/java/org/apache/ignite/console/demo/model/Car.java deleted file mode 100644 index f351efc..0000000 --- a/modules/web-agent/src/main/java/org/apache/ignite/console/demo/model/Car.java +++ /dev/null @@ -1,152 +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.console.demo.model; - -import java.io.Serializable; - -/** - * Car definition. - */ -public class Car implements Serializable { - /** */ - private static final long serialVersionUID = 0L; - - /** Value for id. */ - private int id; - - /** Value for parkingId. */ - private int parkingId; - - /** Value for name. */ - private String name; - - /** - * Empty constructor. - */ - public Car() { - // No-op. - } - - /** - * Full constructor. - */ - public Car( - int id, - int parkingId, - String name - ) { - this.id = id; - this.parkingId = parkingId; - this.name = name; - } - - /** - * 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 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 name. - * - * @return Value for name. - */ - public String getName() { - return name; - } - - /** - * Sets name. - * - * @param name New value for name. - */ - public void setName(String name) { - this.name = name; - } - - /** {@inheritDoc} */ - @Override public boolean equals(Object o) { - if (this == o) - return true; - - if (!(o instanceof Car)) - return false; - - Car that = (Car)o; - - if (id != that.id) - return false; - - if (parkingId != that.parkingId) - return false; - - if (name != null ? !name.equals(that.name) : that.name != null) - return false; - - return true; - } - - /** {@inheritDoc} */ - @Override public int hashCode() { - int res = id; - - res = 31 * res + parkingId; - - res = 31 * res + (name != null ? name.hashCode() : 0); - - return res; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return "Car [id=" + id + - ", parkingId=" + parkingId + - ", name=" + name + - ']'; - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/6af6560a/modules/web-agent/src/main/java/org/apache/ignite/console/demo/model/Country.java ---------------------------------------------------------------------- diff --git a/modules/web-agent/src/main/java/org/apache/ignite/console/demo/model/Country.java b/modules/web-agent/src/main/java/org/apache/ignite/console/demo/model/Country.java deleted file mode 100644 index 348928b..0000000 --- a/modules/web-agent/src/main/java/org/apache/ignite/console/demo/model/Country.java +++ /dev/null @@ -1,152 +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.console.demo.model; - -import java.io.Serializable; - -/** - * Country definition. - */ -public class Country implements Serializable { - /** */ - private static final long serialVersionUID = 0L; - - /** Value for id. */ - private int id; - - /** Value for name. */ - private String name; - - /** Value for population. */ - private int population; - - /** - * Empty constructor. - */ - public Country() { - // No-op. - } - - /** - * Full constructor. - */ - public Country( - int id, - String name, - int population - ) { - this.id = id; - this.name = name; - this.population = population; - } - - /** - * 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 name. - * - * @return Value for name. - */ - public String getName() { - return name; - } - - /** - * Sets name. - * - * @param name New value for name. - */ - public void setName(String name) { - this.name = name; - } - - /** - * Gets population. - * - * @return Value for population. - */ - public int getPopulation() { - return population; - } - - /** - * Sets population. - * - * @param population New value for population. - */ - public void setPopulation(int population) { - this.population = population; - } - - /** {@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 (name != null ? !name.equals(that.name) : that.name != null) - return false; - - if (population != that.population) - return false; - - return true; - } - - /** {@inheritDoc} */ - @Override public int hashCode() { - int res = id; - - res = 31 * res + (name != null ? name.hashCode() : 0); - - res = 31 * res + population; - - return res; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return "Country [id=" + id + - ", name=" + name + - ", population=" + population + - ']'; - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/6af6560a/modules/web-agent/src/main/java/org/apache/ignite/console/demo/model/Department.java ---------------------------------------------------------------------- diff --git a/modules/web-agent/src/main/java/org/apache/ignite/console/demo/model/Department.java b/modules/web-agent/src/main/java/org/apache/ignite/console/demo/model/Department.java deleted file mode 100644 index 1c2f3b2..0000000 --- a/modules/web-agent/src/main/java/org/apache/ignite/console/demo/model/Department.java +++ /dev/null @@ -1,152 +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.console.demo.model; - -import java.io.Serializable; - -/** - * Department definition. - */ -public class Department implements Serializable { - /** */ - private static final long serialVersionUID = 0L; - - /** Value for id. */ - private int id; - - /** Value for countryId. */ - private int countryId; - - /** Value for name. */ - private String name; - - /** - * Empty constructor. - */ - public Department() { - // No-op. - } - - /** - * Full constructor. - */ - public Department( - int id, - int countryId, - String name - ) { - this.id = id; - this.countryId = countryId; - this.name = name; - } - - /** - * 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 countryId. - * - * @return Value for countryId. - */ - public int getCountryId() { - return countryId; - } - - /** - * Sets countryId. - * - * @param countryId New value for countryId. - */ - public void setCountryId(int countryId) { - this.countryId = countryId; - } - - /** - * Gets name. - * - * @return Value for name. - */ - public String getName() { - return name; - } - - /** - * Sets name. - * - * @param name New value for name. - */ - public void setName(String name) { - this.name = name; - } - - /** {@inheritDoc} */ - @Override public boolean equals(Object o) { - if (this == o) - return true; - - if (!(o instanceof Department)) - return false; - - Department that = (Department)o; - - if (id != that.id) - return false; - - if (countryId != that.countryId) - return false; - - if (name != null ? !name.equals(that.name) : that.name != null) - return false; - - return true; - } - - /** {@inheritDoc} */ - @Override public int hashCode() { - int res = id; - - res = 31 * res + countryId; - - res = 31 * res + (name != null ? name.hashCode() : 0); - - return res; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return "Department [id=" + id + - ", countryId=" + countryId + - ", name=" + name + - ']'; - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/6af6560a/modules/web-agent/src/main/java/org/apache/ignite/console/demo/model/Employee.java ---------------------------------------------------------------------- diff --git a/modules/web-agent/src/main/java/org/apache/ignite/console/demo/model/Employee.java b/modules/web-agent/src/main/java/org/apache/ignite/console/demo/model/Employee.java deleted file mode 100644 index a3e7eba..0000000 --- a/modules/web-agent/src/main/java/org/apache/ignite/console/demo/model/Employee.java +++ /dev/null @@ -1,356 +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.console.demo.model; - -import java.io.Serializable; -import java.sql.Date; - -/** - * Employee definition. - */ -public class Employee implements Serializable { - /** */ - private static final long serialVersionUID = 0L; - - /** Value for id. */ - private int id; - - /** Value for departmentId. */ - private int departmentId; - - /** Value for managerId. */ - private Integer managerId; - - /** Value for firstName. */ - private String firstName; - - /** Value for lastName. */ - private String lastName; - - /** Value for email. */ - private String email; - - /** Value for phoneNumber. */ - private String phoneNumber; - - /** Value for hireDate. */ - private Date hireDate; - - /** Value for job. */ - private String job; - - /** Value for salary. */ - private Double salary; - - /** - * Empty constructor. - */ - public Employee() { - // No-op. - } - - /** - * Full constructor. - */ - public Employee( - int id, - int departmentId, - Integer managerId, - String firstName, - String lastName, - String email, - String phoneNumber, - Date hireDate, - String job, - Double salary - ) { - this.id = id; - this.departmentId = departmentId; - this.managerId = managerId; - this.firstName = firstName; - this.lastName = lastName; - this.email = email; - this.phoneNumber = phoneNumber; - this.hireDate = hireDate; - this.job = job; - this.salary = salary; - } - - /** - * 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 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 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; - } - - /** - * Gets firstName. - * - * @return Value for firstName. - */ - public String getFirstName() { - return firstName; - } - - /** - * Sets firstName. - * - * @param firstName New value for firstName. - */ - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - /** - * Gets lastName. - * - * @return Value for lastName. - */ - public String getLastName() { - return lastName; - } - - /** - * Sets lastName. - * - * @param lastName New value for lastName. - */ - public void setLastName(String lastName) { - this.lastName = lastName; - } - - /** - * Gets email. - * - * @return Value for email. - */ - public String getEmail() { - return email; - } - - /** - * Sets email. - * - * @param email New value for email. - */ - public void setEmail(String email) { - this.email = email; - } - - /** - * Gets phoneNumber. - * - * @return Value for phoneNumber. - */ - public String getPhoneNumber() { - return phoneNumber; - } - - /** - * Sets phoneNumber. - * - * @param phoneNumber New value for phoneNumber. - */ - public void setPhoneNumber(String phoneNumber) { - this.phoneNumber = phoneNumber; - } - - /** - * Gets hireDate. - * - * @return Value for hireDate. - */ - public Date getHireDate() { - return hireDate; - } - - /** - * Sets hireDate. - * - * @param hireDate New value for hireDate. - */ - public void setHireDate(Date hireDate) { - this.hireDate = hireDate; - } - - /** - * Gets job. - * - * @return Value for job. - */ - public String getJob() { - return job; - } - - /** - * Sets job. - * - * @param job New value for job. - */ - public void setJob(String job) { - this.job = job; - } - - /** - * Gets salary. - * - * @return Value for salary. - */ - public Double getSalary() { - return salary; - } - - /** - * Sets salary. - * - * @param salary New value for salary. - */ - public void setSalary(Double salary) { - this.salary = salary; - } - - /** {@inheritDoc} */ - @Override public boolean equals(Object o) { - if (this == o) - return true; - - if (!(o instanceof Employee)) - return false; - - Employee that = (Employee)o; - - if (id != that.id) - return false; - - if (departmentId != that.departmentId) - return false; - - if (managerId != null ? !managerId.equals(that.managerId) : that.managerId != null) - return false; - - if (firstName != null ? !firstName.equals(that.firstName) : that.firstName != null) - return false; - - if (lastName != null ? !lastName.equals(that.lastName) : that.lastName != null) - return false; - - if (email != null ? !email.equals(that.email) : that.email != null) - return false; - - if (phoneNumber != null ? !phoneNumber.equals(that.phoneNumber) : that.phoneNumber != null) - return false; - - if (hireDate != null ? !hireDate.equals(that.hireDate) : that.hireDate != null) - return false; - - if (job != null ? !job.equals(that.job) : that.job != null) - return false; - - if (salary != null ? !salary.equals(that.salary) : that.salary != null) - return false; - - return true; - } - - /** {@inheritDoc} */ - @Override public int hashCode() { - int res = id; - - res = 31 * res + departmentId; - - res = 31 * res + (managerId != null ? managerId.hashCode() : 0); - - res = 31 * res + (firstName != null ? firstName.hashCode() : 0); - - res = 31 * res + (lastName != null ? lastName.hashCode() : 0); - - res = 31 * res + (email != null ? email.hashCode() : 0); - - res = 31 * res + (phoneNumber != null ? phoneNumber.hashCode() : 0); - - res = 31 * res + (hireDate != null ? hireDate.hashCode() : 0); - - res = 31 * res + (job != null ? job.hashCode() : 0); - - res = 31 * res + (salary != null ? salary.hashCode() : 0); - - return res; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return "Employee [id=" + id + - ", departmentId=" + departmentId + - ", managerId=" + managerId + - ", firstName=" + firstName + - ", lastName=" + lastName + - ", email=" + email + - ", phoneNumber=" + phoneNumber + - ", hireDate=" + hireDate + - ", job=" + job + - ", salary=" + salary + - ']'; - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/6af6560a/modules/web-agent/src/main/java/org/apache/ignite/console/demo/model/Parking.java ---------------------------------------------------------------------- diff --git a/modules/web-agent/src/main/java/org/apache/ignite/console/demo/model/Parking.java b/modules/web-agent/src/main/java/org/apache/ignite/console/demo/model/Parking.java deleted file mode 100644 index d55ae81..0000000 --- a/modules/web-agent/src/main/java/org/apache/ignite/console/demo/model/Parking.java +++ /dev/null @@ -1,152 +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.console.demo.model; - -import java.io.Serializable; - -/** - * Parking definition. - */ -public class Parking implements Serializable { - /** */ - private static final long serialVersionUID = 0L; - - /** Value for id. */ - private int id; - - /** Value for name. */ - private String name; - - /** Value for capacity. */ - private int capacity; - - /** - * Empty constructor. - */ - public Parking() { - // No-op. - } - - /** - * Full constructor. - */ - public Parking( - int id, - String name, - int capacity - ) { - this.id = id; - this.name = name; - this.capacity = capacity; - } - - /** - * 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 name. - * - * @return Value for name. - */ - public String getName() { - return name; - } - - /** - * Sets name. - * - * @param name New value for name. - */ - public void setName(String name) { - this.name = name; - } - - /** - * Gets capacity. - * - * @return Value for capacity. - */ - public int getCapacity() { - return capacity; - } - - /** - * Sets capacity. - * - * @param capacity New value for capacity. - */ - public void setCapacity(int capacity) { - this.capacity = capacity; - } - - /** {@inheritDoc} */ - @Override public boolean equals(Object o) { - if (this == o) - return true; - - if (!(o instanceof Parking)) - return false; - - Parking that = (Parking)o; - - if (id != that.id) - return false; - - if (name != null ? !name.equals(that.name) : that.name != null) - return false; - - if (capacity != that.capacity) - return false; - - return true; - } - - /** {@inheritDoc} */ - @Override public int hashCode() { - int res = id; - - res = 31 * res + (name != null ? name.hashCode() : 0); - - res = 31 * res + capacity; - - return res; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return "Parking [id=" + id + - ", name=" + name + - ", capacity=" + capacity + - ']'; - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/6af6560a/modules/web-agent/src/main/resources/log4j.properties ---------------------------------------------------------------------- diff --git a/modules/web-agent/src/main/resources/log4j.properties b/modules/web-agent/src/main/resources/log4j.properties deleted file mode 100644 index 3b7767c..0000000 --- a/modules/web-agent/src/main/resources/log4j.properties +++ /dev/null @@ -1,53 +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. - -log4j.rootLogger=INFO,console_err,file - -log4j.logger.org.apache.http=WARN -log4j.logger.org.apache.ignite.spi.checkpoint.noop.NoopCheckpointSpi=OFF -log4j.logger.org.apache.ignite.spi.swapspace.noop.NoopSwapSpaceSpi=OFF -log4j.logger.org.apache.ignite.internal.managers.collision.GridCollisionManager=ERROR -log4j.logger.org.apache.commons.beanutils=WARN -log4j.logger.sun.net.www.protocol.http=WARN - -# Configure console appender. -log4j.appender.console_err=org.apache.log4j.ConsoleAppender -log4j.appender.console_err.Threshold=WARN -log4j.appender.console_err.layout=org.apache.log4j.PatternLayout -log4j.appender.console_err.layout.ConversionPattern=[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n - -# Configure console appender. -log4j.appender.console=org.apache.log4j.ConsoleAppender -log4j.appender.console.layout=org.apache.log4j.PatternLayout -log4j.appender.console.layout.ConversionPattern=[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n -log4j.appender.console.filter.a=org.apache.log4j.varia.LevelMatchFilter -log4j.appender.console.filter.a.LevelToMatch=INFO -log4j.appender.console.filter.a.AcceptOnMatch=true -log4j.appender.console.filter.b=org.apache.log4j.varia.LevelMatchFilter -log4j.appender.console.filter.b.LevelToMatch=ERROR -log4j.appender.console.filter.b.AcceptOnMatch=false -log4j.appender.console.filter.c=org.apache.log4j.varia.LevelMatchFilter -log4j.appender.console.filter.c.LevelToMatch=WARN -log4j.appender.console.filter.c.AcceptOnMatch=false - -log4j.category.org.apache.ignite.console=INFO,console - -# Direct log messages to a log file -log4j.appender.file=org.apache.log4j.RollingFileAppender -log4j.appender.file.File=logs/ignite-web-agent.log -log4j.appender.file.MaxFileSize=10MB -log4j.appender.file.MaxBackupIndex=10 -log4j.appender.file.layout=org.apache.log4j.PatternLayout -log4j.appender.file.layout.ConversionPattern=[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n http://git-wip-us.apache.org/repos/asf/ignite/blob/6af6560a/modules/web-console/.gitignore ---------------------------------------------------------------------- diff --git a/modules/web-console/.gitignore b/modules/web-console/.gitignore new file mode 100644 index 0000000..9ddddc4 --- /dev/null +++ b/modules/web-console/.gitignore @@ -0,0 +1,6 @@ +docker/standalone/backend/build +docker/standalone/frontend/build +docker/standalone/data +docker/compose/backend/build +docker/compose/frontend/build +docker/dev/data http://git-wip-us.apache.org/repos/asf/ignite/blob/6af6560a/modules/web-console/DEVNOTES.txt ---------------------------------------------------------------------- diff --git a/modules/web-console/DEVNOTES.txt b/modules/web-console/DEVNOTES.txt index 3732b78..27211aa 100644 --- a/modules/web-console/DEVNOTES.txt +++ b/modules/web-console/DEVNOTES.txt @@ -13,22 +13,26 @@ How to deploy locally: npm install -g npm-windows-upgrade npm-windows-upgrade See: https://github.com/felixrieseberg/npm-windows-upgrade - Check npm version: "npm --version". -5. Run "npm install --no-optional" in terminal for download dependencies. -6. Build ignite-web-agent module follow instructions from 'modules/web-agent/README.txt'. -7. Copy ignite-web-agent-.zip from target of ignite-web-agent module to 'modules/web-console/src/main/js/serve/agent_dists' folder. + Check npm version: "npm --version", it should be 3.x. +5. Change directory to '$IGNITE_HOME/modules/web-console/backend' and + run "npm install --no-optional" for download backend dependencies. +6. Change directory to '$IGNITE_HOME/modules/web-console/frontend' and + run "npm install --no-optional" for download frontend dependencies. +7. Build ignite-web-agent module follow instructions from 'modules/web-agent/README.txt'. +8. Copy ignite-web-agent-.zip from '$IGNITE_HOME/modules/web-console/web-agent/target' + to '$IGNITE_HOME/modules/web-console/backend/agent_dists' folder. -Steps 1 - 7 should be executed once. +Steps 1 - 8 should be executed once. How to run console in development mode: 1. Configure MongoDB to run as service or in terminal change dir to $MONGO_INSTALL_DIR/server/3.0/bin and start MongoDB by executing "mongod". -2. In new terminal change directory to '$IGNITE_HOME/modules/web-console/src/main/js'. - If needed run "npm install --no-optional" (if dependencies changed) and run "node serve" to start backend. +2. In new terminal change directory to '$IGNITE_HOME/modules/web-console/backend'. + If needed run "npm install --no-optional" (if dependencies changed) and run "npm start" to start backend. -3. In new terminal change directory to '$IGNITE_HOME/modules/web-console/src/main/js' - and start webpack in development mode "npm run dev" . +3. In new terminal change directory to '$IGNITE_HOME/modules/web-console/frontend'. + If needed run "npm install --no-optional" (if dependencies changed) and start webpack in development mode "npm run dev". 4. In browser open: http://localhost:9000 http://git-wip-us.apache.org/repos/asf/ignite/blob/6af6560a/modules/web-console/backend/.babelrc ---------------------------------------------------------------------- diff --git a/modules/web-console/backend/.babelrc b/modules/web-console/backend/.babelrc new file mode 100644 index 0000000..7eb36f4 --- /dev/null +++ b/modules/web-console/backend/.babelrc @@ -0,0 +1,9 @@ +{ + "presets": ["es2015", "stage-1"], + "plugins": [[ + "transform-builtin-extend", { + "globals": ["Error", "Array"], + "approximate": true + } + ]] +} http://git-wip-us.apache.org/repos/asf/ignite/blob/6af6560a/modules/web-console/backend/.eslintrc ---------------------------------------------------------------------- diff --git a/modules/web-console/backend/.eslintrc b/modules/web-console/backend/.eslintrc new file mode 100644 index 0000000..c0c772b --- /dev/null +++ b/modules/web-console/backend/.eslintrc @@ -0,0 +1,188 @@ +parser: "babel-eslint" + +env: + es6: true + node: true + mocha: true + +ecmaFeatures: + arrowFunctions: true + blockBindings: true + classes: true + defaultParams: true + destructuring: true + module: true + objectLiteralComputedProperties: true + objectLiteralShorthandMethods: true + objectLiteralShorthandProperties: true + spread: true + templateStrings: true + experimentalObjectRestSpread: true + +globals: + _: true + io: true + +rules: + arrow-parens: [1, "always"] + arrow-spacing: [1, { "before": true, "after": true }] + accessor-pairs: 2 + block-scoped-var: 2 + brace-style: [0, "1tbs"] + comma-dangle: [2, "never"] + comma-spacing: [2, {"before": false, "after": true}] + comma-style: [2, "last"] + complexity: [1, 40] + computed-property-spacing: [2, "never"] + consistent-return: 0 + consistent-this: [0, "that"] + constructor-super: 2 + curly: [2, "multi-or-nest"] + default-case: 2 + dot-location: 0 + dot-notation: [2, { "allowKeywords": true }] + eol-last: 2 + eqeqeq: 2 + func-names: 0 + func-style: [0, "declaration"] + generator-star-spacing: 0 + guard-for-in: 1 + handle-callback-err: 0 + id-length: [2, {"min": 1, "max": 60}] + indent: [2, 4, {"SwitchCase": 1}] + key-spacing: [2, { "beforeColon": false, "afterColon": true }] + lines-around-comment: 0 + linebreak-style: [0, "unix"] + max-depth: [0, 4] + max-len: [0, 120, 4] + max-nested-callbacks: [1, 4] + max-params: [0, 3] + max-statements: [0, 10] + new-cap: 2 + new-parens: 2 + no-alert: 2 + no-array-constructor: 2 + no-bitwise: 0 + no-caller: 2 + no-catch-shadow: 2 + no-cond-assign: 2 + no-console: 0 + no-constant-condition: 2 + no-continue: 0 + no-class-assign: 2 + no-const-assign: 2 + no-control-regex: 2 + no-debugger: 2 + no-delete-var: 2 + no-div-regex: 0 + no-dupe-keys: 2 + no-dupe-args: 2 + no-duplicate-case: 2 + no-else-return: 2 + no-empty: 2 + no-empty-character-class: 2 + no-eq-null: 2 + no-eval: 2 + no-ex-assign: 2 + no-extend-native: 2 + no-extra-bind: 2 + no-extra-boolean-cast: 2 + no-extra-parens: 0 + no-extra-semi: 2 + no-fallthrough: 2 + no-floating-decimal: 1 + no-func-assign: 2 + no-implied-eval: 2 + no-inline-comments: 0 + no-inner-declarations: [2, "functions"] + no-invalid-regexp: 2 + no-irregular-whitespace: 2 + no-iterator: 2 + no-label-var: 2 + no-labels: 2 + no-lone-blocks: 2 + no-lonely-if: 2 + no-implicit-coercion: [2, {"boolean": false, "number": true, "string": true}] + no-loop-func: 2 + no-mixed-requires: [0, false] + no-mixed-spaces-and-tabs: [2, true] + no-multi-spaces: 2 + no-multi-str: 2 + no-multiple-empty-lines: [0, {"max": 2}] + no-native-reassign: 2 + no-negated-in-lhs: 2 + no-nested-ternary: 0 + no-new: 2 + no-new-func: 2 + no-new-object: 2 + no-new-require: 0 + no-new-wrappers: 2 + no-obj-calls: 2 + no-octal: 2 + no-octal-escape: 2 + no-param-reassign: 0 + no-path-concat: 0 + no-plusplus: 0 + no-process-env: 0 + no-process-exit: 1 + no-proto: 2 + no-redeclare: 2 + no-regex-spaces: 1 + no-restricted-modules: 0 + no-script-url: 0 + no-self-compare: 2 + no-sequences: 2 + no-shadow: 2 + no-shadow-restricted-names: 2 + no-spaced-func: 2 + no-sparse-arrays: 1 + no-sync: 0 + no-ternary: 0 + no-trailing-spaces: 2 + no-throw-literal: 0 + no-this-before-super: 2 + no-unexpected-multiline: 2 + no-undef: 2 + no-undef-init: 2 + no-undefined: 2 + no-unneeded-ternary: 2 + no-unreachable: 2 + no-unused-expressions: [2, { allowShortCircuit: true }] + no-unused-vars: [2, {"vars": "all", "args": "after-used"}] + no-use-before-define: 2 + no-useless-call: 2 + no-void: 0 + no-var: 2 + no-warning-comments: 0 + no-with: 2 + newline-after-var: 0 + object-shorthand: [2, "always"] + one-var: [2, "never"] + operator-assignment: [2, "always"] + operator-linebreak: 0 + padded-blocks: 0 + prefer-const: 1 + prefer-spread: 2 + quote-props: [2, "as-needed"] + quotes: [2, "single"] + radix: 1 + semi: [2, "always"] + semi-spacing: [2, {"before": false, "after": true}] + sort-vars: 0 + keyword-spacing: 2 + space-before-blocks: [2, "always"] + space-before-function-paren: [2, "never"] + space-in-parens: 0 + space-infix-ops: 2 + space-unary-ops: [2, { "words": true, "nonwords": false }] + spaced-comment: [1, "always"] + use-isnan: 2 + valid-jsdoc: 0 + valid-typeof: 2 + vars-on-top: 2 + wrap-iife: 0 + wrap-regex: 0 + yoda: [2, "never"] + +parserOptions: + sourceType: module http://git-wip-us.apache.org/repos/asf/ignite/blob/6af6560a/modules/web-console/backend/.gitignore ---------------------------------------------------------------------- diff --git a/modules/web-console/backend/.gitignore b/modules/web-console/backend/.gitignore new file mode 100644 index 0000000..f95e2bf --- /dev/null +++ b/modules/web-console/backend/.gitignore @@ -0,0 +1,8 @@ +*.idea +*.log +.npmrc +node_modules +serve/config/*.json +serve/agent_dists/*.zip +agent_dists/*.zip +config/*.json http://git-wip-us.apache.org/repos/asf/ignite/blob/6af6560a/modules/web-console/backend/agent_dists/README.txt ---------------------------------------------------------------------- diff --git a/modules/web-console/backend/agent_dists/README.txt b/modules/web-console/backend/agent_dists/README.txt new file mode 100644 index 0000000..d51bdf9 --- /dev/null +++ b/modules/web-console/backend/agent_dists/README.txt @@ -0,0 +1,7 @@ +Ignite Web Console +====================================== + +This is default folder for agent distributives. + +Also, you could specify custom folder in `serve/config/settings.json` +