#ignite-964: GridVersionCommandHandler code style.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/d85dab7e Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/d85dab7e Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/d85dab7e Branch: refs/heads/ignite-964 Commit: d85dab7e830f9a7157755d6823080ab6a6dccc70 Parents: 3bc20e8 Author: ivasilinets <ivasilin...@gridgain.com> Authored: Wed Jul 1 12:29:20 2015 +0300 Committer: ivasilinets <ivasilin...@gridgain.com> Committed: Wed Jul 1 12:29:20 2015 +0300 ---------------------------------------------------------------------- .../processors/rest/GridRestProcessor.java | 2 +- .../version/GridVersionCommandHandler.java | 67 -------------------- .../version/GridVersionNameCommandHandler.java | 67 ++++++++++++++++++++ 3 files changed, 68 insertions(+), 68 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d85dab7e/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java index 86bfafe..5a073a0 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java @@ -290,7 +290,7 @@ public class GridRestProcessor extends GridProcessorAdapter { addHandler(new GridCacheCommandHandler(ctx)); addHandler(new GridTaskCommandHandler(ctx)); addHandler(new GridTopologyCommandHandler(ctx)); - addHandler(new GridVersionCommandHandler(ctx)); + addHandler(new GridVersionNameCommandHandler(ctx)); addHandler(new DataStructuresCommandHandler(ctx)); addHandler(new IgniteScriptingCommandHandler(ctx)); addHandler(new QueryCommandHandler(ctx)); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d85dab7e/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/version/GridVersionCommandHandler.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/version/GridVersionCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/version/GridVersionCommandHandler.java deleted file mode 100644 index 9597ab3..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/version/GridVersionCommandHandler.java +++ /dev/null @@ -1,67 +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.processors.rest.handlers.version; - -import org.apache.ignite.internal.*; -import org.apache.ignite.internal.processors.rest.*; -import org.apache.ignite.internal.processors.rest.handlers.*; -import org.apache.ignite.internal.processors.rest.request.*; -import org.apache.ignite.internal.util.future.*; -import org.apache.ignite.internal.util.typedef.internal.*; - -import java.util.*; - -import static org.apache.ignite.internal.IgniteVersionUtils.*; -import static org.apache.ignite.internal.processors.rest.GridRestCommand.*; - -/** - * Handler for {@link GridRestCommand#VERSION} command. - */ -public class GridVersionCommandHandler extends GridRestCommandHandlerAdapter { - /** Supported commands. */ - private static final Collection<GridRestCommand> SUPPORTED_COMMANDS = U.sealList(VERSION, NAME); - - /** - * @param ctx Context. - */ - public GridVersionCommandHandler(GridKernalContext ctx) { - super(ctx); - } - - /** {@inheritDoc} */ - @Override public Collection<GridRestCommand> supportedCommands() { - return SUPPORTED_COMMANDS; - } - - /** {@inheritDoc} */ - @Override public IgniteInternalFuture<GridRestResponse> handleAsync(GridRestRequest req) { - assert req != null; - - assert SUPPORTED_COMMANDS.contains(req.command()); - - switch (req.command()){ - case VERSION: - return new GridFinishedFuture<>(new GridRestResponse(VER_STR)); - - case NAME: - return new GridFinishedFuture<>(new GridRestResponse(ctx.gridName())); - } - - return new GridFinishedFuture<>(); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d85dab7e/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/version/GridVersionNameCommandHandler.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/version/GridVersionNameCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/version/GridVersionNameCommandHandler.java new file mode 100644 index 0000000..c22b838 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/version/GridVersionNameCommandHandler.java @@ -0,0 +1,67 @@ +/* + * 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.rest.handlers.version; + +import org.apache.ignite.internal.*; +import org.apache.ignite.internal.processors.rest.*; +import org.apache.ignite.internal.processors.rest.handlers.*; +import org.apache.ignite.internal.processors.rest.request.*; +import org.apache.ignite.internal.util.future.*; +import org.apache.ignite.internal.util.typedef.internal.*; + +import java.util.*; + +import static org.apache.ignite.internal.IgniteVersionUtils.*; +import static org.apache.ignite.internal.processors.rest.GridRestCommand.*; + +/** + * Handler for {@link GridRestCommand#VERSION} and {@link GridRestCommand#NAME} command. + */ +public class GridVersionNameCommandHandler extends GridRestCommandHandlerAdapter { + /** Supported commands. */ + private static final Collection<GridRestCommand> SUPPORTED_COMMANDS = U.sealList(VERSION, NAME); + + /** + * @param ctx Context. + */ + public GridVersionNameCommandHandler(GridKernalContext ctx) { + super(ctx); + } + + /** {@inheritDoc} */ + @Override public Collection<GridRestCommand> supportedCommands() { + return SUPPORTED_COMMANDS; + } + + /** {@inheritDoc} */ + @Override public IgniteInternalFuture<GridRestResponse> handleAsync(GridRestRequest req) { + assert req != null; + + assert SUPPORTED_COMMANDS.contains(req.command()); + + switch (req.command()){ + case VERSION: + return new GridFinishedFuture<>(new GridRestResponse(VER_STR)); + + case NAME: + return new GridFinishedFuture<>(new GridRestResponse(ctx.gridName())); + } + + return new GridFinishedFuture<>(); + } +}