org.tizen.web.zimlaunch_2.0.0.201311011708

16:50:49.537 INFO  jd.cli.Main - Decompiling org.tizen.web.zimlaunch_2.0.0.201311011708.jar
package org.tizen.web.zimlaunch;

import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
import org.tizen.common.connection.ConnectionPlugin;
import org.tizen.common.connection.ConnectionPluginSurrogate;
import org.tizen.sdblib.SmartDevelopmentBridge;
import org.tizen.web.zimlaunch.notification.TizenWebConsole;
import org.tizen.web.zimlaunch.util.ConnectionUtil;
import org.tizen.web.zimlaunch.util.DeviceChangeListener;
import org.tizen.web.zimlaunch.util.WRTCommandUtil;

public class Activator
  extends AbstractUIPlugin
{
  public static final String PLUGIN_ID = "org.tizen.web.zimlaunch";
  private static Activator plugin;
  private static BundleContext fgBundleContext;
  private static DeviceChangeListener listener = new DeviceChangeListener();
  
  public void start(BundleContext context)
    throws Exception
  {
    fgBundleContext = context;
    super.start(context);
    plugin = this;
    SmartDevelopmentBridge.addDeviceChangeListener(listener);
    TizenWebConsole.setSurrogate(new ConsolePluginSurrogate());
    WRTCommandUtil.getInstance().setSurrogate(new ActivatorSurrogate());
    ConnectionUtil.getInstance().setSurrogate(new ConnectionPluginSurrogate());
    ConnectionUtil.getInstance().setSelectedDevice(ConnectionPlugin.getDefault().getCurrentDevice());
    ConnectionPlugin.getDefault().addSelectionListener(ConnectionUtil.getInstance());
  }
  
  public void stop(BundleContext context)
    throws Exception
  {
    plugin = null;
    super.stop(context);
    fgBundleContext = null;
    
    SmartDevelopmentBridge.removeDeviceChangeListener(listener);
    ConnectionPlugin.getDefault().removeSelectionListener(ConnectionUtil.getInstance());
  }
  
  public static Activator getDefault()
  {
    return plugin;
  }
  
  public static BundleContext getBundleContext()
  {
    return fgBundleContext;
  }
  
  public void initializeDefaultPreferences(IPreferenceStore store)
  {
    setInitialPreferences(store);
  }
  
  public static ImageDescriptor getImageDescriptor(String path)
  {
    return imageDescriptorFromPlugin("org.tizen.web.zimlaunch", path);
  }
  
  public static String getUniqueIdentifier()
  {
    return "org.tizen.web.zimlaunch";
  }
  
  /* Error */
  private void setInitialPreferences(IPreferenceStore store)
  {
    // Byte code:
    //   0: aconst_null
    //   1: astore_2
    //   2: ldc 122
    //   4: invokevirtual 124	java/lang/Class:getClassLoader	()Ljava/lang/ClassLoader;
    //   7: ldc -126
    //   9: invokevirtual 132	java/lang/ClassLoader:getResourceAsStream	(Ljava/lang/String;)Ljava/io/InputStream;
    //   12: astore_2
    //   13: new 138	java/util/Properties
    //   16: dup
    //   17: invokespecial 140	java/util/Properties:<init>	()V
    //   20: astore_3
    //   21: aload_3
    //   22: aload_2
    //   23: invokevirtual 141	java/util/Properties:load	(Ljava/io/InputStream;)V
    //   26: aload_1
    //   27: ldc -111
    //   29: invokeinterface 147 2 0
    //   34: ifne +12 -> 46
    //   37: aload_1
    //   38: ldc -111
    //   40: iconst_1
    //   41: invokeinterface 153 3 0
    //   46: aload_1
    //   47: ldc -99
    //   49: invokeinterface 159 2 0
    //   54: invokestatic 163	org/tizen/common/util/StringUtil:isEmpty	(Ljava/lang/CharSequence;)Z
    //   57: ifeq +21 -> 78
    //   60: aload_3
    //   61: ldc -99
    //   63: invokevirtual 169	java/util/Properties:getProperty	(Ljava/lang/String;)Ljava/lang/String;
    //   66: astore 4
    //   68: aload_1
    //   69: ldc -99
    //   71: aload 4
    //   73: invokeinterface 172 3 0
    //   78: aload_1
    //   79: ldc -81
    //   81: invokeinterface 159 2 0
    //   86: invokestatic 163	org/tizen/common/util/StringUtil:isEmpty	(Ljava/lang/CharSequence;)Z
    //   89: ifeq +21 -> 110
    //   92: aload_3
    //   93: ldc -81
    //   95: invokevirtual 169	java/util/Properties:getProperty	(Ljava/lang/String;)Ljava/lang/String;
    //   98: astore 4
    //   100: aload_1
    //   101: ldc -81
    //   103: aload 4
    //   105: invokeinterface 172 3 0
    //   110: aload_1
    //   111: ldc -79
    //   113: invokeinterface 159 2 0
    //   118: invokestatic 163	org/tizen/common/util/StringUtil:isEmpty	(Ljava/lang/CharSequence;)Z
    //   121: ifeq +21 -> 142
    //   124: aload_3
    //   125: ldc -79
    //   127: invokevirtual 169	java/util/Properties:getProperty	(Ljava/lang/String;)Ljava/lang/String;
    //   130: astore 4
    //   132: aload_1
    //   133: ldc -79
    //   135: aload 4
    //   137: invokeinterface 172 3 0
    //   142: aload_1
    //   143: ldc -77
    //   145: invokeinterface 159 2 0
    //   150: invokestatic 163	org/tizen/common/util/StringUtil:isEmpty	(Ljava/lang/CharSequence;)Z
    //   153: ifeq +21 -> 174
    //   156: aload_3
    //   157: ldc -77
    //   159: invokevirtual 169	java/util/Properties:getProperty	(Ljava/lang/String;)Ljava/lang/String;
    //   162: astore 4
    //   164: aload_1
    //   165: ldc -77
    //   167: aload 4
    //   169: invokeinterface 172 3 0
    //   174: aload_1
    //   175: ldc -75
    //   177: invokeinterface 159 2 0
    //   182: invokestatic 163	org/tizen/common/util/StringUtil:isEmpty	(Ljava/lang/CharSequence;)Z
    //   185: ifeq +21 -> 206
    //   188: aload_3
    //   189: ldc -75
    //   191: invokevirtual 169	java/util/Properties:getProperty	(Ljava/lang/String;)Ljava/lang/String;
    //   194: astore 4
    //   196: aload_1
    //   197: ldc -75
    //   199: aload 4
    //   201: invokeinterface 172 3 0
    //   206: aload_1
    //   207: ldc -73
    //   209: invokeinterface 159 2 0
    //   214: invokestatic 163	org/tizen/common/util/StringUtil:isEmpty	(Ljava/lang/CharSequence;)Z
    //   217: ifeq +21 -> 238
    //   220: aload_3
    //   221: ldc -73
    //   223: invokevirtual 169	java/util/Properties:getProperty	(Ljava/lang/String;)Ljava/lang/String;
    //   226: astore 4
    //   228: aload_1
    //   229: ldc -73
    //   231: aload 4
    //   233: invokeinterface 172 3 0
    //   238: aload_1
    //   239: ldc -71
    //   241: invokeinterface 159 2 0
    //   246: invokestatic 163	org/tizen/common/util/StringUtil:isEmpty	(Ljava/lang/CharSequence;)Z
    //   249: ifeq +59 -> 308
    //   252: aload_3
    //   253: ldc -71
    //   255: invokevirtual 169	java/util/Properties:getProperty	(Ljava/lang/String;)Ljava/lang/String;
    //   258: astore 4
    //   260: aload_1
    //   261: ldc -71
    //   263: aload 4
    //   265: invokeinterface 172 3 0
    //   270: goto +38 -> 308
    //   273: astore_3
    //   274: aload_3
    //   275: invokestatic 187	org/tizen/common/util/log/Logger:log	(Ljava/lang/Throwable;)V
    //   278: iconst_1
    //   279: anewarray 193	java/lang/Object
    //   282: dup
    //   283: iconst_0
    //   284: aload_2
    //   285: aastore
    //   286: invokestatic 195	org/tizen/common/util/IOUtil:tryClose	([Ljava/lang/Object;)V
    //   289: goto +30 -> 319
    //   292: astore 5
    //   294: iconst_1
    //   295: anewarray 193	java/lang/Object
    //   298: dup
    //   299: iconst_0
    //   300: aload_2
    //   301: aastore
    //   302: invokestatic 195	org/tizen/common/util/IOUtil:tryClose	([Ljava/lang/Object;)V
    //   305: aload 5
    //   307: athrow
    //   308: iconst_1
    //   309: anewarray 193	java/lang/Object
    //   312: dup
    //   313: iconst_0
    //   314: aload_2
    //   315: aastore
    //   316: invokestatic 195	org/tizen/common/util/IOUtil:tryClose	([Ljava/lang/Object;)V
    //   319: return
    // Line number table:
    //   Java source line #155	-> byte code offset #0
    //   Java source line #158	-> byte code offset #2
    //   Java source line #159	-> byte code offset #13
    //   Java source line #160	-> byte code offset #21
    //   Java source line #163	-> byte code offset #26
    //   Java source line #164	-> byte code offset #37
    //   Java source line #168	-> byte code offset #46
    //   Java source line #170	-> byte code offset #60
    //   Java source line #172	-> byte code offset #68
    //   Java source line #175	-> byte code offset #78
    //   Java source line #176	-> byte code offset #92
    //   Java source line #177	-> byte code offset #100
    //   Java source line #180	-> byte code offset #110
    //   Java source line #181	-> byte code offset #124
    //   Java source line #182	-> byte code offset #132
    //   Java source line #190	-> byte code offset #142
    //   Java source line #192	-> byte code offset #156
    //   Java source line #195	-> byte code offset #164
    //   Java source line #198	-> byte code offset #174
    //   Java source line #199	-> byte code offset #188
    //   Java source line #200	-> byte code offset #196
    //   Java source line #203	-> byte code offset #206
    //   Java source line #204	-> byte code offset #220
    //   Java source line #205	-> byte code offset #228
    //   Java source line #208	-> byte code offset #238
    //   Java source line #209	-> byte code offset #252
    //   Java source line #210	-> byte code offset #260
    //   Java source line #212	-> byte code offset #273
    //   Java source line #213	-> byte code offset #274
    //   Java source line #214	-> byte code offset #278
    //   Java source line #215	-> byte code offset #284
    //   Java source line #214	-> byte code offset #292
    //   Java source line #215	-> byte code offset #300
    //   Java source line #216	-> byte code offset #305
    //   Java source line #214	-> byte code offset #308
    //   Java source line #215	-> byte code offset #314
    //   Java source line #217	-> byte code offset #319
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	320	0	this	Activator
    //   0	320	1	store	IPreferenceStore
    //   1	314	2	is	java.io.InputStream
    //   20	233	3	props	java.util.Properties
    //   273	2	3	e	java.io.IOException
    //   66	6	4	defaultValue	String
    //   98	6	4	defaultValue	String
    //   130	6	4	defaultValue	String
    //   162	6	4	defaultValue	String
    //   194	6	4	defaultValue	String
    //   226	6	4	defaultValue	String
    //   258	6	4	defaultValue	String
    //   292	14	5	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   2	270	273	java/io/IOException
    //   2	278	292	finally
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.zimlaunch.Activator
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.zimlaunch;

import org.tizen.common.Surrogate;

public class ActivatorSurrogate
  implements Surrogate<Activator>
{
  public Activator getAdapter()
  {
    return Activator.getDefault();
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.zimlaunch.ActivatorSurrogate
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.zimlaunch;

import org.eclipse.ui.console.ConsolePlugin;
import org.tizen.common.Surrogate;

public class ConsolePluginSurrogate
  implements Surrogate<ConsolePlugin>
{
  public ConsolePlugin getAdapter()
  {
    return ConsolePlugin.getDefault();
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.zimlaunch.ConsolePluginSurrogate
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.zimlaunch.cli.command;

import java.text.MessageFormat;
import org.tizen.common.core.command.ExecutionContext;
import org.tizen.common.core.command.Executor;
import org.tizen.common.core.command.Prompter;
import org.tizen.common.util.StringUtil;

public class CheckInstallCommand
  extends QueryCommand
{
  protected String widgetID;
  protected boolean isInstalled;
  
  public String getWidgetID()
  {
    return widgetID;
  }
  
  public Boolean isInstalled()
  {
    return Boolean.valueOf(isInstalled);
  }
  
  public void setInstalled(boolean isInstalled)
  {
    this.isInstalled = isInstalled;
  }
  
  public CheckInstallCommand(String widgetID)
  {
    this.widgetID = widgetID;
  }
  
  public void run(Executor executor, ExecutionContext context)
    throws Exception
  {
    boolean op = isPrintOption();
    setPrintOption(false);
    super.run(executor, context);
    setPrintOption(op);
    
    setInstalled(false);
    String delim = System.getProperty("line.separator") + " ";
    String[] arrayOfString;
    int j = (arrayOfString = StringUtil.split(getResult(), delim)).length;
    for (int i = 0; i < j; i++)
    {
      String widget = arrayOfString[i];
      if (getWidgetID().equals(widget))
      {
        setInstalled(true);
        break;
      }
    }
    String msg;
    String msg;
    if (isInstalled().booleanValue()) {
      msg = MessageFormat.format("''{0}'' is installed.", new Object[] { getWidgetID() });
    } else {
      msg = MessageFormat.format("''{0}'' is not installed.", new Object[] { getWidgetID() });
    }
    if (isPrintOption()) {
      context.getPrompter().notify(msg);
    }
    clearResult();
    setResult(msg);
  }
  
  public void undo(Executor executor, ExecutionContext context)
    throws Exception
  {
    super.undo(executor, context);
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.zimlaunch.cli.command.CheckInstallCommand
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.zimlaunch.cli.command;

import java.text.MessageFormat;
import org.apache.http.client.HttpClient;
import org.apache.http.impl.client.DefaultHttpClient;
import org.tizen.common.core.command.ExecutionContext;
import org.tizen.common.core.command.Executor;
import org.tizen.common.core.command.Prompter;
import org.tizen.common.core.command.sdb.ForwardSdbCommand;
import org.tizen.common.util.Assert;
import org.tizen.common.util.LocalPortChecker;
import org.tizen.common.util.StringUtil;

public class DebugCommand
  extends WRTCommand
{
  protected static final String WRT_LAUNCHER_RUN_COMMAND = "/usr/bin/wrt-launcher --start";
  protected static final String WRT_LAUNCHER_RUN_COMMNAD_TIME = "--timeout=";
  protected static final String WRT_LAUNCHER_DEBUG_OPTION = "--debug";
  protected String widgetID;
  protected String localPort;
  protected String remotePort;
  protected String inspectorURL;
  
  public String getInspectorURL()
  {
    return inspectorURL;
  }
  
  public void setInspectorURL(String inspectorURL)
  {
    this.inspectorURL = inspectorURL;
  }
  
  public String getLocalPort()
  {
    return localPort;
  }
  
  public void setLocalPort(String localPort)
  {
    this.localPort = localPort;
  }
  
  public String getRemotePort()
  {
    return remotePort;
  }
  
  public void setRemotePort(String port)
  {
    remotePort = port;
  }
  
  public String getWidgetID()
  {
    return widgetID;
  }
  
  public DebugCommand(String wigetID)
  {
    widgetID = wigetID;
  }
  
  protected String getPackageName(Executor executor, ExecutionContext context)
    throws Exception
  {
    WgtInfoCommand getWgtInfoCommand = new WgtInfoCommand(getWidgetID());
    getWgtInfoCommand.setDevice(getDevice());
    getWgtInfoCommand.setPrintOption(isPrintOption());
    getWgtInfoCommand.run(executor, context);
    
    return getWgtInfoCommand.getPackageName();
  }
  
  protected void initRemotePort()
  {
    String[] line = StringUtil.split(getResult(), "\r\n");
    String port = "9222";
    String[] arrayOfString1;
    int j = (arrayOfString1 = line).length;
    for (int i = 0; i < j; i++)
    {
      String tmp = arrayOfString1[i];
      String[] contents = StringUtil.split(tmp, " ");
      boolean isThisLine = false;
      String[] arrayOfString2;
      int m = (arrayOfString2 = contents).length;
      for (int k = 0; k < m; k++)
      {
        String content = arrayOfString2[k];
        if ("port:".equals(content))
        {
          isThisLine = true;
          break;
        }
      }
      if (isThisLine)
      {
        port = contents[(contents.length - 1)];
        break;
      }
    }
    setRemotePort(port);
  }
  
  protected void initLocalPort()
  {
    String port = getRemotePort();
    int localPort = LocalPortChecker.getAvailableLocalPort(1, Integer.parseInt(port));
    
    setLocalPort(Integer.toString(localPort));
  }
  
  protected void initPort()
  {
    initRemotePort();
    initLocalPort();
  }
  
  protected ForwardSdbCommand createForward(Executor executor, ExecutionContext context)
  {
    initPort();
    String remotePort = getRemotePort();
    String localPort = getLocalPort();
    
    ForwardSdbCommand forward = new ForwardSdbCommand(Integer.parseInt(localPort), Integer.parseInt(remotePort));
    return forward;
  }
  
  protected void setUrl(String port, String urlpart)
  {
    String urlString = "http://127.0.0.1:" + port + "/" + urlpart;
    setInspectorURL(urlString);
  }
  
  protected HttpClient createHttpClient()
  {
    return new DefaultHttpClient();
  }
  
  /* Error */
  protected void initInspectorURL()
    throws Exception
  {
    // Byte code:
    //   0: ldc -69
    //   2: astore_1
    //   3: aload_0
    //   4: invokevirtual 189	org/tizen/web/zimlaunch/cli/command/DebugCommand:createHttpClient	()Lorg/apache/http/client/HttpClient;
    //   7: astore_2
    //   8: aload_2
    //   9: invokeinterface 191 1 0
    //   14: ldc -59
    //   16: iconst_0
    //   17: invokestatic 199	java/lang/Boolean:valueOf	(Z)Ljava/lang/Boolean;
    //   20: invokeinterface 205 3 0
    //   25: pop
    //   26: aload_2
    //   27: invokeinterface 191 1 0
    //   32: ldc -45
    //   34: ldc -43
    //   36: invokestatic 214	java/lang/Integer:valueOf	(I)Ljava/lang/Integer;
    //   39: invokeinterface 205 3 0
    //   44: pop
    //   45: aload_2
    //   46: invokeinterface 191 1 0
    //   51: ldc -39
    //   53: ldc -43
    //   55: invokestatic 214	java/lang/Integer:valueOf	(I)Ljava/lang/Integer;
    //   58: invokeinterface 205 3 0
    //   63: pop
    //   64: new 219	org/apache/http/client/methods/HttpGet
    //   67: dup
    //   68: new 164	java/lang/StringBuilder
    //   71: dup
    //   72: ldc -90
    //   74: invokespecial 168	java/lang/StringBuilder:<init>	(Ljava/lang/String;)V
    //   77: aload_0
    //   78: invokevirtual 153	org/tizen/web/zimlaunch/cli/command/DebugCommand:getLocalPort	()Ljava/lang/String;
    //   81: invokevirtual 169	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   84: ldc -35
    //   86: invokevirtual 169	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   89: invokevirtual 175	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   92: invokespecial 223	org/apache/http/client/methods/HttpGet:<init>	(Ljava/lang/String;)V
    //   95: astore_3
    //   96: aload_2
    //   97: aload_3
    //   98: invokeinterface 224 2 0
    //   103: astore 4
    //   105: aload 4
    //   107: invokeinterface 228 1 0
    //   112: invokeinterface 234 1 0
    //   117: istore 5
    //   119: sipush 200
    //   122: iload 5
    //   124: if_icmpeq +34 -> 158
    //   127: iload 5
    //   129: invokestatic 240	org/tizen/web/zimlaunch/exception/HTTPResponseCode:getDescriptionforCode	(I)Ljava/lang/String;
    //   132: astore 6
    //   134: new 164	java/lang/StringBuilder
    //   137: dup
    //   138: invokespecial 245	java/lang/StringBuilder:<init>	()V
    //   141: getstatic 246	org/tizen/web/zimlaunch/exception/TizenWebIDEExceptionCode:WEB_IDE_FAIL_TO_WEBKIT_RESPONSE	Lorg/tizen/web/zimlaunch/exception/TizenWebIDEExceptionCode;
    //   144: invokevirtual 252	java/lang/StringBuilder:append	(Ljava/lang/Object;)Ljava/lang/StringBuilder;
    //   147: aload 6
    //   149: invokevirtual 169	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   152: invokevirtual 175	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   155: invokestatic 255	org/tizen/common/util/Assert:fail	(Ljava/lang/Object;)V
    //   158: aload 4
    //   160: invokeinterface 261 1 0
    //   165: astore 6
    //   167: aload 6
    //   169: ifnull +110 -> 279
    //   172: aload 6
    //   174: invokeinterface 265 1 0
    //   179: astore 7
    //   181: aload 6
    //   183: invokeinterface 271 1 0
    //   188: l2i
    //   189: istore 8
    //   191: aload 7
    //   193: invokestatic 275	org/tizen/common/util/StringUtil:asString	(Ljava/io/InputStream;)Ljava/lang/String;
    //   196: astore 9
    //   198: aload 9
    //   200: invokevirtual 279	java/lang/String:length	()I
    //   203: iload 8
    //   205: if_icmpeq +9 -> 214
    //   208: getstatic 282	org/tizen/web/zimlaunch/exception/TizenWebIDEExceptionCode:WEB_IDE_FAIL_TO_READ_CONTENT	Lorg/tizen/web/zimlaunch/exception/TizenWebIDEExceptionCode;
    //   211: invokestatic 255	org/tizen/common/util/Assert:fail	(Ljava/lang/Object;)V
    //   214: new 285	org/tizen/web/common/JSONObject
    //   217: dup
    //   218: new 287	org/tizen/web/common/JSONTokener
    //   221: dup
    //   222: aload 9
    //   224: invokespecial 289	org/tizen/web/common/JSONTokener:<init>	(Ljava/lang/String;)V
    //   227: invokespecial 290	org/tizen/web/common/JSONObject:<init>	(Lorg/tizen/web/common/JSONTokener;)V
    //   230: astore 10
    //   232: aload 10
    //   234: ldc_w 293
    //   237: invokevirtual 295	org/tizen/web/common/JSONObject:getString	(Ljava/lang/String;)Ljava/lang/String;
    //   240: astore_1
    //   241: goto +23 -> 264
    //   244: astore 11
    //   246: aload 7
    //   248: invokevirtual 299	java/io/InputStream:close	()V
    //   251: goto +10 -> 261
    //   254: astore 12
    //   256: aload 12
    //   258: invokestatic 304	org/tizen/common/util/log/Logger:log	(Ljava/lang/Throwable;)V
    //   261: aload 11
    //   263: athrow
    //   264: aload 7
    //   266: invokevirtual 299	java/io/InputStream:close	()V
    //   269: goto +10 -> 279
    //   272: astore 12
    //   274: aload 12
    //   276: invokestatic 304	org/tizen/common/util/log/Logger:log	(Ljava/lang/Throwable;)V
    //   279: aload_0
    //   280: aload_0
    //   281: invokevirtual 153	org/tizen/web/zimlaunch/cli/command/DebugCommand:getLocalPort	()Ljava/lang/String;
    //   284: aload_1
    //   285: invokevirtual 310	org/tizen/web/zimlaunch/cli/command/DebugCommand:setUrl	(Ljava/lang/String;Ljava/lang/String;)V
    //   288: goto +19 -> 307
    //   291: astore 13
    //   293: aload_2
    //   294: invokeinterface 312 1 0
    //   299: invokeinterface 316 1 0
    //   304: aload 13
    //   306: athrow
    //   307: aload_2
    //   308: invokeinterface 312 1 0
    //   313: invokeinterface 316 1 0
    //   318: return
    // Line number table:
    //   Java source line #279	-> byte code offset #0
    //   Java source line #280	-> byte code offset #3
    //   Java source line #283	-> byte code offset #8
    //   Java source line #284	-> byte code offset #26
    //   Java source line #285	-> byte code offset #45
    //   Java source line #288	-> byte code offset #64
    //   Java source line #289	-> byte code offset #96
    //   Java source line #292	-> byte code offset #105
    //   Java source line #293	-> byte code offset #119
    //   Java source line #296	-> byte code offset #127
    //   Java source line #297	-> byte code offset #134
    //   Java source line #301	-> byte code offset #158
    //   Java source line #302	-> byte code offset #167
    //   Java source line #303	-> byte code offset #172
    //   Java source line #304	-> byte code offset #181
    //   Java source line #306	-> byte code offset #191
    //   Java source line #307	-> byte code offset #198
    //   Java source line #308	-> byte code offset #208
    //   Java source line #312	-> byte code offset #214
    //   Java source line #313	-> byte code offset #232
    //   Java source line #314	-> byte code offset #244
    //   Java source line #315	-> byte code offset #246
    //   Java source line #316	-> byte code offset #261
    //   Java source line #315	-> byte code offset #264
    //   Java source line #320	-> byte code offset #279
    //   Java source line #321	-> byte code offset #291
    //   Java source line #322	-> byte code offset #293
    //   Java source line #323	-> byte code offset #304
    //   Java source line #322	-> byte code offset #307
    //   Java source line #324	-> byte code offset #318
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	319	0	this	DebugCommand
    //   2	283	1	responseURL	String
    //   7	301	2	httpclient	HttpClient
    //   95	3	3	httpget	org.apache.http.client.methods.HttpGet
    //   103	56	4	response	org.apache.http.HttpResponse
    //   117	11	5	code	int
    //   132	16	6	msg	String
    //   165	17	6	entity	org.apache.http.HttpEntity
    //   179	86	7	instream	java.io.InputStream
    //   189	15	8	contentLength	int
    //   196	27	9	content	String
    //   230	3	10	obj	org.tizen.web.common.JSONObject
    //   244	18	11	localObject1	Object
    //   254	3	12	e	java.io.IOException
    //   272	3	12	e	java.io.IOException
    //   291	14	13	localObject2	Object
    // Exception table:
    //   from	to	target	type
    //   191	244	244	finally
    //   246	251	254	java/io/IOException
    //   264	269	272	java/io/IOException
    //   64	291	291	finally
  }
  
  protected void initInspectorEnviroment(Executor executor, ExecutionContext context)
    throws Exception
  {
    ForwardSdbCommand forward = createForward(executor, context);
    forward.setDevice(getDevice());
    forward.run(executor, context);
    try
    {
      initInspectorURL();
    }
    catch (Exception localException)
    {
      forward.undo(executor, context);
    }
  }
  
  protected boolean checkCommandReturnCode()
  {
    if (!getResult().contains("result: launched")) {
      return false;
    }
    return super.checkCommandReturnCode();
  }
  
  public void run(Executor executor, ExecutionContext context)
    throws Exception
  {
    String name = getWidgetID();
    Assert.notNull(name);
    
    setCommand("/usr/bin/wrt-launcher --start " + name + " " + "--debug" + " " + "--timeout=" + getTime());
    super.run(executor, context);
    String msg;
    if (checkCommandReturnCode())
    {
      String msg = MessageFormat.format("''{0}'' debug launch successful.", new Object[] { getWidgetID() });
      try
      {
        initInspectorEnviroment(executor, context);
      }
      catch (Exception e)
      {
        context.getPrompter().notify("Remote inspector initialization failed.");
        throw e;
      }
      msg = 
        msg + System.getProperty("line.separator") + "DEBUG URL: " + getInspectorURL();
    }
    else
    {
      msg = MessageFormat.format("''{0}'' debug launch failed.", new Object[] { getWidgetID() });
    }
    if (isPrintOption()) {
      context.getPrompter().notify(msg);
    }
    clearResult();
    setResult(msg);
  }
  
  public void undo(Executor executor, ExecutionContext context)
    throws Exception
  {
    super.undo(executor, context);
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.zimlaunch.cli.command.DebugCommand
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.zimlaunch.cli.command;

import java.text.MessageFormat;
import org.tizen.common.core.command.ExecutionContext;
import org.tizen.common.core.command.Executor;
import org.tizen.common.core.command.Prompter;
import org.tizen.common.util.StringUtil;

public class GetIDCommand
  extends QueryCommand
{
  protected String widgetID;
  protected String ID;
  
  public String getWidgetID()
  {
    return widgetID;
  }
  
  public String getID()
  {
    return ID;
  }
  
  public void setID(String ID)
  {
    this.ID = ID;
  }
  
  public GetIDCommand(String widgetID)
  {
    this.widgetID = widgetID;
  }
  
  public void run(Executor executor, ExecutionContext context)
    throws Exception
  {
    boolean op = isPrintOption();
    setPrintOption(false);
    super.run(executor, context);
    setPrintOption(op);
    
    String delim = System.getProperty("line.separator");
    String subdelim = " ";
    String[] arrayOfString1;
    int j = (arrayOfString1 = StringUtil.split(getResult(), delim)).length;
    for (int i = 0; i < j; i++)
    {
      String line = arrayOfString1[i];
      boolean isFind = false;
      String[] arrayOfString2;
      int m = (arrayOfString2 = StringUtil.split(line, subdelim)).length;
      for (int k = 0; k < m; k++)
      {
        String word = arrayOfString2[k];
        if (getWidgetID().equals(word))
        {
          isFind = true;
          break;
        }
      }
      if (isFind)
      {
        String[] word = StringUtil.split(line, subdelim);
        setID(word[1]);
        break;
      }
    }
    if (isPrintOption()) {
      context.getPrompter().notify(
        MessageFormat.format("''{0}'' id: {1}", new Object[] { getWidgetID(), getID() }));
    }
  }
  
  public void undo(Executor executor, ExecutionContext context)
    throws Exception
  {
    super.undo(executor, context);
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.zimlaunch.cli.command.GetIDCommand
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.zimlaunch.cli.command;

import java.io.IOException;
import java.io.StringReader;
import java.text.MessageFormat;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.tizen.common.TizenPlatformConstants;
import org.tizen.common.core.command.ExecutionContext;
import org.tizen.common.core.command.Executor;
import org.tizen.common.core.command.Prompter;
import org.tizen.common.util.Assert;
import org.tizen.common.util.StringUtil;
import org.tizen.common.util.ZipUtil;
import org.tizen.sdblib.IDevice;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

public class InstallCommand
  extends WRTCommand
{
  protected static final String WRT_INSTALL_COMMAND = TizenPlatformConstants.PKG_TOOL_INSTALL_COMMAND;
  protected String remotePath;
  protected String localPath;
  protected String pkgNamePrefix = "pkg_name[";
  protected String widget;
  
  public InstallCommand(IDevice device, String widget)
  {
    setDevice(device);
    remotePath = (TizenPlatformConstants.getAppTmpDirectory(device) + "/");
    this.widget = widget;
  }
  
  public String getWidget()
  {
    return widget;
  }
  
  public void setWidget(String widget)
  {
    if (!isWidget(widget)) {
      Assert.fail("correct widget extension is .wgt");
    }
    this.widget = widget;
  }
  
  public String getRemotePath()
  {
    return remotePath;
  }
  
  public void setRemotePath(String remotePath)
  {
    this.remotePath = remotePath;
  }
  
  public String getLocalPath()
  {
    return localPath;
  }
  
  public void setLocalPath(String localPath)
  {
    this.localPath = localPath;
  }
  
  protected String getExtention(String widget)
  {
    int extentpos = widget.lastIndexOf('.');
    if ((extentpos > 0) && (extentpos < widget.length() - 1)) {
      return widget.substring(extentpos + 1).toLowerCase();
    }
    return "";
  }
  
  protected boolean isWidget(String widget)
  {
    if ("wgt".equals(getExtention(widget))) {
      return true;
    }
    return false;
  }
  
  protected String createCommand()
  {
    if (!isWidget(getWidget())) {
      Assert.fail("correct widget extension is .wgt");
    }
    String cmd = String.format(WRT_INSTALL_COMMAND, new Object[] { "wgt", getRemotePath() + getWidget() });
    return cmd;
  }
  
  protected boolean checkCommandReturnCode()
  {
    return super.checkCommandReturnCode();
  }
  
  public void run(Executor executor, ExecutionContext context)
    throws Exception
  {
    setCommand(createCommand());
    super.run(executor, context);
    String appid = getAppIdLocal();
    appid = appid != null ? appid : getAppId();
    if (StringUtil.isEmpty(appid)) {
      appid = getWidget();
    }
    String msg;
    String msg;
    if (checkCommandReturnCode()) {
      msg = MessageFormat.format("''{0}'' install successful.", new Object[] { appid });
    } else {
      msg = MessageFormat.format("''{0}'' install failed.", new Object[] { appid });
    }
    if (isPrintOption()) {
      context.getPrompter().notify(msg);
    }
  }
  
  public void undo(Executor executor, ExecutionContext context)
    throws Exception
  {
    super.undo(executor, context);
  }
  
  protected String getAppIdLocal()
    throws IOException, ParserConfigurationException, SAXException
  {
    String path = getLocalPath();
    String contents = ZipUtil.getContent(path, "config.xml");
    if (StringUtil.isEmpty(contents)) {
      return null;
    }
    DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
    InputSource is = new InputSource();
    is.setCharacterStream(new StringReader(contents));
    
    Document doc = db.parse(is);
    NodeList nodes = doc.getElementsByTagName("tizen:application");
    if (nodes.getLength() < 1) {
      return null;
    }
    Element tizen = (Element)nodes.item(0);
    
    return tizen.getAttribute("id");
  }
  
  protected String getAppId()
  {
    String ori = getResult();
    if (StringUtil.isEmpty(ori)) {
      return ori;
    }
    String[] arr = StringUtil.split(ori, "\n");
    if (arr.length > 1)
    {
      int start = arr[1].indexOf(pkgNamePrefix) + pkgNamePrefix.length();
      String appID = arr[1].substring(start, start + 10);
      return appID;
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.zimlaunch.cli.command.InstallCommand
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.zimlaunch.cli.command;

import java.text.MessageFormat;
import org.tizen.common.core.command.ExecutionContext;
import org.tizen.common.core.command.Executor;
import org.tizen.common.core.command.Prompter;
import org.tizen.common.util.Assert;

public class KillCommand
  extends WRTCommand
{
  protected static final String WRT_LAUNCHER_KILL_COMMAND = "/usr/bin/wrt-launcher --kill";
  protected String widgetID;
  
  public String getWidgetID()
  {
    return widgetID;
  }
  
  public KillCommand(String widgetID)
  {
    this.widgetID = widgetID;
  }
  
  protected String getAppId(Executor executor, ExecutionContext context)
    throws Exception
  {
    WgtInfoCommand getWgtInfoCommand = new WgtInfoCommand(getWidgetID());
    getWgtInfoCommand.setDevice(getDevice());
    getWgtInfoCommand.setPrintOption(isPrintOption());
    getWgtInfoCommand.run(executor, context);
    
    return getWgtInfoCommand.getAppId();
  }
  
  protected boolean checkCommandReturnCode()
  {
    String result = getResult();
    Assert.notNull(result);
    if (!result.contains("result: killed")) {
      return false;
    }
    return super.checkCommandReturnCode();
  }
  
  public void run(Executor executor, ExecutionContext context)
    throws Exception
  {
    String killingKey = getAppId(executor, context);
    Assert.notNull(killingKey);
    
    setCommand("/usr/bin/wrt-launcher --kill " + killingKey);
    super.run(executor, context);
    String msg;
    String msg;
    if (checkCommandReturnCode()) {
      msg = MessageFormat.format("''{0}'' kill successful.", new Object[] { getWidgetID() });
    } else {
      msg = MessageFormat.format("''{0}'' kill failed.", new Object[] { getWidgetID() });
    }
    if (isPrintOption()) {
      context.getPrompter().notify(msg);
    }
    clearResult();
    setResult(msg);
  }
  
  public void undo(Executor executor, ExecutionContext context)
    throws Exception
  {
    super.undo(executor, context);
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.zimlaunch.cli.command.KillCommand
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.zimlaunch.cli.command;

import org.tizen.common.core.command.ExecutionContext;
import org.tizen.common.core.command.Executor;
import org.tizen.common.core.command.Prompter;

public class ModeCommnad
  extends WRTCommand
{
  protected static final String WRT_LAUNCHER_MODE_COMMAND = "/usr/bin/wrt-launcher --developer-mode 1";
  
  public void run(Executor executor, ExecutionContext context)
    throws Exception
  {
    setCommand("/usr/bin/wrt-launcher --developer-mode 1");
    super.run(executor, context);
    
    String msg = null;
    if (checkCommandReturnCode()) {
      msg = "Enable developer mode.";
    } else {
      msg = "Failed developer mode setting.";
    }
    if (isPrintOption()) {
      context.getPrompter().notify(msg);
    }
    clearResult();
    setResult(msg);
  }
  
  public void undo(Executor executor, ExecutionContext context)
    throws Exception
  {
    super.undo(executor, context);
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.zimlaunch.cli.command.ModeCommnad
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.zimlaunch.cli.command;

import org.tizen.common.core.command.ExecutionContext;
import org.tizen.common.core.command.Executor;
import org.tizen.common.core.command.Prompter;
import org.tizen.common.util.StringUtil;

public class QueryCommand
  extends WRTCommand
{
  protected static final String WRT_LAUNCHER_LIST_COMMAND = "/usr/bin/wrt-launcher -l";
  
  public void run(Executor executor, ExecutionContext context)
    throws Exception
  {
    setCommand("/usr/bin/wrt-launcher -l");
    super.run(executor, context);
    if (isPrintOption())
    {
      String msg = getResult();
      if (getCommand().endsWith(" 2>&1; echo $?")) {
        msg = deleteSuccessReturnCode(msg);
      }
      context.getPrompter().notify(msg);
    }
  }
  
  public void undo(Executor executor, ExecutionContext context)
    throws Exception
  {
    super.undo(executor, context);
  }
  
  private String deleteSuccessReturnCode(String msg)
  {
    String successReturnCode = "0";
    
    String[] msgLines = StringUtil.split(msg, "\n");
    StringBuffer sb = new StringBuffer();
    for (int i = 0; i < msgLines.length; i++)
    {
      if ((i == msgLines.length - 1) && 
        (successReturnCode.equals(StringUtil.trim(msgLines[i])))) {
        break;
      }
      sb.append(msgLines[i]);
      sb.append("\n");
    }
    return sb.toString();
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.zimlaunch.cli.command.QueryCommand
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.zimlaunch.cli.command;

import java.text.MessageFormat;
import org.tizen.common.core.command.ExecutionContext;
import org.tizen.common.core.command.Executor;
import org.tizen.common.core.command.Prompter;
import org.tizen.common.util.Assert;

public class RunCommand
  extends WRTCommand
{
  protected static final String WRT_LAUNCHER_RUN_COMMAND = "/usr/bin/wrt-launcher --start";
  protected static final String WRT_LAUNCHER_RUN_COMMNAD_TIME = "--timeout=";
  protected String widgetID;
  
  public String getWidgetID()
  {
    return widgetID;
  }
  
  public RunCommand(String wigetID)
  {
    widgetID = wigetID;
  }
  
  protected String getPackageName(Executor executor, ExecutionContext context)
    throws Exception
  {
    WgtInfoCommand getNameCommand = new WgtInfoCommand(getWidgetID());
    getNameCommand.setDevice(getDevice());
    getNameCommand.setPrintOption(isPrintOption());
    getNameCommand.run(executor, context);
    
    return getNameCommand.getPackageName();
  }
  
  protected boolean checkCommandReturnCode()
  {
    if (!getResult().contains("result: launched")) {
      return false;
    }
    return super.checkCommandReturnCode();
  }
  
  public void run(Executor executor, ExecutionContext context)
    throws Exception
  {
    String name = getWidgetID();
    Assert.notNull(name);
    
    setCommand("/usr/bin/wrt-launcher --start " + name + " " + "--timeout=" + getTime());
    super.run(executor, context);
1 2 3 4 5 6 7 8 9 10

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd