STORM-1261: port backtype.storm.command.deactivate to java
Project: http://git-wip-us.apache.org/repos/asf/storm/repo Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/a64daee0 Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/a64daee0 Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/a64daee0 Branch: refs/heads/master Commit: a64daee0e2d77c4553d2a53a027e9f40194f7370 Parents: 54f17d8 Author: Robert (Bobby) Evans <[email protected]> Authored: Sat Feb 13 13:46:08 2016 -0600 Committer: Robert (Bobby) Evans <[email protected]> Committed: Sat Feb 13 13:46:08 2016 -0600 ---------------------------------------------------------------------- bin/storm.cmd | 2 +- bin/storm.py | 2 +- .../clj/org/apache/storm/command/deactivate.clj | 24 ------------ .../org/apache/storm/command/Deactivate.java | 40 ++++++++++++++++++++ 4 files changed, 42 insertions(+), 26 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/storm/blob/a64daee0/bin/storm.cmd ---------------------------------------------------------------------- diff --git a/bin/storm.cmd b/bin/storm.cmd index b29a648..367574c 100644 --- a/bin/storm.cmd +++ b/bin/storm.cmd @@ -134,7 +134,7 @@ goto :eof :deactivate - set CLASS=org.apache.storm.command.deactivate + set CLASS=org.apache.storm.command.Deactivate set STORM_OPTS=%STORM_CLIENT_OPTS% %STORM_OPTS% goto :eof http://git-wip-us.apache.org/repos/asf/storm/blob/a64daee0/bin/storm.py ---------------------------------------------------------------------- diff --git a/bin/storm.py b/bin/storm.py index e14990e..cc8fe8f 100755 --- a/bin/storm.py +++ b/bin/storm.py @@ -403,7 +403,7 @@ def deactivate(*args): print_usage(command="deactivate") sys.exit(2) exec_storm_class( - "org.apache.storm.command.deactivate", + "org.apache.storm.command.Deactivate", args=args, jvmtype="-client", extrajars=[USER_CONF_DIR, STORM_BIN_DIR]) http://git-wip-us.apache.org/repos/asf/storm/blob/a64daee0/storm-core/src/clj/org/apache/storm/command/deactivate.clj ---------------------------------------------------------------------- diff --git a/storm-core/src/clj/org/apache/storm/command/deactivate.clj b/storm-core/src/clj/org/apache/storm/command/deactivate.clj deleted file mode 100644 index 4fd2c85..0000000 --- a/storm-core/src/clj/org/apache/storm/command/deactivate.clj +++ /dev/null @@ -1,24 +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. -(ns org.apache.storm.command.deactivate - (:use [org.apache.storm thrift log]) - (:gen-class)) - -(defn -main [name] - (with-configured-nimbus-connection nimbus - (.deactivate nimbus name) - (log-message "Deactivated topology: " name) - )) http://git-wip-us.apache.org/repos/asf/storm/blob/a64daee0/storm-core/src/jvm/org/apache/storm/command/Deactivate.java ---------------------------------------------------------------------- diff --git a/storm-core/src/jvm/org/apache/storm/command/Deactivate.java b/storm-core/src/jvm/org/apache/storm/command/Deactivate.java new file mode 100644 index 0000000..6b9dd11 --- /dev/null +++ b/storm-core/src/jvm/org/apache/storm/command/Deactivate.java @@ -0,0 +1,40 @@ +/** + * 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.storm.command; + +import org.apache.storm.generated.Nimbus; +import org.apache.storm.utils.NimbusClient; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class Deactivate { + private static final Logger LOG = LoggerFactory.getLogger(Deactivate.class); + + public static void main(String [] args) throws Exception { + final String name = args[0]; + + NimbusClient.withConfiguredClient(new NimbusClient.WithNimbus() { + @Override + public void run(Nimbus.Client nimbus) throws Exception { + nimbus.deactivate(name); + LOG.info("Deactivated topology: {}", name); + } + }); + } +}
