alex-plekhanov commented on a change in pull request #26:
URL: https://github.com/apache/ignite-extensions/pull/26#discussion_r518571185



##########
File path: modules/spring-data-2.0-ext/pom.xml
##########
@@ -149,6 +149,12 @@
             <version>${ignite.version}</version>
             <scope>test</scope>
         </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-spring-data-proxy</artifactId>

Review comment:
       Let's name it "ignite-spring-data-commons", perhaps we can move here 
some more classes later.

##########
File path: 
modules/spring-data-2.0-ext/src/main/java/org/apache/ignite/springdata20/repository/query/IgniteRepositoryQuery.java
##########
@@ -351,7 +340,21 @@ public IgniteRepositoryQuery(Ignite ignite,
 
         Query iQry = prepareQuery(qry, config, returnStgy, parameters);
 
-        QueryCursor qryCursor = cache.query(iQry);
+        QueryCursor qryCursor;
+
+        try {
+            qryCursor = cache.query(iQry);
+        }
+        catch (IllegalArgumentException e) {
+            if (cache instanceof IgniteCacheClientProxy) {
+                throw new IllegalStateException(String.format("Query of type 
%s is not supported by thin client." +
+                    " Check %s#%s method configuration or use Ignite node 
instance to connect to the Ignite cluster.",
+                    iQry.getClass().getSimpleName(), 
mtd.getDeclaringClass().getName(), mtd.getName()), e);
+            }
+
+            throw e;
+        }
+

Review comment:
       Redundant NL

##########
File path: 
modules/spring-data-ext/src/main/java/org/apache/ignite/springdata/repository/support/IgniteRepositoryFactoryBean.java
##########
@@ -81,12 +84,30 @@ protected IgniteRepositoryFactoryBean(Class<? extends T> 
repositoryInterface) {
                     return new IgniteRepositoryFactory(path);
                 }
                 catch (BeansException ex3) {
-                    throw new IgniteException("Failed to initialize Ignite 
repository factory. Ignite instance or" +
-                        " IgniteConfiguration or a path to Ignite's spring XML 
configuration must be defined in the" +
-                        " application configuration");
+                    throw new IgniteException("Failed to initialize Ignite 
repository factory. One of the following" +
+                        " beans must be defined in application configuration: 
\"igniteInstance\", \"igniteCfg\"," +
+                        " \"igniteSpringCfgPath\".");
                 }
             }
         }
     }
+
+    /**
+     * Creates instance of {@link IgniteRepositoryFactory} via reflection.
+     *
+     * @param args Arguments to be used when creating the {@link 
IgniteRepositoryFactory} instance.
+     * @return {@link IgniteRepositoryFactory} instance.
+     */
+    private IgniteRepositoryFactory createRepositoryFactory(Object... args) {
+        Constructor<?> ctor = 
ReflectionUtils.findConstructor(IgniteRepositoryFactory.class, args);

Review comment:
       Let's use if/else if instead of reflection. 
   Or better inline these if's to `createRepositoryFactory()` method (like in 
other modules).

##########
File path: 
modules/spring-data-2.2-ext/src/main/java/org/apache/ignite/springdata22/repository/query/IgniteRepositoryQuery.java
##########
@@ -351,7 +340,21 @@ public IgniteRepositoryQuery(Ignite ignite,
 
         Query iQry = prepareQuery(qry, config, returnStgy, parameters);
 
-        QueryCursor qryCursor = cache.query(iQry);
+        QueryCursor qryCursor;
+
+        try {
+            qryCursor = cache.query(iQry);
+        }
+        catch (IllegalArgumentException e) {
+            if (cache instanceof IgniteCacheClientProxy) {
+                throw new IllegalStateException(String.format("Query of type 
%s is not supported by thin client." +
+                    " Check %s#%s method configuration or use Ignite node 
instance to connect to the Ignite cluster.",
+                    iQry.getClass().getSimpleName(), 
mtd.getDeclaringClass().getName(), mtd.getName()), e);
+            }
+
+            throw e;
+        }
+

Review comment:
       Redundant NL




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to