ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [09/16] ignite git commit: IGNITE-950 - Renaming examples.
Date Wed, 04 Nov 2015 10:28:12 GMT
http://git-wip-us.apache.org/repos/asf/ignite/blob/9fae3cd8/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/9fae3cd8/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 0adb5b7..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.binary.BinaryObject;
-
-/**
- * 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, BinaryObject> portableCache = cache.withKeepBinary();
-
-        // Get recently created organization as a portable object.
-        BinaryObject 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, BinaryObject> portableCache = cache.withKeepBinary();
-
-        // Get recently created organizations as portable objects.
-        Map<Integer, BinaryObject> 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 (BinaryObject 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/9fae3cd8/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 0975c29..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.binary.BinaryObject;
-
-/**
- * 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<BinaryObject, BinaryObject> portableCache = employeeCache.withKeepBinary();
-
-                // 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<BinaryObject, BinaryObject> cache) {
-        SqlQuery<BinaryObject, BinaryObject> query = new SqlQuery<>(Employee.class,
"zip = ?");
-
-        int zip = 94109;
-
-        QueryCursor<Cache.Entry<BinaryObject, BinaryObject>> employees = cache.query(query.setArgs(zip));
-
-        System.out.println();
-        System.out.println(">>> Employees with zip " + zip + ':');
-
-        for (Cache.Entry<BinaryObject, BinaryObject> 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<BinaryObject, BinaryObject> cache)
{
-        SqlQuery<BinaryObject, BinaryObject> 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<BinaryObject, BinaryObject>> employees =
-            cache.query(query.setArgs(organizationName));
-
-        System.out.println();
-        System.out.println(">>> Employees working for " + organizationName + ':');
-
-        for (Cache.Entry<BinaryObject, BinaryObject> e : employees.getAll())
-            System.out.println(">>>     " + e.getValue());
-    }
-
-    /**
-     * Queries names and salaries for all employees.
-     *
-     * @param cache Ignite cache.
-     */
-    private static void sqlFieldsQuery(IgniteCache<BinaryObject, BinaryObject> 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<BinaryObject, BinaryObject> cache) {
-        TextQuery<BinaryObject, BinaryObject> query = new TextQuery<>(Employee.class,
"TX");
-
-        QueryCursor<Cache.Entry<BinaryObject, BinaryObject>> employees = cache.query(query);
-
-        System.out.println();
-        System.out.println(">>> Employees living in Texas:");
-
-        for (Cache.Entry<BinaryObject, BinaryObject> 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/9fae3cd8/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/9fae3cd8/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/9fae3cd8/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/9fae3cd8/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/9fae3cd8/modules/core/src/main/java/org/apache/ignite/cache/QueryIndex.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/QueryIndex.java b/modules/core/src/main/java/org/apache/ignite/cache/QueryIndex.java
index 4868e9e..f12044d 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/QueryIndex.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/QueryIndex.java
@@ -48,6 +48,25 @@ public class QueryIndex implements Serializable {
     }
 
     /**
+     * Creates single-field sorted ascending index.
+     *
+     * @param name Field name.
+     */
+    public QueryIndex(String name) {
+        this(name, QueryIndexType.SORTED, true);
+    }
+
+    /**
+     * Creates single-field sorted index.
+     *
+     * @param name Field name.
+     * @param asc Ascending flag.
+     */
+    public QueryIndex(String name, boolean asc) {
+        this(name, QueryIndexType.SORTED, asc);
+    }
+
+    /**
      * Creates index for one field.
      * If index is sorted, then ascending sorting is used by default.
      * To specify sort order, use the next method.

http://git-wip-us.apache.org/repos/asf/ignite/blob/9fae3cd8/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/datastreaming/DataStreamProcessorPortableSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/datastreaming/DataStreamProcessorPortableSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/datastreaming/DataStreamProcessorPortableSelfTest.java
index 68538d9..58adfe3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/datastreaming/DataStreamProcessorPortableSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/datastreaming/DataStreamProcessorPortableSelfTest.java
@@ -17,9 +17,14 @@
 
 package org.apache.ignite.internal.processors.cache.portable.datastreaming;
 
+import java.util.Collection;
+import java.util.Map;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.binary.BinaryObject;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.processors.datastreamer.DataStreamProcessorSelfTest;
 import org.apache.ignite.marshaller.portable.PortableMarshaller;
+import org.apache.ignite.stream.StreamReceiver;
 
 /**
  *
@@ -35,4 +40,32 @@ public class DataStreamProcessorPortableSelfTest extends DataStreamProcessorSelf
 
         return cfg;
     }
+
+    /** {@inheritDoc} */
+    @Override protected StreamReceiver<String, TestObject> getStreamReceiver() {
+        return new TestDataReceiver();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected boolean customKeepBinary() {
+        return true;
+    }
+
+    /**
+     *
+     */
+    private static class TestDataReceiver implements StreamReceiver<String, TestObject>
{
+        /** {@inheritDoc} */
+        @Override public void receive(IgniteCache<String, TestObject> cache,
+            Collection<Map.Entry<String, TestObject>> entries) {
+            for (Map.Entry<String, TestObject> e : entries) {
+                assertTrue(e.getKey() instanceof String);
+                assertTrue(String.valueOf(e.getValue()), e.getValue() instanceof BinaryObject);
+
+                TestObject obj = ((BinaryObject)e.getValue()).deserialize();
+
+                cache.put(e.getKey(), new TestObject(obj.val + 1));
+            }
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/9fae3cd8/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorSelfTest.java
index b6b3d70..65dd690 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorSelfTest.java
@@ -149,6 +149,13 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest
{
     }
 
     /**
+     * @return {@code True} if custom stream receiver should use keepBinary flag.
+     */
+    protected boolean customKeepBinary() {
+        return false;
+    }
+
+    /**
      * @throws Exception If failed.
      */
     public void testPartitioned() throws Exception {
@@ -914,6 +921,7 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest
{
 
             try (IgniteDataStreamer<String, TestObject> ldr = ignite.dataStreamer(null))
{
                 ldr.allowOverwrite(true);
+                ldr.keepBinary(customKeepBinary());
 
                 ldr.receiver(getStreamReceiver());
 


Mime
View raw message