org.eclipse.osgi_3.7.2.v20120110-1415

s FileNotFoundException;
  
  public abstract String preFindLibrary(String paramString, BundleClassLoader paramBundleClassLoader, BundleData paramBundleData)
    throws FileNotFoundException;
  
  public abstract String postFindLibrary(String paramString, BundleClassLoader paramBundleClassLoader, BundleData paramBundleData);
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.framework.adaptor.ClassLoaderDelegateHook
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.framework.adaptor;

import org.osgi.framework.Bundle;

public abstract interface EventPublisher
{
  public abstract void publishFrameworkEvent(int paramInt, Bundle paramBundle, Throwable paramThrowable);
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.framework.adaptor.EventPublisher
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.framework.adaptor;

import java.io.File;

public class FilePath
{
  private static final boolean WINDOWS = File.separatorChar == '\\';
  private static final String CURRENT_DIR = ".";
  private static final char DEVICE_SEPARATOR = ':';
  private static final byte HAS_LEADING = 1;
  private static final byte HAS_TRAILING = 4;
  private static final String[] NO_SEGMENTS = new String[0];
  private static final String PARENT_DIR = "..";
  private static final char SEPARATOR = '/';
  private static final String UNC_SLASHES = "//";
  private String device;
  private byte flags;
  private String[] segments;
  
  public FilePath(File location)
  {
    initialize(location.getPath());
    if (location.isDirectory()) {
      flags = ((byte)(flags | 0x4));
    } else {
      flags = ((byte)(flags & 0xFFFFFFFB));
    }
  }
  
  public FilePath(String original)
  {
    initialize(original);
  }
  
  private int computeSegmentCount(String path)
  {
    int len = path.length();
    if ((len == 0) || ((len == 1) && (path.charAt(0) == '/'))) {
      return 0;
    }
    int count = 1;
    int prev = -1;
    int i;
    while ((i = path.indexOf('/', prev + 1)) != -1)
    {
      int i;
      if ((i != prev + 1) && (i != len)) {
        count++;
      }
      prev = i;
    }
    if (path.charAt(len - 1) == '/') {
      count--;
    }
    return count;
  }
  
  private String[] computeSegments(String path)
  {
    int maxSegmentCount = computeSegmentCount(path);
    if (maxSegmentCount == 0) {
      return NO_SEGMENTS;
    }
    String[] newSegments = new String[maxSegmentCount];
    int len = path.length();
    
    int firstPosition = isAbsolute() ? 1 : 0;
    int lastPosition = hasTrailingSlash() ? len - 2 : len - 1;
    
    int next = firstPosition;
    int actualSegmentCount = 0;
    for (int i = 0; i < maxSegmentCount; i++)
    {
      int start = next;
      int end = path.indexOf('/', next);
      next = end + 1;
      String segment = path.substring(start, end == -1 ? lastPosition + 1 : end);
      if (!".".equals(segment)) {
        if ("..".equals(segment))
        {
          if (actualSegmentCount > 0) {
            actualSegmentCount--;
          }
        }
        else {
          newSegments[(actualSegmentCount++)] = segment;
        }
      }
    }
    if (actualSegmentCount == newSegments.length) {
      return newSegments;
    }
    if (actualSegmentCount == 0) {
      return NO_SEGMENTS;
    }
    String[] actualSegments = new String[actualSegmentCount];
    System.arraycopy(newSegments, 0, actualSegments, 0, actualSegments.length);
    return actualSegments;
  }
  
  public String getDevice()
  {
    return device;
  }
  
  public String[] getSegments()
  {
    return (String[])segments.clone();
  }
  
  public boolean hasTrailingSlash()
  {
    return (flags & 0x4) != 0;
  }
  
  private void initialize(String original)
  {
    original = original.indexOf('\\') == -1 ? original : original.replace('\\', '/');
    if (WINDOWS)
    {
      int deviceSeparatorPos = original.indexOf(':');
      if (deviceSeparatorPos >= 0)
      {
        int start = original.charAt(0) == '/' ? 1 : 0;
        device = original.substring(start, deviceSeparatorPos + 1);
        original = original.substring(deviceSeparatorPos + 1, original.length());
      }
      else if (original.startsWith("//"))
      {
        int uncPrefixEnd = original.indexOf('/', 2);
        if (uncPrefixEnd >= 0) {
          uncPrefixEnd = original.indexOf('/', uncPrefixEnd + 1);
        }
        if (uncPrefixEnd >= 0)
        {
          device = original.substring(0, uncPrefixEnd);
          original = original.substring(uncPrefixEnd, original.length());
        }
        else
        {
          throw new IllegalArgumentException("Not a valid UNC: " + original);
        }
      }
    }
    if (original.charAt(0) == '/') {
      flags = ((byte)(flags | 0x1));
    }
    if (original.charAt(original.length() - 1) == '/') {
      flags = ((byte)(flags | 0x4));
    }
    segments = computeSegments(original);
  }
  
  public boolean isAbsolute()
  {
    return (flags & 0x1) != 0;
  }
  
