IGNITE-45 - Examples

Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/8568c703
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/8568c703
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/8568c703

Branch: refs/heads/ignite-45
Commit: 8568c703c7371074a74d5776ccbcc1c1157b6c6a
Parents: 364a723
Author: Valentin Kulichenko <vkuliche...@gridgain.com>
Authored: Sun Mar 22 16:36:22 2015 -0700
Committer: Valentin Kulichenko <vkuliche...@gridgain.com>
Committed: Sun Mar 22 16:36:22 2015 -0700

----------------------------------------------------------------------
 .../store/CacheNodeWithStoreStartup.java        | 155 -------------------
 .../datagrid/store/CacheStoreExample.java       |  75 ++++-----
 .../CacheStoreExampleCacheConfigurator.java     | 125 +++++++++++++++
 .../store/CacheStoreLoadDataExample.java        |  28 ++--
 .../ignite/examples/datagrid/store/Person.java  | 155 +++++++++++++++++++
 .../store/dummy/CacheDummyPersonStore.java      |   2 +-
 .../hibernate/CacheHibernatePersonStore.java    |   2 +-
 .../datagrid/store/hibernate/Person.hbm.xml     |   2 +-
 .../store/jdbc/CacheJdbcPersonStore.java        |   2 +-
 .../store/jdbc/CacheJdbcPojoPersonStore.java    |   2 +-
 .../examples/datagrid/store/model/Person.java   | 155 -------------------
 ...heStoreLoadDataExampleMultiNodeSelfTest.java |   2 +-
 modules/schema-import/readme.txt                |   4 +-
 13 files changed, 334 insertions(+), 375 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8568c703/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheNodeWithStoreStartup.java
----------------------------------------------------------------------
diff --git 
a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheNodeWithStoreStartup.java
 
