package com.ikea.publishingplatform.service;

import android.content.Context;
import android.os.Handler;
import android.util.Log;
import com.ikea.publishingplatform.model.BaseResponse;
import java.net.HttpURLConnection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.ExecutorService;

public abstract class PublishingPlatformBaseService
{
  protected Context mContext;
  protected final ExecutorService mExecutorService = AppExecutors.stdPrio();
  protected Handler mHandler = new Handler();

  protected PublishingPlatformBaseService(Context paramContext)
  {
    this.mContext = paramContext;
  }

  public class NetworkCaller<T extends BaseResponse>
  {
    private final Class<T> type;

    public NetworkCaller(Context arg2)
    {
      Object localObject;
      this.type = localObject;
    }

    private void addHeaders(HttpURLConnection paramHttpURLConnection, PublishingPlatformRequest paramPublishingPlatformRequest)
    {
      HashMap localHashMap = paramPublishingPlatformRequest.getHeader();
      if ((localHashMap != null) && (!localHashMap.isEmpty()))
      {
        Iterator localIterator = localHashMap.keySet().iterator();
        while (localIterator.hasNext())
        {
          String str = (String)localIterator.next();
          paramHttpURLConnection.setRequestProperty(str, (String)localHashMap.get(str));
        }
      }
    }

    private void dumpHeader(HttpURLConnection paramHttpURLConnection)
    {
      Iterator localIterator = paramHttpURLConnection.getHeaderFields().entrySet().iterator();
      while (localIterator.hasNext())
      {
        Map.Entry localEntry = (Map.Entry)localIterator.next();
        Log.v("Tag", "header Key : " + (String)localEntry.getKey() + " ,Value : " + localEntry.getValue());
      }
    }

