// Path: core/src/main/java/com/comcast/viper/flume2storm/event/F2SEvent.java
// public final class F2SEvent implements Serializable {
//   private static final long serialVersionUID = -5906404402187281472L;
//   private final Map<String, String> headers;
//   private final byte[] body;
// 
//   F2SEvent() {
//     headers = ImmutableMap.of();
//     body = new byte[0];
//   }
// 
//   /**
//    * Constructor to build Flume2Storm events
//    * 
//    * @param headers
//    *          See {@link #getHeaders()}. If null, the headers is an empty
//    *          immutable map.
//    * @param body
//    *          See {@link #getBody()}. If null, the payload of the event is an
//    *          empty byte array.
//    */
//   public F2SEvent(Map<String, String> headers, byte[] body) {
//     if (headers == null) {
//       this.headers = ImmutableMap.of();
//     } else {
//       this.headers = ImmutableMap.copyOf(headers);
//     }
//     if (body == null) {
//       this.body = ArrayUtils.EMPTY_BYTE_ARRAY;
//     } else {
//       this.body = ArrayUtils.clone(body);
//     }
//   }
// 
//   /**
//    * Copy constructor
//    * 
//    * @param event
//    *          Another Flume2Storm event
//    */
//   public F2SEvent(F2SEvent event) {
//     headers = ImmutableMap.copyOf(event.getHeaders());
//     body = event.body;
//   }
// 
//   /**
//    * @return The event body
//    */
//   public byte[] getBody() {
//     return body;
//   }
// 
//   /**
//    * @return The headers (key/value pairs) associated to the event
//    */
//   public Map<String, String> getHeaders() {
//     return headers;
//   }
// 
//   /**
//    * @param key
//    *          A header name (i.e. key)
//    * @return The value of the header, or null if it does not exist
//    */
//   public String getHeader(String key) {
//     return headers.get(key);
//   }
// 
//   /**
//    * @see java.lang.Object#hashCode()
//    */
//   @Override
//   public int hashCode() {
//     return new HashCodeBuilder().append(headers).append(body).hashCode();
//   }
// 
//   /**
//    * @see java.lang.Object#equals(java.lang.Object)
//    */
//   @Override
//   public boolean equals(Object obj) {
//     if (this == obj)
//       return true;
//     if (obj == null)
//       return false;
//     if (getClass() != obj.getClass())
//       return false;
//     F2SEvent other = (F2SEvent) obj;
//     return new EqualsBuilder().append(this.headers, other.headers)
//         .append(this.body, other.body).isEquals();
//   }
// 
//   /**
//    * @see java.lang.Object#toString()
//    */
//   @Override
//   public String toString() {
//     ToStringBuilder toStringBuilder = new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("headers",
//         headers);
//     String bodyStr = StringUtils.toEncodedString(body, F2SEventFactory.DEFAULT_CHARACTER_SET);
//     if (StringUtils.isAsciiPrintable(bodyStr)) {
//       toStringBuilder.append("body", bodyStr);
//     } else {
//       toStringBuilder.append(Hex.encodeHexString(body));
//     }
//     return toStringBuilder.toString();
//   }
// }


import com.comcast.viper.flume2storm.event.F2SEvent;
import com.esotericsoftware.kryo.Kryo;
/**
 * Copyright 2014 Comcast Cable Communications Management, LLC
 *
 * 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.comcast.viper.flume2storm;


/**
 * Common utilities for Kryo serialization of Flume2Storm event
 */
public class KryoUtil {
  /**
   * Registers to the Kryo instance provided the classes needed for Flume2Storm
   * 
   * @param kryo
   *          A Kryo instance
   */
  public static void register(final Kryo kryo) {
    kryo.register(byte[].class);
// Path: core/src/main/java/com/comcast/viper/flume2storm/event/F2SEvent.java
// public final class F2SEvent implements Serializable {
//   private static final long serialVersionUID = -5906404402187281472L;
//   private final Map<String, String> headers;
//   private final byte[] body;
// 
//   F2SEvent() {
//     headers = ImmutableMap.of();
//     body = new byte[0];
//   }
// 
//   /**
//    * Constructor to build Flume2Storm events
//    * 
//    * @param headers
//    *          See {@link #getHeaders()}. If null, the headers is an empty
//    *          immutable map.
//    * @param body
//    *          See {@link #getBody()}. If null, the payload of the event is an
//    *          empty byte array.
//    */
//   public F2SEvent(Map<String, String> headers, byte[] body) {
//     if (headers == null) {
//       this.headers = ImmutableMap.of();
//     } else {
//       this.headers = ImmutableMap.copyOf(headers);
//     }
//     if (body == null) {
//       this.body = ArrayUtils.EMPTY_BYTE_ARRAY;
//     } else {
//       this.body = ArrayUtils.clone(body);
//     }
//   }
// 
//   /**
//    * Copy constructor
//    * 
//    * @param event
//    *          Another Flume2Storm event
//    */
//   public F2SEvent(F2SEvent event) {
//     headers = ImmutableMap.copyOf(event.getHeaders());
//     body = event.body;
//   }
// 
//   /**
//    * @return The event body
//    */
//   public byte[] getBody() {
//     return body;
//   }
// 
//   /**
//    * @return The headers (key/value pairs) associated to the event
//    */
//   public Map<String, String> getHeaders() {
//     return headers;
//   }
// 
//   /**
//    * @param key
//    *          A header name (i.e. key)
//    * @return The value of the header, or null if it does not exist
//    */
//   public String getHeader(String key) {
//     return headers.get(key);
//   }
// 
//   /**
//    * @see java.lang.Object#hashCode()
//    */
//   @Override
//   public int hashCode() {
//     return new HashCodeBuilder().append(headers).append(body).hashCode();
//   }
// 
//   /**
//    * @see java.lang.Object#equals(java.lang.Object)
//    */
//   @Override
//   public boolean equals(Object obj) {
//     if (this == obj)
//       return true;
//     if (obj == null)
//       return false;
//     if (getClass() != obj.getClass())
//       return false;
//     F2SEvent other = (F2SEvent) obj;
//     return new EqualsBuilder().append(this.headers, other.headers)
//         .append(this.body, other.body).isEquals();
//   }
// 
//   /**
//    * @see java.lang.Object#toString()
//    */
//   @Override
//   public String toString() {
//     ToStringBuilder toStringBuilder = new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("headers",
//         headers);
//     String bodyStr = StringUtils.toEncodedString(body, F2SEventFactory.DEFAULT_CHARACTER_SET);
//     if (StringUtils.isAsciiPrintable(bodyStr)) {
//       toStringBuilder.append("body", bodyStr);
//     } else {
//       toStringBuilder.append(Hex.encodeHexString(body));
//     }
//     return toStringBuilder.toString();
//   }
// }


// Path: kryo-utils/src/main/java/com/comcast/viper/flume2storm/KryoUtil.java
import com.comcast.viper.flume2storm.event.F2SEvent;
import com.esotericsoftware.kryo.Kryo;

/**
 * Copyright 2014 Comcast Cable Communications Management, LLC
 *
 * 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.comcast.viper.flume2storm;


/**
 * Common utilities for Kryo serialization of Flume2Storm event
 */
public class KryoUtil {
  /**
   * Registers to the Kryo instance provided the classes needed for Flume2Storm
   * 
   * @param kryo
   *          A Kryo instance
   */
  public static void register(final Kryo kryo) {
    kryo.register(byte[].class);
    kryo.register(F2SEvent.class, new F2SEventSerializer());