sdblib

1: invokevirtual 78	org/tizen/sdblib/daemon/AbstractServer:isState	([Lorg/tizen/sdblib/daemon/ServerState;)Z
    //   14: ifeq +11 -> 25
    //   17: aload_0
    //   18: getstatic 36	org/tizen/sdblib/daemon/ServerState:Terminated	Lorg/tizen/sdblib/daemon/ServerState;
    //   21: invokevirtual 86	org/tizen/sdblib/daemon/AbstractServer:setStatus	(Lorg/tizen/sdblib/daemon/ServerState;)V
    //   24: return
    //   25: aload_0
    //   26: invokevirtual 88	org/tizen/sdblib/daemon/AbstractServer:initialize	()V
    //   29: aload_0
    //   30: getfield 34	org/tizen/sdblib/daemon/AbstractServer:lock	Ljava/util/concurrent/locks/Lock;
    //   33: invokeinterface 49 1 0
    //   38: aload_0
    //   39: iconst_1
    //   40: anewarray 37	org/tizen/sdblib/daemon/ServerState
    //   43: dup
    //   44: iconst_0
    //   45: getstatic 83	org/tizen/sdblib/daemon/ServerState:Halting	Lorg/tizen/sdblib/daemon/ServerState;
    //   48: aastore
    //   49: invokevirtual 78	org/tizen/sdblib/daemon/AbstractServer:isState	([Lorg/tizen/sdblib/daemon/ServerState;)Z
    //   52: ifeq +24 -> 76
    //   55: aload_0
    //   56: getfield 34	org/tizen/sdblib/daemon/AbstractServer:lock	Ljava/util/concurrent/locks/Lock;
    //   59: invokeinterface 53 1 0
    //   64: aload_0
    //   65: invokevirtual 91	org/tizen/sdblib/daemon/AbstractServer:terminate	()V
    //   68: aload_0
    //   69: getstatic 36	org/tizen/sdblib/daemon/ServerState:Terminated	Lorg/tizen/sdblib/daemon/ServerState;
    //   72: invokevirtual 86	org/tizen/sdblib/daemon/AbstractServer:setStatus	(Lorg/tizen/sdblib/daemon/ServerState;)V
    //   75: return
    //   76: aload_0
    //   77: getstatic 94	org/tizen/sdblib/daemon/ServerState:Running	Lorg/tizen/sdblib/daemon/ServerState;
    //   80: invokevirtual 86	org/tizen/sdblib/daemon/AbstractServer:setStatus	(Lorg/tizen/sdblib/daemon/ServerState;)V
    //   83: goto +15 -> 98
    //   86: astore_1
    //   87: aload_0
    //   88: getfield 34	org/tizen/sdblib/daemon/AbstractServer:lock	Ljava/util/concurrent/locks/Lock;
    //   91: invokeinterface 53 1 0
    //   96: aload_1
    //   97: athrow
    //   98: aload_0
    //   99: getfield 34	org/tizen/sdblib/daemon/AbstractServer:lock	Ljava/util/concurrent/locks/Lock;
    //   102: invokeinterface 53 1 0
    //   107: goto +7 -> 114
    //   110: aload_0
    //   111: invokevirtual 97	org/tizen/sdblib/daemon/AbstractServer:process	()V
    //   114: aload_0
    //   115: iconst_1
    //   116: anewarray 37	org/tizen/sdblib/daemon/ServerState
    //   119: dup
    //   120: iconst_0
    //   121: getstatic 83	org/tizen/sdblib/daemon/ServerState:Halting	Lorg/tizen/sdblib/daemon/ServerState;
    //   124: aastore
    //   125: invokevirtual 78	org/tizen/sdblib/daemon/AbstractServer:isState	([Lorg/tizen/sdblib/daemon/ServerState;)Z
    //   128: ifeq -18 -> 110
    //   131: goto +38 -> 169
    //   134: astore_1
    //   135: ldc 100
    //   137: aload_1
    //   138: invokestatic 102	org/tizen/sdblib/util/Log:e	(Ljava/lang/String;Ljava/lang/Throwable;)V
    //   141: aload_0
    //   142: invokevirtual 91	org/tizen/sdblib/daemon/AbstractServer:terminate	()V
    //   145: aload_0
    //   146: getstatic 36	org/tizen/sdblib/daemon/ServerState:Terminated	Lorg/tizen/sdblib/daemon/ServerState;
    //   149: invokevirtual 86	org/tizen/sdblib/daemon/AbstractServer:setStatus	(Lorg/tizen/sdblib/daemon/ServerState;)V
    //   152: goto +28 -> 180
    //   155: astore_2
    //   156: aload_0
    //   157: invokevirtual 91	org/tizen/sdblib/daemon/AbstractServer:terminate	()V
    //   160: aload_0
    //   161: getstatic 36	org/tizen/sdblib/daemon/ServerState:Terminated	Lorg/tizen/sdblib/daemon/ServerState;
    //   164: invokevirtual 86	org/tizen/sdblib/daemon/AbstractServer:setStatus	(Lorg/tizen/sdblib/daemon/ServerState;)V
    //   167: aload_2
    //   168: athrow
    //   169: aload_0
    //   170: invokevirtual 91	org/tizen/sdblib/daemon/AbstractServer:terminate	()V
    //   173: aload_0
    //   174: getstatic 36	org/tizen/sdblib/daemon/ServerState:Terminated	Lorg/tizen/sdblib/daemon/ServerState;
    //   177: invokevirtual 86	org/tizen/sdblib/daemon/AbstractServer:setStatus	(Lorg/tizen/sdblib/daemon/ServerState;)V
    //   180: return
    // Line number table:
    //   Java source line #218	-> byte code offset #0
    //   Java source line #220	-> byte code offset #17
    //   Java source line #221	-> byte code offset #24
    //   Java source line #225	-> byte code offset #25
    //   Java source line #227	-> byte code offset #29
    //   Java source line #230	-> byte code offset #38
    //   Java source line #238	-> byte code offset #55
    //   Java source line #251	-> byte code offset #64
    //   Java source line #252	-> byte code offset #68
    //   Java source line #232	-> byte code offset #75
    //   Java source line #234	-> byte code offset #76
    //   Java source line #237	-> byte code offset #86
    //   Java source line #238	-> byte code offset #87
    //   Java source line #239	-> byte code offset #96
    //   Java source line #238	-> byte code offset #98
    //   Java source line #240	-> byte code offset #107
    //   Java source line #242	-> byte code offset #110
    //   Java source line #240	-> byte code offset #114
    //   Java source line #245	-> byte code offset #134
    //   Java source line #247	-> byte code offset #135
    //   Java source line #251	-> byte code offset #141
    //   Java source line #252	-> byte code offset #145
    //   Java source line #250	-> byte code offset #155
    //   Java source line #251	-> byte code offset #156
    //   Java source line #252	-> byte code offset #160
    //   Java source line #253	-> byte code offset #167
    //   Java source line #251	-> byte code offset #169
    //   Java source line #252	-> byte code offset #173
    //   Java source line #255	-> byte code offset #180
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	181	0	this	AbstractServer
    //   86	11	1	localObject1	Object
    //   134	4	1	e	Exception
    //   155	13	2	localObject2	Object
    // Exception table:
    //   from	to	target	type
    //   38	55	86	finally
    //   76	86	86	finally
    //   25	64	134	java/lang/Exception
    //   76	131	134	java/lang/Exception
    //   25	64	155	finally
    //   76	141	155	finally
  }
  
  /* Error */
  public void boot()
    throws ServerException
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 34	org/tizen/sdblib/daemon/AbstractServer:lock	Ljava/util/concurrent/locks/Lock;
    //   4: invokeinterface 49 1 0
    //   9: aload_0
    //   10: iconst_1
    //   11: anewarray 37	org/tizen/sdblib/daemon/ServerState
    //   14: dup
    //   15: iconst_0
    //   16: getstatic 36	org/tizen/sdblib/daemon/ServerState:Terminated	Lorg/tizen/sdblib/daemon/ServerState;
    //   19: aastore
    //   20: invokevirtual 78	org/tizen/sdblib/daemon/AbstractServer:isState	([Lorg/tizen/sdblib/daemon/ServerState;)Z
    //   23: ifne +11 -> 34
    //   26: new 115	java/lang/IllegalStateException
    //   29: dup
    //   30: invokespecial 117	java/lang/IllegalStateException:<init>	()V
    //   33: athrow
    //   34: aload_0
    //   35: invokevirtual 118	org/tizen/sdblib/daemon/AbstractServer:getName	()Ljava/lang/String;
    //   38: astore_1
    //   39: aload_1
    //   40: ifnonnull +18 -> 58
    //   43: aload_0
    //   44: new 120	java/lang/Thread
    //   47: dup
    //   48: aload_0
    //   49: invokespecial 122	java/lang/Thread:<init>	(Ljava/lang/Runnable;)V
    //   52: putfield 29	org/tizen/sdblib/daemon/AbstractServer:thread	Ljava/lang/Thread;
    //   55: goto +16 -> 71
    //   58: aload_0
    //   59: new 120	java/lang/Thread
    //   62: dup
    //   63: aload_0
    //   64: aload_1
    //   65: invokespecial 125	java/lang/Thread:<init>	(Ljava/lang/Runnable;Ljava/lang/String;)V
    //   68: putfield 29	org/tizen/sdblib/daemon/AbstractServer:thread	Ljava/lang/Thread;
    //   71: aload_0
    //   72: getfield 29	org/tizen/sdblib/daemon/AbstractServer:thread	Ljava/lang/Thread;
    //   75: iconst_1
    //   76: invokevirtual 128	java/lang/Thread:setDaemon	(Z)V
    //   79: aload_0
    //   80: getfield 29	org/tizen/sdblib/daemon/AbstractServer:thread	Ljava/lang/Thread;
    //   83: invokevirtual 132	java/lang/Thread:start	()V
    //   86: aload_0
    //   87: getstatic 135	org/tizen/sdblib/daemon/ServerState:Initializing	Lorg/tizen/sdblib/daemon/ServerState;
    //   90: invokevirtual 86	org/tizen/sdblib/daemon/AbstractServer:setStatus	(Lorg/tizen/sdblib/daemon/ServerState;)V
    //   93: goto +15 -> 108
    //   96: astore_2
    //   97: aload_0
    //   98: getfield 34	org/tizen/sdblib/daemon/AbstractServer:lock	Ljava/util/concurrent/locks/Lock;
    //   101: invokeinterface 53 1 0
    //   106: aload_2
    //   107: athrow
    //   108: aload_0
    //   109: getfield 34	org/tizen/sdblib/daemon/AbstractServer:lock	Ljava/util/concurrent/locks/Lock;
    //   112: invokeinterface 53 1 0
    //   117: return
    // Line number table:
    //   Java source line #266	-> byte code offset #0
    //   Java source line #269	-> byte code offset #9
    //   Java source line #271	-> byte code offset #26
    //   Java source line #274	-> byte code offset #34
    //   Java source line #275	-> byte code offset #39
    //   Java source line #277	-> byte code offset #43
    //   Java source line #281	-> byte code offset #58
    //   Java source line #283	-> byte code offset #71
    //   Java source line #284	-> byte code offset #79
    //   Java source line #285	-> byte code offset #86
    //   Java source line #288	-> byte code offset #96
    //   Java source line #289	-> byte code offset #97
    //   Java source line #290	-> byte code offset #106
    //   Java source line #289	-> byte code offset #108
    //   Java source line #291	-> byte code offset #117
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	118	0	this	AbstractServer
    //   38	27	1	name	String
    //   96	11	2	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   9	96	96	finally
  }
  
  /* Error */
  public void down()
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 34	org/tizen/sdblib/daemon/AbstractServer:lock	Ljava/util/concurrent/locks/Lock;
    //   4: invokeinterface 49 1 0
    //   9: aload_0
    //   10: iconst_2
    //   11: anewarray 37	org/tizen/sdblib/daemon/ServerState
    //   14: dup
    //   15: iconst_0
    //   16: getstatic 36	org/tizen/sdblib/daemon/ServerState:Terminated	Lorg/tizen/sdblib/daemon/ServerState;
    //   19: aastore
    //   20: dup
    //   21: iconst_1
    //   22: getstatic 83	org/tizen/sdblib/daemon/ServerState:Halting	Lorg/tizen/sdblib/daemon/ServerState;
    //   25: aastore
    //   26: invokevirtual 78	org/tizen/sdblib/daemon/AbstractServer:isState	([Lorg/tizen/sdblib/daemon/ServerState;)Z
    //   29: ifeq +11 -> 40
    //   32: new 115	java/lang/IllegalStateException
    //   35: dup
    //   36: invokespecial 117	java/lang/IllegalStateException:<init>	()V
    //   39: athrow
    //   40: aload_0
    //   41: getstatic 83	org/tizen/sdblib/daemon/ServerState:Halting	Lorg/tizen/sdblib/daemon/ServerState;
    //   44: invokevirtual 86	org/tizen/sdblib/daemon/AbstractServer:setStatus	(Lorg/tizen/sdblib/daemon/ServerState;)V
    //   47: goto +15 -> 62
    //   50: astore_1
    //   51: aload_0
    //   52: getfield 34	org/tizen/sdblib/daemon/AbstractServer:lock	Ljava/util/concurrent/locks/Lock;
    //   55: invokeinterface 53 1 0
    //   60: aload_1
    //   61: athrow
    //   62: aload_0
    //   63: getfield 34	org/tizen/sdblib/daemon/AbstractServer:lock	Ljava/util/concurrent/locks/Lock;
    //   66: invokeinterface 53 1 0
    //   71: return
    // Line number table:
    //   Java source line #301	-> byte code offset #0
    //   Java source line #304	-> byte code offset #9
    //   Java source line #305	-> byte code offset #32
    //   Java source line #307	-> byte code offset #40
    //   Java source line #310	-> byte code offset #50
    //   Java source line #311	-> byte code offset #51
    //   Java source line #312	-> byte code offset #60
    //   Java source line #311	-> byte code offset #62
    //   Java source line #314	-> byte code offset #71
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	72	0	this	AbstractServer
    //   50	11	1	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   9	50	50	finally
  }
  
  protected void initialize()
    throws ServerException
  {}
  
  protected abstract void process()
    throws Exception;
  
  protected void terminate() {}
}