b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheNodeWithStoreStartup.java
deleted file mode 100644
index 0edf591..0000000
--- 
a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheNodeWithStoreStartup.java
+++ /dev/null
@@ -1,155 +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.datagrid.store;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
-import org.apache.ignite.cache.store.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.examples.datagrid.store.dummy.*;
-import org.apache.ignite.examples.datagrid.store.hibernate.*;
-import org.apache.ignite.examples.datagrid.store.jdbc.*;
-import org.apache.ignite.examples.datagrid.store.model.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.spi.discovery.tcp.*;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.*;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
-
-import javax.cache.configuration.*;
-import java.sql.*;
-import java.util.*;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.*;
-
-/**
- * Starts up an empty node with example cache and store configuration.
- */
-public class CacheNodeWithStoreStartup {
-    /** Use 
org.apache.ignite.examples.datagrid.store.dummy.CacheDummyPersonStore to run 
example. */
-    public static final String DUMMY = "DUMMY";
-
-    /** Use 
org.apache.ignite.examples.datagrid.store.jdbc.CacheJdbcPersonStore to run 
example. */
-    public static final String SIMPLE_JDBC = "SIMPLE_JDBC";
-
-    /** Use 
org.apache.ignite.examples.datagrid.store.hibernate.CacheHibernatePersonStore 
to run example. */
-    public static final String HIBERNATE = "HIBERNATE";
-
-    /** Use 
org.apache.ignite.examples.datagrid.store.jdbc.CacheJdbcPojoPersonStore to run 
example. */
-    public static final String AUTO = "AUTO";
-
-    /** Store to use. */
-    public static final String STORE = DUMMY;
-
-    /**
-     * Start up an empty node with specified cache configuration.
-     *
-     * @param args Command line arguments, none required.
-     * @throws IgniteException If example execution failed.
-     */
-    public static void main(String[] args) throws IgniteException {
-        Ignition.start(configure());
-    }
-
-    /**
-     * Configure ignite.
-     *
-     * @return Ignite configuration.
-     * @throws IgniteException If failed.
-     */
-    public static IgniteConfiguration configure() throws IgniteException {
-        IgniteConfiguration cfg = new IgniteConfiguration();
-
-        cfg.setLocalHost("127.0.0.1");
-
-        // Discovery SPI.
-        TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
-
-        TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryMulticastIpFinder();
-
-        ipFinder.setAddresses(Arrays.asList("127.0.0.1:47500..47509"));
-
-        discoSpi.setIpFinder(ipFinder);
-
-        CacheConfiguration<Long, Person> cacheCfg = new CacheConfiguration<>();
-
-        // Set atomicity as transaction, since we are showing transactions in 
example.
-        cacheCfg.setAtomicityMode(TRANSACTIONAL);
-
-        cacheCfg.setCacheStoreFactory(new Factory<CacheStore<? super Long, ? 
super Person>>() {
-            @Override public CacheStore<? super Long, ? super Person> create() 
{
-                CacheStore<Long, Person> store;
-
-                switch (STORE) {
-                    case DUMMY:
-                        store = new CacheDummyPersonStore();
-                        break;
-
-                    case SIMPLE_JDBC:
-                        store = new CacheJdbcPersonStore();
-                        break;
-
-                    case HIBERNATE:
-                        store = new CacheHibernatePersonStore();
-                        break;
-
-                    default:
-                        if (!STORE.equals(AUTO))
-                            throw new IllegalStateException("Unexpected store 
configured: " + STORE);
-
-                        store = new CacheJdbcPojoPersonStore();
-                        break;
-                }
-
-                return store;
-            }
-        });
-
-        if (STORE.equals(AUTO))
-            cacheCfg.setTypeMetadata(typeMetadata());
-
-        cacheCfg.setReadThrough(true);
-        cacheCfg.setWriteThrough(true);
-
-        cfg.setDiscoverySpi(discoSpi);
-        cfg.setCacheConfiguration(cacheCfg);
-
-        return cfg;
-    }
-
-    /**
-     * @return Type mapping description.
-     */
-    private static Collection<CacheTypeMetadata> typeMetadata() {
-        CacheTypeMetadata tm = new CacheTypeMetadata();
-
-        tm.setDatabaseTable("PERSON");
-
-        tm.setKeyType("java.lang.Long");
-        
tm.setValueType("org.apache.ignite.examples.datagrid.store.model.Person");
-
-        tm.setKeyFields(F.asList(new CacheTypeFieldMetadata("ID", 
Types.BIGINT, "id", Long.class)));
-
-        tm.setValueFields(F.asList(
-            new CacheTypeFieldMetadata("ID", Types.BIGINT, "id", long.class),
-            new CacheTypeFieldMetadata("FIRST_NAME", Types.VARCHAR, 
"firstName", String.class),
-            new CacheTypeFieldMetadata("LAST_NAME", Types.VARCHAR, "lastName", 
String.class)
-        ));
-
-        return F.asList(tm);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8568c703/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheStoreExample.java
----------------------------------------------------------------------
diff --git 
a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheStoreExample.java
 
b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheStoreExample.java
index 051d5fc..39d5452 100644
--- 
a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheStoreExample.java
+++ 
b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheStoreExample.java
@@ -19,19 +19,21 @@ package org.apache.ignite.examples.datagrid.store;
 
 import org.apache.ignite.*;
 import org.apache.ignite.configuration.*;
-import org.apache.ignite.examples.datagrid.store.model.*;
+import org.apache.ignite.examples.*;
 import org.apache.ignite.transactions.*;
 
 import java.util.*;
 
-import static 
org.apache.ignite.examples.datagrid.store.CacheNodeWithStoreStartup.*;
+import static 
org.apache.ignite.examples.datagrid.store.CacheStoreExampleCacheConfigurator.*;
 
 /**
  * Demonstrates usage of cache with underlying persistent store configured.
  * <p>
- * Remote nodes should always be started using {@link 
CacheNodeWithStoreStartup}.
- * Also you can change type of underlying store modifying configuration in the
- * {@link CacheNodeWithStoreStartup#configure()} method.
+ * Remote nodes should always be started with special configuration file which
+ * enables P2P class loading: {@code 'ignite.{sh|bat} 
examples/config/example-ignite.xml'}.
+ * <p>
+ * Alternatively you can run {@link ExampleNodeStartup} in another JVM which 
will
+ * start node with {@code examples/config/example-ignite.xml} configuration.
  */
 public class CacheStoreExample {
     /** Global person ID to use across entire example. */
@@ -44,64 +46,49 @@ public class CacheStoreExample {
      * @throws IgniteException If example execution failed.
      */
     public static void main(String[] args) throws IgniteException {
-        IgniteConfiguration cfg = CacheNodeWithStoreStartup.configure();
-
         // To start ignite with desired configuration uncomment the 
appropriate line.
-        try (Ignite ignite = Ignition.start(cfg)) {
+        try (Ignite ignite = 
Ignition.start("examples/config/example-ignite.xml")) {
             System.out.println();
             System.out.println(">>> Cache store example started.");
             System.out.println(">>> Store: " + STORE);
 
-            IgniteCache<Long, Person> cache = ignite.jcache(null);
+            CacheConfiguration<Long, Person> cacheCfg = 
CacheStoreExampleCacheConfigurator.cacheConfiguration();
 
-            // Clean up caches on all nodes before run.
-            cache.clear();
+            try (IgniteCache<Long, Person> cache = 
ignite.createCache(cacheCfg)) {
+                try (Transaction tx = ignite.transactions().txStart()) {
+                    Person val = cache.get(id);
 
-            try (Transaction tx = ignite.transactions().txStart()) {
-                Person val = cache.get(id);
+                    System.out.println("Read value: " + val);
 
-                System.out.println("Read value: " + val);
+                    val = cache.getAndPut(id, new Person(id, "Isaac", 
"Newton"));
 
-                val = cache.getAndPut(id, person(id, "Isaac", "Newton"));
+                    System.out.println("Overwrote old value: " + val);
 
-                System.out.println("Overwrote old value: " + val);
+                    val = cache.get(id);
 
-                val = cache.get(id);
+                    System.out.println("Read value: " + val);
 
-                System.out.println("Read value: " + val);
+                    tx.commit();
+                }
 
-                tx.commit();
-            }
+                System.out.println("Read value after commit: " + 
cache.get(id));
 
-            System.out.println("Read value after commit: " + cache.get(id));
+                // If example run with CacheJdbcPojoStore.
+                // Example of CacheJdbcPojoStore special features.
+                if (STORE.equals(AUTO)) {
+                    System.out.println(">>> Example of CacheJdbcPojoStore 
special feature: load from DB with custom SQL.");
 
-            // If example run with CacheJdbcPojoStore.
-            // Example of CacheJdbcPojoStore special features.
-            if (STORE.equals(AUTO)) {
-                System.out.println(">>> Example of CacheJdbcPojoStore special 
feature: load from DB with custom SQL.");
+                    cache.clear();
 
-                cache.clear();
+                    System.out.println("Cache size: " + cache.size());
 
-                System.out.println("Cache size: " + cache.size());
+                    // Load values from DB into store with custom SQL.
+                    cache.loadCache(null, "java.lang.Long", "select * from 
PERSON where id = 2");
 
-                // Load values from DB into store with custom SQL.
-                cache.loadCache(null, "java.lang.Long", "select * from PERSON 
where id = 2");
-
-                System.out.println("Cache size: " + cache.size());
-                System.out.println("Person: " + cache.get(2L));
+                    System.out.println("Cache size: " + cache.size());
+                    System.out.println("Person: " + cache.get(2L));
+                }
             }
         }
     }
-
-    /**
-     * Creates person.
-     *
-     * @param id ID.
-     * @param firstName First name.
-     * @param lastName Last name.
-     * @return Newly created person.
-     */
-    private static Person person(long id, String firstName, String lastName) {
-        return new Person(id, firstName, lastName);
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8568c703/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheStoreExampleCacheConfigurator.java
----------------------------------------------------------------------
diff --git 
a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheStoreExampleCacheConfigurator.java
 
b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheStoreExampleCacheConfigurator.java
new file mode 100644
index 0000000..d44c2a1
--- /dev/null
+++ 
b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheStoreExampleCacheConfigurator.java
@@ -0,0 +1,125 @@
+/*
+ * 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.datagrid.store;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.cache.store.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.examples.datagrid.store.dummy.*;
+import org.apache.ignite.examples.datagrid.store.hibernate.*;
+import org.apache.ignite.examples.datagrid.store.jdbc.*;
+import org.apache.ignite.internal.util.typedef.*;
+
+import javax.cache.configuration.*;
+import java.sql.*;
+import java.util.*;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.*;
+
+/**
+ * Starts up an empty node with example cache and store configuration.
+ */
+public class CacheStoreExampleCacheConfigurator {
+    /** Use 
org.apache.ignite.examples.datagrid.store.dummy.CacheDummyPersonStore to run 
example. */
+    public static final String DUMMY = "DUMMY";
+
+    /** Use 
org.apache.ignite.examples.datagrid.store.jdbc.CacheJdbcPersonStore to run 
example. */
+    public static final String SIMPLE_JDBC = "SIMPLE_JDBC";
+
+    /** Use 
org.apache.ignite.examples.datagrid.store.hibernate.CacheHibernatePersonStore 
to run example. */
+    public static final String HIBERNATE = "HIBERNATE";
+
+    /** Use 
org.apache.ignite.examples.datagrid.store.jdbc.CacheJdbcPojoPersonStore to run 
example. */
+    public static final String AUTO = "AUTO";
+
+    /** Store to use. */
+    public static final String STORE = DUMMY;
+
+    /**
+     * Configure ignite.
+     *
+     * @return Ignite configuration.
+     * @throws IgniteException If failed.
+     */
+    public static CacheConfiguration<Long, Person> cacheConfiguration() throws 
IgniteException {
+        CacheConfiguration<Long, Person> cacheCfg = new CacheConfiguration<>();
+
+        // Set atomicity as transaction, since we are showing transactions in 
example.
+        cacheCfg.setAtomicityMode(TRANSACTIONAL);
+
+        cacheCfg.setCacheStoreFactory(new Factory<CacheStore<? super Long, ? 
super Person>>() {
+            @Override public CacheStore<? super Long, ? super Person> create() 
{
+                CacheStore<Long, Person> store;
+
+                switch (STORE) {
+                    case DUMMY:
+                        store = new CacheDummyPersonStore();
+                        break;
+
+                    case SIMPLE_JDBC:
+                        store = new CacheJdbcPersonStore();
+                        break;
+
+                    case HIBERNATE:
+                        store = new CacheHibernatePersonStore();
+                        break;
+
+                    case AUTO:
+                        store = new CacheJdbcPojoPersonStore();
+                        break;
+
+                    default:
+                        throw new IllegalStateException("Unexpected store 
configured: " + STORE);
+                }
+
+                return store;
+            }
+        });
+
+        if (STORE.equals(AUTO))
+            cacheCfg.setTypeMetadata(typeMetadata());
+
+        cacheCfg.setReadThrough(true);
+        cacheCfg.setWriteThrough(true);
+
+        return cacheCfg;
+    }
+
+    /**
+     * @return Type mapping description.
+     */
+    private static Collection<CacheTypeMetadata> typeMetadata() {
+        CacheTypeMetadata tm = new CacheTypeMetadata();
+
+        tm.setDatabaseTable("PERSON");
+
+        tm.setKeyType("java.lang.Long");
+        
tm.setValueType("org.apache.ignite.examples.datagrid.store.model.Person");
+
+        tm.setKeyFields(F.asList(new CacheTypeFieldMetadata("ID", 
Types.BIGINT, "id", Long.class)));
+
+        tm.setValueFields(F.asList(
+            new CacheTypeFieldMetadata("ID", Types.BIGINT, "id", long.class),
+            new CacheTypeFieldMetadata("FIRST_NAME", Types.VARCHAR, 
"firstName", String.class),
+            new CacheTypeFieldMetadata("LAST_NAME", Types.VARCHAR, "lastName", 
String.class)
+        ));
+
+        return F.asList(tm);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8568c703/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheStoreLoadDataExample.java
----------------------------------------------------------------------
diff --git 
a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheStoreLoadDataExample.java
 
b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheStoreLoadDataExample.java
index 4a0cf2b..d59e004 100644
--- 
a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheStoreLoadDataExample.java
+++ 
b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheStoreLoadDataExample.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.examples.datagrid.store;
 
 import org.apache.ignite.*;
+import org.apache.ignite.configuration.*;
 import org.apache.ignite.examples.*;
 import org.apache.ignite.lang.*;
 
@@ -25,9 +26,11 @@ import org.apache.ignite.lang.*;
  * Loads data on all cache nodes from persistent store at cache startup by 
calling
  * {@link IgniteCache#loadCache(IgniteBiPredicate, Object...)} method.
  * <p>
- * Remote nodes should always be started using {@link 
CacheNodeWithStoreStartup}.
- * Also you can change type of underlying store modifying configuration in the
- * {@link CacheNodeWithStoreStartup#configure()} method.
+ * Remote nodes should always be started with special configuration file which
+ * enables P2P class loading: {@code 'ignite.{sh|bat} 
examples/config/example-ignite.xml'}.
+ * <p>
+ * Alternatively you can run {@link ExampleNodeStartup} in another JVM which 
will
+ * start node with {@code examples/config/example-ignite.xml} configuration.
  */
 public class CacheStoreLoadDataExample {
     /** Heap size required to run this example. */
@@ -45,23 +48,22 @@ public class CacheStoreLoadDataExample {
     public static void main(String[] args) throws IgniteException {
         ExamplesUtils.checkMinMemory(MIN_MEMORY);
 
-        try (Ignite ignite = 
Ignition.start(CacheNodeWithStoreStartup.configure())) {
+        try (Ignite ignite = 
Ignition.start("examples/config/example-ignite.xml")) {
             System.out.println();
             System.out.println(">>> Cache store load data example started.");
 
-            final IgniteCache<String, Integer> cache = ignite.jcache(null);
-
-            // Clean up caches on all nodes before run.
-            cache.clear();
+            CacheConfiguration<Long, Person> cacheCfg = 
CacheStoreExampleCacheConfigurator.cacheConfiguration();
 
-            long start = System.currentTimeMillis();
+            try (IgniteCache<Long, Person> cache = 
ignite.createCache(cacheCfg)) {
+                long start = System.currentTimeMillis();
 
-            // Start loading cache from persistent store on all caching nodes.
-            cache.loadCache(null, ENTRY_COUNT);
+                // Start loading cache from persistent store on all caching 
nodes.
+                cache.loadCache(null, ENTRY_COUNT);
 
-            long end = System.currentTimeMillis();
+                long end = System.currentTimeMillis();
 
-            System.out.println(">>> Loaded " + cache.size() + " keys with 
backups in " + (end - start) + "ms.");
+                System.out.println(">>> Loaded " + cache.size() + " keys with 
backups in " + (end - start) + "ms.");
+            }
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8568c703/examples/src/main/java/org/apache/ignite/examples/datagrid/store/Person.java
----------------------------------------------------------------------
diff --git 
a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/Person.java 
b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/Person.java
new file mode 100644
index 0000000..6337401
--- /dev/null
+++ 
b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/Person.java
@@ -0,0 +1,155 @@
+/*
+ * 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.datagrid.store;
+
+import java.io.*;
+
+/**
+ * Person definition.
+ *
+ * Code generated by Apache Ignite Schema Import utility: 02/24/2015.
+ */
+public class Person implements Serializable {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Value for id. */
+    private long id;
+
+    /** Value for first name. */
+    private String firstName;
+
+    /** Value for last name. */
+    private String lastName;
+
+    /**
+     * Empty constructor.
+     */
+    public Person() {
+        // No-op.
+    }
+
+    /**
+     * Full constructor.
+     */
+    public Person(
+        long id,
+        String firstName,
+        String lastName
+    ) {
+        this.id = id;
+        this.firstName = firstName;
+        this.lastName = lastName;
+    }
+
+    /**
+     * Gets id.
+     *
+     * @return Value for id.
+     */
+    public long getId() {
+        return id;
+    }
+
+    /**
+     * Sets id.
+     *
+     * @param id New value for id.
+     */
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    /**
+     * Gets first name.
+     *
+     * @return Value for first name.
+     */
+    public String getFirstName() {
+        return firstName;
+    }
+
+    /**
+     * Sets first name.
+     *
+     * @param firstName New value for first name.
+     */
+    public void setFirstName(String firstName) {
+        this.firstName = firstName;
+    }
+
+    /**
+     * Gets last name.
+     *
+     * @return Value for last name.
+     */
+    public String getLastName() {
+        return lastName;
+    }
+
+    /**
+     * Sets last name.
+     *
+     * @param lastName New value for last name.
+     */
+    public void setLastName(String lastName) {
+        this.lastName = lastName;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (!(o instanceof Person))
+            return false;
+
+        Person that = (Person)o;
+
+        if (id != that.id)
+            return false;
+
+        if (firstName != null ? !firstName.equals(that.firstName) : 
that.firstName != null)
+            return false;
+
+        if (lastName != null ? !lastName.equals(that.lastName) : that.lastName 
!= null)
+            return false;
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = (int)(id ^ (id >>> 32));
+
+        res = 31 * res + (firstName != null ? firstName.hashCode() : 0);
+
+        res = 31 * res + (lastName != null ? lastName.hashCode() : 0);
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return "Person [id=" + id +
+            ", firstName=" + firstName +
+            ", lastName=" + lastName +
+            "]";
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8568c703/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyPersonStore.java
----------------------------------------------------------------------
diff --git 
a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyPersonStore.java
 
b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyPersonStore.java
index 3640122..1c9e0d6 100644
--- 
a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyPersonStore.java
+++ 
b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyPersonStore.java
@@ -19,7 +19,7 @@ package org.apache.ignite.examples.datagrid.store.dummy;
 
 import org.apache.ignite.*;
 import org.apache.ignite.cache.store.*;
-import org.apache.ignite.examples.datagrid.store.model.*;
+import org.apache.ignite.examples.datagrid.store.*;
 import org.apache.ignite.lang.*;
 import org.apache.ignite.resources.*;
 import org.apache.ignite.transactions.*;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8568c703/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java
----------------------------------------------------------------------
diff --git 
a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java
 
b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java
index d6f14a0..1951f98 100644
--- 
a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java
+++ 
b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java
@@ -18,7 +18,7 @@
 package org.apache.ignite.examples.datagrid.store.hibernate;
 
 import org.apache.ignite.cache.store.*;
-import org.apache.ignite.examples.datagrid.store.model.*;
+import org.apache.ignite.examples.datagrid.store.*;
 import org.apache.ignite.lang.*;
 import org.apache.ignite.resources.*;
 import org.apache.ignite.transactions.Transaction;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8568c703/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/Person.hbm.xml
----------------------------------------------------------------------
diff --git 
a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/Person.hbm.xml
 
b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/Person.hbm.xml
index 7474d77..035ab98 100644
--- 
a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/Person.hbm.xml
+++ 
b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/Person.hbm.xml
@@ -23,7 +23,7 @@
         "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd";>
 
 <hibernate-mapping default-access="field">
-    <class name="org.apache.ignite.examples.datagrid.store.model.Person" 
table="PERSONS">
+    <class name="org.apache.ignite.examples.datagrid.store.Person" 
table="PERSONS">
         <!-- ID. -->
         <id name="id"/>
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8568c703/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcPersonStore.java
----------------------------------------------------------------------
diff --git 
a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcPersonStore.java
 
b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcPersonStore.java
index 252c037..92d6a93 100644
--- 
a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcPersonStore.java
+++ 
b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcPersonStore.java
@@ -19,7 +19,7 @@ package org.apache.ignite.examples.datagrid.store.jdbc;
 
 import org.apache.ignite.*;
 import org.apache.ignite.cache.store.*;
-import org.apache.ignite.examples.datagrid.store.model.*;
+import org.apache.ignite.examples.datagrid.store.*;
 import org.apache.ignite.lang.*;
 import org.apache.ignite.resources.*;
 import org.jetbrains.annotations.*;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8568c703/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcPojoPersonStore.java
----------------------------------------------------------------------
diff --git 
a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcPojoPersonStore.java
 
b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcPojoPersonStore.java
index 4d88463..e69ef7a 100644
--- 
a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcPojoPersonStore.java
+++ 
b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcPojoPersonStore.java
@@ -19,7 +19,7 @@ package org.apache.ignite.examples.datagrid.store.jdbc;
 
 import org.apache.ignite.*;
 import org.apache.ignite.cache.store.jdbc.*;
-import org.apache.ignite.examples.datagrid.store.model.*;
+import org.apache.ignite.examples.datagrid.store.*;
 import org.h2.tools.*;
 
 import javax.cache.*;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8568c703/examples/src/main/java/org/apache/ignite/examples/datagrid/store/model/Person.java
----------------------------------------------------------------------
diff --git 
a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/model/Person.java
 
b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/model/Person.java
deleted file mode 100644
index fad7816..0000000
--- 
a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/model/Person.java
+++ /dev/null
@@ -1,155 +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.datagrid.store.model;
-
-import java.io.*;
-
-/**
- * Person definition.
- *
- * Code generated by Apache Ignite Schema Import utility: 02/24/2015.
- */
-public class Person implements Serializable {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Value for id. */
-    private long id;
-
-    /** Value for first name. */
-    private String firstName;
-
-    /** Value for last name. */
-    private String lastName;
-
-    /**
-     * Empty constructor.
-     */
-    public Person() {
-        // No-op.
-    }
-
-    /**
-     * Full constructor.
-     */
-    public Person(
-        long id,
-        String firstName,
-        String lastName
-    ) {
-        this.id = id;
-        this.firstName = firstName;
-        this.lastName = lastName;
-    }
-
-    /**
-     * Gets id.
-     *
-     * @return Value for id.
-     */
-    public long getId() {
-        return id;
-    }
-
-    /**
-     * Sets id.
-     *
-     * @param id New value for id.
-     */
-    public void setId(long id) {
-        this.id = id;
-    }
-
-    /**
-     * Gets first name.
-     *
-     * @return Value for first name.
-     */
-    public String getFirstName() {
-        return firstName;
-    }
-
-    /**
-     * Sets first name.
-     *
-     * @param firstName New value for first name.
-     */
-    public void setFirstName(String firstName) {
-        this.firstName = firstName;
-    }
-
-    /**
-     * Gets last name.
-     *
-     * @return Value for last name.
-     */
-    public String getLastName() {
-        return lastName;
-    }
-
-    /**
-     * Sets last name.
-     *
-     * @param lastName New value for last name.
-     */
-    public void setLastName(String lastName) {
-        this.lastName = lastName;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean equals(Object o) {
-        if (this == o)
-            return true;
-
-        if (!(o instanceof Person))
-            return false;
-
-        Person that = (Person)o;
-
-        if (id != that.id)
-            return false;
-
-        if (firstName != null ? !firstName.equals(that.firstName) : 
that.firstName != null)
-            return false;
-
-        if (lastName != null ? !lastName.equals(that.lastName) : that.lastName 
!= null)
-            return false;
-
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int hashCode() {
-        int res = (int)(id ^ (id >>> 32));
-
-        res = 31 * res + (firstName != null ? firstName.hashCode() : 0);
-
-        res = 31 * res + (lastName != null ? lastName.hashCode() : 0);
-
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return "Person [id=" + id +
-            ", firstName=" + firstName +
-            ", lastName=" + lastName +
-            "]";
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8568c703/examples/src/test/java/org/apache/ignite/examples/CacheStoreLoadDataExampleMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git 
a/examples/src/test/java/org/apache/ignite/examples/CacheStoreLoadDataExampleMultiNodeSelfTest.java
 
b/examples/src/test/java/org/apache/ignite/examples/CacheStoreLoadDataExampleMultiNodeSelfTest.java
index 5b46e98..fd3862a 100644
--- 
a/examples/src/test/java/org/apache/ignite/examples/CacheStoreLoadDataExampleMultiNodeSelfTest.java
+++ 
b/examples/src/test/java/org/apache/ignite/examples/CacheStoreLoadDataExampleMultiNodeSelfTest.java
@@ -27,7 +27,7 @@ public class CacheStoreLoadDataExampleMultiNodeSelfTest 
extends GridAbstractExam
     /** {@inheritDoc} */
     @Override protected void beforeTest() throws Exception {
         for (int i = 0; i < RMT_NODES_CNT; i++)
-            startGrid("node-" + i, CacheNodeWithStoreStartup.configure());
+            startGrid("node-" + i, "examples/config/example-ignite.xml");
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8568c703/modules/schema-import/readme.txt
----------------------------------------------------------------------
diff --git a/modules/schema-import/readme.txt b/modules/schema-import/readme.txt
index 1494499..9b0a44d 100644
--- a/modules/schema-import/readme.txt
+++ b/modules/schema-import/readme.txt
@@ -70,7 +70,7 @@ Example of spring configuration:
                         <bean 
class="org.apache.ignite.cache.CacheTypeMetadata">
                             <property name="databaseTable" value="PERSON"/>
                             <property name="keyType" 
value="org.apache.ignite.examples.datagrid.store.model.PersonKey"/>
-                            <property name="valueType" 
value="org.apache.ignite.examples.datagrid.store.model.Person"/>
+                            <property name="valueType" 
value="org.apache.ignite.examples.datagrid.store.Person"/>
                             <property name="keyFields">
                                 <list>
                                     <bean 
class="org.apache.ignite.cache.CacheTypeFieldMetadata">
@@ -149,7 +149,7 @@ CacheTypeMetadata tm = new CacheTypeMetadata();
 tm.setDatabaseTable("PERSON");
 
 tm.setKeyType("java.lang.Long");
-tm.setValueType("org.apache.ignite.examples.datagrid.store.model.Person");
+tm.setValueType("org.apache.ignite.examples.datagrid.store.Person");
 
 // Key fields for PERSONS.
 tm.setKeyFields(F.asList(new CacheTypeFieldMetadata("ID", Types.BIGINT, "id", 
Long.class)));

Reply via email to