Simplify event publishing

Eliminate Session interface as there is only one implementation class
currently exists (KafkaSession) and use it directly.

Change-Id: I437ce3cdc6a09c6aadf2c770b754883cd7afcacb
diff --git a/src/main/java/com/googlesource/gerrit/plugins/kafka/message/Publisher.java b/src/main/java/com/googlesource/gerrit/plugins/kafka/message/Publisher.java
index 99d2943..7fa4752 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/kafka/message/Publisher.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/kafka/message/Publisher.java
@@ -21,12 +21,12 @@
 import com.google.inject.assistedinject.Assisted;
 
 import com.googlesource.gerrit.plugins.kafka.config.KafkaProperties;
-import com.googlesource.gerrit.plugins.kafka.session.Session;
+import com.googlesource.gerrit.plugins.kafka.session.KafkaSession;
 import com.googlesource.gerrit.plugins.kafka.session.SessionFactoryProvider;
 
 public class Publisher implements EventListener {
 
-  private final Session session;
+  private final KafkaSession session;
   private final KafkaProperties properties;
   private final Gson gson;
   private boolean available = true;
@@ -72,7 +72,7 @@
     return available;
   }
 
-  public Session getSession() {
+  public KafkaSession getSession() {
     return session;
   }
 
diff --git a/src/main/java/com/googlesource/gerrit/plugins/kafka/session/KafkaSession.java b/src/main/java/com/googlesource/gerrit/plugins/kafka/session/KafkaSession.java
index b2c714a..9b7717d 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/kafka/session/KafkaSession.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/kafka/session/KafkaSession.java
@@ -21,7 +21,7 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public final class KafkaSession implements Session {
+public final class KafkaSession {
 
   private static final Logger LOGGER = LoggerFactory
       .getLogger(KafkaSession.class);
@@ -32,7 +32,6 @@
     this.properties = properties;
   }
 
-  @Override
   public boolean isOpen() {
     if (producer != null) {
       return true;
@@ -40,7 +39,6 @@
     return false;
   }
 
-  @Override
   public void connect() {
     if (isOpen()) {
       LOGGER.debug("Already connected.");
@@ -59,7 +57,6 @@
         KafkaSession.class.getClassLoader());
   }
 
-  @Override
   public void disconnect() {
     LOGGER.info("Disconnecting...");
     if (producer != null) {
@@ -69,7 +66,6 @@
     producer = null;
   }
 
-  @Override
   public void publish(String messageBody) {
     producer.send(new ProducerRecord<>(properties.getTopic(), "" + System.nanoTime(),
         messageBody));
diff --git a/src/main/java/com/googlesource/gerrit/plugins/kafka/session/KafkaSessionFactory.java b/src/main/java/com/googlesource/gerrit/plugins/kafka/session/KafkaSessionFactory.java
index 6260ad3..3a13721 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/kafka/session/KafkaSessionFactory.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/kafka/session/KafkaSessionFactory.java
@@ -17,7 +17,7 @@
 import com.googlesource.gerrit.plugins.kafka.config.KafkaProperties;
 
 public class KafkaSessionFactory {
-  public Session create(KafkaProperties properties) {
+  public KafkaSession create(KafkaProperties properties) {
     return new KafkaSession(properties);
   }
 }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/kafka/session/Session.java b/src/main/java/com/googlesource/gerrit/plugins/kafka/session/Session.java
deleted file mode 100644
index fc8b9ff..0000000
--- a/src/main/java/com/googlesource/gerrit/plugins/kafka/session/Session.java
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (C) 2016 The Android Open Source Project
-//
-// 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.googlesource.gerrit.plugins.kafka.session;
-
-public interface Session {
-  boolean isOpen();
-  void connect();
-  void disconnect();
-  void publish(String message);
-}