/* Location:
 * Qualified Name:     org.tizen.sdblib.daemon.AbstractServer
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.sdblib.daemon;

import org.tizen.sdblib.exception.ServerException;

public abstract interface Server
{
  public abstract void boot()
    throws ServerException;
  
  public abstract void down()
    throws ServerException;
}

/* Location:
 * Qualified Name:     org.tizen.sdblib.daemon.Server
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.sdblib.daemon;

public enum ServerState
{
  Terminated,  Initializing,  Running,  Halting;
}

/* Location:
 * Qualified Name:     org.tizen.sdblib.daemon.ServerState
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.sdblib.exception;

import java.io.IOException;

public class SdbCommandRejectedException
  extends IOException
{
  private static final long serialVersionUID = 3466997028942667337L;
  
  public SdbCommandRejectedException(String message)
  {
    super(message);
  }
}

/* Location:
 * Qualified Name:     org.tizen.sdblib.exception.SdbCommandRejectedException
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.sdblib.exception;

public class ServerException
  extends Exception
{
  private static final long serialVersionUID = 3662986092815719651L;
  
  public ServerException() {}
  
  public ServerException(String msg)
  {
    super(msg);
  }
  
  public ServerException(Throwable cause)
  {
    super(cause);
  }
  
  public ServerException(String msg, Throwable cause)
  {
    super(msg, cause);
  }
}

/* Location:
 * Qualified Name:     org.tizen.sdblib.exception.ServerException
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.sdblib.exception;

import java.io.IOException;

public class ShellCommandUnresponsiveException
  extends IOException
{
  private static final long serialVersionUID = 8123258430753698798L;
}

/* Location:
 * Qualified Name:     org.tizen.sdblib.exception.ShellCommandUnresponsiveException
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.sdblib.exception;

import java.io.IOException;
import org.tizen.sdblib.service.SyncServiceReturnCode;

public class SyncException
  extends IOException
{
  private static final long serialVersionUID = 1371056489747164529L;
  protected final int code;
  
  public SyncException(int code)
  {
    this.code = code;
  }
  
  public SyncException(int code, String message)
  {
    super(message);
    this.code = code;
  }
  
  public SyncException(int code, Throwable cause)
  {
    super(cause);
    this.code = code;
  }
  
  public SyncException(SyncServiceReturnCode code)
  {
    this(code.value());
  }
  
  public SyncException(SyncServiceReturnCode code, Throwable cause)
  {
    this(code.value(), cause);
  }
  
  public SyncException(SyncServiceReturnCode code, String message)
  {
    this(code.value(), message);
  }
  
  public int getCode()
  {
    return code;
  }
}

/* Location:
 * Qualified Name:     org.tizen.sdblib.exception.SyncException
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.sdblib.exception;

import java.io.IOException;

public class TimeoutException
  extends IOException
{
  private static final long serialVersionUID = -4311065054176283079L;
}

/* Location:
 * Qualified Name:     org.tizen.sdblib.exception.TimeoutException
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.sdblib.receiver;

import java.io.IOException;
import org.tizen.sdblib.IShellOutputReceiver;

public class AbstractShellOutputReceiver
  implements IShellOutputReceiver
{
  public Appendable append(CharSequence csq)
    throws IOException
  {
    if (csq == null) {
      return this;
    }
    return append(csq, 0, csq.length());
  }
  
  public Appendable append(CharSequence csq, int start, int end)
    throws IOException
  {
    if (csq == null) {
      return this;
    }
    for (int i = start; i < end; i++) {
      append(csq.charAt(i));
    }
    return this;
  }
  
  public void flush()
    throws IOException
  {}
  
  public boolean isCancelled()
  {
    return false;
  }
  
  public void close()
    throws IOException
  {}
  
  public Appendable append(char c)
    throws IOException
  {
    return this;
  }
}

/* Location:
 * Qualified Name:     org.tizen.sdblib.receiver.AbstractShellOutputReceiver
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.sdblib.receiver;

import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.tizen.sdblib.service.FileEntry;
import org.tizen.sdblib.service.FileEntryType;
import org.tizen.sdblib.util.CollectionUtil;
import org.tizen.sdblib.util.StringUtil;

public class FileEntryFactory
{
  static final String P_PERMISSIONS = "([bcdlsp-][-r][-w][-xsS][-r][-w][-xsS][-r][-w][-xstST])";
  static final String P_FILECOUNT = "(\\d{1,})";
  static final String P_OWNER = "(\\S+)";
  static final String P_GROUP = "(\\S+)";
  static final String P_SIZE = "([\\d\\s,]*)";
  static final String P_DATE = "(\\d{4}-\\d{2}-\\d{2}|[a-zA-Z]{3}\\s+\\d{1,2})";
  static final String P_TIME = "(\\d{1,2}:\\d{1,2}|[0-9]{4})";
  static final String P_NAME = "(.*)";
  static final String PATTERN_STRING = "^" + CollectionUtil.concatenate(
    new String[] { "([bcdlsp-][-r][-w][-xsS][-r][-w][-xsS][-r][-w][-xstST])", "(\\d{1,})", "(\\S+)", "(\\S+)", "([\\d\\s,]*)", "(\\d{4}-\\d{2}-\\d{2}|[a-zA-Z]{3}\\s+\\d{1,2})", "(\\d{1,2}:\\d{1,2}|[0-9]{4})", "(.*)" }, 
    "\\s+") + 
    "$";
  protected static final Pattern PATTERN = Pattern.compile(PATTERN_STRING);
  
  public static FileEntry create(FileEntry parent, String line)
  {
    Matcher m = PATTERN.matcher(line);
    if (!m.matches()) {
      return null;
    }
    String permissions = m.group(1);
    
    String owner = m.group(3);
    String group = m.group(4);
    String size = m.group(5);
    String date = m.group(6);
    String time = m.group(7);
    String name = m.group(8);
    String info = null;
    String linkTo = null;
    FileEntryType objectType = FileEntryType.from(permissions.charAt(0));
    if (objectType == FileEntryType.Link)
    {
      String[] segments = name.split("\\s->\\s");
      if (segments.length == 2)
      {
        name = segments[0];
        
        linkTo = segments[1];
        
        info = "-> " + linkTo;
        if (linkTo.endsWith("/"))
        {
          objectType = FileEntryType.DirectoryLink;
          name = StringUtil.trimTrailingCharacter(name, '/');
        }
      }
    }
    else if (objectType == FileEntryType.Directory)
    {
      name = StringUtil.trimTrailingCharacter(name, '/');
    }
    else if (objectType == FileEntryType.Socket)
    {
      name = StringUtil.trimTrailingCharacter(name, '=');
    }
    else if (objectType == FileEntryType.FIFO)
    {
      name = StringUtil.trimTrailingCharacter(name, '|');
    }
    else if (permissions.contains("x"))
    {
      name = StringUtil.trimTrailingCharacter(name, '*');
    }
    return new FileEntry(null, parent, name, objectType, permissions, owner, group, size, date, time, info, linkTo);
  }
}

/* Location:
 * Qualified Name:     org.tizen.sdblib.receiver.FileEntryFactory
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.sdblib.receiver;

import java.util.Collection;
import java.util.TreeSet;
import org.tizen.sdblib.service.FileEntry;

public class LsReceiver
  extends MultiLineReceiver
{
  public static final String CMD_LS_WITH_STYLE = "ls -lF %s --time-style=long-iso 2> /dev/null";
  protected final FileEntry parent;
  protected final TreeSet<FileEntry> entries = new TreeSet();
  
  public LsReceiver(FileEntry parent)
  {
    this.parent = parent;
  }
  
  public void processNewLines(String[] lines)
  {
    String[] arrayOfString;
    int j = (arrayOfString = lines).length;
    for (int i = 0; i < j; i++)
    {
      String line = arrayOfString[i];
      if (line.length() != 0)
      {
        FileEntry entry = FileEntryFactory.create(parent, line);
        if (entry != null) {
          entries.add(entry);
        }
      }
    }
  }
  
  public Collection<FileEntry> getEntries()
  {
    return entries;
  }
}

/* Location:
 * Qualified Name:     org.tizen.sdblib.receiver.LsReceiver
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.sdblib.receiver;

import java.io.IOException;
import java.util.ArrayList;
import org.tizen.sdblib.IShellOutputReceiver;

public abstract class MultiLineReceiver
  extends AbstractShellOutputReceiver
  implements IShellOutputReceiver
{
  protected boolean bTrimLines = true;
  protected static final int ST_NORMAL = 0;
  protected static final int ST_LINE_CANDIDATE = 1;
  protected int status = 0;
  private final ArrayList<String> lines = new ArrayList();
  protected final StringBuilder buffer = new StringBuilder();
  
  public MultiLineReceiver()
  {
    this(true);
  }
  
  public MultiLineReceiver(boolean bTrimLines)
  {
    this.bTrimLines = bTrimLines;
  }
  
  public void setTrimLines(boolean bTrimLines)
  {
    this.bTrimLines = bTrimLines;
  }
  
  public Appendable append(char c)
    throws IOException
  {
    if (status == 0)
    {
      if ('\r' == c)
      {
        status = 1;
      }
      else if ('\n' == c)
      {
        String line = buffer.toString();
        if (bTrimLines) {
          line = line.trim();
        }
        lines.add(line);
        buffer.delete(0, buffer.length());
        status = 0;
      }
      else
      {
        buffer.append(c);
      }
    }
    else if (1 == status) {
      if ('\n' == c)
      {
        String line = buffer.toString();
        if (bTrimLines) {
          line = line.trim();
        }
        lines.add(line);
        buffer.delete(0, buffer.length());
        status = 0;
      }
      else if ('\r' == c)
      {
        buffer.append('\r');
      }
      else
      {
        buffer.append('\r');
        buffer.append(c);
        status = 0;
      }
    }
    return this;
  }
  
  public Appendable append(CharSequence csq, int start, int end)
    throws IOException
  {
    Appendable ret = super.append(csq, start, end);
    flush();
    return ret;
  }
  
  public void flush()
    throws IOException
  {
    if (lines.size() > 0)
    {
      processNewLines((String[])lines.toArray(new String[lines.size()]));
      lines.clear();
    }
  }
  
  public void close()
    throws IOException
  {
    if (buffer.length() > 0)
    {
      lines.add(buffer.toString());
      buffer.delete(0, buffer.length());
      flush();
    }
    super.close();
  }
  
  public abstract void processNewLines(String[] paramArrayOfString);
}

/* Location:
 * Qualified Name:     org.tizen.sdblib.receiver.MultiLineReceiver
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.sdblib.receiver;

import java.io.IOException;
import org.tizen.sdblib.IShellOutputReceiver;

public final class NullOutputReceiver
  extends AbstractShellOutputReceiver
  implements IShellOutputReceiver
{
  protected static final NullOutputReceiver instance = new NullOutputReceiver();
  
  public static IShellOutputReceiver getInstance()
  {
    return instance;
  }
  
  public Appendable append(char c)
    throws IOException
  {
    return this;
  }
}

/* Location:
 * Qualified Name:     org.tizen.sdblib.receiver.NullOutputReceiver
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.sdblib.service;

import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.SocketChannel;
import java.nio.charset.Charset;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Set;
import org.tizen.sdblib.ICrashReportServiceListener;
import org.tizen.sdblib.IDevice;
import org.tizen.sdblib.IDeviceChangeListener;
import org.tizen.sdblib.SdbHelper;
import org.tizen.sdblib.SdbResponse;
import org.tizen.sdblib.SmartDevelopmentBridge;
import org.tizen.sdblib.daemon.AbstractServer;
import org.tizen.sdblib.exception.ServerException;
import org.tizen.sdblib.util.DeviceUtil;
import org.tizen.sdblib.util.IOUtil;
import org.tizen.sdblib.util.Log;
import org.tizen.sdblib.util.ThreadUtil;

public class CrashReportService
  extends AbstractServer
  implements IDeviceChangeListener
{
  protected final LinkedHashSet<ICrashReportServiceListener> listeners = new LinkedHashSet();
  protected Selector selector = null;
  
  public CrashReportService()
  {
    super("CS Report Service");
  }
  
  protected void initReportChannel()
  {
    IDevice[] devices = SmartDevelopmentBridge.getBridge().getDevices();
    IDevice[] arrayOfIDevice1;
    int j = (arrayOfIDevice1 = devices).length;
    for (int i = 0; i < j; i++)
    {
      IDevice device = arrayOfIDevice1[i];
      if (DeviceUtil.isOnline(device)) {
        registerReportChannel(device);
      }
    }
  }
  
  protected void registerReportChannel(IDevice device)
  {
    try
    {
      SocketChannel channel = SmartDevelopmentBridge.getBridge().openChannel();
      
      SdbHelper.initializeDevice(channel, device.getSerialNumber());
      
      byte[] request = SdbHelper.formSdbRequest("cs:");
      SdbHelper.write(channel, request);
      
      SdbResponse resp = SdbHelper.readSdbResponse(channel);
      if (!okay)
      {
        Log.e("sdb", "got unhappy response from sdb cs req: " + message);
        IOUtil.tryClose(channel);
        return;
      }
      Log.i("sdb", "registering CS Report Service");
      selector.wakeup();
      channel.register(selector, 1, device);
      Log.i("sdb", "registered CS Report Service");
    }
    catch (IOException e)
    {
      e.printStackTrace();
      Log.e("sdb", "failed to open a socket channel");
    }
  }
  
  private void read(SelectionKey key)
  {
    SocketChannel sc = (SocketChannel)key.channel();
    try
    {
      ByteBuffer reply = ByteBuffer.allocate(124);
      
      int len = sc.read(reply);
      Log.i("sdb", "read byte :" + len);
      if (len > 0)
      {
        reply.flip();
        notifyAllListeners((IDevice)key.attachment(), SdbHelper.UTF_CHARSET.decode(reply).toString());
      }
      else if (len < 0)
      {
        key.cancel();
        IOUtil.tryClose(sc);
      }
    }
    catch (IOException e)
    {
      key.cancel();
      Log.e("sdb", "read failed :" + e);
      IOUtil.tryClose(sc);
    }
  }
  
  private void notifyAllListeners(IDevice device, String path)
  {
    Log.i("sdb", "cs file is created and notify from " + device.getSerialNumber());
    Collection<ICrashReportServiceListener> temp = null;
    synchronized (this)
    {
      temp = (Collection)listeners.clone();
    }
    for (ICrashReportServiceListener listener : temp) {
      try
      {
        listener.fileCreated(device, path);
      }
      catch (Exception e)
      {
        Log.e("sdb", "unexpected error occurred :" + e);
      }
    }
  }
  
  public synchronized void addCrashReportServiceListener(ICrashReportServiceListener listener)
  {
    listeners.add(listener);
  }
  
  public synchronized void removeCrashReportServiceListener(ICrashReportServiceListener listener)
  {
    listeners.remove(listener);
  }
  
  public void onConnected(IDevice device)
  {
    if (DeviceUtil.isOnline(device))
    {
      Log.i("sdb", "welcome to new connection :" + device.getSerialNumber());
      registerReportChannel(device);
    }
  }
  
  public void onDisconnected(IDevice device)
  {
    Log.i("sdb", "bye!:" + device.getSerialNumber());
  }
  
  public void onChanged(IDevice device, int changeMask)
  {
    if (changeMask == 1) {
      onConnected(device);
    }
  }
  
  protected void initialize()
    throws ServerException
  {
    try
    {
      Log.i("sdb", "starting CS Report Service");
      selector = Selector.open();
      SmartDevelopmentBridge.addDeviceChangeListener(this);
      initReportChannel();
    }
    catch (IOException e)
    {
      throw new ServerException(e);
    }
  }
  
  protected void process()
    throws Exception
  {
    Log.d("crashreport", "Wait any response");
    if (selector.select() <= 0)
    {
      ThreadUtil.trySleep(50L);
      return;
    }
    Iterator<SelectionKey> iter = selector.selectedKeys().iterator();
    while (iter.hasNext())
    {
      SelectionKey key = (SelectionKey)iter.next();
      Log.d("crash", "Iteration: " + key.interestOps());
      if (key.isConnectable())
      {
        SocketChannel sc = (SocketChannel)key.channel();
        if (sc.isConnectionPending()) {
          sc.finishConnect();
        }
      }
      else if (key.isReadable())
      {
        read(key);
      }
      iter.remove();
    }
  }
  
  protected void terminate()
  {
    SmartDevelopmentBridge.removeDeviceChangeListener(this);
    IOUtil.tryClose(new Object[] {selector });
  }
}

/* Location:
 * Qualified Name:     org.tizen.sdblib.service.CrashReportService
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.sdblib.service;

import java.util.ArrayList;
import java.util.Collection;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.tizen.sdblib.IDevice;
import org.tizen.sdblib.util.Assert;
import org.tizen.sdblib.util.ObjectUtil;

public class FileEntry
  implements Comparable<FileEntry>
{
  private static final String FILE_ROOT = "/";
  public static final String FILE_SEPARATOR = "/";
  public static final long REFRESH_RATE = 5000L;
  public static final long REFRESH_TEST = 4000L;
  public static final int USE_CACHE = 0;
  private static final Pattern ESCAPE_PATTERN = Pattern.compile("([\\\\\"$])");
  protected final IDevice device;
  protected final FileEntry parent;
  protected String name;
  protected FileEntryType type;
  protected final String permissions;
  protected final String owner;
  protected final String group;
  protected final String size;
  protected final String date;
  protected final String time;
  protected String linkSource;
  protected final String info;
  protected long fetchTime = 0L;
  protected Collection<FileEntry> children = new ArrayList();
  
  public FileEntry(IDevice device, FileEntry parent, String name, FileEntryType type, String permission, String owner, String group, String size, String date, String time, String info, String linkSource)
  {
    Assert.isTrue((device == null ? 1 : 0) ^ (parent == null ? 1 : 0));
    Assert.notNull(name);
    this.device = (device == null ? parent.getDevice() : device);
    this.parent = parent;
    this.name = name;
    this.type = type;
    permissions = permission;
    this.owner = owner;
    this.group = group;
    this.size = size;
    this.date = date;
    this.time = time;
    this.info = info;
    this.linkSource = linkSource;
  }
  
  public FileEntryType getType()
  {
    return type;
  }
  
  public void setType(FileEntryType type)
  {
    this.type = type;
  }
  
  public IDevice getDevice()
  {
    return device;
  }
  
  public FileEntry getParent()
  {
    return parent;
  }
  
  public String getName()
  {
    return name;
  }
  
  public void setName(String name)
  {
    this.name = name;
  }
  
  public String getSize()
  {
    return size;
  }
  
  public String getDate()
  {
    return date;
  }
  
  public String getTime()
  {
    return time;
  }
  
  public String getPermissions()
  {
    return permissions;
  }
  
  public String getLinkSource()
  {
    return linkSource;
  }
  
  public String getInfo()
  {
    return info;
  }
  
  public String getFullPath()
  {
    if (parent == null) {
      return "/";
    }
    StringBuilder pathBuilder = new StringBuilder();
    fillPathBuilder(pathBuilder, false);
    
    return pathBuilder.toString();
  }
  
  public String getFullEscapedPath()
  {
    StringBuilder pathBuilder = new StringBuilder();
    fillPathBuilder(pathBuilder, true);
    
    return pathBuilder.toString();
  }
  
  public boolean isDirectory()
  {
    return type.isDirectory();
  }
  
  private String getStringWithDoubleQuote(String str)
  {
    return "\"" + str + "\"";
  }
  
  /* Error */
  public FileEntry[] getChildren()
  {
    // Byte code:
    //   0: new 165	org/tizen/sdblib/receiver/LsReceiver
    //   3: dup
    //   4: aload_0
    //   5: invokespecial 167	org/tizen/sdblib/receiver/LsReceiver:<init>	(Lorg/tizen/sdblib/service/FileEntry;)V
    //   8: astore_1
    //   9: ldc 10
    //   11: aload_0
    //   12: invokevirtual 170	org/tizen/sdblib/service/FileEntry:getType	()Lorg/tizen/sdblib/service/FileEntryType;
    //   15: invokevirtual 172	org/tizen/sdblib/service/FileEntryType:isLink	()Z
    //   18: ifeq +10 -> 28
    //   21: aload_0
    //   22: invokevirtual 175	org/tizen/sdblib/service/FileEntry:getLinkSource	()Ljava/lang/String;
    //   25: goto +7 -> 32
    //   28: aload_0
    //   29: invokevirtual 177	org/tizen/sdblib/service/FileEntry:getFullEscapedPath	()Ljava/lang/String;
    //   32: invokestatic 179	org/tizen/sdblib/util/FilenameUtil:addTailingPath	(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    //   35: astore_2
    //   36: ldc -71
    //   38: iconst_1
    //   39: anewarray 3	java/lang/Object
    //   42: dup
    //   43: iconst_0
    //   44: aload_0
    //   45: aload_2
    //   46: invokespecial 187	org/tizen/sdblib/service/FileEntry:getStringWithDoubleQuote	(Ljava/lang/String;)Ljava/lang/String;
    //   49: aastore
    //   50: invokestatic 189	java/lang/String:format	(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
    //   53: astore_3
    //   54: aload_0
    //   55: getfield 85	org/tizen/sdblib/service/FileEntry:device	Lorg/tizen/sdblib/IDevice;
    //   58: aload_3
    //   59: aload_1
    //   60: invokeinterface 193 3 0
    //   65: goto +41 -> 106
    //   68: astore_2
    //   69: ldc -59
    //   71: new 135	java/lang/StringBuilder
    //   74: dup
    //   75: ldc -57
    //   77: invokespecial 156	java/lang/StringBuilder:<init>	(Ljava/lang/String;)V
    //   80: aload_2
    //   81: invokevirtual 201	java/lang/StringBuilder:append	(Ljava/lang/Object;)Ljava/lang/StringBuilder;
    //   84: invokevirtual 142	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   87: invokestatic 204	org/tizen/sdblib/util/Log:e	(Ljava/lang/String;Ljava/lang/String;)V
    //   90: aload_1
    //   91: invokestatic 210	org/tizen/sdblib/util/IOUtil:tryClose	(Ljava/io/Closeable;)V
    //   94: goto +16 -> 110
    //   97: astore 4
    //   99: aload_1
    //   100: invokestatic 210	org/tizen/sdblib/util/IOUtil:tryClose	(Ljava/io/Closeable;)V
    //   103: aload 4
    //   105: athrow
    //   106: aload_1
    //   107: invokestatic 210	org/tizen/sdblib/util/IOUtil:tryClose	(Ljava/io/Closeable;)V
    //   110: aload_0
    //   111: invokestatic 216	java/lang/System:currentTimeMillis	()J
    //   114: putfield 64	org/tizen/sdblib/service/FileEntry:fetchTime	J
    //   117: aload_0
    //   118: aload_1
    //   119: invokevirtual 222	org/tizen/sdblib/receiver/LsReceiver:getEntries	()Ljava/util/Collection;
    //   122: putfield 69	org/tizen/sdblib/service/FileEntry:children	Ljava/util/Collection;
    //   125: aload_0
    //   126: getfield 69	org/tizen/sdblib/service/FileEntry:children	Ljava/util/Collection;
    //   129: aload_0
    //   130: getfield 69	org/tizen/sdblib/service/FileEntry:children	Ljava/util/Collection;
    //   133: invokeinterface 226 1 0
    //   138: anewarray 1	org/tizen/sdblib/service/FileEntry
    //   141: invokeinterface 231 2 0
    //   146: checkcast 235	[Lorg/tizen/sdblib/service/FileEntry;
    //   149: areturn
    // Line number table:
    //   Java source line #427	-> byte code offset #0
    //   Java source line #431	-> byte code offset #9
    //   Java source line #432	-> byte code offset #36
    //   Java source line #436	-> byte code offset #54
    //   Java source line #438	-> byte code offset #68
    //   Java source line #441	-> byte code offset #69
    //   Java source line #445	-> byte code offset #90
    //   Java source line #444	-> byte code offset #97
    //   Java source line #445	-> byte code offset #99
    //   Java source line #446	-> byte code offset #103
    //   Java source line #445	-> byte code offset #106
    //   Java source line #448	-> byte code offset #110
    //   Java source line #451	-> byte code offset #117
    //   Java source line #453	-> byte code offset #125
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	150	0	this	FileEntry
    //   8	111	1	receiver	org.tizen.sdblib.receiver.LsReceiver
    //   35	11	2	path	String
    //   68	13	2	e	java.io.IOException
    //   53	6	3	command	String
    //   97	7	4	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   9	65	68	java/io/IOException
    //   9	90	97	finally
  }
  
  public FileEntry[] getChildren(int useCache)
  {
    if (useCache == 0)
    {
      if (needFetch()) {
        return getChildren();
      }
      return (FileEntry[])children.toArray(new FileEntry[children.size()]);
    }
    return getChildren();
  }
  
  public boolean isRoot()
  {
    return parent == null;
  }
  
  boolean needFetch()
  {
    if (fetchTime == 0L) {
      return true;
    }
    long current = System.currentTimeMillis();
    if (current - fetchTime > 4000L) {
      return true;
    }
    return false;
  }
  
  protected void fillPathBuilder(StringBuilder pathBuilder, boolean escapePath)
  {
    if (parent == null) {
      return;
    }
    if (parent != null) {
      parent.fillPathBuilder(pathBuilder, escapePath);
    }
    pathBuilder.append("/");
    pathBuilder.append(escapePath ? escape(name) : name);
  }
  
  protected void fillPathSegments(ArrayList<String> list)
  {
    if (parent == null) {
      return;
    }
    if (parent != null) {
      parent.fillPathSegments(list);
    }
    list.add(name);
  }
  
  protected static String escape(String name)
  {
    return ESCAPE_PATTERN.matcher(name).replaceAll("\\\\$1");
  }
  
  public boolean equals(Object obj)
  {
    if (this == obj) {
      return true;
    }
    if (!(obj instanceof FileEntry)) {
      return false;
    }
    FileEntry other = (FileEntry)obj;
    
    return (ObjectUtil.equals(getDevice(), other.getDevice())) && (ObjectUtil.equals(name, name)) && (ObjectUtil.equals(parent, parent));
  }
  
  public int compareTo(FileEntry o)
  {
    if (o == null) {
      return -1;
    }
    if (parent == null)
    {
      if (!ObjectUtil.equals(device, device)) {
        return -1;
      }
    }
    else if (!ObjectUtil.equals(parent, parent)) {
      return -1;
    }
    return name.compareTo(name);
  }
  
  public String toString()
  {
    return name;
  }
}

/* Location:
 * Qualified Name:     org.tizen.sdblib.service.FileEntry
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.sdblib.service;

public class FileEntryConstants
{
  protected static final int REMOTE_PATH_MAX_LENGTH = 1024;
  protected static final int SYNC_DATA_MAX = 65536;
}

/* Location:
 * Qualified Name:     org.tizen.sdblib.service.FileEntryConstants
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.sdb
1 2 3 4 5 6 7

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-2019. Infinite Loop Ltd