Index: modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStartNearTask.java =================================================================== --- modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStartNearTask.java (date 1429859844000) +++ modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStartNearTask.java (date 1429859844000) @@ -1,78 +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.*; -import org.apache.ignite.configuration.*; -import org.apache.ignite.internal.processors.task.*; -import org.apache.ignite.internal.util.typedef.internal.*; -import org.apache.ignite.internal.visor.*; -import org.apache.ignite.lang.*; - -import java.io.*; -import java.nio.charset.*; - -/** - * Task that stop specified caches on specified node. - */ -@GridInternal -public class VisorCacheStartNearTask extends VisorOneNodeTask, Void> { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override protected VisorCacheStartJob job(IgniteBiTuple arg) { - return new VisorCacheStartJob(arg, debug); - } - - /** - * Job that stop specified caches. - */ - private static class VisorCacheStartJob extends VisorJob, Void> { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Create job. - * - * @param arg Contains XML configurations of cache and near cache tuple. - * @param debug Debug flag. - */ - private VisorCacheStartJob(IgniteBiTuple arg, boolean debug) { - super(arg, debug); - } - - /** {@inheritDoc} */ - @Override protected Void run(IgniteBiTuple arg) { - assert arg.get1() != null; - assert arg.get2() != null; - - NearCacheConfiguration nearCfg = Ignition.loadSpringBean( - new ByteArrayInputStream(arg.get2().getBytes(StandardCharsets.UTF_8)), "nearCacheConfiguration"); - - ignite.createNearCache(arg.get1(), nearCfg); - - return null; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(VisorCacheStartJob.class, this); - } - } -} Index: modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStartTask.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStartTask.java (date 1429859844000) +++ modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStartTask.java (date 1429866608000) @@ -23,12 +23,13 @@ import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.internal.visor.*; +import org.apache.ignite.internal.visor.util.*; import org.apache.ignite.lang.*; import java.io.*; /** - * Task that stop specified caches on specified node. + * Task that start cache or near cache with specified configuration. */ @GridInternal public class VisorCacheStartTask extends VisorOneNodeTask, Void> { @@ -41,7 +42,7 @@ } /** - * Job that stop specified caches. + * Job that start cache or near cache with specified configuration. */ private static class VisorCacheStartJob extends VisorJob, Void> { /** */ @@ -50,7 +51,7 @@ /** * Create job. * - * @param arg Contains XML configurations of cache and near cache tuple. + * @param arg Contains Cache name and XML configurations of cache or near cache tuple. * @param debug Debug flag. */ private VisorCacheStartJob(IgniteBiTuple arg, boolean debug) { @@ -59,21 +60,24 @@ /** {@inheritDoc} */ @Override protected Void run(IgniteBiTuple arg) { - String ccfg = arg.get1(); + String name = arg.get1(); - assert ccfg != null; + String cfg = arg.get2(); - CacheConfiguration cfg = Ignition.loadSpringBean( - new ByteArrayInputStream(ccfg.getBytes()), "cacheConfiguration"); + assert !F.isEmpty(cfg); - if (!F.isEmpty(arg.get2())) { + if (name == null) { + CacheConfiguration cacheCfg = Ignition.loadSpringBean(new ByteArrayInputStream(cfg.getBytes()), + "cacheConfiguration"); + + ignite.createCache(cacheCfg); + } + else { NearCacheConfiguration nearCfg = Ignition.loadSpringBean( new ByteArrayInputStream(arg.get2().getBytes()), "nearCacheConfiguration"); - ignite.createCache(cfg, nearCfg); + ignite.createNearCache(VisorTaskUtils.unescapeName(name), nearCfg); } - else - ignite.createCache(cfg); return null; } Index: modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java (date 1429859844000) +++ modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java (date 1429866608000) @@ -120,6 +120,16 @@ } /** + * @param name Escaped name. + * @return Name or {@code null} for default name. + */ + public static String unescapeName(String name) { + assert name != null; + + return DFLT_EMPTY_NAME.equals(name) ? null : name; + } + + /** * @param a First name. * @param b Second name. * @return {@code true} if both names equals.