Eliminate blueprint for openflowplugins-impl karaf commands
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / karaf / ResetSessionStatsComandProvider.java
index db383c6af413e7cacee7e5f2d44ef330eb0f216b..f1da8c6d156f18f579570ee6520b7eb39c241e17 100644 (file)
@@ -5,25 +5,28 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.openflowplugin.impl.karaf;
 
-import java.io.PrintStream;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.console.OsgiCommandSupport;
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.console.Session;
 import org.opendaylight.openflowplugin.impl.statistics.ofpspecific.SessionStatistics;
 
 /**
  * Created by Martin Bobak <mbobak@cisco.com> on 28.5.2015.
  */
 @Command(scope = "ofp", name = "reset-session-stats", description = "Resets session statistics counters.")
-public class ResetSessionStatsComandProvider extends OsgiCommandSupport {
+@Service
+public class ResetSessionStatsComandProvider implements Action {
+    @Reference
+    Session session;
 
     @Override
-    protected Object doExecute() {
-        PrintStream out = session.getConsole();
+    public Object execute() {
         SessionStatistics.resetAllCounters();
-        out.print("Session statistics counters reset.\n");
+        session.getConsole().println("Session statistics counters reset.");
         return null;
     }
 }