Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 44DE618CF9 for ; Mon, 31 Aug 2015 02:00:46 +0000 (UTC) Received: (qmail 21973 invoked by uid 500); 31 Aug 2015 02:00:46 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 21899 invoked by uid 500); 31 Aug 2015 02:00:46 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 21223 invoked by uid 99); 31 Aug 2015 02:00:45 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 31 Aug 2015 02:00:45 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 2C628E060F; Mon, 31 Aug 2015 02:00:45 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: akuznetsov@apache.org To: commits@ignite.apache.org Date: Mon, 31 Aug 2015 02:00:52 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [09/50] [abbrv] ignite git commit: Moved platform cache iterator to Ignite. Moved platform cache iterator to Ignite. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/136c099b Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/136c099b Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/136c099b Branch: refs/heads/ignite-843 Commit: 136c099bf4ff1ba400e711dbad34216633b9236a Parents: e428206 Author: vozerov-gridgain Authored: Thu Aug 27 09:20:44 2015 +0300 Committer: vozerov-gridgain Committed: Thu Aug 27 09:20:44 2015 +0300 ---------------------------------------------------------------------- .../platform/cache/PlatformCacheIterator.java | 72 ++++++++++++++++++++ 1 file changed, 72 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/136c099b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCacheIterator.java ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCacheIterator.java b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCacheIterator.java new file mode 100644 index 0000000..45e777d --- /dev/null +++ b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCacheIterator.java @@ -0,0 +1,72 @@ +/* + * 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.internal.processors.platform.cache; + +import org.apache.ignite.*; +import org.apache.ignite.internal.portable.*; +import org.apache.ignite.internal.processors.platform.*; + +import javax.cache.*; +import java.util.*; + +/** + * Interop cache iterator. + */ +public class PlatformCacheIterator extends PlatformAbstractTarget { + /** Operation: next entry. */ + private static final int OP_NEXT = 1; + + /** Iterator. */ + private final Iterator iter; + + /** + * Constructor. + * + * @param platformCtx Context. + * @param iter Iterator. + */ + public PlatformCacheIterator(PlatformContext platformCtx, Iterator iter) { + super(platformCtx); + + this.iter = iter; + } + + /** {@inheritDoc} */ + @Override protected void processOutOp(int type, PortableRawWriterEx writer) throws IgniteCheckedException { + switch (type) { + case OP_NEXT: + if (iter.hasNext()) { + Cache.Entry e = iter.next(); + + assert e != null; + + writer.writeBoolean(true); + + writer.writeObjectDetached(e.getKey()); + writer.writeObjectDetached(e.getValue()); + } + else + writer.writeBoolean(false); + + break; + + default: + throwUnsupported(type); + } + } +}