You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2013/11/15 14:02:21 UTC
svn commit: r1542253 - in /karaf/trunk/instance/command/src/main:
java/org/apache/karaf/instance/command/StatusCommand.java
java/org/apache/karaf/instance/main/Execute.java
resources/OSGI-INF/blueprint/instance-command.xml
Author: jbonofre
Date: Fri Nov 15 13:02:21 2013
New Revision: 1542253
URL: http://svn.apache.org/r1542253
Log:
[KARAF-2576] Add instance:status command
Added:
karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/command/StatusCommand.java
Modified:
karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/main/Execute.java
karaf/trunk/instance/command/src/main/resources/OSGI-INF/blueprint/instance-command.xml
Added: karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/command/StatusCommand.java
URL: http://svn.apache.org/viewvc/karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/command/StatusCommand.java?rev=1542253&view=auto
==============================================================================
--- karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/command/StatusCommand.java (added)
+++ karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/command/StatusCommand.java Fri Nov 15 13:02:21 2013
@@ -0,0 +1,36 @@
+/*
+ * 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.karaf.instance.command;
+
+import org.apache.karaf.instance.core.Instance;
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.commands.Option;
+
+@Command(scope = "instance", name = "status", description = "Check the current status of an instance.")
+public class StatusCommand extends InstanceCommandSupport {
+
+ @Argument(index = 0, name = "name", description = "The name of the instance", required = true, multiValued = false)
+ private String name;
+
+ protected Object doExecute() throws Exception {
+ Instance instance = getExistingInstance(name);
+ System.out.println(instance.getState());
+ return null;
+ }
+
+}
Modified: karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/main/Execute.java
URL: http://svn.apache.org/viewvc/karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/main/Execute.java?rev=1542253&r1=1542252&r2=1542253&view=diff
==============================================================================
--- karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/main/Execute.java (original)
+++ karaf/trunk/instance/command/src/main/java/org/apache/karaf/instance/main/Execute.java Fri Nov 15 13:02:21 2013
@@ -44,6 +44,7 @@ public class Execute {
ListCommand.class,
RenameCommand.class,
StartCommand.class,
+ StatusCommand.class,
StopCommand.class};
private static final Map<String, Class<?>> COMMANDS = new TreeMap<String, Class<?>>();
Modified: karaf/trunk/instance/command/src/main/resources/OSGI-INF/blueprint/instance-command.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/instance/command/src/main/resources/OSGI-INF/blueprint/instance-command.xml?rev=1542253&r1=1542252&r2=1542253&view=diff
==============================================================================
--- karaf/trunk/instance/command/src/main/resources/OSGI-INF/blueprint/instance-command.xml (original)
+++ karaf/trunk/instance/command/src/main/resources/OSGI-INF/blueprint/instance-command.xml Fri Nov 15 13:02:21 2013
@@ -125,6 +125,15 @@
<null/>
</completers>
</command>
+ <command>
+ <action class="org.apache.karaf.instance.command.StatusCommand">
+ <property name="instanceService" ref="instanceService" />
+ </action>
+ <completers>
+ <ref component-id="instanceCompleter" />
+ <null/>
+ </completers>
+ </command>
</command-bundle>
<reference id="instanceService" interface="org.apache.karaf.instance.core.InstanceService" />