/** {@inheritDoc} */ @Override public <R> QueryCursor<R> query(Query<R> qry) { GridCacheContext<K, V> ctx = getContextSafe(); A.notNull(qry, "qry"); try { ctx.checkSecurity(SecurityPermission.CACHE_READ); validate(qry); convertToBinary(qry); CacheOperationContext opCtxCall = ctx.operationContextPerCall(); boolean keepBinary = opCtxCall != null && opCtxCall.isKeepBinary(); if (qry instanceof ContinuousQuery || qry instanceof ContinuousQueryWithTransformer) return (QueryCursor<R>)queryContinuous((AbstractContinuousQuery)qry, qry.isLocal(), keepBinary); if (qry instanceof SqlQuery) return (QueryCursor<R>)ctx.kernalContext().query().querySql(ctx, (SqlQuery)qry, keepBinary); if (qry instanceof SqlFieldsQuery) return (FieldsQueryCursor<R>)ctx.kernalContext().query().querySqlFields(ctx, (SqlFieldsQuery)qry, null, keepBinary, true).get(0); if (qry instanceof ScanQuery) return query((ScanQuery)qry, null, projection(qry.isLocal())); return (QueryCursor<R>)query(qry, projection(qry.isLocal())); } catch (Exception e) { if (e instanceof CacheException) throw (CacheException)e; throw new CacheException(e.getMessage(), e); } }
/** {@inheritDoc} */ @Override public <T, R> QueryCursor<R> query(Query<T> qry, IgniteClosure<T, R> transformer) { GridCacheContext<K, V> ctx = getContextSafe(); A.notNull(qry, "qry"); A.notNull(transformer, "transformer"); if (!(qry instanceof ScanQuery)) throw new UnsupportedOperationException("Transformers are supported only for SCAN queries."); try { ctx.checkSecurity(SecurityPermission.CACHE_READ); validate(qry); return query((ScanQuery<K, V>)qry, transformer, projection(qry.isLocal())); } catch (Exception e) { if (e instanceof CacheException) throw (CacheException)e; throw new CacheException(e); } }
/** {@inheritDoc} */ @Override public <T, R> QueryCursor<R> query(Query<T> qry, IgniteClosure<T, R> transformer) { A.notNull(qry, "qry"); A.notNull(transformer, "transformer"); if (!(qry instanceof ScanQuery)) throw new UnsupportedOperationException("Transformers are supported only for SCAN queries."); try { ctx.checkSecurity(SecurityPermission.CACHE_READ); validate(qry); return query((ScanQuery<K, V>)qry, transformer, projection(qry.isLocal())); } catch (Exception e) { if (e instanceof CacheException) throw (CacheException)e; throw new CacheException(e); } }
/** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public <R> QueryCursor<R> query(Query<R> qry) { A.notNull(qry, "qry"); try { ctx.checkSecurity(SecurityPermission.CACHE_READ); validate(qry); convertToBinary(qry); CacheOperationContext opCtxCall = ctx.operationContextPerCall(); boolean keepBinary = opCtxCall != null && opCtxCall.isKeepBinary(); if (qry instanceof ContinuousQuery || qry instanceof ContinuousQueryWithTransformer) return (QueryCursor<R>)queryContinuous((AbstractContinuousQuery)qry, qry.isLocal(), keepBinary); if (qry instanceof SqlQuery) return (QueryCursor<R>)ctx.kernalContext().query().querySql(ctx, (SqlQuery)qry, keepBinary); if (qry instanceof SqlFieldsQuery) return (FieldsQueryCursor<R>)ctx.kernalContext().query().querySqlFields(ctx, (SqlFieldsQuery)qry, null, keepBinary, true).get(0); if (qry instanceof ScanQuery) return query((ScanQuery)qry, null, projection(qry.isLocal())); return (QueryCursor<R>)query(qry, projection(qry.isLocal())); } catch (Exception e) { if (e instanceof CacheException) throw (CacheException)e; throw new CacheException(e.getMessage(), e); } }