package com.worklight.location.internal.events.server;

import com.worklight.location.internal.events.storage.Chunk;
import com.worklight.wlclient.WLRequest;
import com.worklight.wlclient.WLRequestListener;
import com.worklight.wlclient.api.WLRequestOptions;
import java.util.Map;
import org.json.JSONArray;

public class EventServer
{
  private static final WLRequestListener EMPTY_LISTENER = new EmptyRequestListener();
  private final IWLRequestFactory factory;

  public EventServer(IWLRequestFactory paramIWLRequestFactory)
  {
    if (paramIWLRequestFactory == null)
      throw new IllegalArgumentException("factory is null");
    this.factory = paramIWLRequestFactory;
  }

  public void send(Chunk paramChunk)
  {
    send(paramChunk, EMPTY_LISTENER);
  }

  public void send(Chunk paramChunk, WLRequestListener paramWLRequestListener)
  {
    WLRequestOptions localWLRequestOptions = new WLRequestOptions();
    JSONArray localJSONArray = new JSONArray();
    for (int i = 0; i < paramChunk.numberOfEvents(); i++)
      localJSONArray.put(paramChunk.get(i));
    localWLRequestOptions.getParameters().put("events", localJSONArray.toString());
    this.factory.createWLRequest(paramWLRequestListener, localWLRequestOptions).makeRequest("events");
  }
}

/* Location:           C:\Documents and Settings\Cesar Cabello Cea\Mis documentos\Downloads\apk-downloader\com.ikea.kompis-6_dex2jar.jar
 * Qualified Name:     com.worklight.location.internal.events.server.EventServer
 * JD-Core Version:    0.6.2
 */