// Path: src/main/java/com/homeadvisor/kafdrop/model/BrokerVO.java
// public class BrokerVO
// {
//    private int id;
//    private String host;
//    private int port;
//    private int jmxPort;
//    private int version;
//    private boolean controller;
//    private Date timestamp;
//    private String rack;
// 
//    public BrokerVO()
//    {
//    }
// 
//    public int getId()
//    {
//       return id;
//    }
// 
//    public void setId(int id)
//    {
//       this.id = id;
//    }
// 
//    public String getHost()
//    {
//       return host;
//    }
// 
//    public void setHost(String host)
//    {
//       this.host = host;
//    }
// 
//    public int getPort()
//    {
//       return port;
//    }
// 
//    public void setPort(int port)
//    {
//       this.port = port;
//    }
// 
//    public int getJmxPort()
//    {
//       return jmxPort;
//    }
// 
//    @JsonProperty("jmx_port")
//    public void setJmxPort(int jmxPort)
//    {
//       this.jmxPort = jmxPort;
//    }
// 
//    public int getVersion()
//    {
//       return version;
//    }
// 
//    public void setVersion(int version)
//    {
//       this.version = version;
//    }
// 
//    public Date getTimestamp()
//    {
//       return timestamp;
//    }
// 
//    public void setTimestamp(Date timestamp)
//    {
//       this.timestamp = timestamp;
//    }
// 
//    public boolean isController()
//    {
//       return controller;
//    }
// 
//    public void setController(boolean controller)
//    {
//       this.controller = controller;
//    }
// 
//    public String getRack()
//    {
//       return rack;
//    }
// 
//    public void setRack(String rack)
//    {
//       this.rack = rack;
//    }
// }
// 
// Path: src/main/java/com/homeadvisor/kafdrop/service/BrokerNotFoundException.java
// @ResponseStatus(HttpStatus.NOT_FOUND)
// public class BrokerNotFoundException extends RuntimeException
// {
//    public BrokerNotFoundException()
//    {
//    }
// 
//    public BrokerNotFoundException(String message)
//    {
//       super(message);
//    }
// }
// 
// Path: src/main/java/com/homeadvisor/kafdrop/service/KafkaMonitor.java
// public interface KafkaMonitor
// {
//    List<BrokerVO> getBrokers();
// 
//    Optional<BrokerVO> getBroker(int id);
// 
//    default Optional<BrokerConfigurationVO> getBrokerConfiguration(int id)
//    {
//       return Optional.empty();
//    }
// 
//    List<TopicVO> getTopics();
// 
//    Optional<TopicVO> getTopic(String topic);
// 
//    ClusterSummaryVO getClusterSummary(Collection<TopicVO> topics);
// 
//    List<ConsumerVO> getConsumers(TopicVO topic);
// 
//    Optional<ConsumerVO> getConsumer(String groupId);
// 
//    Optional<ConsumerVO> getConsumerByTopic(String groupId, TopicVO topic);
// }


import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
import com.homeadvisor.kafdrop.model.BrokerVO;
import com.homeadvisor.kafdrop.service.BrokerNotFoundException;
import com.homeadvisor.kafdrop.service.KafkaMonitor;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
/*
 * Copyright 2017 HomeAdvisor, Inc.
 *
 * Licensed 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 com.homeadvisor.kafdrop.controller;



@Controller
public class BrokerController
{
   @Autowired
   private KafkaMonitor kafkaMonitor;

   @RequestMapping("/broker/{id}")
   public String brokerDetails(@PathVariable("id") int brokerId, Model model)
   {
      model.addAttribute("broker", kafkaMonitor.getBroker(brokerId)
// Path: src/main/java/com/homeadvisor/kafdrop/model/BrokerVO.java
// public class BrokerVO
// {
//    private int id;
//    private String host;
//    private int port;
//    private int jmxPort;
//    private int version;
//    private boolean controller;
//    private Date timestamp;
//    private String rack;
// 
//    public BrokerVO()
//    {
//    }
// 
//    public int getId()
//    {
//       return id;
//    }
// 
//    public void setId(int id)
//    {
//       this.id = id;
//    }
// 
//    public String getHost()
//    {
//       return host;
//    }
// 
//    public void setHost(String host)
//    {
//       this.host = host;
//    }
// 
//    public int getPort()
//    {
//       return port;
//    }
// 
//    public void setPort(int port)
//    {
//       this.port = port;
//    }
// 
//    public int getJmxPort()
//    {
//       return jmxPort;
//    }
// 
//    @JsonProperty("jmx_port")
//    public void setJmxPort(int jmxPort)
//    {
//       this.jmxPort = jmxPort;
//    }
// 
//    public int getVersion()
//    {
//       return version;
//    }
// 
//    public void setVersion(int version)
//    {
//       this.version = version;
//    }
// 
//    public Date getTimestamp()
//    {
//       return timestamp;
//    }
// 
//    public void setTimestamp(Date timestamp)
//    {
//       this.timestamp = timestamp;
//    }
// 
//    public boolean isController()
//    {
//       return controller;
//    }
// 
//    public void setController(boolean controller)
//    {
//       this.controller = controller;
//    }
// 
//    public String getRack()
//    {
//       return rack;
//    }
// 
//    public void setRack(String rack)
//    {
//       this.rack = rack;
//    }
// }
// 
// Path: src/main/java/com/homeadvisor/kafdrop/service/BrokerNotFoundException.java
// @ResponseStatus(HttpStatus.NOT_FOUND)
// public class BrokerNotFoundException extends RuntimeException
// {
//    public BrokerNotFoundException()
//    {
//    }
// 
//    public BrokerNotFoundException(String message)
//    {
//       super(message);
//    }
// }
// 
// Path: src/main/java/com/homeadvisor/kafdrop/service/KafkaMonitor.java
// public interface KafkaMonitor
// {
//    List<BrokerVO> getBrokers();
// 
//    Optional<BrokerVO> getBroker(int id);
// 
//    default Optional<BrokerConfigurationVO> getBrokerConfiguration(int id)
//    {
//       return Optional.empty();
//    }
// 
//    List<TopicVO> getTopics();
// 
//    Optional<TopicVO> getTopic(String topic);
// 
//    ClusterSummaryVO getClusterSummary(Collection<TopicVO> topics);
// 
//    List<ConsumerVO> getConsumers(TopicVO topic);
// 
//    Optional<ConsumerVO> getConsumer(String groupId);
// 
//    Optional<ConsumerVO> getConsumerByTopic(String groupId, TopicVO topic);
// }


// Path: src/main/java/com/homeadvisor/kafdrop/controller/BrokerController.java
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
import com.homeadvisor.kafdrop.model.BrokerVO;
import com.homeadvisor.kafdrop.service.BrokerNotFoundException;
import com.homeadvisor.kafdrop.service.KafkaMonitor;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/*
 * Copyright 2017 HomeAdvisor, Inc.
 *
 * Licensed 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 com.homeadvisor.kafdrop.controller;



@Controller
public class BrokerController
{
   @Autowired
   private KafkaMonitor kafkaMonitor;

   @RequestMapping("/broker/{id}")
   public String brokerDetails(@PathVariable("id") int brokerId, Model model)
   {
      model.addAttribute("broker", kafkaMonitor.getBroker(brokerId)
         .orElseThrow(() -> new BrokerNotFoundException(String.valueOf(brokerId))));