Package net.lr.tutorial.karaf.vote.command.impl

Source Code of net.lr.tutorial.karaf.vote.command.impl.VoteStats

package net.lr.tutorial.karaf.vote.command.impl;

import net.lr.tutorial.karaf.vote.model.VoteService;
import net.lr.tutorial.karaf.vote.model.Voting;

import org.apache.felix.gogo.commands.Argument;
import org.apache.felix.gogo.commands.Command;
import org.apache.karaf.shell.console.OsgiCommandSupport;


/**
* Displays the last log entries
*/
@Command(scope = "vote", name = "stats", description = "list existing votes")
public class VoteStats extends OsgiCommandSupport {
  protected VoteService voteService;
 
  @Argument(index = 0, name="topic", description = "Voting topic to show", required = true, multiValued = false)
  private String topic;

    public void setVoteService(VoteService voteService) {
    this.voteService = voteService;
  }

  protected Object doExecute() throws Exception {
         System.out.println("Executing command list");
         Voting voting = voteService.getVoting(topic);
         System.out.println(voting.getStats());
         return null;
    }
}
TOP

Related Classes of net.lr.tutorial.karaf.vote.command.impl.VoteStats

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.