Repository: ignite Updated Branches: refs/heads/ignite-1192 f4c90c08b -> 99434116e
IGNITE-1192: completed, added an example and improved documentation Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/99434116 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/99434116 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/99434116 Branch: refs/heads/ignite-1192 Commit: 99434116e47909e8c7b0076787fc616b8c21d02f Parents: f4c90c0 Author: Denis Magda <[email protected]> Authored: Tue Apr 11 19:49:05 2017 -0700 Committer: Denis Magda <[email protected]> Committed: Tue Apr 11 19:49:05 2017 -0700 ---------------------------------------------------------------------- examples/pom.xml | 6 + .../examples/springdata/PersonRepository.java | 59 +++++++ .../examples/springdata/SpringAppCfg.java | 69 +++++++++ .../examples/springdata/SpringDataExample.java | 154 +++++++++++++++++++ .../examples/SpringDataExampleSelfTest.java | 32 ++++ .../testsuites/IgniteExamplesSelfTestSuite.java | 2 + modules/spring-data/README.txt | 9 +- .../ignite/springdata/repository/Query.java | 37 ----- .../springdata/repository/config/Query.java | 37 +++++ .../repository/config/RepositoryConfig.java | 2 +- .../repository/config/package-info.java | 22 +++ .../springdata/repository/package-info.java | 22 +++ .../repository/query/package-info.java | 22 +++ .../support/IgniteRepositoryFactory.java | 4 +- .../repository/support/package-info.java | 22 +++ .../springdata/misc/PersonRepository.java | 2 +- .../springdata/misc/PersonSecondRepository.java | 2 +- .../testsuites/IgniteSpringDataTestSuite.java | 2 +- 18 files changed, 457 insertions(+), 48 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/99434116/examples/pom.xml ---------------------------------------------------------------------- diff --git a/examples/pom.xml b/examples/pom.xml index 2bbcc8a..cdb72ca 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -81,6 +81,12 @@ </dependency> <dependency> + <groupId>org.apache.ignite</groupId> + <artifactId>ignite-spring-data</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> <groupId>com.google.code.simple-spring-memcached</groupId> <artifactId>spymemcached</artifactId> <version>2.7.3</version> http://git-wip-us.apache.org/repos/asf/ignite/blob/99434116/examples/src/main/java/org/apache/ignite/examples/springdata/PersonRepository.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/springdata/PersonRepository.java b/examples/src/main/java/org/apache/ignite/examples/springdata/PersonRepository.java new file mode 100644 index 0000000..0517311 --- /dev/null +++ b/examples/src/main/java/org/apache/ignite/examples/springdata/PersonRepository.java @@ -0,0 +1,59 @@ +/* + * 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.springdata; + +import java.util.List; +import javax.cache.Cache; +import org.apache.ignite.examples.model.Person; +import org.apache.ignite.springdata.repository.IgniteRepository; +import org.apache.ignite.springdata.repository.config.Query; +import org.apache.ignite.springdata.repository.config.RepositoryConfig; +import org.springframework.data.domain.Pageable; + +/** + * Apache Ignite Spring Data repository backed by Ignite Person's cache. + * </p> + * To link the repository with an Ignite cache use {@link RepositoryConfig#cacheName()} annotation's parameter. + */ +@RepositoryConfig(cacheName = "PersonCache") +public interface PersonRepository extends IgniteRepository<Person, Long> { + /** + * Gets all the persons with the given name. + * @param name Person name. + * @return A list of Persons with the given first name. + */ + public List<Person> findByFirstName(String name); + + /** + * Returns top Person with the specified surname. + * @param name Person surname. + * @return Person that satisfy the query. + */ + public Cache.Entry<Long, Person> findTopByLastNameLike(String name); + + /** + * Getting ids of all the Person satisfying the custom query from {@link Query} annotation. + * + * @param orgId Query parameter. + * @param pageable Pageable interface. + * @return A list of Persons' ids. + */ + @Query("SELECT id FROM Person WHERE orgId > ?") + public List<Long> selectId(long orgId, Pageable pageable); +} + http://git-wip-us.apache.org/repos/asf/ignite/blob/99434116/examples/src/main/java/org/apache/ignite/examples/springdata/SpringAppCfg.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/springdata/SpringAppCfg.java b/examples/src/main/java/org/apache/ignite/examples/springdata/SpringAppCfg.java new file mode 100644 index 0000000..0dcf5d6 --- /dev/null +++ b/examples/src/main/java/org/apache/ignite/examples/springdata/SpringAppCfg.java @@ -0,0 +1,69 @@ +/* + * 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.springdata; + +import org.apache.ignite.Ignite; +import org.apache.ignite.Ignition; +import org.apache.ignite.configuration.CacheConfiguration; +import org.apache.ignite.configuration.IgniteConfiguration; +import org.apache.ignite.examples.model.Person; +import org.apache.ignite.springdata.repository.IgniteRepository; +import org.apache.ignite.springdata.repository.config.EnableIgniteRepositories; +import org.apache.ignite.springdata.repository.support.IgniteRepositoryFactoryBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * Every {@link IgniteRepository} is bound to a specific Apache Ignite that it communicates to in order to mutate and + * read data via Spring Data API. To pass an instance of Apache Ignite cache to an {@link IgniteRepository} it's + * required to initialize {@link IgniteRepositoryFactoryBean} with on of the following: + * <ul> + * <li>{@link Ignite} instance bean named "igniteInstance"</li> + * <li>{@link IgniteConfiguration} bean named "igniteCfg"</li> + * <li>A path to Ignite's Spring XML configuration named "igniteSpringCfgPath"</li> + * <ul/> + * In this example the first approach is utilized. + */ +@Configuration +@EnableIgniteRepositories +public class SpringAppCfg { + /** + * Creating Apache Ignite instance bean. A bean will be passed to {@link IgniteRepositoryFactoryBean} to initialize + * all Ignite based Spring Data repositories and connect to a cluster. + */ + @Bean + public Ignite igniteInstance() { + IgniteConfiguration cfg = new IgniteConfiguration(); + + // Setting some custom name for the node. + cfg.setIgniteInstanceName("springDataNode"); + + // Enabling peer-class loading feature. + cfg.setPeerClassLoadingEnabled(true); + + // Defining and creating a new cache to be used by Ignite Spring Data repository. + CacheConfiguration ccfg = new CacheConfiguration("PersonCache"); + + // Setting SQL schema for the cache. + ccfg.setIndexedTypes(Long.class, Person.class); + + cfg.setCacheConfiguration(ccfg); + + return Ignition.start(cfg); + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/99434116/examples/src/main/java/org/apache/ignite/examples/springdata/SpringDataExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/springdata/SpringDataExample.java b/examples/src/main/java/org/apache/ignite/examples/springdata/SpringDataExample.java new file mode 100644 index 0000000..6233698 --- /dev/null +++ b/examples/src/main/java/org/apache/ignite/examples/springdata/SpringDataExample.java @@ -0,0 +1,154 @@ +/* + * 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.springdata; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.TreeMap; +import javax.cache.Cache; +import org.apache.ignite.examples.ExampleNodeStartup; +import org.apache.ignite.examples.model.Person; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import org.springframework.data.domain.PageRequest; + +/** + * The example demonstrates how to interact with an Apache Ignite cluster by means of Spring Data API. + * + * Additional cluster nodes can 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 an additional node with {@code examples/config/example-ignite.xml} configuration. + */ +public class SpringDataExample { + /** Spring Application Context. */ + private static AnnotationConfigApplicationContext ctx; + + /** Ignite Spring Data repository. */ + private static PersonRepository repo; + + /** + * Executes the example. + * @param args Command line arguments, none required. + */ + public static void main(String[] args) { + // Initializing Spring Data context and Ignite repository. + igniteSpringDataInit(); + + populateRepository(); + + findPersons(); + + queryRepository(); + + System.out.println("\n>>> Cleaning out the repository..."); + + repo.deleteAll(); + + System.out.println("\n>>> Repository size: " + repo.count()); + + // Destroying the context. + ctx.destroy(); + } + + /** + * Initializes Spring Data and Ignite repositories. + */ + private static void igniteSpringDataInit() { + ctx = new AnnotationConfigApplicationContext(); + + // Explicitly registering Spring configuration. + ctx.register(SpringAppCfg.class); + + ctx.refresh(); + + // Getting a reference to PersonRepository. + repo = ctx.getBean(PersonRepository.class); + } + + /** + * Fills the repository in with sample data. + */ + private static void populateRepository() { + TreeMap<Long, Person> persons = new TreeMap<>(); + + persons.put(1L, new Person(1L, 2000L, "John", "Smith", 15000, "Worked for Apple")); + persons.put(2L, new Person(2L, 2000L, "Brad", "Pitt", 16000, "Worked for Oracle")); + persons.put(3L, new Person(3L, 1000L, "Mark", "Tomson", 10000, "Worked for Sun")); + persons.put(4L, new Person(4L, 2000L, "Erick", "Smith", 13000, "Worked for Apple")); + persons.put(5L, new Person(5L, 1000L, "John", "Rozenberg", 25000, "Worked for RedHat")); + persons.put(6L, new Person(6L, 2000L, "Denis", "Won", 35000, "Worked for CBS")); + persons.put(7L, new Person(7L, 1000L, "Abdula", "Adis", 45000, "Worked for NBC")); + persons.put(8L, new Person(8L, 2000L, "Roman", "Ive", 15000, "Worked for Sun")); + + // Adding data into the repository. + repo.save(persons); + + System.out.println("\n>>> Added " + repo.count() + " Persons into the repository."); + } + + /** + * Gets a list of Persons using standard read operations. + */ + private static void findPersons() { + // Getting Person with specific ID. + Person person = repo.findOne(2L); + + System.out.println("\n>>> Found Person [id=" + 2L + ", val=" + person + "]"); + + // Getting a list of Persons. + + ArrayList<Long> ids = new ArrayList<>(); + + for (long i = 0; i < 5; i++) + ids.add(i); + + Iterator<Person> persons = repo.findAll(ids).iterator(); + + System.out.println("\n>>> Persons list for specific ids: "); + + while (persons.hasNext()) + System.out.println(" >>> " + persons.next()); + } + + /** + * Execute advanced queries over the repository. + */ + private static void queryRepository() { + System.out.println("\n>>> Persons with name 'John':"); + + List<Person> persons = repo.findByFirstName("John"); + + for (Person person: persons) + System.out.println(" >>> " + person); + + + Cache.Entry<Long, Person> topPerson = repo.findTopByLastNameLike("Smith"); + + System.out.println("\n>>> Top Person with surname 'Smith': " + topPerson.getValue()); + + + List<Long> ids = repo.selectId(1000L, new PageRequest(0, 4)); + + System.out.println("\n>>> Persons working for organization with ID > 1000: "); + + for (Long id: ids) + System.out.println(" >>> [id=" + id + "]"); + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/99434116/examples/src/test/java/org/apache/ignite/examples/SpringDataExampleSelfTest.java ---------------------------------------------------------------------- diff --git a/examples/src/test/java/org/apache/ignite/examples/SpringDataExampleSelfTest.java b/examples/src/test/java/org/apache/ignite/examples/SpringDataExampleSelfTest.java new file mode 100644 index 0000000..516ad45 --- /dev/null +++ b/examples/src/test/java/org/apache/ignite/examples/SpringDataExampleSelfTest.java @@ -0,0 +1,32 @@ +/* + * 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; + +import org.apache.ignite.examples.springdata.SpringDataExample; +import org.apache.ignite.testframework.junits.common.GridAbstractExamplesTest; + +/** + * Spring Data example test. + */ +public class SpringDataExampleSelfTest extends GridAbstractExamplesTest { + /** + * @throws Exception If failed. + */ + public void testSpringDataExample() throws Exception { + SpringDataExample.main(EMPTY_ARGS); + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/99434116/examples/src/test/java/org/apache/ignite/testsuites/IgniteExamplesSelfTestSuite.java ---------------------------------------------------------------------- diff --git a/examples/src/test/java/org/apache/ignite/testsuites/IgniteExamplesSelfTestSuite.java b/examples/src/test/java/org/apache/ignite/testsuites/IgniteExamplesSelfTestSuite.java index fcf9be9..3e29e5c 100644 --- a/examples/src/test/java/org/apache/ignite/testsuites/IgniteExamplesSelfTestSuite.java +++ b/examples/src/test/java/org/apache/ignite/testsuites/IgniteExamplesSelfTestSuite.java @@ -42,6 +42,7 @@ import org.apache.ignite.examples.MessagingExamplesSelfTest; import org.apache.ignite.examples.MonteCarloExamplesMultiNodeSelfTest; import org.apache.ignite.examples.MonteCarloExamplesSelfTest; import org.apache.ignite.examples.SpringBeanExamplesSelfTest; +import org.apache.ignite.examples.SpringDataExampleSelfTest; import org.apache.ignite.examples.TaskExamplesMultiNodeSelfTest; import org.apache.ignite.examples.TaskExamplesSelfTest; @@ -73,6 +74,7 @@ public class IgniteExamplesSelfTestSuite extends TestSuite { suite.addTest(new TestSuite(MonteCarloExamplesSelfTest.class)); suite.addTest(new TestSuite(TaskExamplesSelfTest.class)); suite.addTest(new TestSuite(SpringBeanExamplesSelfTest.class)); + suite.addTest(new TestSuite(SpringDataExampleSelfTest.class)); suite.addTest(new TestSuite(IgfsExamplesSelfTest.class)); suite.addTest(new TestSuite(CheckpointExamplesSelfTest.class)); suite.addTest(new TestSuite(ClusterGroupExampleSelfTest.class)); http://git-wip-us.apache.org/repos/asf/ignite/blob/99434116/modules/spring-data/README.txt ---------------------------------------------------------------------- diff --git a/modules/spring-data/README.txt b/modules/spring-data/README.txt index 24718b7..d957fb6 100644 --- a/modules/spring-data/README.txt +++ b/modules/spring-data/README.txt @@ -1,14 +1,13 @@ Apache Ignite Spring Module --------------------------- -Apache Ignite Spring module provides resources injection capabilities and parser for Spring-based -configuration XML files. +Apache Ignite Spring Data module provides an integration with Spring Data framework. -To enable Spring module when starting a standalone node, move 'optional/ignite-spring' folder to +To enable Spring Data module when starting a standalone node, move 'optional/ignite-spring-data' folder to 'libs' folder before running 'ignite.{sh|bat}' script. The content of the module folder will be added to classpath in this case. -Importing Spring Module In Maven Project +Importing Spring Data Module In Maven Project ---------------------------------------- If you are using Maven to manage dependencies of your project, you can add Spring module @@ -24,7 +23,7 @@ interested in): ... <dependency> <groupId>org.apache.ignite</groupId> - <artifactId>ignite-spring</artifactId> + <artifactId>ignite-spring-data</artifactId> <version>${ignite.version}</version> </dependency> ... http://git-wip-us.apache.org/repos/asf/ignite/blob/99434116/modules/spring-data/src/main/java/org/apache/ignite/springdata/repository/Query.java ---------------------------------------------------------------------- diff --git a/modules/spring-data/src/main/java/org/apache/ignite/springdata/repository/Query.java b/modules/spring-data/src/main/java/org/apache/ignite/springdata/repository/Query.java deleted file mode 100644 index 08b7266..0000000 --- a/modules/spring-data/src/main/java/org/apache/ignite/springdata/repository/Query.java +++ /dev/null @@ -1,37 +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.springdata.repository; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Annotation to provide a user defined SQL query for a method. - */ -@Documented -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.METHOD) -public @interface Query { - /** - * SQL query text string. - */ - String value() default ""; -} http://git-wip-us.apache.org/repos/asf/ignite/blob/99434116/modules/spring-data/src/main/java/org/apache/ignite/springdata/repository/config/Query.java ---------------------------------------------------------------------- diff --git a/modules/spring-data/src/main/java/org/apache/ignite/springdata/repository/config/Query.java b/modules/spring-data/src/main/java/org/apache/ignite/springdata/repository/config/Query.java new file mode 100644 index 0000000..1095942 --- /dev/null +++ b/modules/spring-data/src/main/java/org/apache/ignite/springdata/repository/config/Query.java @@ -0,0 +1,37 @@ +/* + * 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.springdata.repository.config; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Annotation to provide a user defined SQL query for a method. + */ +@Documented +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +public @interface Query { + /** + * SQL query text string. + */ + String value() default ""; +} http://git-wip-us.apache.org/repos/asf/ignite/blob/99434116/modules/spring-data/src/main/java/org/apache/ignite/springdata/repository/config/RepositoryConfig.java ---------------------------------------------------------------------- diff --git a/modules/spring-data/src/main/java/org/apache/ignite/springdata/repository/config/RepositoryConfig.java b/modules/spring-data/src/main/java/org/apache/ignite/springdata/repository/config/RepositoryConfig.java index b30ef2e..8027874 100644 --- a/modules/spring-data/src/main/java/org/apache/ignite/springdata/repository/config/RepositoryConfig.java +++ b/modules/spring-data/src/main/java/org/apache/ignite/springdata/repository/config/RepositoryConfig.java @@ -33,7 +33,7 @@ import java.lang.annotation.Target; @Inherited public @interface RepositoryConfig { /** - * @return A name of a distributed Apache Ignite cache the repository will be mapped to. + * @return A name of a distributed Apache Ignite cache an annotated repository will be mapped to. */ String cacheName() default ""; } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/99434116/modules/spring-data/src/main/java/org/apache/ignite/springdata/repository/config/package-info.java ---------------------------------------------------------------------- diff --git a/modules/spring-data/src/main/java/org/apache/ignite/springdata/repository/config/package-info.java b/modules/spring-data/src/main/java/org/apache/ignite/springdata/repository/config/package-info.java new file mode 100644 index 0000000..4b75f7a --- /dev/null +++ b/modules/spring-data/src/main/java/org/apache/ignite/springdata/repository/config/package-info.java @@ -0,0 +1,22 @@ +/* + * 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 description. --> + * Package includes Spring Data integration related configuration files. + */ +package org.apache.ignite.springdata.repository.config; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/99434116/modules/spring-data/src/main/java/org/apache/ignite/springdata/repository/package-info.java ---------------------------------------------------------------------- diff --git a/modules/spring-data/src/main/java/org/apache/ignite/springdata/repository/package-info.java b/modules/spring-data/src/main/java/org/apache/ignite/springdata/repository/package-info.java new file mode 100644 index 0000000..d5951a3 --- /dev/null +++ b/modules/spring-data/src/main/java/org/apache/ignite/springdata/repository/package-info.java @@ -0,0 +1,22 @@ +/* + * 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 description. --> + * Package contains Apache Ignite Spring Data integration. + */ +package org.apache.ignite.springdata.repository; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/99434116/modules/spring-data/src/main/java/org/apache/ignite/springdata/repository/query/package-info.java ---------------------------------------------------------------------- diff --git a/modules/spring-data/src/main/java/org/apache/ignite/springdata/repository/query/package-info.java b/modules/spring-data/src/main/java/org/apache/ignite/springdata/repository/query/package-info.java new file mode 100644 index 0000000..e4cde20 --- /dev/null +++ b/modules/spring-data/src/main/java/org/apache/ignite/springdata/repository/query/package-info.java @@ -0,0 +1,22 @@ +/* + * 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 description. --> + * Package includes classes that integrates with Apache Ignite SQL engine. + */ +package org.apache.ignite.springdata.repository.query; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/99434116/modules/spring-data/src/main/java/org/apache/ignite/springdata/repository/support/IgniteRepositoryFactory.java ---------------------------------------------------------------------- diff --git a/modules/spring-data/src/main/java/org/apache/ignite/springdata/repository/support/IgniteRepositoryFactory.java b/modules/spring-data/src/main/java/org/apache/ignite/springdata/repository/support/IgniteRepositoryFactory.java index 95c4190..bceee1f 100644 --- a/modules/spring-data/src/main/java/org/apache/ignite/springdata/repository/support/IgniteRepositoryFactory.java +++ b/modules/spring-data/src/main/java/org/apache/ignite/springdata/repository/support/IgniteRepositoryFactory.java @@ -24,7 +24,7 @@ import org.apache.ignite.Ignite; import org.apache.ignite.Ignition; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.springdata.repository.IgniteRepository; -import org.apache.ignite.springdata.repository.Query; +import org.apache.ignite.springdata.repository.config.Query; import org.apache.ignite.springdata.repository.config.RepositoryConfig; import org.apache.ignite.springdata.repository.query.IgniteQuery; import org.apache.ignite.springdata.repository.query.IgniteQueryGenerator; @@ -144,7 +144,7 @@ public class IgniteRepositoryFactory extends RepositoryFactorySupport { if (key == QueryLookupStrategy.Key.USE_DECLARED_QUERY) throw new IllegalStateException("To use QueryLookupStrategy.Key.USE_DECLARED_QUERY, pass " + - "a query string via org.apache.ignite.springdata.repository.Query annotation."); + "a query string via org.apache.ignite.springdata.repository.config.Query annotation."); return new IgniteRepositoryQuery(metadata, IgniteQueryGenerator.generateSql(mtd, metadata), mtd, factory, ignite.getOrCreateCache(repoToCache.get(metadata.getRepositoryInterface()))); http://git-wip-us.apache.org/repos/asf/ignite/blob/99434116/modules/spring-data/src/main/java/org/apache/ignite/springdata/repository/support/package-info.java ---------------------------------------------------------------------- diff --git a/modules/spring-data/src/main/java/org/apache/ignite/springdata/repository/support/package-info.java b/modules/spring-data/src/main/java/org/apache/ignite/springdata/repository/support/package-info.java new file mode 100644 index 0000000..95ab21d --- /dev/null +++ b/modules/spring-data/src/main/java/org/apache/ignite/springdata/repository/support/package-info.java @@ -0,0 +1,22 @@ +/* + * 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 description. --> + * Package contains supporting files required by Spring Data framework. + */ +package org.apache.ignite.springdata.repository.support; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/99434116/modules/spring-data/src/test/java/org/apache/ignite/springdata/misc/PersonRepository.java ---------------------------------------------------------------------- diff --git a/modules/spring-data/src/test/java/org/apache/ignite/springdata/misc/PersonRepository.java b/modules/spring-data/src/test/java/org/apache/ignite/springdata/misc/PersonRepository.java index dc164e6..88f47d9 100644 --- a/modules/spring-data/src/test/java/org/apache/ignite/springdata/misc/PersonRepository.java +++ b/modules/spring-data/src/test/java/org/apache/ignite/springdata/misc/PersonRepository.java @@ -21,7 +21,7 @@ package org.apache.ignite.springdata.misc; import java.util.Collection; import java.util.List; import javax.cache.Cache; -import org.apache.ignite.springdata.repository.Query; +import org.apache.ignite.springdata.repository.config.Query; import org.apache.ignite.springdata.repository.config.RepositoryConfig; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; http://git-wip-us.apache.org/repos/asf/ignite/blob/99434116/modules/spring-data/src/test/java/org/apache/ignite/springdata/misc/PersonSecondRepository.java ---------------------------------------------------------------------- diff --git a/modules/spring-data/src/test/java/org/apache/ignite/springdata/misc/PersonSecondRepository.java b/modules/spring-data/src/test/java/org/apache/ignite/springdata/misc/PersonSecondRepository.java index defbb01..a82e822 100644 --- a/modules/spring-data/src/test/java/org/apache/ignite/springdata/misc/PersonSecondRepository.java +++ b/modules/spring-data/src/test/java/org/apache/ignite/springdata/misc/PersonSecondRepository.java @@ -20,7 +20,7 @@ package org.apache.ignite.springdata.misc; import java.util.List; import javax.cache.Cache; import org.apache.ignite.springdata.repository.IgniteRepository; -import org.apache.ignite.springdata.repository.Query; +import org.apache.ignite.springdata.repository.config.Query; import org.apache.ignite.springdata.repository.config.RepositoryConfig; import org.springframework.data.domain.AbstractPageRequest; import org.springframework.data.domain.PageRequest; http://git-wip-us.apache.org/repos/asf/ignite/blob/99434116/modules/spring-data/src/test/java/org/apache/ignite/testsuites/IgniteSpringDataTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/spring-data/src/test/java/org/apache/ignite/testsuites/IgniteSpringDataTestSuite.java b/modules/spring-data/src/test/java/org/apache/ignite/testsuites/IgniteSpringDataTestSuite.java index d44628c..0d6c519 100644 --- a/modules/spring-data/src/test/java/org/apache/ignite/testsuites/IgniteSpringDataTestSuite.java +++ b/modules/spring-data/src/test/java/org/apache/ignite/testsuites/IgniteSpringDataTestSuite.java @@ -22,7 +22,7 @@ import org.apache.ignite.springdata.IgniteSpringDataCrudSelfTest; import org.apache.ignite.springdata.IgniteSpringDataQueriesSelfTest; /** - * + * Ignite Spring Data test suite. */ public class IgniteSpringDataTestSuite extends TestSuite { /**
