You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whirr.apache.org by as...@apache.org on 2012/01/25 16:19:30 UTC
svn commit: r1235798 - in /whirr/trunk: CHANGES.txt
cli/src/main/java/org/apache/whirr/cli/command/RestartServicesCommand.java
cli/src/main/resources/META-INF/services/org.apache.whirr.command.Command
Author: asavu
Date: Wed Jan 25 15:19:29 2012
New Revision: 1235798
URL: http://svn.apache.org/viewvc?rev=1235798&view=rev
Log:
WHIRR-484. Add restart-services command (asavu)
Added:
whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/RestartServicesCommand.java
Modified:
whirr/trunk/CHANGES.txt
whirr/trunk/cli/src/main/resources/META-INF/services/org.apache.whirr.command.Command
Modified: whirr/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/whirr/trunk/CHANGES.txt?rev=1235798&r1=1235797&r2=1235798&view=diff
==============================================================================
--- whirr/trunk/CHANGES.txt (original)
+++ whirr/trunk/CHANGES.txt Wed Jan 25 15:19:29 2012
@@ -30,6 +30,8 @@ Trunk (unreleased changes)
WHIRR-479. ScriptBasedClusterAction should allow filtering by
role and instance-id (asavu)
+ WHIRR-484. Add restart-services command (asavu)
+
BUG FIXES
WHIRR-367. Wrong groupId for zookeeper (Joe Crobak via asavu)
Added: whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/RestartServicesCommand.java
URL: http://svn.apache.org/viewvc/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/RestartServicesCommand.java?rev=1235798&view=auto
==============================================================================
--- whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/RestartServicesCommand.java (added)
+++ whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/RestartServicesCommand.java Wed Jan 25 15:19:29 2012
@@ -0,0 +1,64 @@
+/**
+ * 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.whirr.cli.command;
+
+import joptsimple.OptionSet;
+import org.apache.whirr.ClusterController;
+import org.apache.whirr.ClusterControllerFactory;
+import org.apache.whirr.ClusterSpec;
+import org.apache.whirr.state.ClusterStateStoreFactory;
+
+import java.io.IOException;
+
+/**
+ * A command to restart the cluster services
+ */
+public class RestartServicesCommand extends RoleLifecycleCommand {
+
+ public RestartServicesCommand() throws IOException {
+ this(new ClusterControllerFactory());
+ }
+
+ public RestartServicesCommand(ClusterControllerFactory factory) {
+ this(factory, new ClusterStateStoreFactory());
+ }
+
+ public RestartServicesCommand(ClusterControllerFactory factory,
+ ClusterStateStoreFactory stateStoreFactory) {
+ super("restart-services", "Restart the cluster services.", factory, stateStoreFactory);
+ }
+
+ @Override
+ public int runLifecycleStep(ClusterSpec clusterSpec, ClusterController controller, OptionSet optionSet)
+ throws IOException, InterruptedException {
+ controller.stopServices(
+ clusterSpec,
+ getCluster(clusterSpec, controller),
+ getTargetRolesOrEmpty(optionSet),
+ getTargetInstanceIdsOrEmpty(optionSet)
+ );
+ controller.startServices(
+ clusterSpec,
+ getCluster(clusterSpec, controller),
+ getTargetRolesOrEmpty(optionSet),
+ getTargetInstanceIdsOrEmpty(optionSet)
+ );
+ return 0;
+ }
+}
Modified: whirr/trunk/cli/src/main/resources/META-INF/services/org.apache.whirr.command.Command
URL: http://svn.apache.org/viewvc/whirr/trunk/cli/src/main/resources/META-INF/services/org.apache.whirr.command.Command?rev=1235798&r1=1235797&r2=1235798&view=diff
==============================================================================
--- whirr/trunk/cli/src/main/resources/META-INF/services/org.apache.whirr.command.Command (original)
+++ whirr/trunk/cli/src/main/resources/META-INF/services/org.apache.whirr.command.Command Wed Jan 25 15:19:29 2012
@@ -13,6 +13,7 @@ org.apache.whirr.cli.command.LaunchClust
org.apache.whirr.cli.command.ConfigureServicesCommand
org.apache.whirr.cli.command.StartServicesCommand
org.apache.whirr.cli.command.StopServicesCommand
+org.apache.whirr.cli.command.RestartServicesCommand
org.apache.whirr.cli.command.CleanupClusterCommand
org.apache.whirr.cli.command.DestroyClusterCommand
org.apache.whirr.cli.command.DestroyInstanceCommand