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 82079185A4 for ; Thu, 22 Oct 2015 09:26:54 +0000 (UTC) Received: (qmail 65526 invoked by uid 500); 22 Oct 2015 09:26:54 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 65472 invoked by uid 500); 22 Oct 2015 09:26:54 -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 64761 invoked by uid 99); 22 Oct 2015 09:26:53 -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; Thu, 22 Oct 2015 09:26:53 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id D734AE0A9F; Thu, 22 Oct 2015 09:26:53 +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: Thu, 22 Oct 2015 09:27:13 -0000 Message-Id: In-Reply-To: <9d4d1a7cfd0c49149f55244b156203a3@git.apache.org> References: <9d4d1a7cfd0c49149f55244b156203a3@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [21/50] [abbrv] ignite git commit: IGNITE-1653 fixes http://git-wip-us.apache.org/repos/asf/ignite/blob/50cf42a3/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/ComputeScheduleExample.java ---------------------------------------------------------------------- diff --git a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/ComputeScheduleExample.java b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/ComputeScheduleExample.java deleted file mode 100644 index 8c85a3e..0000000 --- a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/ComputeScheduleExample.java +++ /dev/null @@ -1,68 +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.examples.java8.misc.schedule; - -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteException; -import org.apache.ignite.Ignition; -import org.apache.ignite.examples.ExampleNodeStartup; -import org.apache.ignite.scheduler.SchedulerFuture; - -/** - * Demonstrates a cron-based {@link Runnable} execution scheduling. - * Test runnable object broadcasts a phrase to all cluster nodes every minute - * three times with initial scheduling delay equal to five seconds. - *

- * Remote nodes should always be started with special configuration file which - * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/example-ignite.xml'}. - *

