STORM-1260: port backtype.storm.command.activate to java
Project: http://git-wip-us.apache.org/repos/asf/storm/repo Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/54f17d81 Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/54f17d81 Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/54f17d81 Branch: refs/heads/master Commit: 54f17d81368bc3c58c2a886a63f96c5061c49f13 Parents: b05aeb0 Author: Robert (Bobby) Evans <[email protected]> Authored: Sat Feb 13 13:34:33 2016 -0600 Committer: Robert (Bobby) Evans <[email protected]> Committed: Sat Feb 13 13:34:33 2016 -0600 ---------------------------------------------------------------------- bin/storm.cmd | 2 +- bin/storm.py | 2 +- .../clj/org/apache/storm/command/activate.clj | 24 ------------ .../jvm/org/apache/storm/command/Activate.java | 40 ++++++++++++++++++++ 4 files changed, 42 insertions(+), 26 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/storm/blob/54f17d81/bin/storm.cmd ---------------------------------------------------------------------- diff --git a/bin/storm.cmd b/bin/storm.cmd index 8b3fa92..b29a648 100644 --- a/bin/storm.cmd +++ b/bin/storm.cmd @@ -125,7 +125,7 @@ :activate - set CLASS=org.apache.storm.command.activate + set CLASS=org.apache.storm.command.Activate set STORM_OPTS=%STORM_CLIENT_OPTS% %STORM_OPTS% goto :eof http://git-wip-us.apache.org/repos/asf/storm/blob/54f17d81/bin/storm.py ---------------------------------------------------------------------- diff --git a/bin/storm.py b/bin/storm.py index 48160cc..e14990e 100755 --- a/bin/storm.py +++ b/bin/storm.py @@ -345,7 +345,7 @@ def activate(*args): print_usage(command="activate") sys.exit(2) exec_storm_class( - "org.apache.storm.command.activate", + "org.apache.storm.command.Activate", args=args, jvmtype="-client", extrajars=[USER_CONF_DIR, STORM_BIN_DIR]) http://git-wip-us.apache.org/repos/asf/storm/blob/54f17d81/storm-core/src/clj/org/apache/storm/command/activate.clj ---------------------------------------------------------------------- diff --git a/storm-core/src/clj/org/apache/storm/command/activate.clj b/storm-core/src/clj/org/apache/storm/command/activate.clj deleted file mode 100644 index dc452e8..0000000 --- a/storm-core/src/clj/org/apache/storm/command/activate.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.activate - (:use [org.apache.storm thrift log]) - (:gen-class)) - -(defn -main [name] - (with-configured-nimbus-connection nimbus - (.activate nimbus name) - (log-message "Activated topology: " name) - )) http://git-wip-us.apache.org/repos/asf/storm/blob/54f17d81/storm-core/src/jvm/org/apache/storm/command/Activate.java ---------------------------------------------------------------------- diff --git a/storm-core/src/jvm/org/apache/storm/command/Activate.java b/storm-core/src/jvm/org/apache/storm/command/Activate.java new file mode 100644 index 0000000..6a64bf6 --- /dev/null +++ b/storm-core/src/jvm/org/apache/storm/command/Activate.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 Activate { + private static final Logger LOG = LoggerFactory.getLogger(Activate.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.activate(name); + LOG.info("Activated topology: {}", name); + } + }); + } +}
