ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject [09/11] ignite git commit: IGNITE-4988 Cleanup and refactor VisorXxx tasks and DTO for ignite-2.0
Date Fri, 14 Apr 2017 13:54:37 GMT
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java
index 79f54d6..11b1fde 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java
@@ -17,25 +17,29 @@
 
 package org.apache.ignite.internal.visor.cache;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.cache.CacheMetrics;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
 import org.apache.ignite.internal.processors.cache.GridCacheProcessor;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+import org.apache.ignite.internal.visor.query.VisorQueryMetrics;
 
 /**
  * Data transfer object for {@link CacheMetrics}.
  */
-public class VisorCacheMetrics implements Serializable, LessNamingBean {
+public class VisorCacheMetrics extends VisorDataTransferObject {
     /** */
-    private static final float MICROSECONDS_IN_SECOND = 1_000_000;
+    private static final long serialVersionUID = 0L;
 
     /** */
-    private static final long serialVersionUID = 0L;
+    private static final float MICROSECONDS_IN_SECOND = 1_000_000;
 
     /** Cache name. */
     private String name;
@@ -110,7 +114,7 @@ public class VisorCacheMetrics implements Serializable, LessNamingBean {
     private int rollbacksPerSec;
 
     /** Gets query metrics for cache. */
-    private VisorCacheQueryMetrics qryMetrics;
+    private VisorQueryMetrics qryMetrics;
 
     /** Current size of evict queue used to batch up evictions. */
     private int dhtEvictQueueCurrSize;
@@ -174,11 +178,19 @@ public class VisorCacheMetrics implements Serializable, LessNamingBean {
     }
 
     /**
+     * Default constructor.
+     */
+    public VisorCacheMetrics() {
+        // No-op.
+    }
+
+    /**
+     * Create data transfer object for given cache metrics.
+     *
      * @param ignite Ignite.
      * @param cacheName Cache name.
-     * @return Data transfer object for given cache metrics.
      */
-    public VisorCacheMetrics from(IgniteEx ignite, String cacheName) {
+    public VisorCacheMetrics(IgniteEx ignite, String cacheName) {
         GridCacheProcessor cacheProcessor = ignite.context().cache();
 
         IgniteCache<Object, Object> c = cacheProcessor.jcache(cacheName);
@@ -217,7 +229,7 @@ public class VisorCacheMetrics implements Serializable, LessNamingBean {
         commitsPerSec = perSecond(m.getAverageTxCommitTime());
         rollbacksPerSec = perSecond(m.getAverageTxRollbackTime());
 
-        qryMetrics = VisorCacheQueryMetrics.from(c.queryMetrics());
+        qryMetrics = new VisorQueryMetrics(c.queryMetrics());
 
         dhtEvictQueueCurrSize = m.getDhtEvictQueueCurrentSize();
         txThreadMapSize = m.getTxThreadMapSize();
@@ -239,14 +251,12 @@ public class VisorCacheMetrics implements Serializable, LessNamingBean {
 
         offHeapAllocatedSize = ca.offHeapAllocatedSize();
         offHeapEntriesCnt = ca.offHeapEntriesCount();
-
-        return this;
     }
 
     /**
      * @return Cache name.
      */
-    public String name() {
+    public String getName() {
         return name;
     }
 
@@ -255,287 +265,287 @@ public class VisorCacheMetrics implements Serializable, LessNamingBean {
      *
      * @param name New value for cache name.
      */
-    public void name(String name) {
+    public void setName(String name) {
         this.name = name;
     }
 
     /**
      * @return Cache mode.
      */
-    public CacheMode mode() {
+    public CacheMode getMode() {
         return mode;
     }
 
     /**
      * @return Cache system state.
      */
-    public boolean system() {
+    public boolean isSystem() {
         return sys;
     }
 
     /**
      * @return Total number of reads of the owning entity (either cache or entry).
      */
-    public long reads() {
+    public long getReads() {
         return reads;
     }
 
     /**
      * @return The mean time to execute gets
      */
-    public float avgReadTime() {
+    public float getAvgReadTime() {
         return avgReadTime;
     }
 
     /**
      * @return Total number of writes of the owning entity (either cache or entry).
      */
-    public long writes() {
+    public long getWrites() {
         return writes;
     }
 
     /**
      * @return Total number of hits for the owning entity (either cache or entry).
      */
-    public long hits() {
+    public long getHits() {
         return hits;
     }
 
     /**
      * @return Total number of misses for the owning entity (either cache or entry).
      */
-    public long misses() {
+    public long getMisses() {
         return misses;
     }
 
     /**
      * @return Total number of transaction commits.
      */
-    public long txCommits() {
+    public long getTxCommits() {
         return txCommits;
     }
 
     /**
      * @return avgTxCommitTime
      */
-    public float avgTxCommitTime() {
+    public float getAvgTxCommitTime() {
         return avgTxCommitTime;
     }
 
     /**
      * @return The mean time to execute tx rollbacks.
      */
-    public float avgTxRollbackTime() {
+    public float getAvgTxRollbackTime() {
         return avgTxRollbackTime;
     }
 
     /**
      * @return The total number of puts to the cache.
      */
-    public long puts() {
+    public long getPuts() {
         return puts;
     }
 
     /**
      * @return The mean time to execute puts.
      */
-    public float avgPutTime() {
+    public float getAvgPutTime() {
         return avgPutTime;
     }
 
     /**
      * @return The total number of removals from the cache.
      */
-    public long removals() {
+    public long getRemovals() {
         return removals;
     }
 
     /**
      * @return The mean time to execute removes.
      */
-    public float avgRemovalTime() {
+    public float getAvgRemovalTime() {
         return avgRemovalTime;
     }
 
     /**
      * @return The total number of evictions from the cache.
      */
-    public long evictions() {
+    public long getEvictions() {
         return evictions;
     }
 
     /**
      * @return Total number of transaction rollbacks.
      */
-    public long txRollbacks() {
+    public long getTxRollbacks() {
         return txRollbacks;
     }
 
     /**
      * @return Reads per second.
      */
-    public int readsPerSecond() {
+    public int getReadsPerSecond() {
         return readsPerSec;
     }
 
     /**
      * @return Puts per second.
      */
-    public int putsPerSecond() {
+    public int getPutsPerSecond() {
         return putsPerSec;
     }
 
     /**
      * @return Removes per second.
      */
-    public int removalsPerSecond() {
+    public int getRemovalsPerSecond() {
         return removalsPerSec;
     }
 
     /**
      * @return Commits per second.
      */
-    public int commitsPerSecond() {
+    public int getCommitsPerSecond() {
         return commitsPerSec;
     }
 
     /**
      * @return Rollbacks per second.
      */
-    public int rollbacksPerSecond() {
+    public int getRollbacksPerSecond() {
         return rollbacksPerSec;
     }
 
     /**
      * @return Number of non-{@code null} values in the cache.
      */
-    public int size() {
+    public int getSize() {
         return size;
     }
 
     /**
      * @return Gets number of keys in the cache, possibly with {@code null} values.
      */
-    public int keySize() {
+    public int getKeySize() {
         return keySize;
     }
 
     /**
      * @return Gets query metrics for cache.
      */
-    public VisorCacheQueryMetrics queryMetrics() {
+    public VisorQueryMetrics getQueryMetrics() {
         return qryMetrics;
     }
 
     /**
      * @return Current size of evict queue used to batch up evictions.
      */
-    public int dhtEvictQueueCurrentSize() {
+    public int getDhtEvictQueueCurrentSize() {
         return dhtEvictQueueCurrSize;
     }
 
     /**
      * @return Gets transaction per-thread map size.
      */
-    public int txThreadMapSize() {
+    public int getTxThreadMapSize() {
         return txThreadMapSize;
     }
 
     /**
      * @return Transaction per-Xid map size.
      */
-    public int txXidMapSize() {
+    public int getTxXidMapSize() {
         return txXidMapSize;
     }
 
     /**
      * @return Committed transaction queue size.
      */
-    public int txCommitQueueSize() {
+    public int getTxCommitQueueSize() {
         return txCommitQueueSize;
     }
 
     /**
      * @return Prepared transaction queue size.
      */
-    public int txPrepareQueueSize() {
+    public int getTxPrepareQueueSize() {
         return txPrepareQueueSize;
     }
 
     /**
      * @return Start version counts map size.
      */
-    public int txStartVersionCountsSize() {
+    public int getTxStartVersionCountsSize() {
         return txStartVerCountsSize;
     }
 
     /**
      * @return Number of cached committed transaction IDs.
      */
-    public int txCommittedVersionsSize() {
+    public int getTxCommittedVersionsSize() {
         return txCommittedVersionsSize;
     }
 
     /**
      * @return Number of cached rolled back transaction IDs.
      */
-    public int txRolledbackVersionsSize() {
+    public int getTxRolledbackVersionsSize() {
         return txRolledbackVersionsSize;
     }
 
     /**
      * @return DHT thread map size
      */
-    public int txDhtThreadMapSize() {
+    public int getTxDhtThreadMapSize() {
         return txDhtThreadMapSize;
     }
 
     /**
      * @return Transaction DHT per-Xid map size.
      */
-    public int txDhtXidMapSize() {
+    public int getTxDhtXidMapSize() {
         return txDhtXidMapSize;
     }
 
     /**
      * @return Committed DHT transaction queue size.
      */
-    public int txDhtCommitQueueSize() {
+    public int getTxDhtCommitQueueSize() {
         return txDhtCommitQueueSize;
     }
 
     /**
      * @return Prepared DHT transaction queue size.
      */
-    public int txDhtPrepareQueueSize() {
+    public int getTxDhtPrepareQueueSize() {
         return txDhtPrepareQueueSize;
     }
 
     /**
      * @return DHT start version counts map size.
      */
-    public int txDhtStartVersionCountsSize() {
+    public int getTxDhtStartVersionCountsSize() {
         return txDhtStartVerCountsSize;
     }
 
     /**
      * @return Number of cached committed DHT transaction IDs.
      */
-    public int txDhtCommittedVersionsSize() {
+    public int getTxDhtCommittedVersionsSize() {
         return txDhtCommittedVersionsSize;
     }
 
     /**
      * @return Number of cached rolled back DHT transaction IDs.
      */
-    public int txDhtRolledbackVersionsSize() {
+    public int getTxDhtRolledbackVersionsSize() {
         return txDhtRolledbackVersionsSize;
     }
 
     /**
      * @return Memory size allocated in off-heap.
      */
-    public long offHeapAllocatedSize() {
+    public long getOffHeapAllocatedSize() {
         return offHeapAllocatedSize;
     }
 
@@ -547,6 +557,98 @@ public class VisorCacheMetrics implements Serializable, LessNamingBean {
     }
 
     /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, name);
+        U.writeEnum(out, mode);
+        out.writeBoolean(sys);
+        out.writeInt(size);
+        out.writeInt(keySize);
+        out.writeLong(reads);
+        out.writeFloat(avgReadTime);
+        out.writeLong(writes);
+        out.writeLong(hits);
+        out.writeLong(misses);
+        out.writeLong(txCommits);
+        out.writeFloat(avgTxCommitTime);
+        out.writeLong(txRollbacks);
+        out.writeFloat(avgTxRollbackTime);
+        out.writeLong(puts);
+        out.writeFloat(avgPutTime);
+        out.writeLong(removals);
+        out.writeFloat(avgRemovalTime);
+        out.writeLong(evictions);
+        out.writeInt(readsPerSec);
+        out.writeInt(putsPerSec);
+        out.writeInt(removalsPerSec);
+        out.writeInt(commitsPerSec);
+        out.writeInt(rollbacksPerSec);
+        out.writeInt(dhtEvictQueueCurrSize);
+        out.writeInt(txThreadMapSize);
+        out.writeInt(txXidMapSize);
+        out.writeInt(txCommitQueueSize);
+        out.writeInt(txPrepareQueueSize);
+        out.writeInt(txStartVerCountsSize);
+        out.writeInt(txCommittedVersionsSize);
+        out.writeInt(txRolledbackVersionsSize);
+        out.writeInt(txDhtThreadMapSize);
+        out.writeInt(txDhtXidMapSize);
+        out.writeInt(txDhtCommitQueueSize);
+        out.writeInt(txDhtPrepareQueueSize);
+        out.writeInt(txDhtStartVerCountsSize);
+        out.writeInt(txDhtCommittedVersionsSize);
+        out.writeInt(txDhtRolledbackVersionsSize);
+        out.writeLong(offHeapAllocatedSize);
+        out.writeLong(offHeapEntriesCnt);
+        out.writeObject(qryMetrics);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        name = U.readString(in);
+        mode = CacheMode.fromOrdinal(in.readByte());
+        sys = in.readBoolean();
+        size = in.readInt();
+        keySize = in.readInt();
+        reads = in.readLong();
+        avgReadTime = in.readFloat();
+        writes = in.readLong();
+        hits = in.readLong();
+        misses = in.readLong();
+        txCommits = in.readLong();
+        avgTxCommitTime = in.readFloat();
+        txRollbacks = in.readLong();
+        avgTxRollbackTime = in.readFloat();
+        puts = in.readLong();
+        avgPutTime = in.readFloat();
+        removals = in.readLong();
+        avgRemovalTime = in.readFloat();
+        evictions = in.readLong();
+        readsPerSec = in.readInt();
+        putsPerSec = in.readInt();
+        removalsPerSec = in.readInt();
+        commitsPerSec = in.readInt();
+        rollbacksPerSec = in.readInt();
+        dhtEvictQueueCurrSize = in.readInt();
+        txThreadMapSize = in.readInt();
+        txXidMapSize = in.readInt();
+        txCommitQueueSize = in.readInt();
+        txPrepareQueueSize = in.readInt();
+        txStartVerCountsSize = in.readInt();
+        txCommittedVersionsSize = in.readInt();
+        txRolledbackVersionsSize = in.readInt();
+        txDhtThreadMapSize = in.readInt();
+        txDhtXidMapSize = in.readInt();
+        txDhtCommitQueueSize = in.readInt();
+        txDhtPrepareQueueSize = in.readInt();
+        txDhtStartVerCountsSize = in.readInt();
+        txDhtCommittedVersionsSize = in.readInt();
+        txDhtRolledbackVersionsSize = in.readInt();
+        offHeapAllocatedSize = in.readLong();
+        offHeapEntriesCnt = in.readLong();
+        qryMetrics = (VisorQueryMetrics)in.readObject();
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorCacheMetrics.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java
index 4fd85de..5cc8154 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java
@@ -29,20 +29,19 @@ import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.internal.visor.VisorJob;
 import org.apache.ignite.internal.visor.VisorMultiNodeTask;
-import org.apache.ignite.lang.IgniteBiTuple;
 import org.jetbrains.annotations.Nullable;
 
 /**
  * Task that collect cache metrics from all nodes.
  */
 @GridInternal
-public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask<IgniteBiTuple<Boolean, Collection<String>>,
+public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask<VisorCacheMetricsCollectorTaskArg,
     Iterable<VisorCacheAggregatedMetrics>, Collection<VisorCacheMetrics>> {
     /** */
     private static final long serialVersionUID = 0L;
 
     /** {@inheritDoc} */
-    @Override protected VisorCacheMetricsCollectorJob job(IgniteBiTuple<Boolean, Collection<String>> arg) {
+    @Override protected VisorCacheMetricsCollectorJob job(VisorCacheMetricsCollectorTaskArg arg) {
         return new VisorCacheMetricsCollectorJob(arg, debug);
     }
 
@@ -55,15 +54,15 @@ public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask<IgniteBiT
                 Collection<VisorCacheMetrics> cms = res.getData();
 
                 for (VisorCacheMetrics cm : cms) {
-                    VisorCacheAggregatedMetrics am = grpAggrMetrics.get(cm.name());
+                    VisorCacheAggregatedMetrics am = grpAggrMetrics.get(cm.getName());
 
                     if (am == null) {
-                        am = VisorCacheAggregatedMetrics.from(cm);
+                        am = new VisorCacheAggregatedMetrics(cm);
 
-                        grpAggrMetrics.put(cm.name(), am);
+                        grpAggrMetrics.put(cm.getName(), am);
                     }
 
-                    am.metrics().put(res.getNode().id(), cm);
+                    am.getMetrics().put(res.getNode().id(), cm);
                 }
             }
         }
@@ -76,7 +75,7 @@ public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask<IgniteBiT
      * Job that collect cache metrics from node.
      */
     private static class VisorCacheMetricsCollectorJob
-        extends VisorJob<IgniteBiTuple<Boolean, Collection<String>>, Collection<VisorCacheMetrics>> {
+        extends VisorJob<VisorCacheMetricsCollectorTaskArg, Collection<VisorCacheMetrics>> {
 
         /** */
         private static final long serialVersionUID = 0L;
@@ -87,19 +86,17 @@ public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask<IgniteBiT
          * @param arg Whether to collect metrics for all caches or for specified cache name only.
          * @param debug Debug flag.
          */
-        private VisorCacheMetricsCollectorJob(IgniteBiTuple<Boolean, Collection<String>> arg, boolean debug) {
+        private VisorCacheMetricsCollectorJob(VisorCacheMetricsCollectorTaskArg arg, boolean debug) {
             super(arg, debug);
         }
 
         /** {@inheritDoc} */
-        @Override protected Collection<VisorCacheMetrics> run(final IgniteBiTuple<Boolean, Collection<String>> arg) {
+        @Override protected Collection<VisorCacheMetrics> run(final VisorCacheMetricsCollectorTaskArg arg) {
             assert arg != null;
 
-            Boolean showSysCaches = arg.get1();
+            Boolean showSysCaches = arg.isShowSystemCaches();
 
-            assert showSysCaches != null;
-
-            Collection<String> cacheNames = arg.get2();
+            Collection<String> cacheNames = arg.getCacheNames();
 
             assert cacheNames != null;
 
@@ -115,9 +112,9 @@ public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask<IgniteBiT
                 if (ca.context().started()) {
                     String cacheName = ca.getName();
 
-                    VisorCacheMetrics cm = new VisorCacheMetrics().from(ignite, cacheName);
+                    VisorCacheMetrics cm = new VisorCacheMetrics(ignite, cacheName);
 
-                    if ((allCaches || cacheNames.contains(cacheName)) && (showSysCaches || !cm.system()))
+                    if ((allCaches || cacheNames.contains(cacheName)) && (showSysCaches || !cm.isSystem()))
                         res.add(cm);
                 }
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTaskArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTaskArg.java
new file mode 100644
index 0000000..9529ab4
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTaskArg.java
@@ -0,0 +1,87 @@
+/*
+ * 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.visor.cache;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.List;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Cache start arguments.
+ */
+public class VisorCacheMetricsCollectorTaskArg extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Collect metrics for system caches. */
+    private boolean showSysCaches;
+
+    /** Cache names to collect metrics. */
+    private List<String> cacheNames;
+
+    /**
+     * Default constructor.
+     */
+    public VisorCacheMetricsCollectorTaskArg() {
+        // No-op.
+    }
+
+    /**
+     * @param showSysCaches Collect metrics for system caches.
+     * @param cacheNames Cache names to collect metrics.
+     */
+    public VisorCacheMetricsCollectorTaskArg(boolean showSysCaches, List<String> cacheNames) {
+        this.showSysCaches = showSysCaches;
+        this.cacheNames = cacheNames;
+    }
+
+    /**
+     * @return Collect metrics for system caches
+     */
+    public boolean isShowSystemCaches() {
+        return showSysCaches;
+    }
+
+    /**
+     * @return Cache names to collect metrics
+     */
+    public List<String> getCacheNames() {
+        return cacheNames;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        out.writeBoolean(showSysCaches);
+        U.writeCollection(out, cacheNames);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        showSysCaches = in.readBoolean();
+        cacheNames = U.readList(in);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorCacheMetricsCollectorTaskArg.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNearConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNearConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNearConfiguration.java
index 8771da4..ae55f83 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNearConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNearConfiguration.java
@@ -17,12 +17,15 @@
 
 package org.apache.ignite.internal.visor.cache;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.processors.cache.GridCacheUtils;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClass;
@@ -31,7 +34,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.evictionPolic
 /**
  * Data transfer object for near cache configuration properties.
  */
-public class VisorCacheNearConfiguration implements Serializable, LessNamingBean {
+public class VisorCacheNearConfiguration extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -48,54 +51,74 @@ public class VisorCacheNearConfiguration implements Serializable, LessNamingBean
     private Integer nearEvictMaxSize;
 
     /**
-     * @param ccfg Cache configuration.
-     * @return Data transfer object for near cache configuration properties.
+     * Default constructor.
      */
-    public static VisorCacheNearConfiguration from(CacheConfiguration ccfg) {
-        VisorCacheNearConfiguration cfg = new VisorCacheNearConfiguration();
+    public VisorCacheNearConfiguration() {
+        // No-op.
+    }
 
-        cfg.nearEnabled = GridCacheUtils.isNearEnabled(ccfg);
+    /**
+     * Create data transfer object for near cache configuration properties.
+     *
+     * @param ccfg Cache configuration.
+     */
+    public VisorCacheNearConfiguration(CacheConfiguration ccfg) {
+        nearEnabled = GridCacheUtils.isNearEnabled(ccfg);
 
-        if (cfg.nearEnabled) {
+        if (nearEnabled) {
             NearCacheConfiguration nccfg = ccfg.getNearConfiguration();
 
-            cfg.nearStartSize = nccfg.getNearStartSize();
-            cfg.nearEvictPlc = compactClass(nccfg.getNearEvictionPolicy());
-            cfg.nearEvictMaxSize = evictionPolicyMaxSize(nccfg.getNearEvictionPolicy());
+            nearStartSize = nccfg.getNearStartSize();
+            nearEvictPlc = compactClass(nccfg.getNearEvictionPolicy());
+            nearEvictMaxSize = evictionPolicyMaxSize(nccfg.getNearEvictionPolicy());
         }
-
-        return cfg;
     }
 
     /**
      * @return {@code true} if near cache enabled.
      */
-    public boolean nearEnabled() {
+    public boolean isNearEnabled() {
         return nearEnabled;
     }
 
     /**
      * @return Near cache start size.
      */
-    public int nearStartSize() {
+    public int getNearStartSize() {
         return nearStartSize;
     }
 
     /**
      * @return Near cache eviction policy.
      */
-    @Nullable public String nearEvictPolicy() {
+    @Nullable public String getNearEvictPolicy() {
         return nearEvictPlc;
     }
 
     /**
      * @return Near cache eviction policy max size.
      */
-    @Nullable public Integer nearEvictMaxSize() {
+    @Nullable public Integer getNearEvictMaxSize() {
         return nearEvictMaxSize;
     }
 
     /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        out.writeBoolean(nearEnabled);
+        out.writeInt(nearStartSize);
+        U.writeString(out, nearEvictPlc);
+        out.writeObject(nearEvictMaxSize);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        nearEnabled = in.readBoolean();
+        nearStartSize = in.readInt();
+        nearEvictPlc = U.readString(in);
+        nearEvictMaxSize = (Integer)in.readObject();
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorCacheNearConfiguration.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartition.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartition.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartition.java
index e73d1f6..b57bc53 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartition.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartition.java
@@ -17,58 +17,67 @@
 
 package org.apache.ignite.internal.visor.cache;
 
-import java.io.Serializable;
-import org.apache.ignite.internal.LessNamingBean;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 
 /**
  * Data transfer object for information about keys in cache partition.
  */
-public class VisorCachePartition implements Serializable, LessNamingBean {
+public class VisorCachePartition extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
     /** */
-    private int part;
+    private int partId;
 
     /** */
-    private int heap;
+    private long cnt;
 
-    /** */
-    private long offheap;
+    /**
+     * Default constructor.
+     */
+    public VisorCachePartition() {
+        // No-op.
+    }
 
     /**
      * Full constructor.
      *
-     * @param part Partition id.
-     * @param heap Number of keys in heap.
-     * @param offheap Number of keys in offheap.
+     * @param partId Partition id.
+     * @param cnt Number of keys in partition.
      */
-    public VisorCachePartition(int part, int heap, long offheap) {
-        this.part = part;
-        this.heap = heap;
-        this.offheap = offheap;
+    public VisorCachePartition(int partId, long cnt) {
+        this.partId = partId;
+        this.cnt = cnt;
     }
 
     /**
      * @return Partition id.
      */
-    public int partition() {
-        return part;
+    public int getPartitionId() {
+        return partId;
     }
 
     /**
-     * @return Number of keys in heap.
+     * @return Number of keys in partition.
      */
-    public int heap() {
-        return heap;
+    public long getCount() {
+        return cnt;
     }
 
-    /**
-     * @return Number of keys in offheap.
-     */
-    public long offheap() {
-        return offheap;
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        out.writeInt(partId);
+        out.writeLong(cnt);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        partId = in.readInt();
+        cnt = in.readLong();
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitions.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitions.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitions.java
index f8e54a9..2713179 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitions.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitions.java
@@ -17,16 +17,19 @@
 
 package org.apache.ignite.internal.visor.cache;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import java.util.ArrayList;
 import java.util.List;
-import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 
 /**
  * Data transfer object for information about cache partitions.
  */
-public class VisorCachePartitions implements Serializable, LessNamingBean {
+public class VisorCachePartitions extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -47,40 +50,50 @@ public class VisorCachePartitions implements Serializable, LessNamingBean {
     /**
      * Add primary partition descriptor.
      *
-     * @param part Partition id.
-     * @param heap Number of primary keys in heap.
-     * @param offheap Number of primary keys in offheap.
+     * @param partId Partition id.
+     * @param cnt Number of primary keys in partition.
      */
-    public void addPrimary(int part, int heap, long offheap) {
-       primary.add(new VisorCachePartition(part, heap, offheap));
+    public void addPrimary(int partId, long cnt) {
+       primary.add(new VisorCachePartition(partId, cnt));
     }
 
     /**
      * Add backup partition descriptor.
      *
-     * @param part Partition id.
-     * @param heap Number of backup keys in heap.
-     * @param offheap Number of backup keys in offheap.
+     * @param partId Partition id.
+     * @param cnt Number of backup keys in partition.
      */
-    public void addBackup(int part, int heap, long offheap) {
-       backup.add(new VisorCachePartition(part, heap, offheap));
+    public void addBackup(int partId, long cnt) {
+       backup.add(new VisorCachePartition(partId, cnt));
     }
 
     /**
      * @return Get list of primary partitions.
      */
-    public List<VisorCachePartition> primary() {
+    public List<VisorCachePartition> getPrimary() {
         return primary;
     }
 
     /**
      * @return Get list of backup partitions.
      */
-    public List<VisorCachePartition> backup() {
+    public List<VisorCachePartition> getBackup() {
         return backup;
     }
 
     /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeCollection(out, primary);
+        U.writeCollection(out, backup);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        primary = U.readList(in);
+        backup = U.readList(in);
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorCachePartitions.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitionsTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitionsTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitionsTask.java
index 6d3a9d8..b7ca975 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitionsTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitionsTask.java
@@ -45,7 +45,8 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.escapeName;
  * Task that collect keys distribution in partitions.
  */
 @GridInternal
-public class VisorCachePartitionsTask extends VisorMultiNodeTask<String, Map<UUID, VisorCachePartitions>, VisorCachePartitions> {
+public class VisorCachePartitionsTask extends VisorMultiNodeTask<String,
+    Map<UUID, VisorCachePartitions>, VisorCachePartitions> {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -125,9 +126,9 @@ public class VisorCachePartitionsTask extends VisorMultiNodeTask<String, Map<UUI
 
                         // Pass -1 as topology version in order not to wait for topology version.
                         if (part.primary(AffinityTopologyVersion.NONE))
-                            parts.addPrimary(p, sz, 0);
+                            parts.addPrimary(p, sz);
                         else if (part.state() == GridDhtPartitionState.OWNING && part.backup(AffinityTopologyVersion.NONE))
-                            parts.addBackup(p, sz, 0);
+                            parts.addBackup(p, sz);
                     }
                 }
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryConfiguration.java
deleted file mode 100644
index a21cf43..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryConfiguration.java
+++ /dev/null
@@ -1,122 +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.internal.visor.cache;
-
-import java.io.Serializable;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.internal.LessNamingBean;
-import org.apache.ignite.internal.util.typedef.internal.U;
-
-/**
- * Data transfer object for cache query configuration data.
- */
-public class VisorCacheQueryConfiguration implements Serializable, LessNamingBean {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** */
-    private String[] sqlFuncClss;
-
-    /** */
-    private long longQryWarnTimeout;
-
-    /** */
-    private boolean sqlEscapeAll;
-
-    /** */
-    private String[] indexedTypes;
-
-    /** */
-    private int sqlOnheapRowCacheSize;
-
-    /** */
-    private String sqlSchema;
-
-    /**
-     * @param clss Classes to compact.
-     */
-    private static String[] compactClasses(Class<?>[] clss) {
-        if (clss == null)
-            return null;
-
-        int len = clss.length;
-
-        String[] res = new String[len];
-
-        for (int i = 0; i < len; i++)
-            res[i] = U.compact(clss[i].getName());
-
-        return res;
-    }
-
-    /**
-     * @param ccfg Cache configuration.
-     * @return Fill data transfer object with cache query configuration data.
-     */
-    public VisorCacheQueryConfiguration from(CacheConfiguration ccfg) {
-        sqlFuncClss = compactClasses(ccfg.getSqlFunctionClasses());
-        longQryWarnTimeout = ccfg.getLongQueryWarningTimeout();
-        sqlEscapeAll = ccfg.isSqlEscapeAll();
-        indexedTypes = compactClasses(ccfg.getIndexedTypes());
-        sqlSchema = ccfg.getSqlSchema();
-
-        return this;
-    }
-
-    /**
-     * @return Classes names with SQL functions.
-     */
-    public String[] sqlFunctionClasses() {
-        return sqlFuncClss;
-    }
-
-    /**
-     * @return Timeout in milliseconds after which long query warning will be printed.
-     */
-    public long longQueryWarningTimeout() {
-        return longQryWarnTimeout;
-    }
-
-    /**
-     * @return {@code true} if SQL engine generate SQL statements with escaped names.
-     */
-    public boolean sqlEscapeAll() {
-        return sqlEscapeAll;
-    }
-
-    /**
-     * @return Array of key and value classes names to be indexed.
-     */
-    public String[] indexedTypes() {
-        return indexedTypes;
-    }
-
-    /**
-     * @return Number of SQL rows which will be cached onheap to avoid deserialization on each SQL index access.
-     */
-    public int sqlOnheapRowCacheSize() {
-        return sqlOnheapRowCacheSize;
-    }
-
-    /**
-     * @return Schema name, which is used by SQL engine for SQL statements generation.
-     */
-    public String sqlSchema() {
-        return sqlSchema;
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetrics.java
deleted file mode 100644
index dc46906..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetrics.java
+++ /dev/null
@@ -1,167 +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.internal.visor.cache;
-
-import java.io.Serializable;
-import org.apache.ignite.cache.query.QueryDetailMetrics;
-import org.apache.ignite.internal.util.typedef.internal.S;
-
-/**
- * Data transfer object for cache query detail metrics.
- */
-public class VisorCacheQueryDetailMetrics implements Serializable {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Query type. */
-    private String qryType;
-
-    /** Textual query representation. */
-    private String qry;
-
-    /** Cache name. */
-    private String cache;
-
-    /** Number of executions. */
-    private int execs;
-
-    /** Number of completions executions. */
-    private int completions;
-
-    /** Number of failures. */
-    private int failures;
-
-    /** Minimum time of execution. */
-    private long minTime;
-
-    /** Maximum time of execution. */
-    private long maxTime;
-
-    /** Average time of execution. */
-    private double avgTime;
-
-    /** Sum of execution time of completions time. */
-    private long totalTime;
-
-    /** Sum of execution time of completions time. */
-    private long lastStartTime;
-
-    /**
-     * @param m Cache query metrics.
-     * @return Data transfer object for given cache metrics.
-     */
-    public VisorCacheQueryDetailMetrics from(QueryDetailMetrics m) {
-        qryType = m.queryType();
-        qry = m.query();
-        cache = m.cache();
-
-        execs = m.executions();
-        completions = m.completions();
-        failures = m.failures();
-
-        minTime = m.minimumTime();
-        maxTime = m.maximumTime();
-        avgTime = m.averageTime();
-        totalTime = m.totalTime();
-        lastStartTime = m.lastStartTime();
-
-        return this;
-    }
-
-    /**
-     * @return Query type
-     */
-    public String getQueryType() {
-        return qryType;
-    }
-
-    /**
-     * @return Query type
-     */
-    public String getQuery() {
-        return qry;
-    }
-
-    /**
-     * @return Cache name where query was executed.
-     */
-    public String getCache() {
-        return cache;
-    }
-
-    /**
-     * @return Number of executions.
-     */
-    public int getExecutions() {
-        return execs;
-    }
-
-    /**
-     * @return Number of completed executions.
-     */
-    public int getCompletions() {
-        return completions;
-    }
-
-    /**
-     * @return Total number of times a query execution failed.
-     */
-    public int getFailures() {
-        return failures;
-    }
-
-    /**
-     * @return Minimum execution time of query.
-     */
-    public long getMinimumTime() {
-        return minTime;
-    }
-
-    /**
-     * @return Maximum execution time of query.
-     */
-    public long getMaximumTime() {
-        return maxTime;
-    }
-
-    /**
-     * @return Average execution time of query.
-     */
-    public double getAverageTime() {
-        return avgTime;
-    }
-
-    /**
-     * @return Total time of all query executions.
-     */
-    public long getTotalTime() {
-        return totalTime;
-    }
-
-    /**
-     * @return Latest time query was stared.
-     */
-    public long getLastStartTime() {
-        return lastStartTime;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(VisorCacheQueryDetailMetrics.class, this);
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetricsCollectorTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetricsCollectorTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetricsCollectorTask.java
deleted file mode 100644
index aee5063..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetricsCollectorTask.java
+++ /dev/null
@@ -1,146 +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.internal.visor.cache;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.cache.query.QueryDetailMetrics;
-import org.apache.ignite.compute.ComputeJobResult;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.processors.cache.GridCacheProcessor;
-import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
-import org.apache.ignite.internal.processors.cache.query.GridCacheQueryDetailMetricsAdapter;
-import org.apache.ignite.internal.processors.cache.query.GridCacheQueryDetailMetricsKey;
-import org.apache.ignite.internal.processors.task.GridInternal;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.visor.VisorJob;
-import org.apache.ignite.internal.visor.VisorMultiNodeTask;
-import org.jetbrains.annotations.Nullable;
-
-import static org.apache.ignite.internal.processors.cache.GridCacheUtils.isIgfsCache;
-import static org.apache.ignite.internal.processors.cache.GridCacheUtils.isSystemCache;
-
-/**
- * Task to collect cache query metrics.
- */
-@GridInternal
-public class VisorCacheQueryDetailMetricsCollectorTask extends VisorMultiNodeTask<Long, Collection<VisorCacheQueryDetailMetrics>,
-    Collection<? extends QueryDetailMetrics>> {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** {@inheritDoc} */
-    @Override protected VisorCacheQueryDetailMetricsCollectorJob job(Long arg) {
-        return new VisorCacheQueryDetailMetricsCollectorJob(arg, debug);
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override protected Collection<VisorCacheQueryDetailMetrics> reduce0(List<ComputeJobResult> results)
-        throws IgniteException {
-        Map<GridCacheQueryDetailMetricsKey, GridCacheQueryDetailMetricsAdapter> taskRes = new HashMap<>();
-
-        for (ComputeJobResult res : results) {
-            if (res.getException() != null)
-                throw res.getException();
-
-            Collection<GridCacheQueryDetailMetricsAdapter> metrics = res.getData();
-
-            VisorCacheQueryDetailMetricsCollectorJob.aggregateMetrics(-1, taskRes, metrics);
-        }
-
-        Collection<GridCacheQueryDetailMetricsAdapter> aggMetrics = taskRes.values();
-
-        Collection<VisorCacheQueryDetailMetrics> res = new ArrayList<>(aggMetrics.size());
-
-        for (GridCacheQueryDetailMetricsAdapter m : aggMetrics)
-            res.add(new VisorCacheQueryDetailMetrics().from(m));
-
-        return res;
-    }
-
-    /**
-     * Job that will actually collect query metrics.
-     */
-    private static class VisorCacheQueryDetailMetricsCollectorJob extends VisorJob<Long, Collection<? extends QueryDetailMetrics>> {
-        /** */
-        private static final long serialVersionUID = 0L;
-
-        /**
-         * Create job with specified argument.
-         *
-         * @param arg Last time when metrics were collected.
-         * @param debug Debug flag.
-         */
-        protected VisorCacheQueryDetailMetricsCollectorJob(@Nullable Long arg, boolean debug) {
-            super(arg, debug);
-        }
-
-        /**
-         * @param since Time when metrics were collected last time.
-         * @param res Response.
-         * @param metrics Metrics.
-         */
-        private static void aggregateMetrics(long since, Map<GridCacheQueryDetailMetricsKey,
-            GridCacheQueryDetailMetricsAdapter> res, Collection<GridCacheQueryDetailMetricsAdapter> metrics) {
-            for (GridCacheQueryDetailMetricsAdapter m : metrics) {
-                if (m.lastStartTime() > since) {
-                    GridCacheQueryDetailMetricsKey key = m.key();
-
-                    GridCacheQueryDetailMetricsAdapter aggMetrics = res.get(key);
-
-                    res.put(key, aggMetrics == null ? m : aggMetrics.aggregate(m));
-                }
-            }
-        }
-
-        /** {@inheritDoc} */
-        @Override protected Collection<? extends QueryDetailMetrics> run(@Nullable Long arg) throws IgniteException {
-            assert arg != null;
-
-            IgniteConfiguration cfg = ignite.configuration();
-
-            GridCacheProcessor cacheProc = ignite.context().cache();
-
-            Collection<String> cacheNames = cacheProc.cacheNames();
-
-            Map<GridCacheQueryDetailMetricsKey, GridCacheQueryDetailMetricsAdapter> aggMetrics = new HashMap<>();
-
-            for (String cacheName : cacheNames) {
-                if (!isSystemCache(cacheName) && !isIgfsCache(cfg, cacheName)) {
-                    IgniteInternalCache<Object, Object> cache = cacheProc.cache(cacheName);
-
-                    if (cache == null || !cache.context().started())
-                        continue;
-
-                    aggregateMetrics(arg, aggMetrics, cache.context().queries().detailMetrics());
-                }
-            }
-
-            return new ArrayList<>(aggMetrics.values());
-        }
-
-        /** {@inheritDoc} */
-        @Override public String toString() {
-            return S.toString(VisorCacheQueryDetailMetricsCollectorJob.class, this);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryMetrics.java
deleted file mode 100644
index a3d77e5..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryMetrics.java
+++ /dev/null
@@ -1,102 +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.internal.visor.cache;
-
-import java.io.Serializable;
-import org.apache.ignite.cache.query.QueryMetrics;
-import org.apache.ignite.internal.LessNamingBean;
-import org.apache.ignite.internal.util.typedef.internal.S;
-
-/**
- * Data transfer object for cache query metrics.
- */
-public class VisorCacheQueryMetrics implements Serializable, LessNamingBean {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Minimum execution time of query. */
-    private long minTime;
-
-    /** Maximum execution time of query. */
-    private long maxTime;
-
-    /** Average execution time of query. */
-    private double avgTime;
-
-    /** Number of executions. */
-    private int execs;
-
-    /** Total number of times a query execution failed. */
-    private int fails;
-
-    /**
-     * @param m Cache query metrics.
-     * @return Data transfer object for given cache metrics.
-     */
-    public static VisorCacheQueryMetrics from(QueryMetrics m) {
-        VisorCacheQueryMetrics qm = new VisorCacheQueryMetrics();
-
-        qm.minTime = m.minimumTime();
-        qm.maxTime = m.maximumTime();
-        qm.avgTime = m.averageTime();
-        qm.execs = m.executions();
-        qm.fails = m.fails();
-
-        return qm;
-    }
-
-    /**
-     * @return Minimum execution time of query.
-     */
-    public long minimumTime() {
-        return minTime;
-    }
-
-    /**
-     * @return Maximum execution time of query.
-     */
-    public long maximumTime() {
-        return maxTime;
-    }
-
-    /**
-     * @return Average execution time of query.
-     */
-    public double averageTime() {
-        return avgTime;
-    }
-
-    /**
-     * @return Number of executions.
-     */
-    public int executions() {
-        return execs;
-    }
-
-    /**
-     * @return Total number of times a query execution failed.
-     */
-    public int fails() {
-        return fails;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(VisorCacheQueryMetrics.class, this);
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheRebalanceConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheRebalanceConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheRebalanceConfiguration.java
index 4c28d00..618fa97 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheRebalanceConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheRebalanceConfiguration.java
@@ -17,25 +17,25 @@
 
 package org.apache.ignite.internal.visor.cache;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import org.apache.ignite.cache.CacheRebalanceMode;
 import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 
 /**
  * Data transfer object for cache rebalance configuration properties.
  */
-public class VisorCacheRebalanceConfiguration implements Serializable, LessNamingBean {
+public class VisorCacheRebalanceConfiguration extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
     /** Cache rebalance mode. */
     private CacheRebalanceMode mode;
 
-    /** Rebalance thread pool size. */
-    private int threadPoolSize;
-
     /** Cache rebalance batch size. */
     private int batchSize;
 
@@ -49,65 +49,78 @@ public class VisorCacheRebalanceConfiguration implements Serializable, LessNamin
     private long timeout;
 
     /**
-     * @param ccfg Cache configuration.
-     * @return Data transfer object for rebalance configuration properties.
+     * Default constructor.
      */
-    public static VisorCacheRebalanceConfiguration from(CacheConfiguration ccfg) {
-        VisorCacheRebalanceConfiguration cfg = new VisorCacheRebalanceConfiguration();
-
-        cfg.mode = ccfg.getRebalanceMode();
-        cfg.batchSize = ccfg.getRebalanceBatchSize();
-        cfg.threadPoolSize = ccfg.getRebalanceThreadPoolSize();
-        cfg.partitionedDelay = ccfg.getRebalanceDelay();
-        cfg.throttle = ccfg.getRebalanceThrottle();
-        cfg.timeout = ccfg.getRebalanceTimeout();
-
-        return cfg;
+    public VisorCacheRebalanceConfiguration() {
+        // No-op.
     }
 
     /**
-     * @return Cache rebalance mode.
+     * Create data transfer object for rebalance configuration properties.
+     * @param ccfg Cache configuration.
      */
-    public CacheRebalanceMode mode() {
-        return mode;
+    public VisorCacheRebalanceConfiguration(CacheConfiguration ccfg) {
+        mode = ccfg.getRebalanceMode();
+        batchSize = ccfg.getRebalanceBatchSize();
+        partitionedDelay = ccfg.getRebalanceDelay();
+        throttle = ccfg.getRebalanceThrottle();
+        timeout = ccfg.getRebalanceTimeout();
     }
 
     /**
-     * @return Rebalance thread pool size.
+     * @return Cache rebalance mode.
      */
-    public int threadPoolSize() {
-        return threadPoolSize;
+    public CacheRebalanceMode getMode() {
+        return mode;
     }
 
     /**
      * @return Cache rebalance batch size.
      */
-    public int batchSize() {
+    public int getBatchSize() {
         return batchSize;
     }
 
     /**
      * @return Rebalance partitioned delay.
      */
-    public long partitionedDelay() {
+    public long getPartitionedDelay() {
         return partitionedDelay;
     }
 
     /**
      * @return Time in milliseconds to wait between rebalance messages.
      */
-    public long throttle() {
+    public long getThrottle() {
         return throttle;
     }
 
     /**
      * @return Rebalance timeout.
      */
-    public long timeout() {
+    public long getTimeout() {
         return timeout;
     }
 
     /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeEnum(out, mode);
+        out.writeInt(batchSize);
+        out.writeLong(partitionedDelay);
+        out.writeLong(throttle);
+        out.writeLong(timeout);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        mode = CacheRebalanceMode.fromOrdinal(in.readByte());
+        batchSize = in.readInt();
+        partitionedDelay = in.readLong();
+        throttle = in.readLong();
+        timeout = in.readLong();
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorCacheRebalanceConfiguration.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetQueryDetailMetricsTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetQueryDetailMetricsTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetQueryDetailMetricsTask.java
deleted file mode 100644
index 84aae9d..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetQueryDetailMetricsTask.java
+++ /dev/null
@@ -1,71 +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.internal.visor.cache;
-
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.internal.processors.task.GridInternal;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.visor.VisorJob;
-import org.apache.ignite.internal.visor.VisorOneNodeTask;
-
-/**
- * Reset query detail metrics.
- */
-@GridInternal
-public class VisorCacheResetQueryDetailMetricsTask extends VisorOneNodeTask<Void, Void> {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** {@inheritDoc} */
-    @Override protected VisorCacheResetQueryDetailMetricsJob job(Void arg) {
-        return new VisorCacheResetQueryDetailMetricsJob(arg, debug);
-    }
-
-    /**
-     * Job that reset query detail metrics.
-     */
-    private static class VisorCacheResetQueryDetailMetricsJob extends VisorJob<Void, Void> {
-        /** */
-        private static final long serialVersionUID = 0L;
-
-        /**
-         * @param arg Task argument.
-         * @param debug Debug flag.
-         */
-        private VisorCacheResetQueryDetailMetricsJob(Void arg, boolean debug) {
-            super(arg, debug);
-        }
-
-        /** {@inheritDoc} */
-        @Override protected Void run(Void arg) {
-            for (String cacheName : ignite.cacheNames()) {
-                IgniteCache cache = ignite.cache(cacheName);
-
-                if (cache != null)
-                    cache.resetQueryDetailMetrics();
-            }
-
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public String toString() {
-            return S.toString(VisorCacheResetQueryDetailMetricsJob.class, this);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetQueryMetricsTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetQueryMetricsTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetQueryMetricsTask.java
deleted file mode 100644
index 5ba6156..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetQueryMetricsTask.java
+++ /dev/null
@@ -1,69 +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.internal.visor.cache;
-
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.internal.processors.task.GridInternal;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.visor.VisorJob;
-import org.apache.ignite.internal.visor.VisorOneNodeTask;
-
-/**
- * Reset compute grid query metrics.
- */
-@GridInternal
-public class VisorCacheResetQueryMetricsTask extends VisorOneNodeTask<String, Void> {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** {@inheritDoc} */
-    @Override protected VisorCacheResetQueryMetricsJob job(String arg) {
-        return new VisorCacheResetQueryMetricsJob(arg, debug);
-    }
-
-    /**
-     * Job that reset cache query metrics.
-     */
-    private static class VisorCacheResetQueryMetricsJob extends VisorJob<String, Void> {
-        /** */
-        private static final long serialVersionUID = 0L;
-
-        /**
-         * @param arg Cache name to reset query metrics for.
-         * @param debug Debug flag.
-         */
-        private VisorCacheResetQueryMetricsJob(String arg, boolean debug) {
-            super(arg, debug);
-        }
-
-        /** {@inheritDoc} */
-        @Override protected Void run(String cacheName) {
-            IgniteCache cache = ignite.cache(cacheName);
-
-            if (cache != null)
-                cache.resetQueryMetrics();
-
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public String toString() {
-            return S.toString(VisorCacheResetQueryMetricsJob.class, this);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheSqlIndexMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheSqlIndexMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheSqlIndexMetadata.java
new file mode 100644
index 0000000..cd4c95c
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheSqlIndexMetadata.java
@@ -0,0 +1,115 @@
+/*
+ * 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.visor.cache;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.List;
+import org.apache.ignite.internal.processors.cache.query.GridCacheSqlIndexMetadata;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Data transfer object for cache SQL index metadata.
+ */
+public class VisorCacheSqlIndexMetadata extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** */
+    private String name;
+
+    /** */
+    private List<String> fields;
+
+    /** */
+    private List<String> descendings;
+
+    /** */
+    private boolean unique;
+
+    /**
+     * Default constructor.
+     */
+    public VisorCacheSqlIndexMetadata() {
+        // No-op.
+    }
+
+    /**
+     * Create data transfer object.
+     * 
+     * @param meta SQL index metadata.
+     */
+    public VisorCacheSqlIndexMetadata(GridCacheSqlIndexMetadata meta) {
+        name = meta.name();
+        fields = toList(meta.fields());
+        descendings = toList(meta.descendings());
+        unique = meta.unique();
+    }
+
+    /**
+     * @return Index name.
+     */
+    public String getName() {
+        return name; 
+    }
+    
+    /**
+     * @return Indexed fields names.
+     */
+    public List<String> getFields() {
+        return fields;
+    }
+
+    /**
+     * @return Descendings.
+     */
+    public List<String> getDescendings() {
+        return descendings;
+    }
+
+    /**
+     * @return {@code True} if index is unique, {@code false} otherwise.
+     */
+    public boolean isUnique() {
+        return unique;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, name);
+        U.writeCollection(out, fields);
+        U.writeCollection(out, descendings);
+        out.writeBoolean(unique);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        name = U.readString(in);
+        fields = U.readList(in);
+        descendings = U.readList(in);
+        unique = in.readBoolean();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorCacheSqlIndexMetadata.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheSqlMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheSqlMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheSqlMetadata.java
new file mode 100644
index 0000000..c7ff3a7
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheSqlMetadata.java
@@ -0,0 +1,162 @@
+/*
+ * 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.visor.cache;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.ignite.internal.processors.cache.query.GridCacheSqlIndexMetadata;
+import org.apache.ignite.internal.processors.cache.query.GridCacheSqlMetadata;
+import org.apache.ignite.internal.processors.igfs.IgfsUtils;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Data transfer object for cache SQL metadata.
+ */
+public class VisorCacheSqlMetadata extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** */
+    private String cacheName;
+
+    /** */
+    private List<String> types;
+
+    /** */
+    private Map<String, String> keyClasses;
+
+    /** */
+    private Map<String, String> valClasses;
+
+    /** */
+    private Map<String, Map<String, String>> fields;
+
+    /** */
+    private Map<String, List<VisorCacheSqlIndexMetadata>> indexes;
+
+    /**
+     * Default constructor.
+     */
+    public VisorCacheSqlMetadata() {
+        // No-op.
+    }
+
+    /**
+     * Create data transfer object.
+     *
+     * @param meta Cache SQL metadata.
+     */
+    public VisorCacheSqlMetadata(GridCacheSqlMetadata meta) {
+        cacheName = meta.cacheName();
+        types = toList(meta.types());
+        keyClasses = meta.keyClasses();
+        valClasses = meta.valClasses();
+        fields = meta.fields();
+        indexes = new HashMap<>();
+
+        Map<String, Collection<GridCacheSqlIndexMetadata>> src = meta.indexes();
+
+        if (src != null) {
+            for (Map.Entry<String, Collection<GridCacheSqlIndexMetadata>> entry: src.entrySet()) {
+                Collection<GridCacheSqlIndexMetadata> idxs = entry.getValue();
+
+                List<VisorCacheSqlIndexMetadata> res = new ArrayList<>(idxs.size());
+
+                for (GridCacheSqlIndexMetadata idx : idxs)
+                    res.add(new VisorCacheSqlIndexMetadata(idx));
+
+                indexes.put(entry.getKey(), res);
+            }
+        }
+    }
+
+    /**
+     * @return Cache name.
+     */
+    public String getCacheName() {
+        return cacheName;
+    }
+
+    /**
+     * @return Collection of available types.
+     */
+    public List<String> getTypes() {
+        return types;
+    }
+
+    /**
+     * @return Key classes.
+     */
+    public Map<String, String> getKeyClasses() {
+        return keyClasses;
+    }
+
+    /**
+     * @return Value classes.
+     */
+    public Map<String, String> getValueClasses() {
+        return valClasses;
+    }
+
+    /**
+     * @return Fields.
+     */
+    public Map<String, Map<String, String>> getFields() {
+        return fields;
+    }
+
+    /**
+     * @return Indexes.
+     */
+    public Map<String, List<VisorCacheSqlIndexMetadata>> getIndexes() {
+        return indexes;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, cacheName);
+        U.writeCollection(out, types);
+        IgfsUtils.writeStringMap(out, keyClasses);
+        IgfsUtils.writeStringMap(out, valClasses);
+        U.writeMap(out, fields);
+        U.writeMap(out, indexes);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        cacheName = U.readString(in);
+        types = U.readList(in);
+        keyClasses = IgfsUtils.readStringMap(in);
+        valClasses = IgfsUtils.readStringMap(in);
+        fields = U.readMap(in);
+        indexes = U.readMap(in);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorCacheSqlMetadata.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStartArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStartArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStartArg.java
new file mode 100644
index 0000000..a2fd518
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStartArg.java
@@ -0,0 +1,100 @@
+/*
+ * 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.visor.cache;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Cache start arguments.
+ */
+public class VisorCacheStartArg extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** */
+    private boolean near;
+
+    /** */
+    private String name;
+
+    /** */
+    private String cfg;
+
+    /**
+     * Default constructor.
+     */
+    public VisorCacheStartArg() {
+        // No-op.
+    }
+
+    /**
+     * @param near {@code true} if near cache should be started.
+     * @param name Name for near cache.
+     * @param cfg Cache XML configuration.
+     */
+    public VisorCacheStartArg(boolean near, String name, String cfg) {
+        this.near = near;
+        this.name = name;
+        this.cfg = cfg;
+    }
+
+    /**
+     * @return {@code true} if near cache should be started.
+     */
+    public boolean isNear() {
+        return near;
+    }
+
+    /**
+     * @return Name for near cache.
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * @return Cache XML configuration.
+     */
+    public String getConfiguration() {
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        out.writeBoolean(near);
+        U.writeString(out, name);
+        U.writeString(out, cfg);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        near = in.readBoolean();
+        name = U.readString(in);
+        cfg = U.readString(in);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorCacheStartArg.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStartTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStartTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStartTask.java
index 758f39a..af51a38 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStartTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStartTask.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.visor.cache;
 
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
-import java.io.Serializable;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -41,8 +40,7 @@ import org.jetbrains.annotations.Nullable;
  * Task that start cache or near cache with specified configuration.
  */
 @GridInternal
-public class VisorCacheStartTask extends
-    VisorMultiNodeTask<VisorCacheStartTask.VisorCacheStartArg, Map<UUID, IgniteException>, Void> {
+public class VisorCacheStartTask extends VisorMultiNodeTask<VisorCacheStartArg, Map<UUID, IgniteException>, Void> {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -63,56 +61,6 @@ public class VisorCacheStartTask extends
     }
 
     /**
-     * Cache start arguments.
-     */
-    @SuppressWarnings("PublicInnerClass")
-    public static class VisorCacheStartArg implements Serializable {
-        /** */
-        private static final long serialVersionUID = 0L;
-
-        /** */
-        private final boolean near;
-
-        /** */
-        private final String name;
-
-        /** */
-        private final String cfg;
-
-        /**
-         * @param near {@code true} if near cache should be started.
-         * @param name Name for near cache.
-         * @param cfg Cache XML configuration.
-         */
-        public VisorCacheStartArg(boolean near, String name, String cfg) {
-            this.near = near;
-            this.name = name;
-            this.cfg = cfg;
-        }
-
-        /**
-         * @return {@code true} if near cache should be started.
-         */
-        public boolean near() {
-            return near;
-        }
-
-        /**
-         * @return Name for near cache.
-         */
-        public String name() {
-            return name;
-        }
-
-        /**
-         * @return Cache XML configuration.
-         */
-        public String configuration() {
-            return cfg;
-        }
-    }
-
-    /**
      * Job that start cache or near cache with specified configuration.
      */
     private static class VisorCacheStartJob extends VisorJob<VisorCacheStartArg, Void> {
@@ -131,15 +79,15 @@ public class VisorCacheStartTask extends
 
         /** {@inheritDoc} */
         @Override protected Void run(VisorCacheStartArg arg) throws IgniteException {
-            String cfg = arg.configuration();
+            String cfg = arg.getConfiguration();
 
             assert !F.isEmpty(cfg);
 
             try (ByteArrayInputStream bais = new ByteArrayInputStream(cfg.getBytes())) {
-                if (arg.near) {
+                if (arg.isNear()) {
                     NearCacheConfiguration nearCfg = Ignition.loadSpringBean(bais, "nearCacheConfiguration");
 
-                    ignite.getOrCreateNearCache(VisorTaskUtils.unescapeName(arg.name()), nearCfg);
+                    ignite.getOrCreateNearCache(VisorTaskUtils.unescapeName(arg.getName()), nearCfg);
                 }
                 else {
                     CacheConfiguration cacheCfg = Ignition.loadSpringBean(bais, "cacheConfiguration");


Mime
View raw message