  public String makeRelative(FilePath base)
  {
    if ((device != null) && (!device.equalsIgnoreCase(device))) {
      return base.toString();
    }
    int baseCount = segments.length;
    int count = matchingFirstSegments(base);
    if ((baseCount == count) && (count == segments.length)) {
      return base.hasTrailingSlash() ? "./" : ".";
    }
    StringBuffer relative = new StringBuffer();
    for (int j = 0; j < baseCount - count; j++) {
      relative.append("../");
    }
    for (int i = 0; i < segments.length - count; i++)
    {
      relative.append(segments[(count + i)]);
      relative.append('/');
    }
    if (!base.hasTrailingSlash()) {
      relative.deleteCharAt(relative.length() - 1);
    }
    return relative.toString();
  }
  
  private int matchingFirstSegments(FilePath anotherPath)
  {
    int anotherPathLen = segments.length;
    int max = Math.min(segments.length, anotherPathLen);
    int count = 0;
    for (int i = 0; i < max; i++)
    {
      if (!segments[i].equals(segments[i])) {
        return count;
      }
      count++;
    }
    return count;
  }
  
  public String toString()
  {
    StringBuffer result = new StringBuffer();
    if (device != null) {
      result.append(device);
    }
    if (isAbsolute()) {
      result.append('/');
    }
    for (int i = 0; i < segments.length; i++)
    {
      result.append(segments[i]);
      result.append('/');
    }
    if ((segments.length > 0) && (!hasTrailingSlash())) {
      result.deleteCharAt(result.length() - 1);
    }
    return result.toString();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.framework.adaptor.FilePath
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.framework.adaptor;

import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;
import java.util.Enumeration;
import java.util.List;
import java.util.Properties;
import org.eclipse.osgi.framework.log.FrameworkLog;
import org.eclipse.osgi.service.resolver.PlatformAdmin;
import org.eclipse.osgi.service.resolver.State;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;

public abstract interface FrameworkAdaptor
{
  public static final String FRAMEWORK_SYMBOLICNAME = "org.eclipse.osgi";
  
  public abstract void initialize(EventPublisher paramEventPublisher);
  
  public abstract void initializeStorage()
    throws IOException;
  
  public abstract void compactStorage()
    throws IOException;
  
  public abstract Properties getProperties();
  
  public abstract BundleData[] getInstalledBundles();
  
  public abstract URLConnection mapLocationToURLConnection(String paramString)
    throws BundleException;
  
  public abstract BundleOperation installBundle(String paramString, URLConnection paramURLConnection);
  
  public abstract BundleOperation updateBundle(BundleData paramBundleData, URLConnection paramURLConnection);
  
  public abstract BundleOperation uninstallBundle(BundleData paramBundleData);
  
  public abstract long getTotalFreeSpace()
    throws IOException;
  
  public abstract PermissionStorage getPermissionStorage()
    throws IOException;
  
  public abstract void frameworkStart(BundleContext paramBundleContext)
    throws BundleException;
  
  public abstract void frameworkStop(BundleContext paramBundleContext)
    throws BundleException;
  
  public abstract void frameworkStopping(BundleContext paramBundleContext);
  
  public abstract int getInitialBundleStartLevel();
  
  public abstract void setInitialBundleStartLevel(int paramInt);
  
  public abstract FrameworkLog getFrameworkLog();
  
  public abstract BundleData createSystemBundleData()
    throws BundleException;
  
  public abstract BundleWatcher getBundleWatcher();
  
  public abstract PlatformAdmin getPlatformAdmin();
  
  public abstract State getState();
  
  public abstract ClassLoader getBundleClassLoaderParent();
  
  public abstract void handleRuntimeError(Throwable paramThrowable);
  
  public abstract Enumeration<URL> findEntries(List<BundleData> paramList, String paramString1, String paramString2, int paramInt);
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.framework.adaptor.FrameworkAdaptor
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.framework.adaptor;

import java.io.IOException;

public abstract interface PermissionStorage
{
  public abstract String[] getLocations()
    throws IOException;
  
  public abstract String[] getPermissionData(String paramString)
    throws IOException;
  
  public abstract void setPermissionData(String paramString, String[] paramArrayOfString)
    throws IOException;
  
  public abstract void saveConditionalPermissionInfos(String[] paramArrayOfString)
    throws IOException;
  
  public abstract String[] getConditionalPermissionInfos()
    throws IOException;
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.framework.adaptor.PermissionStorage
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.framework.adaptor;

public abstract interface StatusException
{
  public static final int CODE_OK = 1;
  public static final int CODE_INFO = 2;
  public static final int CODE_WARNING = 4;
  public static final int CODE_ERROR = 8;
  
  public abstract Object getStatus();
  
  public abstract int getStatusCode();
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.framework.adaptor.StatusException
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.framework.console;

import java.util.Dictionary;
import org.osgi.framework.Bundle;

public abstract interface CommandInterpreter
{
  public abstract String nextArgument();
  
  public abstract Object execute(String paramString);
  
  public abstract void print(Object paramObject);
  
  public abstract void println();
  
  public abstract void println(Object paramObject);
  
  public abstract void printStackTrace(Throwable paramThrowable);
  
  public abstract void printDictionary(Dictionary<?, ?> paramDictionary, String paramString);
  
  public abstract void printBundleResource(Bundle paramBundle, String paramString);
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.framework.console.CommandInterpreter
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.framework.console;

public abstract interface CommandProvider
{
  public abstract String getHelp();
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.framework.console.CommandProvider
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.framework.console;

import java.io.InputStream;
import java.io.OutputStream;
import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceFactory;
import org.osgi.framework.ServiceRegistration;

public abstract class ConsoleSession
  implements ServiceFactory<Object>
{
  private volatile ServiceRegistration<Object> sessionRegistration;
  
  public final void close()
  {
    doClose();
    ServiceRegistration<Object> current = sessionRegistration;
    if (current != null)
    {
      sessionRegistration = null;
      try
      {
        current.unregister();
      }
      catch (IllegalStateException localIllegalStateException) {}
    }
  }
  
  protected abstract void doClose();
  
  public abstract InputStream getInput();
  
  public abstract OutputStream getOutput();
  
  public final Object getService(Bundle bundle, ServiceRegistration<Object> registration)
  {
    if (sessionRegistration == null) {
      sessionRegistration = registration;
    }
    return this;
  }
  
  public final void ungetService(Bundle bundle, ServiceRegistration<Object> registration, Object service) {}
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.framework.console.ConsoleSession
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.framework.debug;

import java.io.PrintStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;

public class Debug
{
  public static boolean DEBUG_ENABLED = false;
  public static boolean DEBUG_GENERAL = false;
  public static boolean DEBUG_BUNDLE_TIME = false;
  public static boolean DEBUG_LOADER = false;
  public static boolean DEBUG_EVENTS = false;
  public static boolean DEBUG_SERVICES = false;
  public static boolean DEBUG_HOOKS = false;
  public static boolean DEBUG_PACKAGES = false;
  public static boolean DEBUG_MANIFEST = false;
  public static boolean DEBUG_FILTER = false;
  public static boolean DEBUG_SECURITY = false;
  public static boolean DEBUG_STARTLEVEL = false;
  public static boolean DEBUG_PACKAGEADMIN = false;
  public static boolean DEBUG_PACKAGEADMIN_TIMING = false;
  public static boolean DEBUG_MESSAGE_BUNDLES = false;
  public static boolean MONITOR_ACTIVATION = false;
  public static final String ECLIPSE_OSGI = "org.eclipse.osgi";
  public static final String OPTION_DEBUG_GENERAL = "org.eclipse.osgi/debug";
  public static final String OPTION_DEBUG_BUNDLE_TIME = "org.eclipse.osgi/debug/bundleTime";
  public static final String OPTION_DEBUG_LOADER = "org.eclipse.osgi/debug/loader";
  public static final String OPTION_DEBUG_EVENTS = "org.eclipse.osgi/debug/events";
  public static final String OPTION_DEBUG_SERVICES = "org.eclipse.osgi/debug/services";
  public static final String OPTION_DEBUG_HOOKS = "org.eclipse.osgi/debug/hooks";
  public static final String OPTION_DEBUG_PACKAGES = "org.eclipse.osgi/debug/packages";
  public static final String OPTION_DEBUG_MANIFEST = "org.eclipse.osgi/debug/manifest";
  public static final String OPTION_DEBUG_FILTER = "org.eclipse.osgi/debug/filter";
  public static final String OPTION_DEBUG_SECURITY = "org.eclipse.osgi/debug/security";
  public static final String OPTION_DEBUG_STARTLEVEL = "org.eclipse.osgi/debug/startlevel";
  public static final String OPTION_DEBUG_PACKAGEADMIN = "org.eclipse.osgi/debug/packageadmin";
  public static final String OPTION_DEBUG_PACKAGEADMIN_TIMING = "org.eclipse.osgi/debug/packageadmin/timing";
  public static final String OPTION_MONITOR_ACTIVATION = "org.eclipse.osgi/monitor/activation";
  public static final String OPTION_DEBUG_MESSAGE_BUNDLES = "org.eclipse.osgi/debug/messageBundles";
  
  static
  {
    FrameworkDebugOptions dbgOptions = FrameworkDebugOptions.getDefault();
    if (dbgOptions != null)
    {
      DEBUG_ENABLED = dbgOptions.isDebugEnabled();
      DEBUG_GENERAL = dbgOptions.getBooleanOption("org.eclipse.osgi/debug", false);
      DEBUG_BUNDLE_TIME = (dbgOptions.getBooleanOption("org.eclipse.osgi/debug/bundleTime", false)) || (dbgOptions.getBooleanOption("org.eclipse.core.runtime/timing/startup", false));
      DEBUG_LOADER = dbgOptions.getBooleanOption("org.eclipse.osgi/debug/loader", false);
      DEBUG_EVENTS = dbgOptions.getBooleanOption("org.eclipse.osgi/debug/events", false);
      DEBUG_SERVICES = dbgOptions.getBooleanOption("org.eclipse.osgi/debug/services", false);
      DEBUG_HOOKS = dbgOptions.getBooleanOption("org.eclipse.osgi/debug/hooks", false);
      DEBUG_PACKAGES = dbgOptions.getBooleanOption("org.eclipse.osgi/debug/packages", false);
      DEBUG_MANIFEST = dbgOptions.getBooleanOption("org.eclipse.osgi/debug/manifest", false);
      DEBUG_FILTER = dbgOptions.getBooleanOption("org.eclipse.osgi/debug/filter", false);
      DEBUG_SECURITY = dbgOptions.getBooleanOption("org.eclipse.osgi/debug/security", false);
      DEBUG_STARTLEVEL = dbgOptions.getBooleanOption("org.eclipse.osgi/debug/startlevel", false);
      DEBUG_PACKAGEADMIN = dbgOptions.getBooleanOption("org.eclipse.osgi/debug/packageadmin", false);
      DEBUG_PACKAGEADMIN_TIMING = (dbgOptions.getBooleanOption("org.eclipse.osgi/debug/packageadmin/timing", false)) || (dbgOptions.getBooleanOption("org.eclipse.core.runtime/debug", false));
      DEBUG_MESSAGE_BUNDLES = dbgOptions.getBooleanOption("org.eclipse.osgi/debug/messageBundles", false);
      MONITOR_ACTIVATION = dbgOptions.getBooleanOption("org.eclipse.osgi/monitor/activation", false);
    }
  }
  
  public static PrintStream out = System.out;
  
  public static void print(boolean x)
  {
    out.print(x);
  }
  
  public static void print(char x)
  {
    out.print(x);
  }
  
  public static void print(int x)
  {
    out.print(x);
  }
  
  public static void print(long x)
  {
    out.print(x);
  }
  
  public static void print(float x)
  {
    out.print(x);
  }
  
  public static void print(double x)
  {
    out.print(x);
  }
  
  public static void print(char[] x)
  {
    out.print(x);
  }
  
  public static void print(String x)
  {
    out.print(x);
  }
  
  public static void print(Object x)
  {
    out.print(x);
  }
  
  public static void println(boolean x)
  {
    out.println(x);
  }
  
  public static void println(char x)
  {
    out.println(x);
  }
  
  public static void println(int x)
  {
    out.println(x);
  }
  
  public static void println(long x)
  {
    out.println(x);
  }
  
  public static void println(float x)
  {
    out.println(x);
  }
  
  public static void println(double x)
  {
    out.println(x);
  }
  
  public static void println(char[] x)
  {
    out.println(x);
  }
  
  public static void println(String x)
  {
    out.println(x);
  }
  
  public static void println(Object x)
  {
    out.println(x);
  }
  
  public static void printStackTrace(Throwable t)
  {
    if (t == null) {
      return;
    }
    t.printStackTrace(out);
    
    Method[] methods = t.getClass().getMethods();
    
    int size = methods.length;
    Class<?> throwable = Throwable.class;
    for (int i = 0; i < size; i++)
    {
      Method method = methods[i];
      if ((Modifier.isPublic(method.getModifiers())) && (method.getName().startsWith("get")) && (throwable.isAssignableFrom(method.getReturnType())) && (method.getParameterTypes().length == 0)) {
        try
        {
          Throwable nested = (Throwable)method.invoke(t, null);
          if ((nested != null) && (nested != t))
          {
            out.println("Nested Exception:");
            printStackTrace(nested);
          }
        }
        catch (IllegalAccessException localIllegalAccessException) {}catch (InvocationTargetException localInvocationTargetException) {}
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.framework.debug.Debug
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.framework.debug;

import java.io.BufferedWriter;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
import java.security.AccessController;
import java.text.MessageFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.eclipse.osgi.framework.util.SecureAction;
import org.eclipse.osgi.service.debug.DebugTrace;

class EclipseDebugTrace
  implements DebugTrace
{
  private static final String PROP_TRACE_SIZE_MAX = "eclipse.trace.size.max";
  private static final String PROP_TRACE_FILE_MAX = "eclipse.trace.backup.max";
  private static final String MESSAGE_THREAD_DUMP = "Thread Stack dump: ";
  private static final String MESSAGE_EXIT_METHOD_WITH_RESULTS = "Exiting method {0}with result: ";
  private static final String MESSAGE_EXIT_METHOD_NO_RESULTS = "Exiting method {0}with a void return";
  private static final String MESSAGE_ENTER_METHOD_WITH_PARAMS = "Entering method {0}with parameters: (";
  private static final String MESSAGE_ENTER_METHOD_NO_PARAMS = "Entering method {0}with no parameters";
  private static final String TRACE_FILE_VERSION_COMMENT = "version: ";
  private static final String TRACE_FILE_VERBOSE_COMMENT = "verbose: ";
  private static final String TRACE_FILE_VERSION = "1.1";
  private static final String TRACE_NEW_SESSION = "!SESSION ";
  private static final String TRACE_FILE_DATE = "Time of creation: ";
  private static final SimpleDateFormat TRACE_FILE_DATE_FORMATTER = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
  private static final String TRACE_COMMENT = "#";
  private static final String TRACE_ELEMENT_DELIMITER = "|";
  private static final String TRACE_ELEMENT_DELIMITER_ENCODED = "&#124;";
  private static final String LINE_SEPARATOR;
  private static final String NULL_VALUE = "<null>";
  
  static
  {
    String s = System.getProperty("line.separator");
    LINE_SEPARATOR = s == null ? "\n" : s;
  }
  
  private static final SecureAction secureAction = (SecureAction)AccessController.doPrivileged(SecureAction.createSecureAction());
  private static final Object writeLock = new Object();
  private static final int DEFAULT_TRACE_FILE_SIZE = 1000;
  private static final int DEFAULT_TRACE_FILES = 10;
  private static final int DEFAULT_TRACE_FILE_MIN_SIZE = 10;
  private static final String TRACE_FILE_EXTENSION = ".trace";
  private static final String BACKUP_MARK = ".bak_";
  private int maxTraceFileSize = 1000;
  private int maxTraceFiles = 10;
  private int backupTraceFileIndex = 0;
  private String traceClass = null;
  private String bundleSymbolicName = null;
  static boolean newSession = true;
  private FrameworkDebugOptions debugOptions = null;
  
  EclipseDebugTrace(String bundleSymbolicName, FrameworkDebugOptions debugOptions)
  {
    this(bundleSymbolicName, debugOptions, null);
  }
  
  EclipseDebugTrace(String bundleSymbolicName, FrameworkDebugOptions debugOptions, Class<?> traceClass)
  {
    this.traceClass = (traceClass != null ? traceClass.getName() : null);
    this.debugOptions = debugOptions;
    this.bundleSymbolicName = bundleSymbolicName;
    readLogProperties();
  }
  
  private final boolean isDebuggingEnabled(String optionPath)
  {
    if (optionPath == null) {
      return true;
    }
    boolean debugEnabled = false;
    if (debugOptions.isDebugEnabled())
    {
      String option = bundleSymbolicName + optionPath;
      debugEnabled = debugOptions.getBooleanOption(option, false);
    }
    return debugEnabled;
  }
  
  public void trace(String optionPath, String message)
  {
    if (isDebuggingEnabled(optionPath))
    {
      FrameworkDebugTraceEntry record = new FrameworkDebugTraceEntry(bundleSymbolicName, optionPath, message, traceClass);
      writeRecord(record);
    }
  }
  
  public void trace(String optionPath, String message, Throwable error)
  {
    if (isDebuggingEnabled(optionPath))
    {
      FrameworkDebugTraceEntry record = new FrameworkDebugTraceEntry(bundleSymbolicName, optionPath, message, error, traceClass);
      writeRecord(record);
    }
  }
  
  public void traceEntry(String optionPath)
  {
    if (isDebuggingEnabled(optionPath))
    {
      FrameworkDebugTraceEntry record = new FrameworkDebugTraceEntry(bundleSymbolicName, optionPath, null, traceClass);
      setMessage(record, "Entering method {0}with no parameters");
      writeRecord(record);
    }
  }
  
  public void traceEntry(String optionPath, Object methodArgument)
  {
    if (isDebuggingEnabled(optionPath)) {
      traceEntry(optionPath, new Object[] { methodArgument });
    }
  }
  
  public void traceEntry(String optionPath, Object[] methodArguments)
  {
    if (isDebuggingEnabled(optionPath))
    {
      StringBuffer messageBuffer = new StringBuffer("Entering method {0}with parameters: (");
      if (methodArguments != null)
      {
        int i = 0;
        while (i < methodArguments.length)
        {
          if (methodArguments[i] != null) {
            messageBuffer.append(methodArguments[i].toString());
          } else {
            messageBuffer.append("<null>");
          }
          i++;
          if (i < methodArguments.length) {
            messageBuffer.append(" ");
          }
        }
        messageBuffer.append(")");
      }
      FrameworkDebugTraceEntry record = new FrameworkDebugTraceEntry(bundleSymbolicName, optionPath, null, traceClass);
      setMessage(record, messageBuffer.toString());
      writeRecord(record);
    }
  }
  
  public void traceExit(String optionPath)
  {
    if (isDebuggingEnabled(optionPath))
    {
      FrameworkDebugTraceEntry record = new FrameworkDebugTraceEntry(bundleSymbolicName, optionPath, null, traceClass);
      setMessage(record, "Exiting method {0}with a void return");
      writeRecord(record);
    }
  }
  
  public void traceExit(String optionPath, Object result)
  {
    if (isDebuggingEnabled(optionPath))
    {
      StringBuffer messageBuffer = new StringBuffer("Exiting method {0}with result: ");
      if (result == null) {
        messageBuffer.append("<null>");
      } else {
        messageBuffer.append(result.toString());
      }
      FrameworkDebugTraceEntry record = new FrameworkDebugTraceEntry(bundleSymbolicName, optionPath, null, traceClass);
      setMessage(record, messageBuffer.toString());
      writeRecord(record);
    }
  }
  
  public void traceDumpStack(String optionPath)
  {
    if (isDebuggingEnabled(optionPath))
    {
      StringBuffer messageBuffer = new StringBuffer("Thread Stack dump: ");
      StackTraceElement[] elements = new Exception().getStackTrace();
      
      int firstIndex = traceClass == null ? 1 : 2;
      int endIndex = elements.length - firstIndex;
      StackTraceElement[] newElements = new StackTraceElement[endIndex];
      int i = 0;
      while (i < endIndex)
      {
        newElements[i] = elements[firstIndex];
        i++;
        firstIndex++;
      }
      messageBuffer.append(convertStackTraceElementsToString(newElements));
      FrameworkDebugTraceEntry record = new FrameworkDebugTraceEntry(bundleSymbolicName, optionPath, messageBuffer.toString(), traceClass);
      writeRecord(record);
    }
  }
  
  private final void setMessage(FrameworkDebugTraceEntry record, String originalMessage)
  {
    String argument = null;
    if (!debugOptions.isVerbose())
    {
      StringBuffer classMethodName = new StringBuffer(record.getClassName());
      classMethodName.append("#");
      classMethodName.append(record.getMethodName());
      classMethodName.append(" ");
      argument = classMethodName.toString();
    }
    else
    {
      argument = "";
    }
    String newMessage = MessageFormat.format(originalMessage, new Object[] { argument });
    record.setMessage(newMessage);
  }
  
  private final String convertStackTraceElementsToString(StackTraceElement[] elements)
  {
    StringBuffer buffer = new StringBuffer();
    if (elements != null)
    {
      buffer.append("java.lang.Throwable: ");
      buffer.append(LINE_SEPARATOR);
      int i = 0;
      while (i < elements.length)
      {
        if (elements[i] != null)
        {
          buffer.append("\tat ");
          buffer.append(elements[i].toString());
          buffer.append(LINE_SEPARATOR);
        }
        i++;
      }
    }
    return buffer.toString();
  }
  
  /* Error */
  private void writeRecord(FrameworkDebugTraceEntry entry)
  {
    // Byte code:
    //   0: aload_1
    //   1: ifnull +137 -> 138
    //   4: getstatic 441	org/eclipse/osgi/framework/debug/EclipseDebugTrace:writeLock	Ljava/lang/Object;
    //   7: dup
    //   8: astore_2
    //   9: monitorenter
    //   10: aload_0
    //   11: getfield 446	org/eclipse/osgi/framework/debug/EclipseDebugTrace:debugOptions	Lorg/eclipse/osgi/framework/debug/FrameworkDebugOptions;
    //   14: invokevirtual 517	org/eclipse/osgi/framework/debug/FrameworkDebugOptions:getFile	()Ljava/io/File;
    //   17: astore_3
    //   18: aconst_null
    //   19: astore 4
    //   21: aload_0
    //   22: aload_3
    //   23: aload_1
    //   24: invokevirtual 522	org/eclipse/osgi/framework/debug/FrameworkDebugTraceEntry:getTimestamp	()J
    //   27: invokespecial 499	org/eclipse/osgi/framework/debug/EclipseDebugTrace:checkTraceFileSize	(Ljava/io/File;J)Z
    //   30: pop
    //   31: aload_0
    //   32: aload_3
    //   33: invokespecial 505	org/eclipse/osgi/framework/debug/EclipseDebugTrace:openWriter	(Ljava/io/File;)Ljava/io/Writer;
    //   36: astore 4
    //   38: getstatic 440	org/eclipse/osgi/framework/debug/EclipseDebugTrace:newSession	Z
    //   41: ifeq +17 -> 58
    //   44: aload_0
    //   45: aload 4
    //   47: aload_1
    //   48: invokevirtual 522	org/eclipse/osgi/framework/debug/FrameworkDebugTraceEntry:getTimestamp	()J
    //   51: invokespecial 501	org/eclipse/osgi/framework/debug/EclipseDebugTrace:writeSession	(Ljava/io/Writer;J)V
    //   54: iconst_0
    //   55: putstatic 440	org/eclipse/osgi/framework/debug/EclipseDebugTrace:newSession	Z
    //   58: aload_0
    //   59: aload 4
    //   61: aload_1
    //   62: invokespecial 513	org/eclipse/osgi/framework/debug/EclipseDebugTrace:writeMessage	(Ljava/io/Writer;Lorg/eclipse/osgi/framework/debug/FrameworkDebugTraceEntry;)V
    //   65: aload 4
    //   67: invokevirtual 465	java/io/Writer:flush	()V
    //   70: goto +50 -> 120
    //   73: astore 5
    //   75: getstatic 435	java/lang/System:err	Ljava/io/PrintStream;
    //   78: ldc_w 242
    //   81: invokevirtual 463	java/io/PrintStream:println	(Ljava/lang/String;)V
    //   84: aload 5
    //   86: getstatic 435	java/lang/System:err	Ljava/io/PrintStream;
    //   89: invokevirtual 469	java/lang/Exception:printStackTrace	(Ljava/io/PrintStream;)V
    //   92: aload_3
    //   93: ifnull +37 -> 130
    //   96: aload_0
    //   97: aload 4
    //   99: invokespecial 500	org/eclipse/osgi/framework/debug/EclipseDebugTrace:closeWriter	(Ljava/io/Writer;)V
    //   102: goto +28 -> 130
    //   105: astore 6
    //   107: aload_3
    //   108: ifnull +9 -> 117
    //   111: aload_0
    //   112: aload 4
    //   114: invokespecial 500	org/eclipse/osgi/framework/debug/EclipseDebugTrace:closeWriter	(Ljava/io/Writer;)V
    //   117: aload 6
    //   119: athrow
    //   120: aload_3
    //   121: ifnull +9 -> 130
    //   124: aload_0
    //   125: aload 4
    //   127: invokespecial 500	org/eclipse/osgi/framework/debug/EclipseDebugTrace:closeWriter	(Ljava/io/Writer;)V
    //   130: aload_2
    //   131: monitorexit
    //   132: goto +6 -> 138
    //   135: aload_2
    //   136: monitorexit
    //   137: athrow
    //   138: return
    // Line number table:
    //   Java source line #337	-> byte code offset #0
    //   Java source line #338	-> byte code offset #4
    //   Java source line #339	-> byte code offset #10
    //   Java source line #340	-> byte code offset #18
    //   Java source line #343	-> byte code offset #21
    //   Java source line #345	-> byte code offset #31
    //   Java source line #346	-> byte code offset #38
    //   Java source line #347	-> byte code offset #44
    //   Java source line #348	-> byte code offset #54
    //   Java source line #350	-> byte code offset #58
    //   Java source line #352	-> byte code offset #65
    //   Java source line #353	-> byte code offset #73
    //   Java source line #355	-> byte code offset #75
    //   Java source line #356	-> byte code offset #84
    //   Java source line #359	-> byte code offset #92
    //   Java source line #360	-> byte code offset #96
    //   Java source line #357	-> byte code offset #105
    //   Java source line #359	-> byte code offset #107
    //   Java source line #360	-> byte code offset #111
    //   Java source line #362	-> byte code offset #117
    //   Java source line #359	-> byte code offset #120
    //   Java source line #360	-> byte code offset #124
    //   Java source line #338	-> byte code offset #130
    //   Java source line #365	-> byte code offset #138
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	139	0	this	EclipseDebugTrace
    //   0	139	1	entry	FrameworkDebugTraceEntry
    //   8	128	2	Ljava/lang/Object;	Object
    //   17	104	3	tracingFile	File
    //   19	107	4	traceWriter	Writer
    //   73	12	5	ex	Exception
    //   105	13	6	localObject1	Object
    // Exception table:
    //   from	to	target	type
    //   21	70	73	java/lang/Exception
    //   21	92	105	finally
    //   10	132	135	finally
    //   135	137	135	finally
  }
  
  private void readLogProperties()
  {
    String newMaxTraceFileSize = secureAction.getProperty("eclipse.trace.size.max");
    if (newMaxTraceFileSize != null)
    {
      maxTraceFileSize = Integer.parseInt(newMaxTraceFileSize);
      if ((maxTraceFileSize != 0) && (maxTraceFileSize < 10)) {
        maxTraceFileSize = 10;
      }
    }
    String newMaxLogFiles = secureAction.getProperty("eclipse.trace.backup.max");
    if (newMaxLogFiles != null)
    {
      maxTraceFiles = Integer.parseInt(newMaxLogFiles);
      if (maxTraceFiles < 1) {
        maxTraceFiles = 10;
      }
    }
  }
  
  /* Error */
  private boolean checkTraceFileSize(File traceFile, long timestamp)
  {
    // Byte code:
    //   0: iconst_1
    //   1: istore 4
    //   3: aload_0
    //   4: getfield 438	org/eclipse/osgi/framework/debug/EclipseDebugTrace:maxTraceFileSize	I
    //   7: ifle +468 -> 475
    //   10: aload_1
    //   11: ifnull +464 -> 475
    //   14: aload_1
    //   15: invokevirtual 453	java/io/File:exists	()Z
    //   18: ifeq +457 -> 475
    //   21: aload_1
    //   22: invokevirtual 451	java/io/File:length	()J
    //   25: bipush 10
    //   27: lshr
    //   28: aload_0
    //   29: getfield 438	org/eclipse/osgi/framework/debug/EclipseDebugTrace:maxTraceFileSize	I
    //   32: i2l
    //   33: lcmp
    //   34: ifle +441 -> 475
    //   37: aload_1
    //   38: invokevirtual 455	java/io/File:getAbsolutePath	()Ljava/lang/String;
    //   41: astore 5
    //   43: ldc_w 238
    //   46: astore 6
    //   48: aload 5
    //   50: invokevirtual 476	java/lang/String:toLowerCase	()Ljava/lang/String;
    //   53: ldc 8
    //   55: invokevirtual 479	java/lang/String:endsWith	(Ljava/lang/String;)Z
    //   58: ifeq +55 -> 113
    //   61: new 267	java/lang/StringBuffer
    //   64: dup
    //   65: aload 5
    //   67: iconst_0
    //   68: aload 5
    //   70: invokevirtual 475	java/lang/String:length	()I
    //   73: ldc 8
    //   75: invokevirtual 475	java/lang/String:length	()I
    //   78: isub
    //   79: invokevirtual 477	java/lang/String:substring	(II)Ljava/lang/String;
    //   82: invokestatic 480	java/lang/String:valueOf	(Ljava/lang/Object;)Ljava/lang/String;
    //   85: invokespecial 484	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   88: ldc 7
    //   90: invokevirtual 489	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   93: aload_0
    //   94: getfield 437	org/eclipse/osgi/framework/debug/EclipseDebugTrace:backupTraceFileIndex	I
    //   97: invokevirtual 485	java/lang/StringBuffer:append	(I)Ljava/lang/StringBuffer;
    //   100: ldc 8
    //   102: invokevirtual 489	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   105: invokevirtual 482	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   108: astore 6
    //   110: goto +32 -> 142
    //   113: new 267	java/lang/StringBuffer
    //   116: dup
    //   117: aload 5
    //   119: invokestatic 480	java/lang/String:valueOf	(Ljava/lang/Object;)Ljava/lang/String;
    //   122: invokespecial 484	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   125: ldc 7
    //   127: invokevirtual 489	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   130: aload_0
    //   131: getfield 437	org/eclipse/osgi/framework/debug/EclipseDebugTrace:backupTraceFileIndex	I
    //   134: invokevirtual 485	java/lang/StringBuffer:append	(I)Ljava/lang/StringBuffer;
    //   137: invokevirtual 482	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   140: astore 6
    //   142: new 255	java/io/File
    //   145: dup
    //   146: aload 6
    //   148: invokespecial 457	java/io/File:<init>	(Ljava/lang/String;)V
    //   151: astore 7
    //   153: aload 7
    //   155: invokevirtual 453	java/io/File:exists	()Z
    //   158: ifeq +119 -> 277
    //   161: aload 7
    //   163: invokevirtual 452	java/io/File:delete	()Z
    //   166: ifne +111 -> 277
    //   169: getstatic 435	java/lang/System:err	Ljava/io/PrintStream;
    //   172: new 267	java/lang/StringBuffer
    //   175: dup
    //   176: ldc_w 244
    //   179: invokespecial 484	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   182: aload 7
    //   184: invokevirtual 456	java/io/File:getName	()Ljava/lang/String;
    //   187: invokevirtual 489	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   190: invokevirtual 482	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   193: invokevirtual 463	java/io/PrintStream:println	(Ljava/lang/String;)V
    //   196: aload 7
    //   198: new 255	java/io/File
    //   201: dup
    //   202: new 267	java/lang/StringBuffer
    //   205: dup
    //   206: aload 7
    //   208: invokevirtual 455	java/io/File:getAbsolutePath	()Ljava/lang/String;
    //   211: invokestatic 480	java/lang/String:valueOf	(Ljava/lang/Object;)Ljava/lang/String;
    //   214: invokespecial 484	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   217: invokestatic 490	java/lang/System:currentTimeMillis	()J
    //   220: invokevirtual 486	java/lang/StringBuffer:append	(J)Ljava/lang/StringBuffer;
    //   223: invokevirtual 482	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   226: invokespecial 457	java/io/File:<init>	(Ljava/lang/String;)V
    //   229: invokevirtual 454	java/io/File:renameTo	(Ljava/io/File;)Z
    //   232: ifeq +33 -> 265
    //   235: getstatic 435	java/lang/System:err	Ljava/io/PrintStream;
    //   238: new 267	java/lang/StringBuffer
    //   241: dup
    //   242: ldc_w 246
    //   245: invokespecial 484	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   248: aload 7
    //   250: invokevirtual 456	java/io/File:getName	()Ljava/lang/String;
    //   253: invokevirtual 489	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   256: invokevirtual 482	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   259: invokevirtual 463	java/io/PrintStream:println	(Ljava/lang/String;)V
    //   262: goto +15 -> 277
    //   265: getstatic 435	java/lang/System:err	Ljava/io/PrintStream;
    //   268: ldc_w 243
    //   271: invokevirtual 463	java/io/PrintStream:println	(Ljava/lang/String;)V
    //   274: iconst_0
    //   275: istore 4
    //   277: aload_1
    //   278: aload 7
    //   280: invokevirtual 454	java/io/File:renameTo	(Ljava/io/File;)Z
    //   283: istore 8
    //   285: iload 8
    //   287: ifne +15 -> 302
    //   290: getstatic 435	java/lang/System:err	Ljava/io/PrintStream;
    //   293: ldc_w 245
    //   296: invokevirtual 463	java/io/PrintStream:println	(Ljava/lang/String;)V
    //   299: iconst_0
    //   300: istore 4
    //   302: aconst_null
    //   303: astore 9
    //   305: aload_0
    //   306: aload_1
    //   307: invokespecial 505	org/eclipse/osgi/framework/debug/EclipseDebugTrace:openWriter	(Ljava/io/File;)Ljava/io/Writer;
    //   310: astore 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84

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