SMX4KNL-246: Add an osgi/restart command for a bundle

git-svn-id: https://svn.apache.org/repos/asf/servicemix/smx4/kernel/trunk@758301 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/RestartBundle.java b/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/RestartBundle.java
new file mode 100644
index 0000000..6793ecb
--- /dev/null
+++ b/gshell/gshell-osgi/src/main/java/org/apache/servicemix/kernel/gshell/osgi/RestartBundle.java
@@ -0,0 +1,28 @@
+/*
+ * 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.servicemix.kernel.gshell.osgi;
+
+import org.osgi.framework.Bundle;
+
+public class RestartBundle extends BundleCommand {
+
+    protected void doExecute(Bundle bundle) throws Exception {
+        bundle.stop();
+        bundle.start();
+    }
+
+}
\ No newline at end of file
diff --git a/gshell/gshell-osgi/src/main/resources/META-INF/spring/gshell-osgi.xml b/gshell/gshell-osgi/src/main/resources/META-INF/spring/gshell-osgi.xml
index 51e7336..7f06ebf 100644
--- a/gshell/gshell-osgi/src/main/resources/META-INF/spring/gshell-osgi.xml
+++ b/gshell/gshell-osgi/src/main/resources/META-INF/spring/gshell-osgi.xml
@@ -61,6 +61,9 @@
         <gshell:command name="osgi/resolve">
             <gshell:action class="org.apache.servicemix.kernel.gshell.osgi.ResolveBundle" />
         </gshell:command>
+        <gshell:command name="osgi/restart">
+            <gshell:action class="org.apache.servicemix.kernel.gshell.osgi.RestartBundle" />
+        </gshell:command>
         <gshell:command name="osgi/shutdown">
             <gshell:action class="org.apache.servicemix.kernel.gshell.osgi.Shutdown" />
         </gshell:command>
diff --git a/gshell/gshell-osgi/src/main/resources/org/apache/servicemix/kernel/gshell/osgi/RestartBundle.properties b/gshell/gshell-osgi/src/main/resources/org/apache/servicemix/kernel/gshell/osgi/RestartBundle.properties
new file mode 100644
index 0000000..762aa40
--- /dev/null
+++ b/gshell/gshell-osgi/src/main/resources/org/apache/servicemix/kernel/gshell/osgi/RestartBundle.properties
@@ -0,0 +1,27 @@
+##
+## 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.
+##
+
+##
+## $Rev: 703511 $ $Date: 2008-10-10 18:07:36 +0200 (Fri, 10 Oct 2008) $
+##
+
+command.description=Restart bundle
+
+command.manual=\
+  TODO: about manual
\ No newline at end of file