ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [25/26] ignite git commit: Merged IGNITE-950-new into IGNITE-1282
Date Thu, 05 Nov 2015 13:16:17 GMT
http://git-wip-us.apache.org/repos/asf/ignite/blob/b783d2b7/examples/src/main/java/org/apache/ignite/examples/portable/EmployeeKey.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/EmployeeKey.java b/examples/src/main/java/org/apache/ignite/examples/portable/EmployeeKey.java
deleted file mode 100644
index f322167..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/EmployeeKey.java
+++ /dev/null
@@ -1,90 +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.portable;
-
-/**
- * This class represents key for employee object.
- * <p>
- * Used in query example to collocate employees
- * with their organizations.
- */
-public class EmployeeKey {
-    /** ID. */
-    private int id;
-
-    /** Organization ID. */
-    private int organizationId;
-
-    /**
-     * Required for portable deserialization.
-     */
-    public EmployeeKey() {
-        // No-op.
-    }
-
-    /**
-     * @param id ID.
-     * @param organizationId Organization ID.
-     */
-    public EmployeeKey(int id, int organizationId) {
-        this.id = id;
-        this.organizationId = organizationId;
-    }
-
-    /**
-     * @return ID.
-     */
-    public int id() {
-        return id;
-    }
-
-    /**
-     * @return Organization ID.
-     */
-    public int organizationId() {
-        return organizationId;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean equals(Object o) {
-        if (this == o)
-            return true;
-
-        if (o == null || getClass() != o.getClass())
-            return false;
-
-        EmployeeKey key = (EmployeeKey)o;
-
-        return id == key.id && organizationId == key.organizationId;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int hashCode() {
-        int res = id;
-
-        res = 31 * res + organizationId;
-
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return "EmployeeKey [id=" + id +
-            ", organizationId=" + organizationId + ']';
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/b783d2b7/examples/src/main/java/org/apache/ignite/examples/portable/ExamplePortableNodeStartup.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/ExamplePortableNodeStartup.java b/examples/src/main/java/org/apache/ignite/examples/portable/ExamplePortableNodeStartup.java
deleted file mode 100644
index 87a41f7..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/ExamplePortableNodeStartup.java
+++ /dev/null
@@ -1,36 +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.portable;
-
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.Ignition;
-
-/**
- * Starts up an empty node with example configuration and portable marshaller enabled.
- */
-public class ExamplePortableNodeStartup {
-    /**
-     * Start up an empty node with example configuration and portable marshaller enabled.
-     *
-     * @param args Command line arguments, none required.
-     * @throws IgniteException If failed.
-     */
-    public static void main(String[] args) throws IgniteException {
-        Ignition.start("examples/config/portable/example-ignite-portable.xml");
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/b783d2b7/examples/src/main/java/org/apache/ignite/examples/portable/Organization.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/Organization.java b/examples/src/main/java/org/apache/ignite/examples/portable/Organization.java
deleted file mode 100644
index f52cac1..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/Organization.java
+++ /dev/null
@@ -1,93 +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.portable;
-
-import java.sql.Timestamp;
-
-/**
- * This class represents organization object.
- */
-public class Organization {
-    /** Name. */
-    private String name;
-
-    /** Address. */
-    private Address address;
-
-    /** Type. */
-    private OrganizationType type;
-
-    /** Last update time. */
-    private Timestamp lastUpdated;
-
-    /**
-     * Required for portable deserialization.
-     */
-    public Organization() {
-        // No-op.
-    }
-
-    /**
-     * @param name Name.
-     * @param address Address.
-     * @param type Type.
-     * @param lastUpdated Last update time.
-     */
-    public Organization(String name, Address address, OrganizationType type, Timestamp lastUpdated) {
-        this.name = name;
-        this.address = address;
-        this.type = type;
-        this.lastUpdated = lastUpdated;
-    }
-
-    /**
-     * @return Name.
-     */
-    public String name() {
-        return name;
-    }
-
-    /**
-     * @return Address.
-     */
-    public Address address() {
-        return address;
-    }
-
-    /**
-     * @return Type.
-     */
-    public OrganizationType type() {
-        return type;
-    }
-
-    /**
-     * @return Last update time.
-     */
-    public Timestamp lastUpdated() {
-        return lastUpdated;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return "Organization [name=" + name +
-            ", address=" + address +
-            ", type=" + type +
-            ", lastUpdated=" + lastUpdated + ']';
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/b783d2b7/examples/src/main/java/org/apache/ignite/examples/portable/OrganizationType.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/OrganizationType.java b/examples/src/main/java/org/apache/ignite/examples/portable/OrganizationType.java
deleted file mode 100644
index c753e2d..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/OrganizationType.java
+++ /dev/null
@@ -1,32 +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.portable;
-
-/**
- * Organization type enum.
- */
-public enum OrganizationType {
-    /** Non-profit organization. */
-    NON_PROFIT,
-
-    /** Private organization. */
-    PRIVATE,
-
-    /** Government organization. */
-    GOVERNMENT
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/b783d2b7/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/ComputeClientPortableTaskExecutionExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/ComputeClientPortableTaskExecutionExample.java b/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/ComputeClientPortableTaskExecutionExample.java
deleted file mode 100644
index 34d9cde..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/ComputeClientPortableTaskExecutionExample.java
+++ /dev/null
@@ -1,154 +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.portable.computegrid;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.Ignition;
-import org.apache.ignite.examples.portable.Address;
-import org.apache.ignite.examples.portable.Employee;
-import org.apache.ignite.examples.portable.ExamplePortableNodeStartup;
-import org.apache.ignite.portable.PortableObject;
-
-/**
- * This example demonstrates use of portable objects with task execution.
- * Specifically it shows that portable objects are simple Java POJOs and do not require any special treatment.
- * <p>
- * The example executes map-reduce task that accepts collection of portable objects as an argument.
- * Since these objects are never deserialized on remote nodes, classes are not required on classpath
- * of these nodes.
- * <p>
- * Remote nodes should always be started with special configuration file which
- * enables the portable marshaller: {@code 'ignite.{sh|bat} examples/config/portable/example-ignite-portable.xml'}.
- * <p>
- * Alternatively you can run {@link ExamplePortableNodeStartup} in another JVM which will
- * start node with {@code examples/config/portable/example-ignite-portable.xml} configuration.
- */
-public class ComputeClientPortableTaskExecutionExample {
-    /**
-     * Executes example.
-     *
-     * @param args Command line arguments, none required.
-     */
-    public static void main(String[] args) {
-        try (Ignite ignite = Ignition.start("examples/config/portable/example-ignite-portable.xml")) {
-            System.out.println();
-            System.out.println(">>> Portable objects task execution example started.");
-
-            if (ignite.cluster().forRemotes().nodes().isEmpty()) {
-                System.out.println();
-                System.out.println(">>> This example requires remote nodes to be started.");
-                System.out.println(">>> Please start at least 1 remote node.");
-                System.out.println(">>> Refer to example's javadoc for details on configuration.");
-                System.out.println();
-
-                return;
-            }
-
-            // Generate employees to calculate average salary for.
-            Collection<Employee> employees = employees();
-
-            System.out.println();
-            System.out.println(">>> Calculating average salary for employees:");
-
-            for (Employee employee : employees)
-                System.out.println(">>>     " + employee);
-
-            // Convert collection of employees to collection of portable objects.
-            // This allows to send objects across nodes without requiring to have
-            // Employee class on classpath of these nodes.
-            Collection<PortableObject> portables = ignite.portables().toPortable(employees);
-
-            // Execute task and get average salary.
-            Long avgSalary = ignite.compute(ignite.cluster().forRemotes()).execute(new ComputeClientTask(), portables);
-
-            System.out.println();
-            System.out.println(">>> Average salary for all employees: " + avgSalary);
-            System.out.println();
-        }
-    }
-
-    /**
-     * Creates collection of employees.
-     *
-     * @return Collection of employees.
-     */
-    private static Collection<Employee> employees() {
-        Collection<Employee> employees = new ArrayList<>();
-
-        employees.add(new Employee(
-            "James Wilson",
-            12500,
-            new Address("1096 Eddy Street, San Francisco, CA", 94109),
-            Arrays.asList("Human Resources", "Customer Service")
-        ));
-
-        employees.add(new Employee(
-            "Daniel Adams",
-            11000,
-            new Address("184 Fidler Drive, San Antonio, TX", 78205),
-            Arrays.asList("Development", "QA")
-        ));
-
-        employees.add(new Employee(
-            "Cristian Moss",
-            12500,
-            new Address("667 Jerry Dove Drive, Florence, SC", 29501),
-            Arrays.asList("Logistics")
-        ));
-
-        employees.add(new Employee(
-            "Allison Mathis",
-            25300,
-            new Address("2702 Freedom Lane, Hornitos, CA", 95325),
-            Arrays.asList("Development")
-        ));
-
-        employees.add(new Employee(
-            "Breana Robbin",
-            6500,
-            new Address("3960 Sundown Lane, Austin, TX", 78758),
-            Arrays.asList("Sales")
-        ));
-
-        employees.add(new Employee(
-            "Philip Horsley",
-            19800,
-            new Address("2803 Elsie Drive, Sioux Falls, SD", 57104),
-            Arrays.asList("Sales")
-        ));
-
-        employees.add(new Employee(
-            "Brian Peters",
-            10600,
-            new Address("1407 Pearlman Avenue, Boston, MA", 12110),
-            Arrays.asList("Development", "QA")
-        ));
-
-        employees.add(new Employee(
-            "Jack Yang",
-            12900,
-            new Address("4425 Parrish Avenue Smithsons Valley, TX", 78130),
-            Arrays.asList("Sales")
-        ));
-
-        return employees;
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/b783d2b7/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/ComputeClientTask.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/ComputeClientTask.java b/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/ComputeClientTask.java
deleted file mode 100644
index 0eee8c6..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/ComputeClientTask.java
+++ /dev/null
@@ -1,116 +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.portable.computegrid;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import org.apache.ignite.compute.ComputeJob;
-import org.apache.ignite.compute.ComputeJobAdapter;
-import org.apache.ignite.compute.ComputeJobResult;
-import org.apache.ignite.compute.ComputeTaskSplitAdapter;
-import org.apache.ignite.lang.IgniteBiTuple;
-import org.apache.ignite.portable.PortableObject;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Task that is used for {@link ComputeClientPortableTaskExecutionExample} and
- * similar examples in .NET and C++.
- * <p>
- * This task calculates average salary for provided collection of employees.
- * It splits the collection into batches of size {@code 3} and creates a job
- * for each batch. After all jobs are executed, there results are reduced to
- * get the average salary.
- */
-public class ComputeClientTask extends ComputeTaskSplitAdapter<Collection<PortableObject>, Long> {
-    /** {@inheritDoc} */
-    @Override protected Collection<? extends ComputeJob> split(
-        int gridSize,
-        Collection<PortableObject> arg
-    ) {
-        Collection<ComputeClientJob> jobs = new ArrayList<>();
-
-        Collection<PortableObject> employees = new ArrayList<>();
-
-        // Split provided collection into batches and
-        // create a job for each batch.
-        for (PortableObject employee : arg) {
-            employees.add(employee);
-
-            if (employees.size() == 3) {
-                jobs.add(new ComputeClientJob(employees));
-
-                employees = new ArrayList<>(3);
-            }
-        }
-
-        if (!employees.isEmpty())
-            jobs.add(new ComputeClientJob(employees));
-
-        return jobs;
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public Long reduce(List<ComputeJobResult> results) {
-        long sum = 0;
-        int cnt = 0;
-
-        for (ComputeJobResult res : results) {
-            IgniteBiTuple<Long, Integer> t = res.getData();
-
-            sum += t.get1();
-            cnt += t.get2();
-        }
-
-        return sum / cnt;
-    }
-
-    /**
-     * Remote job for {@link ComputeClientTask}.
-     */
-    private static class ComputeClientJob extends ComputeJobAdapter {
-        /** Collection of employees. */
-        private final Collection<PortableObject> employees;
-
-        /**
-         * @param employees Collection of employees.
-         */
-        private ComputeClientJob(Collection<PortableObject> employees) {
-            this.employees = employees;
-        }
-
-        /** {@inheritDoc} */
-        @Nullable @Override public Object execute() {
-            long sum = 0;
-            int cnt = 0;
-
-            for (PortableObject employee : employees) {
-                System.out.println(">>> Processing employee: " + employee.field("name"));
-
-                // Get salary from portable object. Note that object
-                // doesn't need to be fully deserialized.
-                long salary = employee.field("salary");
-
-                sum += salary;
-                cnt++;
-            }
-
-            return new IgniteBiTuple<>(sum, cnt);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/b783d2b7/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/package-info.java b/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/package-info.java
deleted file mode 100644
index 469128c..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/package-info.java
+++ /dev/null
@@ -1,21 +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 the usage of portable objects with task execution.
- */
-package org.apache.ignite.examples.portable.computegrid;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/b783d2b7/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/CacheClientPortablePutGetExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/CacheClientPortablePutGetExample.java b/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/CacheClientPortablePutGetExample.java
deleted file mode 100644
index 77c5d95..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/CacheClientPortablePutGetExample.java
+++ /dev/null
@@ -1,230 +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.portable.datagrid;
-
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.Ignition;
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.examples.portable.Address;
-import org.apache.ignite.examples.portable.ExamplePortableNodeStartup;
-import org.apache.ignite.examples.portable.Organization;
-import org.apache.ignite.examples.portable.OrganizationType;
-import org.apache.ignite.portable.PortableObject;
-
-/**
- * This example demonstrates use of portable objects with Ignite cache.
- * Specifically it shows that portable objects are simple Java POJOs and do not require any special treatment.
- * <p>
- * The example executes several put-get operations on Ignite cache with portable values. Note that
- * it demonstrates how portable object can be retrieved in fully-deserialized form or in portable object
- * format using special cache projection.
- * <p>
- * Remote nodes should always be started with special configuration file which
- * enables the portable marshaller: {@code 'ignite.{sh|bat} examples/config/portable/example-ignite-portable.xml'}.
- * <p>
- * Alternatively you can run {@link ExamplePortableNodeStartup} in another JVM which will
- * start node with {@code examples/config/portable/example-ignite-portable.xml} configuration.
- */
-public class CacheClientPortablePutGetExample {
-    /** Cache name. */
-    private static final String CACHE_NAME = CacheClientPortablePutGetExample.class.getSimpleName();
-
-    /**
-     * Executes example.
-     *
-     * @param args Command line arguments, none required.
-     */
-    public static void main(String[] args) {
-        try (Ignite ignite = Ignition.start("examples/config/portable/example-ignite-portable.xml")) {
-            System.out.println();
-            System.out.println(">>> Portable objects cache put-get example started.");
-
-            CacheConfiguration<Integer, Organization> cfg = new CacheConfiguration<>();
-
-            cfg.setCacheMode(CacheMode.PARTITIONED);
-            cfg.setName(CACHE_NAME);
-            cfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
-
-            try (IgniteCache<Integer, Organization> cache = ignite.createCache(cfg)) {
-                if (ignite.cluster().forDataNodes(cache.getName()).nodes().isEmpty()) {
-                    System.out.println();
-                    System.out.println(">>> This example requires remote cache node nodes to be started.");
-                    System.out.println(">>> Please start at least 1 remote cache node.");
-                    System.out.println(">>> Refer to example's javadoc for details on configuration.");
-                    System.out.println();
-
-                    return;
-                }
-
-                putGet(cache);
-                putGetPortable(cache);
-                putGetAll(cache);
-                putGetAllPortable(cache);
-
-                System.out.println();
-            }
-            finally {
-                // Delete cache with its content completely.
-                ignite.destroyCache(CACHE_NAME);
-            }
-        }
-    }
-
-    /**
-     * Execute individual put and get.
-     *
-     * @param cache Cache.
-     */
-    private static void putGet(IgniteCache<Integer, Organization> cache) {
-        // Create new Organization portable object to store in cache.
-        Organization org = new Organization(
-            "Microsoft", // Name.
-            new Address("1096 Eddy Street, San Francisco, CA", 94109), // Address.
-            OrganizationType.PRIVATE, // Type.
-            new Timestamp(System.currentTimeMillis())); // Last update time.
-
-        // Put created data entry to cache.
-        cache.put(1, org);
-
-        // Get recently created organization as a strongly-typed fully de-serialized instance.
-        Organization orgFromCache = cache.get(1);
-
-        System.out.println();
-        System.out.println(">>> Retrieved organization instance from cache: " + orgFromCache);
-    }
-
-    /**
-     * Execute individual put and get, getting value in portable format, without de-serializing it.
-     *
-     * @param cache Cache.
-     */
-    private static void putGetPortable(IgniteCache<Integer, Organization> cache) {
-        // Create new Organization portable object to store in cache.
-        Organization org = new Organization(
-            "Microsoft", // Name.
-            new Address("1096 Eddy Street, San Francisco, CA", 94109), // Address.
-            OrganizationType.PRIVATE, // Type.
-            new Timestamp(System.currentTimeMillis())); // Last update time.
-
-        // Put created data entry to cache.
-        cache.put(1, org);
-
-        // Get cache that will get values as portable objects.
-        IgniteCache<Integer, PortableObject> portableCache = cache.withKeepPortable();
-
-        // Get recently created organization as a portable object.
-        PortableObject po = portableCache.get(1);
-
-        // Get organization's name from portable object (note that
-        // object doesn't need to be fully deserialized).
-        String name = po.field("name");
-
-        System.out.println();
-        System.out.println(">>> Retrieved organization name from portable object: " + name);
-    }
-
-    /**
-     * Execute bulk {@code putAll(...)} and {@code getAll(...)} operations.
-     *
-     * @param cache Cache.
-     */
-    private static void putGetAll(IgniteCache<Integer, Organization> cache) {
-        // Create new Organization portable objects to store in cache.
-        Organization org1 = new Organization(
-            "Microsoft", // Name.
-            new Address("1096 Eddy Street, San Francisco, CA", 94109), // Address.
-            OrganizationType.PRIVATE, // Type.
-            new Timestamp(System.currentTimeMillis())); // Last update time.
-
-        Organization org2 = new Organization(
-            "Red Cross", // Name.
-            new Address("184 Fidler Drive, San Antonio, TX", 78205), // Address.
-            OrganizationType.NON_PROFIT, // Type.
-            new Timestamp(System.currentTimeMillis())); // Last update time.
-
-        Map<Integer, Organization> map = new HashMap<>();
-
-        map.put(1, org1);
-        map.put(2, org2);
-
-        // Put created data entries to cache.
-        cache.putAll(map);
-
-        // Get recently created organizations as a strongly-typed fully de-serialized instances.
-        Map<Integer, Organization> mapFromCache = cache.getAll(map.keySet());
-
-        System.out.println();
-        System.out.println(">>> Retrieved organization instances from cache:");
-
-        for (Organization org : mapFromCache.values())
-            System.out.println(">>>     " + org);
-    }
-
-    /**
-     * Execute bulk {@code putAll(...)} and {@code getAll(...)} operations,
-     * getting values in portable format, without de-serializing it.
-     *
-     * @param cache Cache.
-     */
-    private static void putGetAllPortable(IgniteCache<Integer, Organization> cache) {
-        // Create new Organization portable objects to store in cache.
-        Organization org1 = new Organization(
-            "Microsoft", // Name.
-            new Address("1096 Eddy Street, San Francisco, CA", 94109), // Address.
-            OrganizationType.PRIVATE, // Type.
-            new Timestamp(System.currentTimeMillis())); // Last update time.
-
-        Organization org2 = new Organization(
-            "Red Cross", // Name.
-            new Address("184 Fidler Drive, San Antonio, TX", 78205), // Address.
-            OrganizationType.NON_PROFIT, // Type.
-            new Timestamp(System.currentTimeMillis())); // Last update time.
-
-        Map<Integer, Organization> map = new HashMap<>();
-
-        map.put(1, org1);
-        map.put(2, org2);
-
-        // Put created data entries to cache.
-        cache.putAll(map);
-
-        // Get cache that will get values as portable objects.
-        IgniteCache<Integer, PortableObject> portableCache = cache.withKeepPortable();
-
-        // Get recently created organizations as portable objects.
-        Map<Integer, PortableObject> poMap = portableCache.getAll(map.keySet());
-
-        Collection<String> names = new ArrayList<>();
-
-        // Get organizations' names from portable objects (note that
-        // objects don't need to be fully deserialized).
-        for (PortableObject po : poMap.values())
-            names.add(po.<String>field("name"));
-
-        System.out.println();
-        System.out.println(">>> Retrieved organization names from portable objects: " + names);
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/b783d2b7/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/CacheClientPortableQueryExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/CacheClientPortableQueryExample.java b/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/CacheClientPortableQueryExample.java
deleted file mode 100644
index 3170864..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/CacheClientPortableQueryExample.java
+++ /dev/null
@@ -1,325 +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.portable.datagrid;
-
-import java.sql.Timestamp;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import javax.cache.Cache;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.Ignition;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.cache.CacheTypeMetadata;
-import org.apache.ignite.cache.query.QueryCursor;
-import org.apache.ignite.cache.query.SqlFieldsQuery;
-import org.apache.ignite.cache.query.SqlQuery;
-import org.apache.ignite.cache.query.TextQuery;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.examples.portable.Address;
-import org.apache.ignite.examples.portable.Employee;
-import org.apache.ignite.examples.portable.EmployeeKey;
-import org.apache.ignite.examples.portable.ExamplePortableNodeStartup;
-import org.apache.ignite.examples.portable.Organization;
-import org.apache.ignite.examples.portable.OrganizationType;
-import org.apache.ignite.portable.PortableObject;
-
-/**
- * This example demonstrates use of portable objects with cache queries.
- * The example populates cache with sample data and runs several SQL and full text queries over this data.
- * <p>
- * Remote nodes should always be started with {@link ExamplePortableNodeStartup} which starts a node with
- * {@code examples/config/portable/example-ignite-portable.xml} configuration.
- */
-public class CacheClientPortableQueryExample {
-    /** Organization cache name. */
-    private static final String ORGANIZATION_CACHE_NAME = CacheClientPortableQueryExample.class.getSimpleName()
-        + "Organizations";
-
-    /** Employee cache name. */
-    private static final String EMPLOYEE_CACHE_NAME = CacheClientPortableQueryExample.class.getSimpleName()
-        + "Employees";
-
-    /**
-     * Executes example.
-     *
-     * @param args Command line arguments, none required.
-     */
-    public static void main(String[] args) {
-        try (Ignite ignite = Ignition.start("examples/config/portable/example-ignite-portable.xml")) {
-            System.out.println();
-            System.out.println(">>> Portable objects cache query example started.");
-
-            CacheConfiguration<Integer, Organization> orgCacheCfg = new CacheConfiguration<>();
-
-            orgCacheCfg.setCacheMode(CacheMode.PARTITIONED);
-            orgCacheCfg.setName(ORGANIZATION_CACHE_NAME);
-
-            orgCacheCfg.setTypeMetadata(Arrays.asList(createOrganizationTypeMetadata()));
-
-            CacheConfiguration<EmployeeKey, Employee> employeeCacheCfg = new CacheConfiguration<>();
-
-            employeeCacheCfg.setCacheMode(CacheMode.PARTITIONED);
-            employeeCacheCfg.setName(EMPLOYEE_CACHE_NAME);
-
-            employeeCacheCfg.setTypeMetadata(Arrays.asList(createEmployeeTypeMetadata()));
-
-            try (IgniteCache<Integer, Organization> orgCache = ignite.createCache(orgCacheCfg);
-                 IgniteCache<EmployeeKey, Employee> employeeCache = ignite.createCache(employeeCacheCfg)
-            ) {
-                if (ignite.cluster().forDataNodes(orgCache.getName()).nodes().isEmpty()) {
-                    System.out.println();
-                    System.out.println(">>> This example requires remote cache nodes to be started.");
-                    System.out.println(">>> Please start at least 1 remote cache node.");
-                    System.out.println(">>> Refer to example's javadoc for details on configuration.");
-                    System.out.println();
-
-                    return;
-                }
-
-                // Populate cache with sample data entries.
-                populateCache(orgCache, employeeCache);
-
-                // Get cache that will work with portable objects.
-                IgniteCache<PortableObject, PortableObject> portableCache = employeeCache.withKeepPortable();
-
-                // Run SQL query example.
-                sqlQuery(portableCache);
-
-                // Run SQL query with join example.
-                sqlJoinQuery(portableCache);
-
-                // Run SQL fields query example.
-                sqlFieldsQuery(portableCache);
-
-                // Run full text query example.
-                textQuery(portableCache);
-
-                System.out.println();
-            }
-            finally {
-                // Delete caches with their content completely.
-                ignite.destroyCache(ORGANIZATION_CACHE_NAME);
-                ignite.destroyCache(EMPLOYEE_CACHE_NAME);
-            }
-        }
-    }
-
-    /**
-     * Create cache type metadata for {@link Employee}.
-     *
-     * @return Cache type metadata.
-     */
-    private static CacheTypeMetadata createEmployeeTypeMetadata() {
-        CacheTypeMetadata employeeTypeMeta = new CacheTypeMetadata();
-
-        employeeTypeMeta.setValueType(Employee.class);
-
-        employeeTypeMeta.setKeyType(EmployeeKey.class);
-
-        Map<String, Class<?>> ascFields = new HashMap<>();
-
-        ascFields.put("name", String.class);
-        ascFields.put("salary", Long.class);
-        ascFields.put("address.zip", Integer.class);
-        ascFields.put("organizationId", Integer.class);
-
-        employeeTypeMeta.setAscendingFields(ascFields);
-
-        employeeTypeMeta.setTextFields(Arrays.asList("address.street"));
-
-        return employeeTypeMeta;
-    }
-
-    /**
-     * Create cache type metadata for {@link Organization}.
-     *
-     * @return Cache type metadata.
-     */
-    private static CacheTypeMetadata createOrganizationTypeMetadata() {
-        CacheTypeMetadata organizationTypeMeta = new CacheTypeMetadata();
-
-        organizationTypeMeta.setValueType(Organization.class);
-
-        organizationTypeMeta.setKeyType(Integer.class);
-
-        Map<String, Class<?>> ascFields = new HashMap<>();
-
-        ascFields.put("name", String.class);
-
-        Map<String, Class<?>> queryFields = new HashMap<>();
-
-        queryFields.put("address.street", String.class);
-
-        organizationTypeMeta.setAscendingFields(ascFields);
-
-        organizationTypeMeta.setQueryFields(queryFields);
-
-        return organizationTypeMeta;
-    }
-
-    /**
-     * Queries employees that have provided ZIP code in address.
-     *
-     * @param cache Ignite cache.
-     */
-    private static void sqlQuery(IgniteCache<PortableObject, PortableObject> cache) {
-        SqlQuery<PortableObject, PortableObject> query = new SqlQuery<>(Employee.class, "zip = ?");
-
-        int zip = 94109;
-
-        QueryCursor<Cache.Entry<PortableObject, PortableObject>> employees = cache.query(query.setArgs(zip));
-
-        System.out.println();
-        System.out.println(">>> Employees with zip " + zip + ':');
-
-        for (Cache.Entry<PortableObject, PortableObject> e : employees.getAll())
-            System.out.println(">>>     " + e.getValue().deserialize());
-    }
-
-    /**
-     * Queries employees that work for organization with provided name.
-     *
-     * @param cache Ignite cache.
-     */
-    private static void sqlJoinQuery(IgniteCache<PortableObject, PortableObject> cache) {
-        SqlQuery<PortableObject, PortableObject> query = new SqlQuery<>(Employee.class,
-            "from Employee, \"" + ORGANIZATION_CACHE_NAME + "\".Organization as org " +
-                "where Employee.organizationId = org._key and org.name = ?");
-
-        String organizationName = "GridGain";
-
-        QueryCursor<Cache.Entry<PortableObject, PortableObject>> employees =
-            cache.query(query.setArgs(organizationName));
-
-        System.out.println();
-        System.out.println(">>> Employees working for " + organizationName + ':');
-
-        for (Cache.Entry<PortableObject, PortableObject> e : employees.getAll())
-            System.out.println(">>>     " + e.getValue());
-    }
-
-    /**
-     * Queries names and salaries for all employees.
-     *
-     * @param cache Ignite cache.
-     */
-    private static void sqlFieldsQuery(IgniteCache<PortableObject, PortableObject> cache) {
-        SqlFieldsQuery query = new SqlFieldsQuery("select name, salary from Employee");
-
-        QueryCursor<List<?>> employees = cache.query(query);
-
-        System.out.println();
-        System.out.println(">>> Employee names and their salaries:");
-
-        for (List<?> row : employees.getAll())
-            System.out.println(">>>     [Name=" + row.get(0) + ", salary=" + row.get(1) + ']');
-    }
-
-    /**
-     * Queries employees that live in Texas using full-text query API.
-     *
-     * @param cache Ignite cache.
-     */
-    private static void textQuery(IgniteCache<PortableObject, PortableObject> cache) {
-        TextQuery<PortableObject, PortableObject> query = new TextQuery<>(Employee.class, "TX");
-
-        QueryCursor<Cache.Entry<PortableObject, PortableObject>> employees = cache.query(query);
-
-        System.out.println();
-        System.out.println(">>> Employees living in Texas:");
-
-        for (Cache.Entry<PortableObject, PortableObject> e : employees.getAll())
-            System.out.println(">>>     " + e.getValue().deserialize());
-    }
-
-    /**
-     * Populates cache with data.
-     *
-     * @param orgCache Organization cache.
-     * @param employeeCache Employee cache.
-     */
-    private static void populateCache(IgniteCache<Integer, Organization> orgCache,
-        IgniteCache<EmployeeKey, Employee> employeeCache) {
-        orgCache.put(1, new Organization(
-            "GridGain",
-            new Address("1065 East Hillsdale Blvd, Foster City, CA", 94404),
-            OrganizationType.PRIVATE,
-            new Timestamp(System.currentTimeMillis())
-        ));
-
-        orgCache.put(2, new Organization(
-            "Microsoft",
-            new Address("1096 Eddy Street, San Francisco, CA", 94109),
-            OrganizationType.PRIVATE,
-            new Timestamp(System.currentTimeMillis())
-        ));
-
-        employeeCache.put(new EmployeeKey(1, 1), new Employee(
-            "James Wilson",
-            12500,
-            new Address("1096 Eddy Street, San Francisco, CA", 94109),
-            Arrays.asList("Human Resources", "Customer Service")
-        ));
-
-        employeeCache.put(new EmployeeKey(2, 1), new Employee(
-            "Daniel Adams",
-            11000,
-            new Address("184 Fidler Drive, San Antonio, TX", 78130),
-            Arrays.asList("Development", "QA")
-        ));
-
-        employeeCache.put(new EmployeeKey(3, 1), new Employee(
-            "Cristian Moss",
-            12500,
-            new Address("667 Jerry Dove Drive, Florence, SC", 29501),
-            Arrays.asList("Logistics")
-        ));
-
-        employeeCache.put(new EmployeeKey(4, 2), new Employee(
-            "Allison Mathis",
-            25300,
-            new Address("2702 Freedom Lane, San Francisco, CA", 94109),
-            Arrays.asList("Development")
-        ));
-
-        employeeCache.put(new EmployeeKey(5, 2), new Employee(
-            "Breana Robbin",
-            6500,
-            new Address("3960 Sundown Lane, Austin, TX", 78130),
-            Arrays.asList("Sales")
-        ));
-
-        employeeCache.put(new EmployeeKey(6, 2), new Employee(
-            "Philip Horsley",
-            19800,
-            new Address("2803 Elsie Drive, Sioux Falls, SD", 57104),
-            Arrays.asList("Sales")
-        ));
-
-        employeeCache.put(new EmployeeKey(7, 2), new Employee(
-            "Brian Peters",
-            10600,
-            new Address("1407 Pearlman Avenue, Boston, MA", 12110),
-            Arrays.asList("Development", "QA")
-        ));
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/ignite/blob/b783d2b7/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/package-info.java b/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/package-info.java
deleted file mode 100644
index b24f233..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/package-info.java
+++ /dev/null
@@ -1,21 +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 the usage of portable objects with cache.
- */
-package org.apache.ignite.examples.portable.datagrid;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/b783d2b7/examples/src/main/java/org/apache/ignite/examples/portable/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/package-info.java b/examples/src/main/java/org/apache/ignite/examples/portable/package-info.java
deleted file mode 100644
index 4301027..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/package-info.java
+++ /dev/null
@@ -1,21 +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.
- */
-
-/**
- * Contains portable classes and examples.
- */
-package org.apache.ignite.examples.portable;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/b783d2b7/examples/src/test/java/org/apache/ignite/examples/CacheClientPortableExampleTest.java
----------------------------------------------------------------------
diff --git a/examples/src/test/java/org/apache/ignite/examples/CacheClientPortableExampleTest.java b/examples/src/test/java/org/apache/ignite/examples/CacheClientPortableExampleTest.java
index 6ea1484..22261e2 100644
--- a/examples/src/test/java/org/apache/ignite/examples/CacheClientPortableExampleTest.java
+++ b/examples/src/test/java/org/apache/ignite/examples/CacheClientPortableExampleTest.java
@@ -17,8 +17,8 @@
 
 package org.apache.ignite.examples;
 
-import org.apache.ignite.examples.portable.datagrid.CacheClientPortablePutGetExample;
-import org.apache.ignite.examples.portable.datagrid.CacheClientPortableQueryExample;
+import org.apache.ignite.examples.binary.datagrid.CacheClientBinaryPutGetExample;
+import org.apache.ignite.examples.binary.datagrid.CacheClientBinaryQueryExample;
 import org.apache.ignite.testframework.junits.common.GridAbstractExamplesTest;
 
 /**
@@ -34,13 +34,13 @@ public class CacheClientPortableExampleTest extends GridAbstractExamplesTest {
      * @throws Exception If failed.
      */
     public void testPortablePutGetExample() throws Exception {
-        CacheClientPortablePutGetExample.main(new String[] {});
+        CacheClientBinaryPutGetExample.main(new String[] {});
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testPortableQueryExample() throws Exception {
-        CacheClientPortableQueryExample.main(new String[] {});
+        CacheClientBinaryQueryExample.main(new String[] {});
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/b783d2b7/examples/src/test/java/org/apache/ignite/examples/ComputeClientPortableExampleTest.java
----------------------------------------------------------------------
diff --git a/examples/src/test/java/org/apache/ignite/examples/ComputeClientPortableExampleTest.java b/examples/src/test/java/org/apache/ignite/examples/ComputeClientPortableExampleTest.java
index 2223aec..44d8776 100644
--- a/examples/src/test/java/org/apache/ignite/examples/ComputeClientPortableExampleTest.java
+++ b/examples/src/test/java/org/apache/ignite/examples/ComputeClientPortableExampleTest.java
@@ -16,7 +16,7 @@
  */
 package org.apache.ignite.examples;
 
-import org.apache.ignite.examples.portable.computegrid.ComputeClientPortableTaskExecutionExample;
+import org.apache.ignite.examples.binary.computegrid.ComputeClientBinaryTaskExecutionExample;
 import org.apache.ignite.testframework.junits.common.GridAbstractExamplesTest;
 
 /**
@@ -32,6 +32,6 @@ public class ComputeClientPortableExampleTest extends GridAbstractExamplesTest {
      * @throws Exception If failed.
      */
     public void testPortableTaskExecutionExample() throws Exception {
-        ComputeClientPortableTaskExecutionExample.main(new String[] {});
+        ComputeClientBinaryTaskExecutionExample.main(new String[] {});
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/b783d2b7/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java
----------------------------------------------------------------------
diff --git a/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java b/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java
index 8d9a3f5..b8ccc03 100644
--- a/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java
+++ b/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java
@@ -43,6 +43,7 @@ import org.apache.ignite.internal.GridDirectCollection;
 import org.apache.ignite.internal.GridDirectMap;
 import org.apache.ignite.internal.GridDirectTransient;
 import org.apache.ignite.internal.IgniteCodeGeneratingFail;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
 import org.apache.ignite.internal.util.typedef.internal.SB;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteUuid;
@@ -165,7 +166,9 @@ public class MessageCodeGenerator {
 
         MessageCodeGenerator gen = new MessageCodeGenerator(srcDir);
 
-        gen.generateAll(true);
+//        gen.generateAll(true);
+
+        gen.generateAndWrite(GridNearAtomicUpdateRequest.class);
 
 //        gen.generateAndWrite(DataStreamerEntry.class);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/b783d2b7/modules/core/src/main/java/org/apache/ignite/Ignite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/Ignite.java b/modules/core/src/main/java/org/apache/ignite/Ignite.java
index f2c180b..d320744 100644
--- a/modules/core/src/main/java/org/apache/ignite/Ignite.java
+++ b/modules/core/src/main/java/org/apache/ignite/Ignite.java
@@ -469,11 +469,11 @@ public interface Ignite extends AutoCloseable {
     public <T extends IgnitePlugin> T plugin(String name) throws PluginNotFoundException;
 
     /**
-     * Gets an instance of {@link IgnitePortables} interface.
+     * Gets an instance of {@link IgniteBinary} interface.
      *
-     * @return Instance of {@link IgnitePortables} interface.
+     * @return Instance of {@link IgniteBinary} interface.
      */
-    public IgnitePortables portables();
+    public IgniteBinary binary();
 
     /**
      * Closes {@code this} instance of grid. This method is identical to calling

http://git-wip-us.apache.org/repos/asf/ignite/blob/b783d2b7/modules/core/src/main/java/org/apache/ignite/IgniteBinary.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteBinary.java b/modules/core/src/main/java/org/apache/ignite/IgniteBinary.java
new file mode 100644
index 0000000..71be821
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteBinary.java
@@ -0,0 +1,366 @@
+/*
+ * 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;
+
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.TreeMap;
+import java.util.UUID;
+import org.apache.ignite.marshaller.portable.PortableMarshaller;
+import org.apache.ignite.binary.BinaryObjectBuilder;
+import org.apache.ignite.binary.BinaryObjectException;
+import org.apache.ignite.binary.BinaryType;
+import org.apache.ignite.binary.BinaryObject;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Defines portable objects functionality. With portable objects you are able to:
+ * <ul>
+ * <li>Seamlessly interoperate between Java, .NET, and C++.</li>
+ * <li>Make any object portable with zero code change to your existing code.</li>
+ * <li>Nest portable objects within each other.</li>
+ * <li>Automatically handle {@code circular} or {@code null} references.</li>
+ * <li>Automatically convert collections and maps between Java, .NET, and C++.</li>
+ * <li>
+ *      Optionally avoid deserialization of objects on the server side
+ *      (objects are stored in {@link org.apache.ignite.binary.BinaryObject} format).
+ * </li>
+ * <li>Avoid need to have concrete class definitions on the server side.</li>
+ * <li>Dynamically change structure of the classes without having to restart the cluster.</li>
+ * <li>Index into portable objects for querying purposes.</li>
+ * </ul>
+ * <h1 class="header">Working With Portables Directly</h1>
+ * Once an object is defined as portable,
+ * Ignite will always store it in memory in the portable (i.e. binary) format.
+ * User can choose to work either with the portable format or with the deserialized form
+ * (assuming that class definitions are present in the classpath).
+ * <p>
+ * To work with the portable format directly, user should create a special cache projection
+ * using IgniteCache.withKeepBinary() method and then retrieve individual fields as needed:
+ * <pre name=code class=java>
+ * IgniteCache&lt;PortableObject, PortableObject&gt; prj = cache.withKeepBinary();
+ *
+ * // Convert instance of MyKey to portable format.
+ * // We could also use PortableBuilder to create the key in portable format directly.
+ * PortableObject key = grid.binary().toBinary(new MyKey());
+ *
+ * PortableObject val = prj.get(key);
+ *
+ * String field = val.field("myFieldName");
+ * </pre>
+ * Alternatively, if we have class definitions in the classpath, we may choose to work with deserialized
+ * typed objects at all times. In this case we do incur the deserialization cost. However, if
+ * {@link PortableMarshaller#isKeepDeserialized()} is {@code true} then Ignite will only deserialize on the first access
+ * and will cache the deserialized object, so it does not have to be deserialized again:
+ * <pre name=code class=java>
+ * IgniteCache&lt;MyKey.class, MyValue.class&gt; cache = grid.cache(null);
+ *
+ * MyValue val = cache.get(new MyKey());
+ *
+ * // Normal java getter.
+ * String fieldVal = val.getMyFieldName();
+ * </pre>
+ * If we used, for example, one of the automatically handled portable types for a key, like integer,
+ * and still wanted to work with binary portable format for values, then we would declare cache projection
+ * as follows:
+ * <pre name=code class=java>
+ * IgniteCache&lt;Integer.class, PortableObject&gt; prj = cache.withKeepBinary();
+ * </pre>
+ * <h1 class="header">Automatic Portable Types</h1>
+ * Note that only portable classes are converted to {@link org.apache.ignite.binary.BinaryObject} format. Following
+ * classes are never converted (e.g., {@link #toBinary(Object)} method will return original
+ * object, and instances of these classes will be stored in cache without changes):
+ * <ul>
+ *     <li>All primitives (byte, int, ...) and there boxed versions (Byte, Integer, ...)</li>
+ *     <li>Arrays of primitives (byte[], int[], ...)</li>
+ *     <li>{@link String} and array of {@link String}s</li>
+ *     <li>{@link UUID} and array of {@link UUID}s</li>
+ *     <li>{@link Date} and array of {@link Date}s</li>
+ *     <li>{@link Timestamp} and array of {@link Timestamp}s</li>
+ *     <li>Enums and array of enums</li>
+ *     <li>
+ *         Maps, collections and array of objects (but objects inside
+ *         them will still be converted if they are portable)
+ *     </li>
+ * </ul>
+ * <h1 class="header">Working With Maps and Collections</h1>
+ * All maps and collections in the portable objects are serialized automatically. When working
+ * with different platforms, e.g. C++ or .NET, Ignite will automatically pick the most
+ * adequate collection or map in either language. For example, {@link ArrayList} in Java will become
+ * {@code List} in C#, {@link LinkedList} in Java is {@link LinkedList} in C#, {@link HashMap}
+ * in Java is {@code Dictionary} in C#, and {@link TreeMap} in Java becomes {@code SortedDictionary}
+ * in C#, etc.
+ * <h1 class="header">Building Portable Objects</h1>
+ * Ignite comes with {@link org.apache.ignite.binary.BinaryObjectBuilder} which allows to build portable objects dynamically:
+ * <pre name=code class=java>
+ * PortableBuilder builder = Ignition.ignite().binary().builder();
+ *
+ * builder.typeId("MyObject");
+ *
+ * builder.stringField("fieldA", "A");
+ * build.intField("fieldB", "B");
+ *
+ * PortableObject portableObj = builder.build();
+ * </pre>
+ * For the cases when class definition is present
+ * in the class path, it is also possible to populate a standard POJO and then
+ * convert it to portable format, like so:
+ * <pre name=code class=java>
+ * MyObject obj = new MyObject();
+ *
+ * obj.setFieldA("A");
+ * obj.setFieldB(123);
+ *
+ * PortableObject portableObj = Ignition.ignite().binary().toBinary(obj);
+ * </pre>
+ * NOTE: you don't need to convert typed objects to portable format before storing
+ * them in cache, Ignite will do that automatically.
+ * <h1 class="header">Portable Metadata</h1>
+ * Even though Ignite portable protocol only works with hash codes for type and field names
+ * to achieve better performance, Ignite provides metadata for all portable types which
+ * can be queried ar runtime via any of the {@link IgniteBinary#metadata(Class)}
+ * methods. Having metadata also allows for proper formatting of {@code PortableObject#toString()} method,
+ * even when portable objects are kept in binary format only, which may be necessary for audit reasons.
+ * <h1 class="header">Dynamic Structure Changes</h1>
+ * Since objects are always cached in the portable binary format, server does not need to
+ * be aware of the class definitions. Moreover, if class definitions are not present or not
+ * used on the server, then clients can continuously change the structure of the portable
+ * objects without having to restart the cluster. For example, if one client stores a
+ * certain class with fields A and B, and another client stores the same class with
+ * fields B and C, then the server-side portable object will have the fields A, B, and C.
+ * As the structure of a portable object changes, the new fields become available for SQL queries
+ * automatically.
+ * <h1 class="header">Configuration</h1>
+ * By default all your objects are considered as binary and no specific configuration is needed.
+ * However, in some cases, like when an object is used by both Java and .Net, you may need to specify portable objects
+ * explicitly by calling {@link PortableMarshaller#setClassNames(Collection)}.
+ * The only requirement Ignite imposes is that your object has an empty
+ * constructor. Note, that since server side does not have to know the class definition,
+ * you only need to list portable objects in configuration on the client side. However, if you
+ * list them on the server side as well, then you get the ability to deserialize portable objects
+ * into concrete types on the server as well as on the client.
+ * <p>
+ * Here is an example of portable configuration (note that star (*) notation is supported):
+ * <pre name=code class=xml>
+ * ...
+ * &lt;!-- Explicit portable objects configuration. --&gt;
+ * &lt;property name="marshaller"&gt;
+ *     &lt;bean class="org.apache.ignite.marshaller.portable.PortableMarshaller"&gt;
+ *         &lt;property name="classNames"&gt;
+ *             &lt;list&gt;
+ *                 &lt;value&gt;my.package.for.portable.objects.*&lt;/value&gt;
+ *                 &lt;value&gt;org.apache.ignite.examples.client.portable.Employee&lt;/value&gt;
+ *             &lt;/list&gt;
+ *         &lt;/property&gt;
+ *     &lt;/bean&gt;
+ * &lt;/property&gt;
+ * ...
+ * </pre>
+ * or from code:
+ * <pre name=code class=java>
+ * IgniteConfiguration cfg = new IgniteConfiguration();
+ *
+ * PortableMarshaller marsh = new PortableMarshaller();
+ *
+ * marsh.setClassNames(Arrays.asList(
+ *     Employee.class.getName(),
+ *     Address.class.getName())
+ * );
+ *
+ * cfg.setMarshaller(marsh);
+ * </pre>
+ * You can also specify class name for a portable object via {@link org.apache.ignite.binary.BinaryTypeConfiguration}.
+ * Do it in case if you need to override other configuration properties on per-type level, like
+ * ID-mapper, or serializer.
+ * <h1 class="header">Custom Affinity Keys</h1>
+ * Often you need to specify an alternate key (not the cache key) for affinity routing whenever
+ * storing objects in cache. For example, if you are caching {@code Employee} object with
+ * {@code Organization}, and want to colocate employees with organization they work for,
+ * so you can process them together, you need to specify an alternate affinity key.
+ * With portable objects you would have to do it as following:
+ * <pre name=code class=xml>
+ * &lt;property name="marshaller"&gt;
+ *     &lt;bean class="org.gridgain.grid.marshaller.portable.PortableMarshaller"&gt;
+ *         ...
+ *         &lt;property name="typeConfigurations"&gt;
+ *             &lt;list&gt;
+ *                 &lt;bean class="org.apache.ignite.portable.PortableTypeConfiguration"&gt;
+ *                     &lt;property name="className" value="org.apache.ignite.examples.client.portable.EmployeeKey"/&gt;
+ *                     &lt;property name="affinityKeyFieldName" value="organizationId"/&gt;
+ *                 &lt;/bean&gt;
+ *             &lt;/list&gt;
+ *         &lt;/property&gt;
+ *         ...
+ *     &lt;/bean&gt;
+ * &lt;/property&gt;
+ * </pre>
+ * <h1 class="header">Serialization</h1>
+ * Serialization and deserialization works out-of-the-box in Ignite. However, you can provide your own custom
+ * serialization logic by optionally implementing {@link org.apache.ignite.binary.Binarylizable} interface, like so:
+ * <pre name=code class=java>
+ * public class Address implements PortableMarshalAware {
+ *     private String street;
+ *     private int zip;
+ *
+ *     // Empty constructor required for portable deserialization.
+ *     public Address() {}
+ *
+ *     &#64;Override public void writeBinary(PortableWriter writer) throws PortableException {
+ *         writer.writeString("street", street);
+ *         writer.writeInt("zip", zip);
+ *     }
+ *
+ *     &#64;Override public void readBinary(PortableReader reader) throws PortableException {
+ *         street = reader.readString("street");
+ *         zip = reader.readInt("zip");
+ *     }
+ * }
+ * </pre>
+ * Alternatively, if you cannot change class definitions, you can provide custom serialization
+ * logic in {@link org.apache.ignite.binary.BinarySerializer} either globally in {@link PortableMarshaller} or
+ * for a specific type via {@link org.apache.ignite.binary.BinaryTypeConfiguration} instance.
+ * <p>
+ * Similar to java serialization you can use {@code writeReplace()} and {@code readResolve()} methods.
+ * <ul>
+ *     <li>
+ *         {@code readResolve} is defined as follows: {@code ANY-ACCESS-MODIFIER Object readResolve()}.
+ *         It may be used to replace the de-serialized object by another one of your choice.
+ *     </li>
+ *     <li>
+ *          {@code writeReplace} is defined as follows: {@code ANY-ACCESS-MODIFIER Object writeReplace()}. This method
+ *          allows the developer to provide a replacement object that will be serialized instead of the original one.
+ *     </li>
+ * </ul>
+ *
+ * <h1 class="header">Custom ID Mappers</h1>
+ * Ignite implementation uses name hash codes to generate IDs for class names or field names
+ * internally. However, in cases when you want to provide your own ID mapping schema,
+ * you can provide your own {@link org.apache.ignite.binary.BinaryTypeIdMapper} implementation.
+ * <p>
+ * ID-mapper may be provided either globally in {@link PortableMarshaller},
+ * or for a specific type via {@link org.apache.ignite.binary.BinaryTypeConfiguration} instance.
+ * <h1 class="header">Query Indexing</h1>
+ * Portable objects can be indexed for querying by specifying index fields in
+ * {@link org.apache.ignite.cache.CacheTypeMetadata} inside of specific
+ * {@link org.apache.ignite.configuration.CacheConfiguration} instance,
+ * like so:
+ * <pre name=code class=xml>
+ * ...
+ * &lt;bean class="org.apache.ignite.cache.CacheConfiguration"&gt;
+ *     ...
+ *     &lt;property name="typeMetadata"&gt;
+ *         &lt;list&gt;
+ *             &lt;bean class="CacheTypeMetadata"&gt;
+ *                 &lt;property name="type" value="Employee"/&gt;
+ *
+ *                 &lt;!-- Fields to index in ascending order. --&gt;
+ *                 &lt;property name="ascendingFields"&gt;
+ *                     &lt;map&gt;
+ *                     &lt;entry key="name" value="java.lang.String"/&gt;
+ *
+ *                         &lt;!-- Nested portable objects can also be indexed. --&gt;
+ *                         &lt;entry key="address.zip" value="java.lang.Integer"/&gt;
+ *                     &lt;/map&gt;
+ *                 &lt;/property&gt;
+ *             &lt;/bean&gt;
+ *         &lt;/list&gt;
+ *     &lt;/property&gt;
+ * &lt;/bean&gt;
+ * </pre>
+ */
+public interface IgniteBinary {
+    /**
+     * Gets type ID for given type name.
+     *
+     * @param typeName Type name.
+     * @return Type ID.
+     */
+    public int typeId(String typeName);
+
+    /**
+     * Converts provided object to instance of {@link org.apache.ignite.binary.BinaryObject}.
+     *
+     * @param obj Object to convert.
+     * @return Converted object.
+     * @throws org.apache.ignite.binary.BinaryObjectException In case of error.
+     */
+    public <T> T toBinary(@Nullable Object obj) throws BinaryObjectException;
+
+    /**
+     * Creates new portable builder.
+     *
+     * @param typeId ID of the type.
+     * @return Newly portable builder.
+     */
+    public BinaryObjectBuilder builder(int typeId) throws BinaryObjectException;
+
+    /**
+     * Creates new portable builder.
+     *
+     * @param typeName Type name.
+     * @return Newly portable builder.
+     */
+    public BinaryObjectBuilder builder(String typeName) throws BinaryObjectException;
+
+    /**
+     * Creates portable builder initialized by existing portable object.
+     *
+     * @param portableObj Portable object to initialize builder.
+     * @return Portable builder.
+     */
+    public BinaryObjectBuilder builder(BinaryObject portableObj) throws BinaryObjectException;
+
+    /**
+     * Gets metadata for provided class.
+     *
+     * @param cls Class.
+     * @return Metadata.
+     * @throws org.apache.ignite.binary.BinaryObjectException In case of error.
+     */
+    public BinaryType metadata(Class<?> cls) throws BinaryObjectException;
+
+    /**
+     * Gets metadata for provided class name.
+     *
+     * @param typeName Type name.
+     * @return Metadata.
+     * @throws org.apache.ignite.binary.BinaryObjectException In case of error.
+     */
+    public BinaryType metadata(String typeName) throws BinaryObjectException;
+
+    /**
+     * Gets metadata for provided type ID.
+     *
+     * @param typeId Type ID.
+     * @return Metadata.
+     * @throws org.apache.ignite.binary.BinaryObjectException In case of error.
+     */
+    public BinaryType metadata(int typeId) throws BinaryObjectException;
+
+    /**
+     * Gets metadata for all known types.
+     *
+     * @return Metadata.
+     * @throws org.apache.ignite.binary.BinaryObjectException In case of error.
+     */
+    public Collection<BinaryType> metadata() throws BinaryObjectException;
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/b783d2b7/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
index e0f9f55..099a3f4 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
@@ -132,9 +132,9 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
     public IgniteCache<K, V> withNoRetries();
 
     /**
-     * Returns cache that will operate with portable objects.
+     * Returns cache that will operate with binary objects.
      * <p>
-     * Cache returned by this method will not be forced to deserialize portable objects,
+     * Cache returned by this method will not be forced to deserialize binary objects,
      * so keys and values will be returned from cache API methods without changes. Therefore,
      * signature of the cache can contain only following types:
      * <ul>
@@ -153,21 +153,21 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
      * </ul>
      * <p>
      * For example, if you use {@link Integer} as a key and {@code Value} class as a value
-     * (which will be stored in portable format), you should acquire following projection
+     * (which will be stored in binary format), you should acquire following projection
      * to avoid deserialization:
      * <pre>
-     * IgniteCache<Integer, PortableObject> prj = cache.withKeepPortable();
+     * IgniteCache<Integer, BinaryObject> prj = cache.withKeepBinary();
      *
      * // Value is not deserialized and returned in portable format.
-     * PortableObject po = prj.get(1);
+     * BinaryObject po = prj.get(1);
      * </pre>
      * <p>
-     * Note that this method makes sense only if cache is working in portable mode ({@link PortableMarshaller} is used).
+     * Note that this method makes sense only if cache is working in binary mode ({@link PortableMarshaller} is used).
      * If not, this method is no-op and will return current cache.
      *
      * @return New cache instance for portable objects.
      */
-    public <K1, V1> IgniteCache<K1, V1> withKeepPortable();
+    public <K1, V1> IgniteCache<K1, V1> withKeepBinary();
 
     /**
      * Executes {@link #localLoadCache(IgniteBiPredicate, Object...)} on all cache nodes.

http://git-wip-us.apache.org/repos/asf/ignite/blob/b783d2b7/modules/core/src/main/java/org/apache/ignite/IgniteDataStreamer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteDataStreamer.java b/modules/core/src/main/java/org/apache/ignite/IgniteDataStreamer.java
index 79bd163..20d0057 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteDataStreamer.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteDataStreamer.java
@@ -146,6 +146,22 @@ public interface IgniteDataStreamer<K, V> extends AutoCloseable {
     public void skipStore(boolean skipStore);
 
     /**
+     * Gets flag indicating that objects should be kept in binary format when passed to the stream receiver.
+     * Default is {@code false}.
+     *
+     * @return Skip store flag.
+     */
+    public boolean keepBinary();
+
+    /**
+     * Sets flag indicating that objects should be kept in binary format when passes to the steam receiver.
+     * Default is {@code false}.
+     *
+     * @param keepBinary Keep binary flag.
+     */
+    public void keepBinary(boolean keepBinary);
+
+    /**
      * Gets size of per node key-value pairs buffer.
      *
      * @return Per node buffer size.


Mime
View raw message