http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/QueryExample.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/QueryExample.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/QueryExample.cs deleted file mode 100644 index 523b83f..0000000 --- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/QueryExample.cs +++ /dev/null @@ -1,226 +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. - */ - -using System; -using System.Collections; -using System.Collections.Generic; -using Apache.Ignite.Core; -using Apache.Ignite.Core.Cache; -using Apache.Ignite.Core.Cache.Query; -using Apache.Ignite.ExamplesDll.Portable; - -namespace Apache.Ignite.Examples.Datagrid -{ - /// <summary> - /// This example populates cache with sample data and runs several SQL and - /// full text queries over this data. - /// <para /> - /// 1) Build the project Apache.Ignite.ExamplesDll (select it -> right-click -> Build). - /// Apache.Ignite.ExamplesDll.dll must appear in %IGNITE_HOME%/platforms/dotnet/Examples/Apache.Ignite.ExamplesDll/bin/${Platform]/${Configuration} folder. - /// 2) Set this class as startup object (Apache.Ignite.Examples project -> right-click -> Properties -> - /// Application -> Startup object); - /// 3) Start example (F5 or Ctrl+F5). - /// <para /> - /// This example can be run with standalone Apache Ignite .Net node: - /// 1) Run %IGNITE_HOME%/platforms/dotnet/Apache.Ignite/bin/${Platform]/${Configuration}/Apache.Ignite.exe: - /// Apache.Ignite.exe -IgniteHome="%IGNITE_HOME%" -springConfigUrl=platforms\dotnet\examples\config\example-cache-query.xml -assembly=[path_to_Apache.Ignite.ExamplesDll.dll] - /// 2) Start example. - /// </summary> - public class QueryExample - { - [STAThread] - public static void Main() - { - var cfg = new IgniteConfiguration - { - SpringConfigUrl = @"platforms\dotnet\examples\config\example-cache-query.xml", - JvmOptions = new List<string> { "-Xms512m", "-Xmx1024m" } - }; - - using (var ignite = Ignition.Start(cfg)) - { - Console.WriteLine(); - Console.WriteLine(">>> Cache query example started."); - - var cache = ignite.GetCache<object, object>(null); - - // Clean up caches on all nodes before run. - cache.Clear(); - - // Populate cache with sample data entries. - PopulateCache(cache); - - // Create cache that will work with specific types. - var employeeCache = ignite.GetCache<EmployeeKey, Employee>(null); - - // Run SQL query example. - SqlQueryExample(employeeCache); - - // Run SQL query with join example. - SqlJoinQueryExample(employeeCache); - - // Run SQL fields query example. - SqlFieldsQueryExample(employeeCache); - - // Run full text query example. - FullTextQueryExample(employeeCache); - - Console.WriteLine(); - } - - Console.WriteLine(); - Console.WriteLine(">>> Example finished, press any key to exit ..."); - Console.ReadKey(); - } - - /// <summary> - /// Queries employees that have provided ZIP code in address. - /// </summary> - /// <param name="cache">Cache.</param> - private static void SqlQueryExample(ICache<EmployeeKey, Employee> cache) - { - const int zip = 94109; - - var qry = cache.Query(new SqlQuery(typeof(Employee), "zip = ?", zip)); - - Console.WriteLine(); - Console.WriteLine(">>> Employees with zipcode " + zip + ":"); - - foreach (var entry in qry) - Console.WriteLine(">>> " + entry.Value); - } - - /// <summary> - /// Queries employees that work for organization with provided name. - /// </summary> - /// <param name="cache">Cache.</param> - private static void SqlJoinQueryExample(ICache<EmployeeKey, Employee> cache) - { - const string orgName = "Apache"; - - var qry = cache.Query(new SqlQuery("Employee", - "from Employee, Organization " + - "where Employee.organizationId = Organization._key and Organization.name = ?", orgName)); - - Console.WriteLine(); - Console.WriteLine(">>> Employees working for " + orgName + ":"); - - foreach (var entry in qry) - Console.WriteLine(">>> " + entry.Value); - } - - /// <summary> - /// Queries names and salaries for all employees. - /// </summary> - /// <param name="cache">Cache.</param> - private static void SqlFieldsQueryExample(ICache<EmployeeKey, Employee> cache) - { - var qry = cache.QueryFields(new SqlFieldsQuery("select name, salary from Employee")); - - Console.WriteLine(); - Console.WriteLine(">>> Employee names and their salaries:"); - - foreach (IList row in qry) - Console.WriteLine(">>> [Name=" + row[0] + ", salary=" + row[1] + ']'); - } - - /// <summary> - /// Queries employees that live in Texas using full-text query API. - /// </summary> - /// <param name="cache">Cache.</param> - private static void FullTextQueryExample(ICache<EmployeeKey, Employee> cache) - { - var qry = cache.Query(new TextQuery("Employee", "TX")); - - Console.WriteLine(); - Console.WriteLine(">>> Employees living in Texas:"); - - foreach (var entry in qry) - Console.WriteLine(">>> " + entry.Value); - } - - /// <summary> - /// Populate cache with data for this example. - /// </summary> - /// <param name="cache">Cache.</param> - private static void PopulateCache(ICache<object, object> cache) - { - cache.Put(1, new Organization( - "Apache", - new Address("1065 East Hillsdale Blvd, Foster City, CA", 94404), - OrganizationType.Private, - DateTime.Now - )); - - cache.Put(2, new Organization( - "Microsoft", - new Address("1096 Eddy Street, San Francisco, CA", 94109), - OrganizationType.Private, - DateTime.Now - )); - - cache.Put(new EmployeeKey(1, 1), new Employee( - "James Wilson", - 12500, - new Address("1096 Eddy Street, San Francisco, CA", 94109), - new List<string> { "Human Resources", "Customer Service" } - )); - - cache.Put(new EmployeeKey(2, 1), new Employee( - "Daniel Adams", - 11000, - new Address("184 Fidler Drive, San Antonio, TX", 78130), - new List<string> { "Development", "QA" } - )); - - cache.Put(new EmployeeKey(3, 1), new Employee( - "Cristian Moss", - 12500, - new Address("667 Jerry Dove Drive, Florence, SC", 29501), - new List<string> { "Logistics" } - )); - - cache.Put(new EmployeeKey(4, 2), new Employee( - "Allison Mathis", - 25300, - new Address("2702 Freedom Lane, San Francisco, CA", 94109), - new List<string> { "Development" } - )); - - cache.Put(new EmployeeKey(5, 2), new Employee( - "Breana Robbin", - 6500, - new Address("3960 Sundown Lane, Austin, TX", 78130), - new List<string> { "Sales" } - )); - - cache.Put(new EmployeeKey(6, 2), new Employee( - "Philip Horsley", - 19800, - new Address("2803 Elsie Drive, Sioux Falls, SD", 57104), - new List<string> { "Sales" } - )); - - cache.Put(new EmployeeKey(7, 2), new Employee( - "Brian Peters", - 10600, - new Address("1407 Pearlman Avenue, Boston, MA", 12110), - new List<string> { "Development", "QA" } - )); - } - } -}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/StoreExample.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/StoreExample.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/StoreExample.cs deleted file mode 100644 index 6c2b40d..0000000 --- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/StoreExample.cs +++ /dev/null @@ -1,114 +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. - */ - -using System; -using System.Collections.Generic; -using Apache.Ignite.Core; -using Apache.Ignite.ExamplesDll.Datagrid; -using Apache.Ignite.ExamplesDll.Portable; - -namespace Apache.Ignite.Examples.Datagrid -{ - /// <summary> - /// Example demonstrating cache store. - /// <para /> - /// 1) Build the project Apache.Ignite.ExamplesDll (select it -> right-click -> Build). - /// Apache.Ignite.ExamplesDll.dll must appear in %IGNITE_HOME%/platforms/dotnet/Examples/Apache.Ignite.ExamplesDll/bin/${Platform]/${Configuration} folder. - /// 2) Set this class as startup object (Apache.Ignite.Examples project -> right-click -> Properties -> - /// Application -> Startup object); - /// 3) Start example (F5 or Ctrl+F5). - /// <para /> - /// This example can be run with standalone Apache Ignite .Net node: - /// 1) Run %IGNITE_HOME%/platforms/dotnet/Apache.Ignite/bin/${Platform]/${Configuration}/Apache.Ignite.exe: - /// Apache.Ignite.exe -IgniteHome="%IGNITE_HOME%" -springConfigUrl=platforms\dotnet\examples\config\example-cache-store.xml -assembly=[path_to_Apache.Ignite.ExamplesDll.dll] - /// 2) Start example. - /// </summary> - class StoreExample - { - /// <summary> - /// Runs the example. - /// </summary> - [STAThread] - public static void Main() - { - var cfg = new IgniteConfiguration - { - SpringConfigUrl = @"platforms\dotnet\examples\config\example-cache-store.xml", - JvmOptions = new List<string> { "-Xms512m", "-Xmx1024m" } - }; - - using (var ignite = Ignition.Start(cfg)) - { - Console.WriteLine(); - Console.WriteLine(">>> Cache store example started."); - - var cache = ignite.GetCache<int, Employee>(null); - - // Clean up caches on all nodes before run. - cache.Clear(); - - Console.WriteLine(); - Console.WriteLine(">>> Cleared values from cache."); - Console.WriteLine(">>> Current cache size: " + cache.GetSize()); - - // Load entries from store which pass provided filter. - cache.LoadCache(new EmployeeStorePredicate()); - - Console.WriteLine(); - Console.WriteLine(">>> Loaded entry from store through ICache.LoadCache()."); - Console.WriteLine(">>> Current cache size: " + cache.GetSize()); - - // Load entry from store calling ICache.Get() method. - Employee emp = cache.Get(2); - - Console.WriteLine(); - Console.WriteLine(">>> Loaded entry from store through ICache.Get(): " + emp); - Console.WriteLine(">>> Current cache size: " + cache.GetSize()); - - // Put an entry to the cache - cache.Put(3, new Employee( - "James Wilson", - 12500, - new Address("1096 Eddy Street, San Francisco, CA", 94109), - new List<string> { "Human Resources", "Customer Service" } - )); - - Console.WriteLine(); - Console.WriteLine(">>> Put entry to cache. "); - Console.WriteLine(">>> Current cache size: " + cache.GetSize()); - - // Clear values again. - cache.Clear(); - - Console.WriteLine(); - Console.WriteLine(">>> Cleared values from cache again."); - Console.WriteLine(">>> Current cache size: " + cache.GetSize()); - - // Read values from cache after clear. - Console.WriteLine(); - Console.WriteLine(">>> Read values after clear:"); - - for (int i = 1; i <= 3; i++) - Console.WriteLine(">>> Key=" + i + ", value=" + cache.Get(i)); - } - - Console.WriteLine(); - Console.WriteLine(">>> Example finished, press any key to exit ..."); - Console.ReadKey(); - } - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/TransactionExample.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/TransactionExample.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/TransactionExample.cs deleted file mode 100644 index 6be3523..0000000 --- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/TransactionExample.cs +++ /dev/null @@ -1,104 +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. - */ - -using System; -using System.Collections.Generic; -using Apache.Ignite.Core; -using Apache.Ignite.Core.Transactions; -using Apache.Ignite.ExamplesDll.Portable; - -namespace Apache.Ignite.Examples.Datagrid -{ - /// <summary> - /// This example demonstrates how to use transactions on Apache cache. - /// <para /> - /// 1) Build the project Apache.Ignite.ExamplesDll (select it -> right-click -> Build). - /// Apache.Ignite.ExamplesDll.dll must appear in %IGNITE_HOME%/platforms/dotnet/Examples/Apache.Ignite.ExamplesDll/bin/${Platform]/${Configuration} folder. - /// 2) Set this class as startup object (Apache.Ignite.Examples project -> right-click -> Properties -> - /// Application -> Startup object); - /// 3) Start example (F5 or Ctrl+F5). - /// <para /> - /// This example can be run with standalone Apache Ignite .Net node: - /// 1) Run %IGNITE_HOME%/platforms/dotnet/Apache.Ignite/bin/${Platform]/${Configuration}/Apache.Ignite.exe: - /// Apache.Ignite.exe -IgniteHome="%IGNITE_HOME%" -springConfigUrl=platforms\dotnet\examples\config\example-cache.xml -assembly=[path_to_Apache.Ignite.ExamplesDll.dll] - /// 2) Start example. - /// </summary> - class TransactionExample - { - /// <summary> - /// Runs the example. - /// </summary> - [STAThread] - public static void Main() - { - var cfg = new IgniteConfiguration - { - SpringConfigUrl = @"platforms\dotnet\examples\config\example-cache.xml", - JvmOptions = new List<string> { "-Xms512m", "-Xmx1024m" } - }; - - using (var ignite = Ignition.Start(cfg)) - { - Console.WriteLine(); - Console.WriteLine(">>> Transaction example started."); - - var cache = ignite.GetCache<int, Account>("tx"); - - // Clean up caches on all nodes before run. - cache.Clear(); - - // Initialize. - cache.Put(1, new Account(1, 100)); - cache.Put(2, new Account(2, 200)); - - Console.WriteLine(); - Console.WriteLine(">>> Accounts before transfer: "); - Console.WriteLine(">>> " + cache.Get(1)); - Console.WriteLine(">>> " + cache.Get(2)); - Console.WriteLine(); - - // Transfer money between accounts in a single transaction. - using (var tx = cache.Ignite.GetTransactions().TxStart(TransactionConcurrency.Pessimistic, - TransactionIsolation.RepeatableRead)) - { - Account acc1 = cache.Get(1); - Account acc2 = cache.Get(2); - - acc1.Balance += 100; - acc2.Balance -= 100; - - cache.Put(1, acc1); - cache.Put(2, acc2); - - tx.Commit(); - } - - Console.WriteLine(">>> Transfer finished."); - - Console.WriteLine(); - Console.WriteLine(">>> Accounts after transfer: "); - Console.WriteLine(">>> " + cache.Get(1)); - Console.WriteLine(">>> " + cache.Get(2)); - Console.WriteLine(); - } - - Console.WriteLine(); - Console.WriteLine(">>> Example finished, press any key to exit ..."); - Console.ReadKey(); - } - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Events/EventsExample.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Events/EventsExample.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Events/EventsExample.cs deleted file mode 100644 index 83802cc..0000000 --- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Events/EventsExample.cs +++ /dev/null @@ -1,118 +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. - */ - -using System; -using System.Collections.Generic; -using System.Linq; -using Apache.Ignite.Core; -using Apache.Ignite.Core.Events; -using Apache.Ignite.ExamplesDll.Compute; -using Apache.Ignite.ExamplesDll.Events; -using Apache.Ignite.ExamplesDll.Portable; - -namespace Apache.Ignite.Examples.Events -{ - /// <summary> - /// Example demonstrating Ignite events. - /// <para /> - /// 1) Build the project Apache.Ignite.ExamplesDll (select it -> right-click -> Build). - /// Apache.Ignite.ExamplesDll.dll must appear in %IGNITE_HOME%/platforms/dotnet/Examples/Apache.Ignite.ExamplesDll/bin/${Platform]/${Configuration} folder. - /// 2) Set this class as startup object (Apache.Ignite.Examples project -> right-click -> Properties -> - /// Application -> Startup object); - /// 3) Start example (F5 or Ctrl+F5). - /// <para /> - /// This example can be run with standalone Apache Ignite .Net node: - /// 1) Run %IGNITE_HOME%/platforms/dotnet/Apache.Ignite/bin/${Platform]/${Configuration}/Apache.Ignite.exe: - /// Apache.Ignite.exe -IgniteHome="%IGNITE_HOME%" -springConfigUrl=platforms\dotnet\examples\config\example-compute.xml -assembly=[path_to_Apache.Ignite.ExamplesDll.dll] - /// 2) Start example. - /// </summary> - public class EventsExample - { - /// <summary> - /// Runs the example. - /// </summary> - [STAThread] - public static void Main() - { - var cfg = new IgniteConfiguration - { - SpringConfigUrl = @"platforms\dotnet\examples\config\example-compute.xml", - JvmOptions = new List<string> {"-Xms512m", "-Xmx1024m"} - }; - - using (var ignite = Ignition.Start(cfg)) - { - Console.WriteLine(">>> Events example started."); - Console.WriteLine(); - - // Local listen example - Console.WriteLine(">>> Listening for a local event..."); - - var listener = new LocalListener(); - ignite.GetEvents().LocalListen(listener, EventType.EvtsTaskExecution); - - ExecuteTask(ignite); - - ignite.GetEvents().StopLocalListen(listener); - - Console.WriteLine(">>> Received events count: " + listener.EventsReceived); - Console.WriteLine(); - - // Remote listen example (start standalone nodes for better demonstration) - Console.WriteLine(">>> Listening for remote events..."); - - var localListener = new LocalListener(); - var remoteFilter = new RemoteFilter(); - - var listenId = ignite.GetEvents().RemoteListen(localListener: localListener, - remoteFilter: remoteFilter, types: EventType.EvtsJobExecution); - - ExecuteTask(ignite); - - ignite.GetEvents().StopRemoteListen(listenId); - - Console.WriteLine(">>> Received events count: " + localListener.EventsReceived); - } - - Console.WriteLine(); - Console.WriteLine(">>> Example finished, press any key to exit ..."); - Console.ReadKey(); - } - - /// <summary> - /// Executes a task to generate events. - /// </summary> - /// <param name="ignite">Ignite instance.</param> - private static void ExecuteTask(IIgnite ignite) - { - var employees = Enumerable.Range(1, 10).SelectMany(x => new[] - { - new Employee("Allison Mathis", - 25300, - new Address("2702 Freedom Lane, San Francisco, CA", 94109), - new[] {"Development"}), - - new Employee("Breana Robbin", - 6500, - new Address("3960 Sundown Lane, Austin, TX", 78130), - new[] {"Sales"}) - }).ToArray(); - - ignite.GetCompute().Execute(new AverageSalaryTask(), employees); - } - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Messaging/MessagingExample.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Messaging/MessagingExample.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Messaging/MessagingExample.cs deleted file mode 100644 index a24c47c..0000000 --- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Messaging/MessagingExample.cs +++ /dev/null @@ -1,112 +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. - */ - -using System; -using System.Collections.Generic; -using System.Threading; -using Apache.Ignite.Core; -using Apache.Ignite.ExamplesDll.Messaging; - -namespace Apache.Ignite.Examples.Messaging -{ - /// <summary> - /// Example demonstrating Ignite messaging. Should be run with standalone Apache Ignite .Net node. - /// <para /> - /// 1) Run %IGNITE_HOME%/platforms/dotnet/Apache.Ignite/bin/${Platform]/${Configuration}/Apache.Ignite.exe: - /// Apache.Ignite.exe -IgniteHome="%IGNITE_HOME%" -springConfigUrl=platforms\dotnet\examples\config\example-compute.xml -assembly=[path_to_Apache.Ignite.ExamplesDll.dll] - /// 2) Build the project Apache.Ignite.ExamplesDll (select it -> right-click -> Build). - /// Apache.Ignite.ExamplesDll.dll must appear in %IGNITE_HOME%/platforms/dotnet/Examples/Apache.Ignite.ExamplesDll/bin/${Platform]/${Configuration} folder. - /// 3) Set this class as startup object (Apache.Ignite.Examples project -> right-click -> Properties -> - /// Application -> Startup object); - /// 4) Start example (F5 or Ctrl+F5). - /// </summary> - public class MessagingExample - { - /// <summary> - /// Runs the example. - /// </summary> - [STAThread] - public static void Main() - { - var cfg = new IgniteConfiguration - { - SpringConfigUrl = @"platforms\dotnet\examples\config\example-compute.xml", - JvmOptions = new List<string> { "-Xms512m", "-Xmx1024m" } - }; - - using (var ignite = Ignition.Start(cfg)) - { - var remotes = ignite.GetCluster().ForRemotes(); - - if (remotes.GetNodes().Count == 0) - { - Console.WriteLine(">>> This example requires remote nodes to be started."); - Console.WriteLine(">>> Please start at least 1 remote node."); - Console.WriteLine(">>> Refer to example's documentation for details on configuration."); - } - else - { - Console.WriteLine(">>> Messaging example started."); - Console.WriteLine(); - - // Set up local listeners - var localMessaging = ignite.GetCluster().ForLocal().GetMessaging(); - - var msgCount = remotes.GetNodes().Count * 10; - - var orderedCounter = new CountdownEvent(msgCount); - var unorderedCounter = new CountdownEvent(msgCount); - - localMessaging.LocalListen(new LocalListener(unorderedCounter), Topic.Unordered); - localMessaging.LocalListen(new LocalListener(orderedCounter), Topic.Ordered); - - // Set up remote listeners - var remoteMessaging = remotes.GetMessaging(); - - remoteMessaging.RemoteListen(new RemoteUnorderedListener(), Topic.Unordered); - remoteMessaging.RemoteListen(new RemoteOrderedListener(), Topic.Ordered); - - // Send unordered - Console.WriteLine(">>> Sending unordered messages..."); - - for (var i = 0; i < 10; i++) - remoteMessaging.Send(i, Topic.Unordered); - - Console.WriteLine(">>> Finished sending unordered messages."); - - // Send ordered - Console.WriteLine(">>> Sending ordered messages..."); - - for (var i = 0; i < 10; i++) - remoteMessaging.SendOrdered(i, Topic.Ordered); - - Console.WriteLine(">>> Finished sending ordered messages."); - - Console.WriteLine(">>> Check output on all nodes for message printouts."); - Console.WriteLine(">>> Waiting for messages acknowledgements from all remote nodes..."); - - unorderedCounter.Wait(); - orderedCounter.Wait(); - } - } - - Console.WriteLine(); - Console.WriteLine(">>> Example finished, press any key to exit ..."); - Console.ReadKey(); - } - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Misc/LifecycleExample.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Misc/LifecycleExample.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Misc/LifecycleExample.cs deleted file mode 100644 index 2d319e8..0000000 --- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Misc/LifecycleExample.cs +++ /dev/null @@ -1,109 +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. - */ - -using System; -using System.Collections.Generic; -using Apache.Ignite.Core; -using Apache.Ignite.Core.Lifecycle; -using Apache.Ignite.Core.Resource; - -namespace Apache.Ignite.Examples.Misc -{ - /// <summary> - /// This example shows how to provide your own <see cref="ILifecycleBean"/> implementation - /// to be able to hook into Apache lifecycle. Example bean will output occurred lifecycle - /// events to the console. - /// <para /> - /// 1) Build the project Apache.Ignite.ExamplesDll (select it -> right-click -> Build). - /// Apache.Ignite.ExamplesDll.dll must appear in %IGNITE_HOME%/platforms/dotnet/Examples/Apache.Ignite.ExamplesDll/bin/${Platform]/${Configuration} folder. - /// 2) Set this class as startup object (Apache.Ignite.Examples project -> right-click -> Properties -> - /// Application -> Startup object); - /// 3) Start example (F5 or Ctrl+F5). - /// </summary> - public class LifecycleExample - { - /// <summary> - /// Runs the example. - /// </summary> - [STAThread] - public static void Main() - { - Console.WriteLine(); - Console.WriteLine(">>> Lifecycle example started."); - - // Create new configuration. - var lifecycleExampleBean = new LifecycleExampleBean(); - - var cfg = new IgniteConfiguration - { - SpringConfigUrl = @"platforms\dotnet\examples\config\example-compute.xml", - JvmOptions = new List<string> { "-Xms512m", "-Xmx1024m" }, - LifecycleBeans = new List<ILifecycleBean> { lifecycleExampleBean } - }; - - // Provide lifecycle bean to configuration. - using (Ignition.Start(cfg)) - { - // Make sure that lifecycle bean was notified about Ignite startup. - Console.WriteLine(); - Console.WriteLine(">>> Started (should be true): " + lifecycleExampleBean.Started); - } - - // Make sure that lifecycle bean was notified about Ignite stop. - Console.WriteLine(); - Console.WriteLine(">>> Started (should be false): " + lifecycleExampleBean.Started); - - Console.WriteLine(); - Console.WriteLine(">>> Example finished, press any key to exit ..."); - Console.ReadKey(); - } - - /// <summary> - /// Sample lifecycle bean implementation. - /// </summary> - private class LifecycleExampleBean : ILifecycleBean - { - /** Auto-injected Ignite instance. */ - [InstanceResource] -#pragma warning disable 649 - private IIgnite _ignite; -#pragma warning restore 649 - - /** <inheritDoc /> */ - public void OnLifecycleEvent(LifecycleEventType evt) - { - Console.WriteLine(); - Console.WriteLine(">>> Ignite lifecycle event occurred: " + evt); - Console.WriteLine(">>> Ignite name: " + (_ignite != null ? _ignite.Name : "not available")); - - if (evt == LifecycleEventType.AfterNodeStart) - Started = true; - else if (evt == LifecycleEventType.AfterNodeStop) - Started = false; - } - - /// <summary> - /// Started flag. - /// </summary> - public bool Started - { - get; - private set; - } - } - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Properties/AssemblyInfo.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Properties/AssemblyInfo.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Properties/AssemblyInfo.cs deleted file mode 100644 index 555a35f..0000000 --- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +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. - */ - -using System.Reflection; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("Apache Ignite Examples")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Apache Software Foundation")] -[assembly: AssemblyProduct("Apache Ignite")] -[assembly: AssemblyCopyright("Copyright © 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -[assembly: ComVisible(false)] - -[assembly: Guid("41a0cb95-3435-4c78-b867-900b28e2c9ee")] - -[assembly: AssemblyVersion("1.5.0")] -[assembly: AssemblyFileVersion("1.5.0")] \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Services/IMapService.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Services/IMapService.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Services/IMapService.cs deleted file mode 100644 index 7253a0b..0000000 --- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Services/IMapService.cs +++ /dev/null @@ -1,56 +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. - */ - -using Apache.Ignite.ExamplesDll.Services; - -namespace Apache.Ignite.Examples.Services -{ - /// <summary> - /// Interface for service proxy interaction. - /// Actual service class (<see cref="MapService{TK,TV}"/>) does not have to implement this interface. - /// Target method/property will be searched by signature (name, arguments). - /// </summary> - public interface IMapService<TK, TV> - { - /// <summary> - /// Puts an entry to the map. - /// </summary> - /// <param name="key">The key.</param> - /// <param name="value">The value.</param> - void Put(TK key, TV value); - - /// <summary> - /// Gets an entry from the map. - /// </summary> - /// <param name="key">The key.</param> - /// <returns>Entry value.</returns> - TV Get(TK key); - - /// <summary> - /// Clears the map. - /// </summary> - void Clear(); - - /// <summary> - /// Gets the size of the map. - /// </summary> - /// <value> - /// The size. - /// </value> - int Size { get; } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Services/ServicesExample.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Services/ServicesExample.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Services/ServicesExample.cs deleted file mode 100644 index 6d0ddd0..0000000 --- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Services/ServicesExample.cs +++ /dev/null @@ -1,77 +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. - */ - -using System; -using System.Collections.Generic; -using Apache.Ignite.Core; -using Apache.Ignite.ExamplesDll.Services; - -namespace Apache.Ignite.Examples.Services -{ - /// <summary> - /// Example demonstrating Ignite services. - /// <para /> - /// 1) Build the project Apache.Ignite.ExamplesDll (select it -> right-click -> Build). - /// Apache.Ignite.ExamplesDll.dll must appear in %IGNITE_HOME%/platforms/dotnet/Examples/Apache.Ignite.ExamplesDll/bin/${Platform]/${Configuration} folder. - /// 2) Set this class as startup object (Apache.Ignite.Examples project -> right-click -> Properties -> - /// Application -> Startup object); - /// 3) Start example (F5 or Ctrl+F5). - /// <para /> - /// This example can be run with standalone Apache Ignite .Net node: - /// 1) Run %IGNITE_HOME%/platforms/dotnet/Apache.Ignite/bin/${Platform]/${Configuration}/Apache.Ignite.exe: - /// Apache.Ignite.exe -IgniteHome="%IGNITE_HOME%" -springConfigUrl=platforms\dotnet\examples\config\example-cache.xml -assembly=[path_to_Apache.Ignite.ExamplesDll.dll] - /// 2) Start example. - /// </summary> - public class ServicesExample - { - /// <summary> - /// Runs the example. - /// </summary> - [STAThread] - public static void Main() - { - var cfg = new IgniteConfiguration - { - SpringConfigUrl = @"platforms\dotnet\examples\config\example-compute.xml", - JvmOptions = new List<string> {"-Xms512m", "-Xmx1024m"} - }; - - using (var ignite = Ignition.Start(cfg)) - { - Console.WriteLine(">>> Services example started."); - Console.WriteLine(); - - // Deploy a service - var svc = new MapService<int, string>(); - Console.WriteLine(">>> Deploying service to all nodes..."); - ignite.GetServices().DeployNodeSingleton("service", svc); - - // Get a sticky service proxy so that we will always be contacting the same remote node. - var prx = ignite.GetServices().GetServiceProxy<IMapService<int, string>>("service", true); - - for (var i = 0; i < 10; i++) - prx.Put(i, i.ToString()); - - var mapSize = prx.Size; - - Console.WriteLine(">>> Map service size: " + mapSize); - - ignite.GetServices().CancelAll(); - } - } - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Apache.Ignite.ExamplesDll.csproj ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Apache.Ignite.ExamplesDll.csproj b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Apache.Ignite.ExamplesDll.csproj deleted file mode 100644 index cb2ff6f..0000000 --- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Apache.Ignite.ExamplesDll.csproj +++ /dev/null @@ -1,75 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProjectGuid>{DFB08363-202E-412D-8812-349EF10A8702}</ProjectGuid> - <OutputType>Library</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>Apache.Ignite.ExamplesDll</RootNamespace> - <AssemblyName>Apache.Ignite.ExamplesDll</AssemblyName> - <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> - <FileAlignment>512</FileAlignment> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> - <PlatformTarget>x64</PlatformTarget> - <OutputPath>bin\x64\Debug\</OutputPath> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> - <PlatformTarget>x64</PlatformTarget> - <OutputPath>bin\x64\Release\</OutputPath> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> - <DebugSymbols>true</DebugSymbols> - <OutputPath>bin\x86\Debug\</OutputPath> - <PlatformTarget>x86</PlatformTarget> - <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'"> - <OutputPath>bin\x86\Release\</OutputPath> - <PlatformTarget>x86</PlatformTarget> - <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> - </PropertyGroup> - <ItemGroup> - <Reference Include="System" /> - <Reference Include="System.Core" /> - </ItemGroup> - <ItemGroup> - <Compile Include="Compute\AverageSalaryJob.cs" /> - <Compile Include="Compute\AverageSalaryTask.cs" /> - <Compile Include="Compute\CharacterCountClosure.cs" /> - <Compile Include="Compute\CharacterCountReducer.cs" /> - <Compile Include="Datagrid\EmployeeStorePredicate.cs" /> - <Compile Include="Datagrid\ContinuousQueryFilter.cs" /> - <Compile Include="Datagrid\EmployeeStore.cs" /> - <Compile Include="Events\LocalListener.cs" /> - <Compile Include="Events\RemoteFilter.cs" /> - <Compile Include="Messaging\LocalListener.cs" /> - <Compile Include="Messaging\RemoteOrderedListener.cs" /> - <Compile Include="Messaging\RemoteUnorderedListener.cs" /> - <Compile Include="Messaging\Topic.cs" /> - <Compile Include="Portable\Account.cs" /> - <Compile Include="Portable\Address.cs" /> - <Compile Include="Portable\Employee.cs" /> - <Compile Include="Portable\EmployeeKey.cs" /> - <Compile Include="Portable\Organization.cs" /> - <Compile Include="Portable\OrganizationType.cs" /> - <Compile Include="Properties\AssemblyInfo.cs" /> - <Compile Include="Services\MapService.cs" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\..\Apache.Ignite.Core\Apache.Ignite.Core.csproj"> - <Project>{4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}</Project> - <Name>Apache.Ignite.Core</Name> - </ProjectReference> - </ItemGroup> - <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> - <!-- To modify your build process, add your task inside one of the targets below and uncomment it. - Other similar extension points exist, see Microsoft.Common.targets. - <Target Name="BeforeBuild"> - </Target> - <Target Name="AfterBuild"> - </Target> - --> -</Project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Apache.Ignite.ExamplesDll.csprojrel ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Apache.Ignite.ExamplesDll.csprojrel b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Apache.Ignite.ExamplesDll.csprojrel deleted file mode 100644 index fa6b71c..0000000 --- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Apache.Ignite.ExamplesDll.csprojrel +++ /dev/null @@ -1,72 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProjectGuid>{DFB08363-202E-412D-8812-349EF10A8702}</ProjectGuid> - <OutputType>Library</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>Apache.Ignite.ExamplesDll</RootNamespace> - <AssemblyName>Apache.Ignite.ExamplesDll</AssemblyName> - <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> - <FileAlignment>512</FileAlignment> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> - <PlatformTarget>x64</PlatformTarget> - <OutputPath>bin\x64\Debug\</OutputPath> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> - <PlatformTarget>x64</PlatformTarget> - <OutputPath>bin\x64\Release\</OutputPath> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> - <DebugSymbols>true</DebugSymbols> - <OutputPath>bin\x86\Debug\</OutputPath> - <PlatformTarget>x86</PlatformTarget> - <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'"> - <OutputPath>bin\x86\Release\</OutputPath> - <PlatformTarget>x86</PlatformTarget> - <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> - </PropertyGroup> - <ItemGroup> - <Reference Include="Apache.Ignite.Core"> - <HintPath>..\..\Apache.Ignite\bin\$(Platform)\$(Configuration)\Apache.Ignite.Core.dll</HintPath> - </Reference> - <Reference Include="System" /> - <Reference Include="System.Core" /> - </ItemGroup> - <ItemGroup> - <Compile Include="Compute\AverageSalaryJob.cs" /> - <Compile Include="Compute\AverageSalaryTask.cs" /> - <Compile Include="Compute\CharacterCountClosure.cs" /> - <Compile Include="Compute\CharacterCountReducer.cs" /> - <Compile Include="Datagrid\EmployeeStorePredicate.cs" /> - <Compile Include="Datagrid\ContinuousQueryFilter.cs" /> - <Compile Include="Datagrid\EmployeeStore.cs" /> - <Compile Include="Events\LocalListener.cs" /> - <Compile Include="Events\RemoteFilter.cs" /> - <Compile Include="Messaging\LocalListener.cs" /> - <Compile Include="Messaging\RemoteOrderedListener.cs" /> - <Compile Include="Messaging\RemoteUnorderedListener.cs" /> - <Compile Include="Messaging\Topic.cs" /> - <Compile Include="Portable\Account.cs" /> - <Compile Include="Portable\Address.cs" /> - <Compile Include="Portable\Employee.cs" /> - <Compile Include="Portable\EmployeeKey.cs" /> - <Compile Include="Portable\Organization.cs" /> - <Compile Include="Portable\OrganizationType.cs" /> - <Compile Include="Properties\AssemblyInfo.cs" /> - <Compile Include="Services\MapService.cs" /> - </ItemGroup> - <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> - <!-- To modify your build process, add your task inside one of the targets below and uncomment it. - Other similar extension points exist, see Microsoft.Common.targets. - <Target Name="BeforeBuild"> - </Target> - <Target Name="AfterBuild"> - </Target> - --> -</Project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Compute/AverageSalaryJob.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Compute/AverageSalaryJob.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Compute/AverageSalaryJob.cs deleted file mode 100644 index e4713d4..0000000 --- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Compute/AverageSalaryJob.cs +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * 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. - */ - -using System; -using System.Collections.Generic; -using Apache.Ignite.Core.Compute; -using Apache.Ignite.ExamplesDll.Portable; - -namespace Apache.Ignite.ExamplesDll.Compute -{ - /// <summary> - /// Average salary job. - /// </summary> - [Serializable] - public class AverageSalaryJob : ComputeJobAdapter<Tuple<long, int>> - { - /// <summary> Employees. </summary> - private readonly ICollection<Employee> _employees = new List<Employee>(); - - /// <summary> - /// Adds employee. - /// </summary> - /// <param name="employee">Employee.</param> - public void Add(Employee employee) - { - _employees.Add(employee); - } - - /// <summary> - /// Execute the job. - /// </summary> - /// <returns>Job result: tuple with total salary in the first item and employees count in the second.</returns> - override public Tuple<long, int> Execute() - { - long sum = 0; - int count = 0; - - Console.WriteLine(); - Console.WriteLine(">>> Executing salary job for " + _employees.Count + " employee(s) ..."); - Console.WriteLine(); - - foreach (Employee emp in _employees) - { - sum += emp.Salary; - count++; - } - - return new Tuple<long, int>(sum, count); - } - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Compute/AverageSalaryTask.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Compute/AverageSalaryTask.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Compute/AverageSalaryTask.cs deleted file mode 100644 index f8acb01..0000000 --- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Compute/AverageSalaryTask.cs +++ /dev/null @@ -1,84 +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. - */ - -using System; -using System.Collections.Generic; -using System.Linq; -using Apache.Ignite.Core.Compute; -using Apache.Ignite.ExamplesDll.Portable; - -namespace Apache.Ignite.ExamplesDll.Compute -{ - /// <summary> - /// Average salary task. - /// </summary> - public class AverageSalaryTask : ComputeTaskSplitAdapter<ICollection<Employee>, Tuple<long, int>, long> - { - /// <summary> - /// Split the task distributing employees between several jobs. - /// </summary> - /// <param name="gridSize">Number of available grid nodes.</param> - /// <param name="arg">Task execution argument.</param> - protected override ICollection<IComputeJob<Tuple<long, int>>> Split(int gridSize, ICollection<Employee> arg) - { - ICollection<Employee> employees = arg; - - var jobs = new List<IComputeJob<Tuple<long, int>>>(gridSize); - - int count = 0; - - foreach (Employee employee in employees) - { - int idx = count++ % gridSize; - - AverageSalaryJob job; - - if (idx >= jobs.Count) - { - job = new AverageSalaryJob(); - - jobs.Add(job); - } - else - job = (AverageSalaryJob) jobs[idx]; - - job.Add(employee); - } - - return jobs; - } - - /// <summary> - /// Calculate average salary after all jobs are finished. - /// </summary> - /// <param name="results">Job results.</param> - /// <returns>Average salary.</returns> - public override long Reduce(IList<IComputeJobResult<Tuple<long, int>>> results) - { - long sum = 0; - int count = 0; - - foreach (var t in results.Select(result => result.Data())) - { - sum += t.Item1; - count += t.Item2; - } - - return sum / count; - } - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Compute/CharacterCountClosure.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Compute/CharacterCountClosure.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Compute/CharacterCountClosure.cs deleted file mode 100644 index 2823221..0000000 --- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Compute/CharacterCountClosure.cs +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * 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. - */ - -using System; -using Apache.Ignite.Core.Compute; - -namespace Apache.Ignite.ExamplesDll.Compute -{ - /// <summary> - /// Closure counting characters in a string. - /// </summary> - [Serializable] - public class CharacterCountClosure : IComputeFunc<string, int> - { - /// <summary> - /// Calculate character count of the given word. - /// </summary> - /// <param name="arg">Word.</param> - /// <returns>Character count.</returns> - public int Invoke(string arg) - { - int len = arg.Length; - - Console.WriteLine("Character count in word \"" + arg + "\": " + len); - - return len; - } - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Compute/CharacterCountReducer.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Compute/CharacterCountReducer.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Compute/CharacterCountReducer.cs deleted file mode 100644 index 6825046..0000000 --- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Compute/CharacterCountReducer.cs +++ /dev/null @@ -1,51 +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. - */ - -using Apache.Ignite.Core.Compute; - -namespace Apache.Ignite.ExamplesDll.Compute -{ - /// <summary> - /// Character count reducer which collects individual string lengths and aggregate them. - /// </summary> - public class CharacterCountReducer : IComputeReducer<int, int> - { - /// <summary> Total length. </summary> - private int _length; - - /// <summary> - /// Collect character counts of distinct words. - /// </summary> - /// <param name="res">Character count of a distinct word.</param> - /// <returns><c>True</c> to continue collecting results until all closures are finished.</returns> - public bool Collect(int res) - { - _length += res; - - return true; - } - - /// <summary> - /// Reduce all collected results. - /// </summary> - /// <returns>Total character count.</returns> - public int Reduce() - { - return _length; - } - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Datagrid/ContinuousQueryFilter.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Datagrid/ContinuousQueryFilter.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Datagrid/ContinuousQueryFilter.cs deleted file mode 100644 index 8c05f42..0000000 --- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Datagrid/ContinuousQueryFilter.cs +++ /dev/null @@ -1,50 +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. - */ - -using System; -using Apache.Ignite.Core.Cache.Event; - -namespace Apache.Ignite.ExamplesDll.Datagrid -{ - /// <summary> - /// Filter for continuous query example. - /// </summary> - [Serializable] - public class ContinuousQueryFilter : ICacheEntryEventFilter<int, string> - { - /// <summary> Threshold. </summary> - private readonly int _threshold; - - /// <summary> - /// Constructor. - /// </summary> - /// <param name="threshold">Threshold.</param> - public ContinuousQueryFilter(int threshold) - { - _threshold = threshold; - } - - /// <summary> - /// Evaluates cache entry event. - /// </summary> - /// <param name="evt">Event.</param> - public bool Evaluate(ICacheEntryEvent<int, string> evt) - { - return evt.Key >= _threshold; - } - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Datagrid/EmployeeStore.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Datagrid/EmployeeStore.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Datagrid/EmployeeStore.cs deleted file mode 100644 index 742b048..0000000 --- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Datagrid/EmployeeStore.cs +++ /dev/null @@ -1,121 +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. - */ - -using System; -using System.Collections; -using System.Collections.Concurrent; -using System.Collections.Generic; -using Apache.Ignite.Core.Cache; -using Apache.Ignite.Core.Cache.Store; -using Apache.Ignite.ExamplesDll.Portable; - -namespace Apache.Ignite.ExamplesDll.Datagrid -{ - /// <summary> - /// Example cache store implementation. - /// </summary> - public class EmployeeStore : CacheStoreAdapter - { - /// <summary> - /// Dictionary representing the store. - /// </summary> - private readonly ConcurrentDictionary<object, object> _db = new ConcurrentDictionary<object, object>( - new List<KeyValuePair<object, object>> - { - new KeyValuePair<object, object>(1, new Employee( - "Allison Mathis", - 25300, - new Address("2702 Freedom Lane, San Francisco, CA", 94109), - new List<string> {"Development"} - )), - - new KeyValuePair<object, object>(2, new Employee( - "Breana Robbin", - 6500, - new Address("3960 Sundown Lane, Austin, TX", 78130), - new List<string> {"Sales"} - )) - }); - - /// <summary> - /// Loads all values from underlying persistent storage. - /// This method gets called as a result of <see cref="ICache{TK,TV}.LoadCache"/> call. - /// </summary> - /// <param name="act">Action that loads a cache entry.</param> - /// <param name="args">Optional arguments.</param> - public override void LoadCache(Action<object, object> act, params object[] args) - { - // Iterate over whole underlying store and call act on each entry to load it into the cache. - foreach (var entry in _db) - act(entry.Key, entry.Value); - } - - /// <summary> - /// Loads multiple objects from the cache store. - /// This method gets called as a result of <see cref="ICache{K,V}.GetAll"/> call. - /// </summary> - /// <param name="keys">Keys to load.</param> - /// <returns> - /// A map of key, values to be stored in the cache. - /// </returns> - public override IDictionary LoadAll(ICollection keys) - { - var result = new Dictionary<object, object>(); - - foreach (var key in keys) - result[key] = Load(key); - - return result; - } - - /// <summary> - /// Loads an object from the cache store. - /// This method gets called as a result of <see cref="ICache{K,V}.Get"/> call. - /// </summary> - /// <param name="key">Key to load.</param> - /// <returns>Loaded value</returns> - public override object Load(object key) - { - object val; - - _db.TryGetValue(key, out val); - - return val; - } - - /// <summary> - /// Write key-value pair to store. - /// </summary> - /// <param name="key">Key to write.</param> - /// <param name="val">Value to write.</param> - public override void Write(object key, object val) - { - _db[key] = val; - } - - /// <summary> - /// Delete cache entry form store. - /// </summary> - /// <param name="key">Key to delete.</param> - public override void Delete(object key) - { - object val; - - _db.TryRemove(key, out val); - } - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Datagrid/EmployeeStorePredicate.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Datagrid/EmployeeStorePredicate.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Datagrid/EmployeeStorePredicate.cs deleted file mode 100644 index a585e5e..0000000 --- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Datagrid/EmployeeStorePredicate.cs +++ /dev/null @@ -1,40 +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. - */ - -using System; -using Apache.Ignite.Core.Cache; -using Apache.Ignite.ExamplesDll.Portable; - -namespace Apache.Ignite.ExamplesDll.Datagrid -{ - /// <summary> - /// Example cache entry predicate. - /// </summary> - [Serializable] - public class EmployeeStorePredicate : ICacheEntryFilter<int, Employee> - { - /// <summary> - /// Returns a value indicating whether provided cache entry satisfies this predicate. - /// </summary> - /// <param name="entry">Cache entry.</param> - /// <returns>Value indicating whether provided cache entry satisfies this predicate.</returns> - public bool Invoke(ICacheEntry<int, Employee> entry) - { - return entry.Key == 1; - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Events/LocalListener.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Events/LocalListener.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Events/LocalListener.cs deleted file mode 100644 index 8a28355..0000000 --- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Events/LocalListener.cs +++ /dev/null @@ -1,55 +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. - */ - -using System; -using System.Threading; -using Apache.Ignite.Core.Events; - -namespace Apache.Ignite.ExamplesDll.Events -{ - /// <summary> - /// Local event listener. - /// </summary> - public class LocalListener : IEventFilter<IEvent> - { - /** Сount of received events. */ - private int _eventsReceived; - - /// <summary> - /// Gets the count of received events. - /// </summary> - public int EventsReceived - { - get { return _eventsReceived; } - } - - /// <summary> - /// Determines whether specified event passes this filter. - /// </summary> - /// <param name="nodeId">Node identifier.</param> - /// <param name="evt">Event.</param> - /// <returns>Value indicating whether specified event passes this filter.</returns> - public bool Invoke(Guid nodeId, IEvent evt) - { - Interlocked.Increment(ref _eventsReceived); - - Console.WriteLine("Local listener received an event [evt={0}]", evt.Name); - - return true; - } - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Events/RemoteFilter.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Events/RemoteFilter.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Events/RemoteFilter.cs deleted file mode 100644 index db3204a..0000000 --- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Events/RemoteFilter.cs +++ /dev/null @@ -1,42 +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. - */ - -using System; -using Apache.Ignite.Core.Events; - -namespace Apache.Ignite.ExamplesDll.Events -{ - /// <summary> - /// Remote event filter. - /// </summary> - [Serializable] - public class RemoteFilter : IEventFilter<IEvent> - { - /// <summary> - /// Determines whether specified event passes this filter. - /// </summary> - /// <param name="nodeId">Node identifier.</param> - /// <param name="evt">Event.</param> - /// <returns>Value indicating whether specified event passes this filter.</returns> - public bool Invoke(Guid nodeId, IEvent evt) - { - Console.WriteLine("Remote filter received event [evt={0}]", evt.Name); - - return evt is JobEvent; - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Messaging/LocalListener.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Messaging/LocalListener.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Messaging/LocalListener.cs deleted file mode 100644 index 7659bb4..0000000 --- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Messaging/LocalListener.cs +++ /dev/null @@ -1,59 +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. - */ - -using System; -using System.Threading; -using Apache.Ignite.Core.Messaging; - -namespace Apache.Ignite.ExamplesDll.Messaging -{ - /// <summary> - /// Local message listener which signals countdown event on each received message. - /// </summary> - public class LocalListener : IMessageFilter<int> - { - /** Countdown event. */ - private readonly CountdownEvent _countdown; - - /// <summary> - /// Initializes a new instance of the <see cref="LocalListener"/> class. - /// </summary> - /// <param name="countdown">The countdown event.</param> - public LocalListener(CountdownEvent countdown) - { - if (countdown == null) - throw new ArgumentNullException("countdown"); - - _countdown = countdown; - } - - /// <summary> - /// Receives a message and returns a value - /// indicating whether provided message and node id satisfy this predicate. - /// Returning false will unsubscribe this listener from future notifications. - /// </summary> - /// <param name="nodeId">Node identifier.</param> - /// <param name="message">Message.</param> - /// <returns>Value indicating whether provided message and node id satisfy this predicate.</returns> - public bool Invoke(Guid nodeId, int message) - { - _countdown.Signal(); - - return !_countdown.IsSet; - } - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Messaging/RemoteOrderedListener.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Messaging/RemoteOrderedListener.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Messaging/RemoteOrderedListener.cs deleted file mode 100644 index 8ae5ac1..0000000 --- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Messaging/RemoteOrderedListener.cs +++ /dev/null @@ -1,54 +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. - */ - -using System; -using Apache.Ignite.Core; -using Apache.Ignite.Core.Messaging; -using Apache.Ignite.Core.Resource; - -namespace Apache.Ignite.ExamplesDll.Messaging -{ - /// <summary> - /// Listener for Ordered topic. - /// </summary> - [Serializable] - public class RemoteOrderedListener : IMessageFilter<int> - { - /** Injected Ignite instance. */ - [InstanceResource] -#pragma warning disable 649 - private readonly IIgnite _ignite; -#pragma warning restore 649 - - /// <summary> - /// Receives a message and returns a value - /// indicating whether provided message and node id satisfy this predicate. - /// Returning false will unsubscribe this listener from future notifications. - /// </summary> - /// <param name="nodeId">Node identifier.</param> - /// <param name="message">Message.</param> - /// <returns>Value indicating whether provided message and node id satisfy this predicate.</returns> - public bool Invoke(Guid nodeId, int message) - { - Console.WriteLine("Received ordered message [msg={0}, fromNodeId={1}]", message, nodeId); - - _ignite.GetCluster().ForNodeIds(nodeId).GetMessaging().Send(message, Topic.Ordered); - - return true; - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Messaging/RemoteUnorderedListener.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Messaging/RemoteUnorderedListener.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Messaging/RemoteUnorderedListener.cs deleted file mode 100644 index 166dbd6..0000000 --- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Messaging/RemoteUnorderedListener.cs +++ /dev/null @@ -1,54 +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. - */ - -using System; -using Apache.Ignite.Core; -using Apache.Ignite.Core.Messaging; -using Apache.Ignite.Core.Resource; - -namespace Apache.Ignite.ExamplesDll.Messaging -{ - /// <summary> - /// Listener for Unordered topic. - /// </summary> - [Serializable] - public class RemoteUnorderedListener : IMessageFilter<int> - { - /** Injected Ignite instance. */ - [InstanceResource] -#pragma warning disable 649 - private readonly IIgnite _ignite; -#pragma warning restore 649 - - /// <summary> - /// Receives a message and returns a value - /// indicating whether provided message and node id satisfy this predicate. - /// Returning false will unsubscribe this listener from future notifications. - /// </summary> - /// <param name="nodeId">Node identifier.</param> - /// <param name="message">Message.</param> - /// <returns>Value indicating whether provided message and node id satisfy this predicate.</returns> - public bool Invoke(Guid nodeId, int message) - { - Console.WriteLine("Received unordered message [msg={0}, fromNodeId={1}]", message, nodeId); - - _ignite.GetCluster().ForNodeIds(nodeId).GetMessaging().Send(message, Topic.Unordered); - - return true; - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Messaging/Topic.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Messaging/Topic.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Messaging/Topic.cs deleted file mode 100644 index bda0bfe..0000000 --- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Messaging/Topic.cs +++ /dev/null @@ -1,28 +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. - */ - -namespace Apache.Ignite.ExamplesDll.Messaging -{ - /// <summary> - /// Message topics. - /// </summary> - public static class Topic - { - public const int Ordered = 1; - public const int Unordered = 2; - } -} \ No newline at end of file