    // ERROR //
    public T execute(PublishingPlatformRequest paramPublishingPlatformRequest)
      throws java.lang.Exception
    {
      // Byte code:
      //   0: aconst_null
      //   1: astore_2
      //   2: aconst_null
      //   3: astore_3
      //   4: aconst_null
      //   5: astore 4
      //   7: aconst_null
      //   8: astore 5
      //   10: aconst_null
      //   11: astore 6
      //   13: aload_1
      //   14: invokevirtual 116	com/ikea/publishingplatform/service/PublishingPlatformRequest:isBatchRequest	()Z
      //   17: istore 8
      //   19: aconst_null
      //   20: astore 5
      //   22: aconst_null
      //   23: astore 4
      //   25: aconst_null
      //   26: astore_2
      //   27: aconst_null
      //   28: astore_3
      //   29: aconst_null
      //   30: astore 6
      //   32: iload 8
      //   34: ifne +6 -> 40
      //   37: invokestatic 121	java/lang/System:gc	()V
      //   40: aload_1
      //   41: invokevirtual 124	com/ikea/publishingplatform/service/PublishingPlatformRequest:getURI	()Ljava/lang/String;
      //   44: astore 9
      //   46: new 81	java/lang/StringBuilder
      //   49: dup
      //   50: invokespecial 82	java/lang/StringBuilder:<init>	()V
      //   53: aload_0
      //   54: invokevirtual 128	java/lang/Object:getClass	()Ljava/lang/Class;
      //   57: invokevirtual 133	java/lang/Class:getName	()Ljava/lang/String;
      //   60: invokevirtual 88	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
      //   63: ldc 135
      //   65: invokevirtual 88	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
      //   68: invokevirtual 103	java/lang/StringBuilder:toString	()Ljava/lang/String;
      //   71: aload 9
      //   73: invokestatic 109	android/util/Log:v	(Ljava/lang/String;Ljava/lang/String;)I
      //   76: pop
      //   77: new 137	java/net/URL
      //   80: dup
      //   81: aload 9
      //   83: invokespecial 140	java/net/URL:<init>	(Ljava/lang/String;)V
      //   86: invokevirtual 144	java/net/URL:openConnection	()Ljava/net/URLConnection;
      //   89: checkcast 60	java/net/HttpURLConnection
      //   92: astore 4
      //   94: aload 4
      //   96: aload_1
      //   97: invokevirtual 147	com/ikea/publishingplatform/service/PublishingPlatformRequest:getHttpRequestType	()Ljava/lang/String;
      //   100: invokevirtual 150	java/net/HttpURLConnection:setRequestMethod	(Ljava/lang/String;)V
      //   103: aload 4
      //   105: ldc 152
      //   107: ldc 154
      //   109: invokevirtual 157	java/net/HttpURLConnection:addRequestProperty	(Ljava/lang/String;Ljava/lang/String;)V
      //   112: aload 4
      //   114: ldc 152
      //   116: ldc 159
      //   118: invokevirtual 157	java/net/HttpURLConnection:addRequestProperty	(Ljava/lang/String;Ljava/lang/String;)V
      //   121: aload 4
      //   123: ldc 160
      //   125: invokevirtual 164	java/net/HttpURLConnection:setConnectTimeout	(I)V
      //   128: aload 4
      //   130: ldc 160
      //   132: invokevirtual 167	java/net/HttpURLConnection:setReadTimeout	(I)V
      //   135: aload_0
      //   136: aload 4
      //   138: aload_1
      //   139: invokespecial 169	com/ikea/publishingplatform/service/PublishingPlatformBaseService$NetworkCaller:addHeaders	(Ljava/net/HttpURLConnection;Lcom/ikea/publishingplatform/service/PublishingPlatformRequest;)V
      //   142: ldc 171
      //   144: aload_1
      //   145: invokevirtual 147	com/ikea/publishingplatform/service/PublishingPlatformRequest:getHttpRequestType	()Ljava/lang/String;
      //   148: invokevirtual 175	java/lang/String:equals	(Ljava/lang/Object;)Z
      //   151: istore 11
      //   153: aconst_null
      //   154: astore 5
      //   156: aconst_null
      //   157: astore_2
      //   158: aconst_null
      //   159: astore_3
      //   160: aconst_null
      //   161: astore 6
      //   163: iload 11
      //   165: ifeq +94 -> 259
      //   168: aload_1
      //   169: invokevirtual 178	com/ikea/publishingplatform/service/PublishingPlatformRequest:getPostData	()Ljava/lang/String;
      //   172: astore 12
      //   174: aconst_null
      //   175: astore 5
      //   177: aconst_null
      //   178: astore_2
      //   179: aconst_null
      //   180: astore_3
      //   181: aconst_null
      //   182: astore 6
      //   184: aload 12
      //   186: ifnull +73 -> 259
      //   189: aload_1
      //   190: invokevirtual 178	com/ikea/publishingplatform/service/PublishingPlatformRequest:getPostData	()Ljava/lang/String;
      //   193: ldc 180
      //   195: invokevirtual 184	java/lang/String:getBytes	(Ljava/lang/String;)[B
      //   198: astore 13
      //   200: aload 4
      //   202: ldc 186
      //   204: new 81	java/lang/StringBuilder
      //   207: dup
      //   208: invokespecial 82	java/lang/StringBuilder:<init>	()V
      //   211: ldc 188
      //   213: invokevirtual 88	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
      //   216: aload 13
      //   218: arraylength
      //   219: invokestatic 193	java/lang/Integer:toString	(I)Ljava/lang/String;
      //   222: invokevirtual 88	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
      //   225: invokevirtual 103	java/lang/StringBuilder:toString	()Ljava/lang/String;
      //   228: invokevirtual 64	java/net/HttpURLConnection:setRequestProperty	(Ljava/lang/String;Ljava/lang/String;)V
      //   231: aload 4
      //   233: iconst_1
      //   234: invokevirtual 197	java/net/HttpURLConnection:setDoOutput	(Z)V
      //   237: aload 4
      //   239: iconst_1
      //   240: invokevirtual 200	java/net/HttpURLConnection:setDoInput	(Z)V
      //   243: aload 4
      //   245: invokevirtual 204	java/net/HttpURLConnection:getOutputStream	()Ljava/io/OutputStream;
      //   248: astore_3
      //   249: aload_3
      //   250: aload 13
      //   252: invokevirtual 210	java/io/OutputStream:write	([B)V
      //   255: aload_3
      //   256: invokevirtual 213	java/io/OutputStream:flush	()V
      //   259: aload 4
      //   261: invokevirtual 217	java/net/HttpURLConnection:getResponseCode	()I
      //   264: istore 14
      //   266: iload 14
      //   268: sipush 200
      //   271: if_icmplt +155 -> 426
      //   274: iload 14
      //   276: sipush 300
      //   279: if_icmpge +147 -> 426
      //   282: iconst_1
      //   283: istore 15
      //   285: aconst_null
      //   286: astore 5
      //   288: aconst_null
      //   289: astore_2
      //   290: aconst_null
      //   291: astore 6
      //   293: iload 15
      //   295: ifeq +137 -> 432
      //   298: aload 4
      //   300: invokevirtual 221	java/net/HttpURLConnection:getInputStream	()Ljava/io/InputStream;
      //   303: astore_2
      //   304: new 223	com/google/gson/GsonBuilder
      //   307: dup
      //   308: invokespecial 224	com/google/gson/GsonBuilder:<init>	()V
      //   311: invokevirtual 228	com/google/gson/GsonBuilder:setPrettyPrinting	()Lcom/google/gson/GsonBuilder;
      //   314: invokevirtual 232	com/google/gson/GsonBuilder:create	()Lcom/google/gson/Gson;
      //   317: astore 16
      //   319: new 234	java/io/BufferedInputStream
      //   322: dup
      //   323: aload_2
      //   324: invokespecial 237	java/io/BufferedInputStream:<init>	(Ljava/io/InputStream;)V
      //   327: astore 17
      //   329: new 239	java/io/InputStreamReader
      //   332: dup
      //   333: aload 17
      //   335: ldc 180
      //   337: invokespecial 242	java/io/InputStreamReader:<init>	(Ljava/io/InputStream;Ljava/lang/String;)V
      //   340: astore 18
      //   342: aload 16
      //   344: aload 18
      //   346: aload_0
      //   347: getfield 19	com/ikea/publishingplatform/service/PublishingPlatformBaseService$NetworkCaller:type	Ljava/lang/Class;
      //   350: invokevirtual 248	com/google/gson/Gson:fromJson	(Ljava/io/Reader;Ljava/lang/Class;)Ljava/lang/Object;
      //   353: checkcast 250	com/ikea/publishingplatform/model/BaseResponse
      //   356: astore 19
      //   358: aload 18
      //   360: astore 6
      //   362: aload 17
      //   364: astore 5
      //   366: ldc 252
      //   368: aload 19
      //   370: invokevirtual 253	java/lang/Object:toString	()Ljava/lang/String;
      //   373: invokestatic 109	android/util/Log:v	(Ljava/lang/String;Ljava/lang/String;)I
      //   376: pop
      //   377: aload_3
      //   378: ifnull +7 -> 385
      //   381: aload_3
      //   382: invokestatic 259	com/ikea/publishingplatform/util/IOUtils:closeQuietly	(Ljava/io/Closeable;)V
      //   385: aload 6
      //   387: ifnull +8 -> 395
      //   390: aload 6
      //   392: invokestatic 259	com/ikea/publishingplatform/util/IOUtils:closeQuietly	(Ljava/io/Closeable;)V
      //   395: aload 5
      //   397: ifnull +8 -> 405
      //   400: aload 5
      //   402: invokestatic 259	com/ikea/publishingplatform/util/IOUtils:closeQuietly	(Ljava/io/Closeable;)V
      //   405: aload_2
      //   406: ifnull +7 -> 413
      //   409: aload_2
      //   410: invokestatic 259	com/ikea/publishingplatform/util/IOUtils:closeQuietly	(Ljava/io/Closeable;)V
      //   413: aload 4
      //   415: ifnull +8 -> 423
      //   418: aload 4
      //   420: invokevirtual 262	java/net/HttpURLConnection:disconnect	()V
      //   423: aload 19
      //   425: areturn
      //   426: iconst_0
      //   427: istore 15
      //   429: goto -144 -> 285
      //   432: aload_0
      //   433: getfield 19	com/ikea/publishingplatform/service/PublishingPlatformBaseService$NetworkCaller:type	Ljava/lang/Class;
      //   436: invokevirtual 265	java/lang/Class:newInstance	()Ljava/lang/Object;
      //   439: checkcast 250	com/ikea/publishingplatform/model/BaseResponse
      //   442: astore 19
      //   444: aload 19
      //   446: iconst_1
      //   447: invokevirtual 268	com/ikea/publishingplatform/model/BaseResponse:setError	(Z)V
      //   450: aconst_null
      //   451: astore 5
      //   453: aconst_null
      //   454: astore_2
      //   455: aconst_null
      //   456: astore 6
      //   458: goto -92 -> 366
      //   461: astore 7
      //   463: aload_3
      //   464: ifnull +7 -> 471
      //   467: aload_3
      //   468: invokestatic 259	com/ikea/publishingplatform/util/IOUtils:closeQuietly	(Ljava/io/Closeable;)V
      //   471: aload 6
      //   473: ifnull +8 -> 481
      //   476: aload 6
      //   478: invokestatic 259	com/ikea/publishingplatform/util/IOUtils:closeQuietly	(Ljava/io/Closeable;)V
      //   481: aload 5
      //   483: ifnull +8 -> 491
      //   486: aload 5
      //   488: invokestatic 259	com/ikea/publishingplatform/util/IOUtils:closeQuietly	(Ljava/io/Closeable;)V
      //   491: aload_2
      //   492: ifnull +7 -> 499
      //   495: aload_2
      //   496: invokestatic 259	com/ikea/publishingplatform/util/IOUtils:closeQuietly	(Ljava/io/Closeable;)V
      //   499: aload 4
      //   501: ifnull +8 -> 509
      //   504: aload 4
      //   506: invokevirtual 262	java/net/HttpURLConnection:disconnect	()V
      //   509: aload 7
      //   511: athrow
      //   512: astore 7
      //   514: aload 17
      //   516: astore 5
      //   518: aconst_null
      //   519: astore 6
      //   521: goto -58 -> 463
      //   524: astore 7
      //   526: aload 18
      //   528: astore 6
      //   530: aload 17
      //   532: astore 5
      //   534: goto -71 -> 463
      //
      // Exception table:
      //   from	to	target	type
      //   13	19	461	finally
      //   37	40	461	finally
      //   40	153	461	finally
      //   168	174	461	finally
      //   189	259	461	finally
      //   259	266	461	finally
      //   298	329	461	finally
      //   366	377	461	finally
      //   432	450	461	finally
      //   329	342	512	finally
      //   342	358	524	finally
    }
  }
}

/* Location:           C:\Documents and Settings\Cesar Cabello Cea\Mis documentos\Downloads\apk-downloader\com.ikea.kompis-6_dex2jar.jar
 * Qualified Name:     com.ikea.publishingplatform.service.PublishingPlatformBaseService
 * JD-Core Version:    0.6.2
 */