Android Open Source - SysLog Run Command






From Project

Back to project page SysLog.

License

The source code is released under:

GNU General Public License

If you think the Android project SysLog listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/* SysLog - A simple logging tool
 * Copyright (C) 2013-2014  Scott Warner <Tortel1210@gmail.com>
 * /*  w w w.jav  a  2 s  .  co  m*/
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
package com.tortel.syslog;

/**
 * A class that contains all the command details
 */
public class RunCommand {
  private boolean kernelLog;
  private boolean lastKernelLog;
  private boolean mainLog;
  private boolean eventLog;
  private boolean modemLog;
  private boolean root;

    private boolean scrubEnabled;
  
  private String appendText;
  private String notes;
  
  private GrepOption grepOption;
  private String grep;
  
  public boolean grep(){
    return grep != null && !"".equals(grep);
  }
  
  public String getNotes() {
      String toRet = null;
      if(notes != null && !"".equals(notes)){
          toRet = notes;
      }
      // Only add the grep notes if grep was actually used
      if(grep()){
          toRet = notes == null ? "" : notes;
          toRet += "\n"+grepOption.toString()+" grepped for "+grep;
      }
    return toRet;
  }
  
  public void setGrep(String grep) {
        //Need to make sure all quotes are escaped
    grep = grep.trim();
        grep = grep.replace("\"", "\\\"");
    this.grep = grep;
  }
  
  public String getDebugString(){
    StringBuilder builder = new StringBuilder();
    builder.append("Command information:");
    builder.append("\nkernelLog: "+kernelLog);
    builder.append("\nlastKernelLog: "+lastKernelLog);
    builder.append("\nmainLog: "+mainLog);
    builder.append("\neventLog: "+eventLog);
    builder.append("\nmodemLog: "+modemLog);
    builder.append("\ngrepOption: "+grepOption.toString());
    builder.append("\ngrep: "+grep);
    builder.append("\nfileAppendText: "+appendText);
    builder.append("\nnotes: "+notes);
    
    return builder.toString();
  }
  
  /**
   * Strips all invalid characters from a string,
   * for use in filenames. It replaces invalid characters
   * with '_'
   * @param name the string to clean
   * @return the clean string
   */
  private String cleanFileName(String name){
    return name.replaceAll("[^a-zA-Z0-9.-]", "_");
  }
  
  public boolean isKernelLog() {
    return kernelLog;
  }
  public void setKernelLog(boolean kernelLog) {
    this.kernelLog = kernelLog;
  }
  public boolean isLastKernelLog() {
    return lastKernelLog;
  }
  public void setLastKernelLog(boolean lastKernelLog) {
    this.lastKernelLog = lastKernelLog;
  }
  public boolean isMainLog() {
    return mainLog;
  }
  public void setMainLog(boolean mainLog) {
    this.mainLog = mainLog;
  }
  public boolean isModemLog() {
    return modemLog;
  }
  public void setModemLog(boolean radioLog) {
    this.modemLog = radioLog;
  }
  public String getAppendText() {
    return appendText;
  }
  public void setAppendText(String appendText) {
    this.appendText = cleanFileName(appendText.trim());
  }
  public void setNotes(String notes) {
    this.notes = notes.trim();
  }
  public GrepOption getGrepOption() {
    return grepOption;
  }
  public void setGrepOption(GrepOption grepOption) {
    this.grepOption = grepOption;
  }
  public String getGrep() {
    return grep;
  }
    public boolean hasRoot() {
        return root;
    }
    public void setRoot(boolean root) {
        this.root = root;
    }
    public boolean isEventLog() {
        return eventLog;
    }
    public void setEventLog(boolean eventLog) {
        this.eventLog = eventLog;
    }

    public boolean isScrubEnabled() {
        return scrubEnabled;
    }

    public void setScrubEnabled(boolean scrubEnabled) {
        this.scrubEnabled = scrubEnabled;
    }
}




Java Source Code List

com.tortel.syslog.GrepOption.java
com.tortel.syslog.LiveLogActivity.java
com.tortel.syslog.MainActivity.java
com.tortel.syslog.Result.java
com.tortel.syslog.RunCommand.java
com.tortel.syslog.ZipWriter.java
com.tortel.syslog.dialog.AboutDialog.java
com.tortel.syslog.dialog.CustomPathDialog.java
com.tortel.syslog.dialog.ExceptionDialog.java
com.tortel.syslog.dialog.FaqDialog.java
com.tortel.syslog.dialog.LowSpaceDialog.java
com.tortel.syslog.dialog.OhShitDialog.java
com.tortel.syslog.exception.CreateFolderException.java
com.tortel.syslog.exception.LowSpaceException.java
com.tortel.syslog.exception.NoFilesException.java
com.tortel.syslog.exception.RunCommandException.java
com.tortel.syslog.utils.InputStreamWrapper.java
com.tortel.syslog.utils.ScrubberUtils.java
com.tortel.syslog.utils.Utils.java
jackpal.androidterm.emulatorview.BaseTextRenderer.java
jackpal.androidterm.emulatorview.Bitmap4x8FontRenderer.java
jackpal.androidterm.emulatorview.ByteQueue.java
jackpal.androidterm.emulatorview.ColorScheme.java
jackpal.androidterm.emulatorview.EmulatorDebug.java
jackpal.androidterm.emulatorview.EmulatorView.java
jackpal.androidterm.emulatorview.GrowableIntArray.java
jackpal.androidterm.emulatorview.PaintRenderer.java
jackpal.androidterm.emulatorview.Screen.java
jackpal.androidterm.emulatorview.StyleRow.java
jackpal.androidterm.emulatorview.TermKeyListener.java
jackpal.androidterm.emulatorview.TermSession.java
jackpal.androidterm.emulatorview.TerminalEmulator.java
jackpal.androidterm.emulatorview.TextRenderer.java
jackpal.androidterm.emulatorview.TextStyle.java
jackpal.androidterm.emulatorview.TranscriptScreen.java
jackpal.androidterm.emulatorview.UnicodeTranscript.java
jackpal.androidterm.emulatorview.UpdateCallback.java
jackpal.androidterm.emulatorview.compat.AndroidCharacterCompat.java
jackpal.androidterm.emulatorview.compat.AndroidCompat.java
jackpal.androidterm.emulatorview.compat.ClipboardManagerCompatFactory.java
jackpal.androidterm.emulatorview.compat.ClipboardManagerCompatV11.java
jackpal.androidterm.emulatorview.compat.ClipboardManagerCompatV1.java
jackpal.androidterm.emulatorview.compat.ClipboardManagerCompat.java
jackpal.androidterm.emulatorview.compat.KeyCharacterMapCompat.java
jackpal.androidterm.emulatorview.compat.KeycodeConstants.java
jackpal.androidterm.emulatorview.compat.Patterns.java