- * Alternatively you can run {@link ExampleNodeStartup} in another JVM which will start node - * with {@code examples/config/example-ignite.xml} configuration. - */ -public class ComputeScheduleExample { - /** - * Executes example. - * - * @param args Command line arguments, none required. - * @throws IgniteException If example execution failed. - */ - public static void main(String[] args) throws IgniteException { - try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) { - System.out.println(); - System.out.println("Compute schedule example started."); - - // Schedule output message every minute. - SchedulerFuture fut = ignite.scheduler().scheduleLocal(() -> - ignite.compute().broadcast(() -> { - System.out.println(); - System.out.println("Howdy! :)"); - - return "Howdy! :)"; - }), - "{5, 3} * * * * *" // Cron expression. - ); - - while (!fut.isDone()) - System.out.println(">>> Invocation result: " + fut.get()); - - System.out.println(); - System.out.println(">>> Schedule future is done and has been unscheduled."); - System.out.println(">>> Check all nodes for hello message output."); - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/50cf42a3/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/package-info.java ---------------------------------------------------------------------- diff --git a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/package-info.java b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/package-info.java deleted file mode 100644 index 42132f1..0000000 --- a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/package-info.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * 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. - */ - -/** - * - * Demonstrates usage of cron-based scheduler. - */ -package org.apache.ignite.examples.java8.misc.schedule; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/50cf42a3/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamTransformerExample.java ---------------------------------------------------------------------- diff --git a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamTransformerExample.java b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamTransformerExample.java deleted file mode 100644 index 538c4eb..0000000 --- a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamTransformerExample.java +++ /dev/null @@ -1,101 +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.examples.java8.streaming; - -import java.util.List; -import java.util.Random; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.IgniteDataStreamer; -import org.apache.ignite.Ignition; -import org.apache.ignite.cache.query.SqlFieldsQuery; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.examples.ExampleNodeStartup; -import org.apache.ignite.examples.ExamplesUtils; -import org.apache.ignite.stream.StreamTransformer; - -/** - * Stream random numbers into the streaming cache. - * To start the example, you should: - *

    - *
  • Start a few nodes using {@link ExampleNodeStartup} or by starting remote nodes as specified below.
  • - *
  • Start streaming using {@link StreamTransformerExample}.
  • - *
- *

- * You should start remote nodes by running {@link ExampleNodeStartup} in another JVM. - */ -public class StreamTransformerExample { - /** Random number generator. */ - private static final Random RAND = new Random(); - - /** Range within which to generate numbers. */ - private static final int RANGE = 1000; - - public static void main(String[] args) throws Exception { - // Mark this cluster member as client. - Ignition.setClientMode(true); - - try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) { - if (!ExamplesUtils.hasServerNodes(ignite)) - return; - - CacheConfiguration cfg = new CacheConfiguration<>("randomNumbers"); - - // Index key and value. - cfg.setIndexedTypes(Integer.class, Long.class); - - // Auto-close cache at the end of the example. - try (IgniteCache stmCache = ignite.getOrCreateCache(cfg)) { - try (IgniteDataStreamer stmr = ignite.dataStreamer(stmCache.getName())) { - // Allow data updates. - stmr.allowOverwrite(true); - - // Configure data transformation to count random numbers added to the stream. - stmr.receiver(StreamTransformer.from((e, arg) -> { - // Get current count. - Long val = e.getValue(); - - // Increment count by 1. - e.setValue(val == null ? 1L : val + 1); - - return null; - })); - - // Stream 10 million of random numbers into the streamer cache. - for (int i = 1; i <= 10_000_000; i++) { - stmr.addData(RAND.nextInt(RANGE), 1L); - - if (i % 500_000 == 0) - System.out.println("Number of tuples streamed into Ignite: " + i); - } - } - - // Query top 10 most popular numbers every. - SqlFieldsQuery top10Qry = new SqlFieldsQuery("select _key, _val from Long order by _val desc limit 10"); - - // Execute queries. - List> top10 = stmCache.query(top10Qry).getAll(); - - System.out.println("Top 10 most popular numbers:"); - - // Print top 10 words. - ExamplesUtils.printQueryResults(top10); - } - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/50cf42a3/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamVisitorExample.java ---------------------------------------------------------------------- diff --git a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamVisitorExample.java b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamVisitorExample.java deleted file mode 100644 index cef9f2f..0000000 --- a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamVisitorExample.java +++ /dev/null @@ -1,172 +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.examples.java8.streaming; - -import java.io.Serializable; -import java.util.List; -import java.util.Random; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.IgniteDataStreamer; -import org.apache.ignite.Ignition; -import org.apache.ignite.cache.query.SqlFieldsQuery; -import org.apache.ignite.cache.query.annotations.QuerySqlField; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.examples.ExampleNodeStartup; -import org.apache.ignite.examples.ExamplesUtils; -import org.apache.ignite.stream.StreamVisitor; - -/** - * Stream random numbers into the streaming cache. - * To start the example, you should: - *

    - *
  • Start a few nodes using {@link ExampleNodeStartup} or by starting remote nodes as specified below.
  • - *
  • Start streaming using {@link StreamVisitorExample}.
  • - *
- *

- * You should start remote nodes by running {@link ExampleNodeStartup} in another JVM. - */ -public class StreamVisitorExample { - /** Random number generator. */ - private static final Random RAND = new Random(); - - /** The list of instruments. */ - private static final String[] INSTRUMENTS = {"IBM", "GOOG", "MSFT", "GE", "EBAY", "YHOO", "ORCL", "CSCO", "AMZN", "RHT"}; - - /** The list of initial instrument prices. */ - private static final double[] INITIAL_PRICES = {194.9, 893.49, 34.21, 23.24, 57.93, 45.03, 44.41, 28.44, 378.49, 69.50}; - - public static void main(String[] args) throws Exception { - // Mark this cluster member as client. - Ignition.setClientMode(true); - - try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) { - if (!ExamplesUtils.hasServerNodes(ignite)) - return; - - // Market data cache with default configuration. - CacheConfiguration mktDataCfg = new CacheConfiguration<>("marketTicks"); - - // Financial instrument cache configuration. - CacheConfiguration instCfg = new CacheConfiguration<>("instCache"); - - // Index key and value for querying financial instruments. - // Note that Instrument class has @QuerySqlField annotation for secondary field indexing. - instCfg.setIndexedTypes(String.class, Instrument.class); - - // Auto-close caches at the end of the example. - try ( - IgniteCache mktCache = ignite.getOrCreateCache(mktDataCfg); - IgniteCache instCache = ignite.getOrCreateCache(instCfg) - ) { - try (IgniteDataStreamer mktStmr = ignite.dataStreamer(mktCache.getName())) { - // Note that we receive market data, but do not populate 'mktCache' (it remains empty). - // Instead we update the instruments in the 'instCache'. - // Since both, 'instCache' and 'mktCache' use the same key, updates are collocated. - mktStmr.receiver(StreamVisitor.from((cache, e) -> { - String symbol = e.getKey(); - Double tick = e.getValue(); - - Instrument inst = instCache.get(symbol); - - if (inst == null) - inst = new Instrument(symbol); - - // Don't populate market cache, as we don't use it for querying. - // Update cached instrument based on the latest market tick. - inst.update(tick); - - instCache.put(symbol, inst); - })); - - // Stream 10 million market data ticks into the system. - for (int i = 1; i <= 10_000_000; i++) { - int idx = RAND.nextInt(INSTRUMENTS.length); - - // Use gaussian distribution to ensure that - // numbers closer to 0 have higher probability. - double price = round2(INITIAL_PRICES[idx] + RAND.nextGaussian()); - - mktStmr.addData(INSTRUMENTS[idx], price); - - if (i % 500_000 == 0) - System.out.println("Number of tuples streamed into Ignite: " + i); - } - } - - // Select top 3 best performing instruments. - SqlFieldsQuery top3qry = new SqlFieldsQuery( - "select symbol, (latest - open) from Instrument order by (latest - open) desc limit 3"); - - // Execute queries. - List> top3 = instCache.query(top3qry).getAll(); - - System.out.println("Top performing financial instruments: "); - - // Print top 10 words. - ExamplesUtils.printQueryResults(top3); - } - } - } - - /** - * Rounds double value to two significant signs. - * - * @param val value to be rounded. - * @return rounded double value. - */ - private static double round2(double val) { - return Math.floor(100 * val + 0.5) / 100; - } - - /** - * Financial instrument. - */ - public static class Instrument implements Serializable { - /** Instrument symbol. */ - @QuerySqlField(index = true) - private final String symbol; - - /** Open price. */ - @QuerySqlField(index = true) - private double open; - - /** Close price. */ - @QuerySqlField(index = true) - private double latest; - - /** - * @param symbol Symbol. - */ - public Instrument(String symbol) { - this.symbol = symbol; - } - - /** - * Updates this instrument based on the latest market tick price. - * - * @param price Latest price. - */ - public void update(double price) { - if (open == 0) - open = price; - - this.latest = price; - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/50cf42a3/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/streaming/package-info.java ---------------------------------------------------------------------- diff --git a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/streaming/package-info.java b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/streaming/package-info.java deleted file mode 100644 index d215d2f..0000000 --- a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/streaming/package-info.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * 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. - */ - -/** - * - * Demonstrates usage of data streamer. - */ -package org.apache.ignite.examples.java8.streaming; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/50cf42a3/examples/config/hibernate/README.txt ---------------------------------------------------------------------- diff --git a/examples/config/hibernate/README.txt b/examples/config/hibernate/README.txt deleted file mode 100644 index 5b7ab29..0000000 --- a/examples/config/hibernate/README.txt +++ /dev/null @@ -1,8 +0,0 @@ -Hibernate L2 Cache Configuration Example ----------------------------------------- - -This folder contains example-hibernate-L2-cache.xml file that demonstrates -how to configure Hibernate to use Apache Ignite cache as an L2 cache provider. - -This file is also used in Hibernate example located in org.apache.ignite.examples.datagrid.hibernate -package. http://git-wip-us.apache.org/repos/asf/ignite/blob/50cf42a3/examples/config/hibernate/example-hibernate-L2-cache.xml ---------------------------------------------------------------------- diff --git a/examples/config/hibernate/example-hibernate-L2-cache.xml b/examples/config/hibernate/example-hibernate-L2-cache.xml deleted file mode 100644 index 3248946..0000000 --- a/examples/config/hibernate/example-hibernate-L2-cache.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - - - jdbc:h2:mem:example;DB_CLOSE_DELAY=-1 - - - create - - - true - - - true - - - true - - - org.apache.ignite.cache.hibernate.HibernateRegionFactory - - - on_close - - - READ_ONLY - - - - - - - - - - - http://git-wip-us.apache.org/repos/asf/ignite/blob/50cf42a3/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 7b8763f..6eeb006 100644 --- a/pom.xml +++ b/pom.xml @@ -147,6 +147,72 @@ + lgpl + + modules/hibernate + modules/geospatial + modules/schedule + + + + + + maven-assembly-plugin + + + org.apache.apache.resources + apache-source-release-assembly-descriptor + 1.0.4 + + + + + release-lgpl + prepare-package + + single + + + + assembly/release-${ignite.edition}-lgpl.xml + + release-package + false + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + 1.7 + false + + + release-postprocessing-lgpl + + run + + package + + + + + + + + + + + + + + + + + release true @@ -459,72 +525,6 @@ - lgpl - - modules/hibernate - modules/geospatial - modules/schedule - - - - - - maven-assembly-plugin - - - org.apache.apache.resources - apache-source-release-assembly-descriptor - 1.0.4 - - - - - release-lgpl - prepare-package - - single - - - - assembly/release-${ignite.edition}-lgpl.xml - - release-package - false - - - - - - - org.apache.maven.plugins - maven-antrun-plugin - 1.7 - false - - - release-postprocessing-lgpl - - run - - package - - - - - - - - - - - - - - - - - examples examples