// Path: appender-core/src/main/java/com/van/logging/Event.java
// public class Event implements Serializable {
// 
//     static final long serialVersionUID = 1000L;
// 
//     private final String source;
//     private final String type;
//     private final String threadName;
// 
//     private final String message;
// 
//     public Event(String source, String type, String message) {
//         this(source, type, message, Thread.currentThread().getName());
//     }
// 
//     public Event(String source, String type, String message, String threadName) {
//         Objects.requireNonNull(source);
//         Objects.requireNonNull(type);
//         Objects.requireNonNull(message);
//         Objects.requireNonNull(threadName);
//         this.source = source;
//         this.type = type;
//         this.threadName = threadName;
//         this.message = message;
//     }
// 
//     public String getSource() {
//         return source;
//     }
// 
//     public String getType() {
//         return type;
//     }
// 
//     public String getThreadName() {
//         return threadName;
//     }
// 
//     public String getMessage() {
//         return message;
//     }
// 
//     @Override
//     public String toString() {
//         return String.format("%s %s:%s:%s", threadName, source, type, message);
//     }
// }
// 
// Path: appender-core/src/main/java/com/van/logging/IPublishHelper.java
// public interface IPublishHelper<T> {
//     /**
//      * A publish batch is starting.  This is a good place to (re)initialize
//      * a buffer.
//      *
//      * @param context publish context providing useful properties for the
//      * publish operation
//      */
//     void start(PublishContext context);
// 
//     /**
//      * A log event should be published.  Implementations may want to accumulate
//      * this in a batch until {{@link #end(PublishContext)}
//      *
//      * @param context publish context providing useful properties for the
//      * publish operation
//      * @param sequence counter of the sequence of this event in the batch
//      * @param event the log event
//      */
//     void publish(PublishContext context, int sequence, T event);
// 
//     /**
//      * A publish batch has ended.  Implementations should conclude a batch
//      * and clean up resources here.
//      *
//      * @param context publish context providing useful properties for the
//      * publish operation
//      */
//     void end(PublishContext context);
// }
// 
// Path: appender-core/src/main/java/com/van/logging/PublishContext.java
// public class PublishContext {
//     private final String cacheName;
//     private final String hostName;
//     private final String[] tags;
// 
//     /**
//      * Creates an instance with the data provided
//      *
//      * @param cacheName name of the cache used to distinguish it from other caches
//      * @param hostName the host name where the logs are collected (typically
//      * 	the name of the local host)
//      * @param tags additional tags for the event that the logger was initialized with
//      */
//     public PublishContext(String cacheName, String hostName, String[] tags) {
//         this.cacheName = cacheName;
//         this.hostName = hostName;
//         this.tags = tags;
//     }
// 
//     public String getCacheName() {
//         return cacheName;
//     }
// 
//     public String getHostName() {
//         return hostName;
//     }
// 
//     public String[] getTags() {
//         return tags;
//     }
// 
// }


import com.van.logging.Event;
import com.van.logging.IPublishHelper;
import com.van.logging.PublishContext;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.apache.solr.common.SolrInputDocument;
import java.net.URL;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
package com.van.logging.solr;




/**
 * Publish helper to publish logs to Solr
 *
 * @author vly
 *
 */
public class SolrPublishHelper implements IPublishHelper<Event> {
    private final SolrClient client;

    private int offset;
    private Date timeStamp;
    private List<SolrInputDocument> docs;

    public SolrPublishHelper(URL collectionUrl) {
        this.client = new HttpSolrClient.Builder()
            .withBaseSolrUrl(collectionUrl.toExternalForm())
            .build();
    }

// Path: appender-core/src/main/java/com/van/logging/Event.java
// public class Event implements Serializable {
// 
//     static final long serialVersionUID = 1000L;
// 
//     private final String source;
//     private final String type;
//     private final String threadName;
// 
//     private final String message;
// 
//     public Event(String source, String type, String message) {
//         this(source, type, message, Thread.currentThread().getName());
//     }
// 
//     public Event(String source, String type, String message, String threadName) {
//         Objects.requireNonNull(source);
//         Objects.requireNonNull(type);
//         Objects.requireNonNull(message);
//         Objects.requireNonNull(threadName);
//         this.source = source;
//         this.type = type;
//         this.threadName = threadName;
//         this.message = message;
//     }
// 
//     public String getSource() {
//         return source;
//     }
// 
//     public String getType() {
//         return type;
//     }
// 
//     public String getThreadName() {
//         return threadName;
//     }
// 
//     public String getMessage() {
//         return message;
//     }
// 
//     @Override
//     public String toString() {
//         return String.format("%s %s:%s:%s", threadName, source, type, message);
//     }
// }
// 
// Path: appender-core/src/main/java/com/van/logging/IPublishHelper.java
// public interface IPublishHelper<T> {
//     /**
//      * A publish batch is starting.  This is a good place to (re)initialize
//      * a buffer.
//      *
//      * @param context publish context providing useful properties for the
//      * publish operation
//      */
//     void start(PublishContext context);
// 
//     /**
//      * A log event should be published.  Implementations may want to accumulate
//      * this in a batch until {{@link #end(PublishContext)}
//      *
//      * @param context publish context providing useful properties for the
//      * publish operation
//      * @param sequence counter of the sequence of this event in the batch
//      * @param event the log event
//      */
//     void publish(PublishContext context, int sequence, T event);
// 
//     /**
//      * A publish batch has ended.  Implementations should conclude a batch
//      * and clean up resources here.
//      *
//      * @param context publish context providing useful properties for the
//      * publish operation
//      */
//     void end(PublishContext context);
// }
// 
// Path: appender-core/src/main/java/com/van/logging/PublishContext.java
// public class PublishContext {
//     private final String cacheName;
//     private final String hostName;
//     private final String[] tags;
// 
//     /**
//      * Creates an instance with the data provided
//      *
//      * @param cacheName name of the cache used to distinguish it from other caches
//      * @param hostName the host name where the logs are collected (typically
//      * 	the name of the local host)
//      * @param tags additional tags for the event that the logger was initialized with
//      */
//     public PublishContext(String cacheName, String hostName, String[] tags) {
//         this.cacheName = cacheName;
//         this.hostName = hostName;
//         this.tags = tags;
//     }
// 
//     public String getCacheName() {
//         return cacheName;
//     }
// 
//     public String getHostName() {
//         return hostName;
//     }
// 
//     public String[] getTags() {
//         return tags;
//     }
// 
// }


// Path: appender-core/src/main/java/com/van/logging/solr/SolrPublishHelper.java
import com.van.logging.Event;
import com.van.logging.IPublishHelper;
import com.van.logging.PublishContext;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.apache.solr.common.SolrInputDocument;
import java.net.URL;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;

package com.van.logging.solr;




/**
 * Publish helper to publish logs to Solr
 *
 * @author vly
 *
 */
public class SolrPublishHelper implements IPublishHelper<Event> {
    private final SolrClient client;

    private int offset;
    private Date timeStamp;
    private List<SolrInputDocument> docs;

    public SolrPublishHelper(URL collectionUrl) {
        this.client = new HttpSolrClient.Builder()
            .withBaseSolrUrl(collectionUrl.toExternalForm())
            .build();
    }

    public void publish(PublishContext context, int sequence, Event event) {