org.eclipse.osgi_3.7.2.v20120110-1415

String fileName;
  private int keyCount = 0;
  private int keySize = 0;
  private int valueSize = 0;
  private long hashSize = 0L;
  private long fileSize = 0L;
  
  private static int sizeOf(String value)
  {
    return 44 + 2 * value.length();
  }
  
  private static int sizeOf(Properties value)
  {
    return (int)Math.round(44.0D + (16.0D + value.size() * 1.25D * 4.0D) + 24 * value.size());
  }
  
  public ResourceBundleStats(String pluginId, String fileName, URL input)
  {
    this.pluginId = pluginId;
    this.fileName = fileName;
    initialize(input);
  }
  
  public ResourceBundleStats(String pluginId, String fileName, ResourceBundle bundle)
  {
    this.pluginId = pluginId;
    this.fileName = fileName;
    initialize(bundle);
  }
  
  private void initialize(ResourceBundle bundle)
  {
    for (Enumeration<String> keys = bundle.getKeys(); keys.hasMoreElements();)
    {
      String key = (String)keys.nextElement();
      keySize += sizeOf(key);
      valueSize += sizeOf(bundle.getString(key));
      keyCount += 1;
    }
  }
  
  /* Error */
  private void initialize(URL url)
  {
    // Byte code:
    //   0: aconst_null
    //   1: astore_2
    //   2: new 80	java/util/Properties
    //   5: dup
    //   6: invokespecial 150	java/util/Properties:<init>	()V
    //   9: astore_3
    //   10: aload_1
    //   11: invokevirtual 148	java/net/URL:openStream	()Ljava/io/InputStream;
    //   14: astore_2
    //   15: aload_0
    //   16: aload_2
    //   17: invokevirtual 143	java/io/InputStream:available	()I
    //   20: i2l
    //   21: putfield 139	org/eclipse/core/runtime/internal/stats/ResourceBundleStats:fileSize	J
    //   24: aload_3
    //   25: aload_2
    //   26: invokevirtual 151	java/util/Properties:load	(Ljava/io/InputStream;)V
    //   29: aload_3
    //   30: invokevirtual 152	java/util/Properties:keySet	()Ljava/util/Set;
    //   33: invokeinterface 164 1 0
    //   38: astore 4
    //   40: goto +57 -> 97
    //   43: aload 4
    //   45: invokeinterface 163 1 0
    //   50: checkcast 76	java/lang/String
    //   53: astore 5
    //   55: aload_0
    //   56: dup
    //   57: getfield 137	org/eclipse/core/runtime/internal/stats/ResourceBundleStats:keySize	I
    //   60: aload 5
    //   62: invokestatic 156	org/eclipse/core/runtime/internal/stats/ResourceBundleStats:sizeOf	(Ljava/lang/String;)I
    //   65: iadd
    //   66: putfield 137	org/eclipse/core/runtime/internal/stats/ResourceBundleStats:keySize	I
    //   69: aload_0
    //   70: dup
    //   71: getfield 138	org/eclipse/core/runtime/internal/stats/ResourceBundleStats:valueSize	I
    //   74: aload_3
    //   75: aload 5
    //   77: invokevirtual 153	java/util/Properties:getProperty	(Ljava/lang/String;)Ljava/lang/String;
    //   80: invokestatic 156	org/eclipse/core/runtime/internal/stats/ResourceBundleStats:sizeOf	(Ljava/lang/String;)I
    //   83: iadd
    //   84: putfield 138	org/eclipse/core/runtime/internal/stats/ResourceBundleStats:valueSize	I
    //   87: aload_0
    //   88: dup
    //   89: getfield 136	org/eclipse/core/runtime/internal/stats/ResourceBundleStats:keyCount	I
    //   92: iconst_1
    //   93: iadd
    //   94: putfield 136	org/eclipse/core/runtime/internal/stats/ResourceBundleStats:keyCount	I
    //   97: aload 4
    //   99: invokeinterface 162 1 0
    //   104: ifne -61 -> 43
    //   107: aload_0
    //   108: aload_3
    //   109: invokestatic 158	org/eclipse/core/runtime/internal/stats/ResourceBundleStats:sizeOf	(Ljava/util/Properties;)I
    //   112: i2l
    //   113: putfield 140	org/eclipse/core/runtime/internal/stats/ResourceBundleStats:hashSize	J
    //   116: goto +16 -> 132
    //   119: astore 6
    //   121: aload_2
    //   122: ifnull +7 -> 129
    //   125: aload_2
    //   126: invokevirtual 144	java/io/InputStream:close	()V
    //   129: aload 6
    //   131: athrow
    //   132: aload_2
    //   133: ifnull +11 -> 144
    //   136: aload_2
    //   137: invokevirtual 144	java/io/InputStream:close	()V
    //   140: goto +4 -> 144
    //   143: pop
    //   144: return
    // Line number table:
    //   Java source line #68	-> byte code offset #0
    //   Java source line #69	-> byte code offset #2
    //   Java source line #72	-> byte code offset #10
    //   Java source line #73	-> byte code offset #15
    //   Java source line #74	-> byte code offset #24
    //   Java source line #75	-> byte code offset #29
    //   Java source line #76	-> byte code offset #43
    //   Java source line #77	-> byte code offset #55
    //   Java source line #78	-> byte code offset #69
    //   Java source line #79	-> byte code offset #87
    //   Java source line #75	-> byte code offset #97
    //   Java source line #81	-> byte code offset #107
    //   Java source line #82	-> byte code offset #119
    //   Java source line #83	-> byte code offset #121
    //   Java source line #84	-> byte code offset #125
    //   Java source line #85	-> byte code offset #129
    //   Java source line #83	-> byte code offset #132
    //   Java source line #84	-> byte code offset #136
    //   Java source line #86	-> byte code offset #143
    //   Java source line #90	-> byte code offset #144
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	145	0	this	ResourceBundleStats
    //   0	145	1	url	URL
    //   1	136	2	stream	java.io.InputStream
    //   9	100	3	props	Properties
    //   38	60	4	iter	java.util.Iterator<Object>
    //   53	23	5	key	String
    //   119	11	6	localObject	Object
    //   143	1	7	localIOException	java.io.IOException
    // Exception table:
    //   from	to	target	type
    //   10	119	119	finally
    //   10	140	143	java/io/IOException
  }
  
  public long getHashSize()
  {
    return hashSize;
  }
  
  public int getKeyCount()
  {
    return keyCount;
  }
  
  public String getPluginId()
  {
    return pluginId;
  }
  
  public int getKeySize()
  {
    return keySize;
  }
  
  public int getValueSize()
  {
    return valueSize;
  }
  
  public long getTotalSize()
  {
    return keySize + valueSize + hashSize;
  }
  
  public String getFileName()
  {
    return fileName;
  }
  
  public long getFileSize()
  {
    return fileSize;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.core.runtime.internal.stats.ResourceBundleStats
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.core.runtime.internal.stats;

import java.net.URL;
import java.util.Collection;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
import java.util.Stack;
import org.eclipse.osgi.baseadaptor.BaseData;
import org.eclipse.osgi.baseadaptor.HookConfigurator;
import org.eclipse.osgi.baseadaptor.HookRegistry;
import org.eclipse.osgi.baseadaptor.bundlefile.BundleEntry;
import org.eclipse.osgi.baseadaptor.hooks.ClassLoadingStatsHook;
import org.eclipse.osgi.baseadaptor.loader.ClasspathEntry;
import org.eclipse.osgi.baseadaptor.loader.ClasspathManager;
import org.eclipse.osgi.framework.adaptor.BundleWatcher;
import org.eclipse.osgi.framework.debug.Debug;
import org.eclipse.osgi.framework.debug.FrameworkDebugOptions;
import org.eclipse.osgi.util.ManifestElement;
import org.osgi.framework.Bundle;

public class StatsManager
  implements BundleWatcher, HookConfigurator, ClassLoadingStatsHook
{
  private Hashtable<Long, BundleStats> bundles = new Hashtable(20);
  private Map<Thread, Stack<BundleStats>> activationStacks = new HashMap(5);
  private static boolean booting = true;
  private static StatsManager defaultInstance;
  public static boolean MONITOR_ACTIVATION = false;
  public static boolean MONITOR_CLASSES = false;
  public static boolean MONITOR_RESOURCES = false;
  public static String TRACE_FILENAME = "runtime.traces";
  public static String TRACE_FILTERS = "trace.properties";
  public static boolean TRACE_CLASSES = false;
  public static boolean TRACE_BUNDLES = false;
  public static final String FRAMEWORK_SYMBOLICNAME = "org.eclipse.osgi";
  private static final String OPTION_MONITOR_ACTIVATION = "org.eclipse.osgi/monitor/activation";
  private static final String OPTION_MONITOR_CLASSES = "org.eclipse.osgi/monitor/classes";
  private static final String OPTION_MONITOR_RESOURCES = "org.eclipse.osgi/monitor/resources";
  private static final String OPTION_TRACE_BUNDLES = "org.eclipse.osgi/trace/activation";
  private static final String OPTION_TRACE_CLASSES = "org.eclipse.osgi/trace/classLoading";
  private static final String OPTION_TRACE_FILENAME = "org.eclipse.osgi/trace/filename";
  private static final String OPTION_TRACE_FILTERS = "org.eclipse.osgi/trace/filters";
  
  static
  {
    setDebugOptions();
  }
  
  public static StatsManager getDefault()
  {
    if (defaultInstance == null)
    {
      defaultInstance = new StatsManager();
      defaultInstance.initialize();
    }
    return defaultInstance;
  }
  
  public static void setDebugOptions()
  {
    FrameworkDebugOptions options = FrameworkDebugOptions.getDefault();
    if (options == null) {
      return;
    }
    MONITOR_ACTIVATION = options.getBooleanOption("org.eclipse.osgi/monitor/activation", false);
    MONITOR_CLASSES = options.getBooleanOption("org.eclipse.osgi/monitor/classes", false);
    MONITOR_RESOURCES = options.getBooleanOption("org.eclipse.osgi/monitor/resources", false);
    TRACE_CLASSES = options.getBooleanOption("org.eclipse.osgi/trace/classLoading", false);
    TRACE_BUNDLES = options.getBooleanOption("org.eclipse.osgi/trace/activation", false);
    TRACE_FILENAME = options.getOption("org.eclipse.osgi/trace/filename", TRACE_FILENAME);
    TRACE_FILTERS = options.getOption("org.eclipse.osgi/trace/filters", TRACE_FILTERS);
  }
  
  public static void doneBooting()
  {
    booting = false;
  }
  
  public static boolean isBooting()
  {
    return booting;
  }
  
  public static String[] getArrayFromList(String prop)
  {
    return ManifestElement.getArrayFromList(prop, ",");
  }
  
  private void initialize()
  {
    BundleStats bundle = findBundle("org.eclipse.osgi", 0L);
    bundle.setTimestamp(System.currentTimeMillis());
    bundle.setActivationOrder(bundles.size());
    bundle.setDuringStartup(booting);
  }
  
  public void watchBundle(Bundle bundle, int type)
  {
    switch (type)
    {
    case 4: 
      startActivation(bundle);
      break;
    case 8: 
      endActivation(bundle);
    }
  }
  
  public void startActivation(Bundle bundle)
  {
    BundleStats info = findBundle(bundle.getSymbolicName(), bundle.getBundleId());
    info.setTimestamp(System.currentTimeMillis());
    info.setActivationOrder(bundles.size());
    info.setDuringStartup(booting);
    
    Stack<BundleStats> activationStack = (Stack)activationStacks.get(Thread.currentThread());
    if (activationStack == null)
    {
      activationStack = new Stack();
      activationStacks.put(Thread.currentThread(), activationStack);
    }
    if (activationStack.size() != 0)
    {
      BundleStats activatedBy = (BundleStats)activationStack.peek();
      activatedBy.activated(info);
      info.setActivatedBy(activatedBy);
    }
    activationStack.push(info);
    if (TRACE_BUNDLES) {
      traceActivate(bundle, info);
    }
  }
  
  public void endActivation(Bundle symbolicName)
  {
    Stack<BundleStats> activationStack = (Stack)activationStacks.get(Thread.currentThread());
    
    BundleStats info = (BundleStats)activationStack.pop();
    info.endActivation();
  }
  
  /* Error */
  private void traceActivate(Bundle bundle, BundleStats info)
  {
    // Byte code:
    //   0: new 188	java/io/PrintWriter
    //   3: dup
    //   4: new 186	java/io/FileOutputStream
    //   7: dup
    //   8: getstatic 355	org/eclipse/core/runtime/internal/stats/ClassloaderStats:traceFile	Ljava/io/File;
    //   11: invokevirtual 369	java/io/File:getAbsolutePath	()Ljava/lang/String;
    //   14: iconst_1
    //   15: invokespecial 370	java/io/FileOutputStream:<init>	(Ljava/lang/String;Z)V
    //   18: invokespecial 373	java/io/PrintWriter:<init>	(Ljava/io/OutputStream;)V
    //   21: astore_3
    //   22: getstatic 355	org/eclipse/core/runtime/internal/stats/ClassloaderStats:traceFile	Ljava/io/File;
    //   25: invokevirtual 368	java/io/File:length	()J
    //   28: lstore 4
    //   30: aload_3
    //   31: new 194	java/lang/StringBuffer
    //   34: dup
    //   35: ldc_w 180
    //   38: invokespecial 380	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   41: aload_1
    //   42: invokeinterface 435 1 0
    //   47: invokevirtual 381	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   50: invokevirtual 379	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   53: invokevirtual 374	java/io/PrintWriter:println	(Ljava/lang/String;)V
    //   56: aload_3
    //   57: ldc_w 181
    //   60: invokevirtual 374	java/io/PrintWriter:println	(Ljava/lang/String;)V
    //   63: aload_0
    //   64: getfield 365	org/eclipse/core/runtime/internal/stats/StatsManager:activationStacks	Ljava/util/Map;
    //   67: invokestatic 383	java/lang/Thread:currentThread	()Ljava/lang/Thread;
    //   70: invokeinterface 432 2 0
    //   75: checkcast 202	java/util/Stack
    //   78: astore 6
    //   80: aload 6
    //   82: invokevirtual 392	java/util/Stack:size	()I
    //   85: iconst_1
    //   86: isub
    //   87: istore 7
    //   89: goto +39 -> 128
    //   92: aload_3
    //   93: new 194	java/lang/StringBuffer
    //   96: dup
    //   97: ldc_w 178
    //   100: invokespecial 380	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   103: aload 6
    //   105: iload 7
    //   107: invokevirtual 396	java/util/Stack:get	(I)Ljava/lang/Object;
    //   110: checkcast 203	org/eclipse/core/runtime/internal/stats/BundleStats
    //   113: invokevirtual 404	org/eclipse/core/runtime/internal/stats/BundleStats:getSymbolicName	()Ljava/lang/String;
    //   116: invokevirtual 381	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   119: invokevirtual 379	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   122: invokevirtual 374	java/io/PrintWriter:println	(Ljava/lang/String;)V
    //   125: iinc 7 -1
    //   128: iload 7
    //   130: ifge -38 -> 92
    //   133: aload_3
    //   134: ldc_w 182
    //   137: invokevirtual 374	java/io/PrintWriter:println	(Ljava/lang/String;)V
    //   140: invokestatic 409	org/eclipse/core/runtime/internal/stats/ClassloaderStats:getClassStack	()Ljava/util/Stack;
    //   143: astore 7
    //   145: aload 7
    //   147: invokevirtual 392	java/util/Stack:size	()I
    //   150: iconst_1
    //   151: isub
    //   152: istore 8
    //   154: goto +39 -> 193
    //   157: aload_3
    //   158: new 194	java/lang/StringBuffer
    //   161: dup
    //   162: ldc_w 178
    //   165: invokespecial 380	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   168: aload 7
    //   170: iload 8
    //   172: invokevirtual 396	java/util/Stack:get	(I)Ljava/lang/Object;
    //   175: checkcast 204	org/eclipse/core/runtime/internal/stats/ClassStats
    //   178: invokevirtual 408	org/eclipse/core/runtime/internal/stats/ClassStats:getClassName	()Ljava/lang/String;
    //   181: invokevirtual 381	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   184: invokevirtual 379	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   187: invokevirtual 374	java/io/PrintWriter:println	(Ljava/lang/String;)V
    //   190: iinc 8 -1
    //   193: iload 8
    //   195: ifge -38 -> 157
    //   198: aload_3
    //   199: ldc_w 183
    //   202: invokevirtual 374	java/io/PrintWriter:println	(Ljava/lang/String;)V
    //   205: new 197	java/lang/Throwable
    //   208: dup
    //   209: invokespecial 384	java/lang/Throwable:<init>	()V
    //   212: aload_3
    //   213: invokevirtual 385	java/lang/Throwable:printStackTrace	(Ljava/io/PrintWriter;)V
    //   216: aload_2
    //   217: lload 4
    //   219: invokevirtual 402	org/eclipse/core/runtime/internal/stats/BundleStats:setTraceStart	(J)V
    //   222: goto +22 -> 244
    //   225: astore 9
    //   227: aload_3
    //   228: invokevirtual 372	java/io/PrintWriter:close	()V
    //   231: aload_2
    //   232: getstatic 355	org/eclipse/core/runtime/internal/stats/ClassloaderStats:traceFile	Ljava/io/File;
    //   235: invokevirtual 368	java/io/File:length	()J
    //   238: invokevirtual 401	org/eclipse/core/runtime/internal/stats/BundleStats:setTraceEnd	(J)V
    //   241: aload 9
    //   243: athrow
    //   244: aload_3
    //   245: invokevirtual 372	java/io/PrintWriter:close	()V
    //   248: aload_2
    //   249: getstatic 355	org/eclipse/core/runtime/internal/stats/ClassloaderStats:traceFile	Ljava/io/File;
    //   252: invokevirtual 368	java/io/File:length	()J
    //   255: invokevirtual 401	org/eclipse/core/runtime/internal/stats/BundleStats:setTraceEnd	(J)V
    //   258: goto +8 -> 266
    //   261: astore_3
    //   262: aload_3
    //   263: invokevirtual 371	java/io/IOException:printStackTrace	()V
    //   266: return
    // Line number table:
    //   Java source line #154	-> byte code offset #0
    //   Java source line #156	-> byte code offset #22
    //   Java source line #157	-> byte code offset #30
    //   Java source line #158	-> byte code offset #56
    //   Java source line #159	-> byte code offset #63
    //   Java source line #160	-> byte code offset #80
    //   Java source line #161	-> byte code offset #92
    //   Java source line #160	-> byte code offset #125
    //   Java source line #162	-> byte code offset #133
    //   Java source line #163	-> byte code offset #140
    //   Java source line #164	-> byte code offset #145
    //   Java source line #165	-> byte code offset #157
    //   Java source line #164	-> byte code offset #190
    //   Java source line #166	-> byte code offset #198
    //   Java source line #167	-> byte code offset #205
    //   Java source line #168	-> byte code offset #216
    //   Java source line #169	-> byte code offset #225
    //   Java source line #170	-> byte code offset #227
    //   Java source line #171	-> byte code offset #231
    //   Java source line #172	-> byte code offset #241
    //   Java source line #170	-> byte code offset #244
    //   Java source line #171	-> byte code offset #248
    //   Java source line #173	-> byte code offset #261
    //   Java source line #174	-> byte code offset #262
    //   Java source line #176	-> byte code offset #266
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	267	0	this	StatsManager
    //   0	267	1	bundle	Bundle
    //   0	267	2	info	BundleStats
    //   21	224	3	output	java.io.PrintWriter
    //   261	2	3	e	java.io.IOException
    //   28	190	4	startPosition	long
    //   78	26	6	activationStack	Stack<BundleStats>
    //   87	42	7	i	int
    //   143	26	7	classStack	Stack<ClassStats>
    //   152	42	8	i	int
    //   225	17	9	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   22	225	225	finally
    //   0	258	261	java/io/IOException
  }
  
  public BundleStats findBundle(String symbolicName, long id)
  {
    BundleStats result = (BundleStats)bundles.get(new Long(id));
    try
    {
      if (result == null)
      {
        result = new BundleStats(symbolicName, id);
        bundles.put(new Long(id), result);
      }
    }
    catch (IllegalAccessError e)
    {
      e.printStackTrace();
    }
    return result;
  }
  
  public BundleStats[] getBundles()
  {
    return (BundleStats[])bundles.values().toArray(new BundleStats[bundles.size()]);
  }
  
  public BundleStats getBundle(long id)
  {
    return (BundleStats)bundles.get(new Long(id));
  }
  
  public void preFindLocalClass(String name, ClasspathManager manager)
    throws ClassNotFoundException
  {
    if (MONITOR_CLASSES) {
      ClassloaderStats.startLoadingClass(getClassloaderId(manager), name);
    }
  }
  
  public void postFindLocalClass(String name, Class<?> clazz, ClasspathManager manager)
  {
    if (MONITOR_CLASSES) {
      ClassloaderStats.endLoadingClass(getClassloaderId(manager), name, clazz != null);
    }
  }
  
  public void preFindLocalResource(String name, ClasspathManager manager) {}
  
  public void postFindLocalResource(String name, URL resource, ClasspathManager manager)
  {
    if ((MONITOR_RESOURCES) && 
      (resource != null) && (name.endsWith(".properties"))) {
      ClassloaderStats.loadedBundle(getClassloaderId(manager), new ResourceBundleStats(getClassloaderId(manager), name, resource));
    }
  }
  
  public void recordClassDefine(String name, Class<?> clazz, byte[] classbytes, ClasspathEntry classpathEntry, BundleEntry entry, ClasspathManager manager) {}
  
  private String getClassloaderId(ClasspathManager loader)
  {
    return loader.getBaseData().getSymbolicName();
  }
  
  public void addHooks(HookRegistry hookRegistry)
  {
    if (Debug.MONITOR_ACTIVATION) {
      hookRegistry.addWatcher(getDefault());
    }
    if ((MONITOR_CLASSES) || (MONITOR_RESOURCES)) {
      hookRegistry.addClassLoadingStatsHook(getDefault());
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.core.runtime.internal.stats.StatsManager
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.log;

import org.osgi.service.log.LogEntry;

public abstract interface ExtendedLogEntry
  extends LogEntry
{
  public abstract String getLoggerName();
  
  public abstract Object getContext();
  
  public abstract long getThreadId();
  
  public abstract String getThreadName();
  
  public abstract long getSequenceNumber();
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.log.ExtendedLogEntry
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.log;

import org.osgi.service.log.LogListener;
import org.osgi.service.log.LogReaderService;

public abstract interface ExtendedLogReaderService
  extends LogReaderService
{
  public abstract void addLogListener(LogListener paramLogListener, LogFilter paramLogFilter);
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.log.ExtendedLogReaderService
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.log;

import org.osgi.framework.Bundle;
import org.osgi.service.log.LogService;

public abstract interface ExtendedLogService
  extends LogService, Logger
{
  public abstract Logger getLogger(String paramString);
  
  public abstract Logger getLogger(Bundle paramBundle, String paramString);
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.log.ExtendedLogService
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.log;

import org.osgi.framework.Bundle;

public abstract interface LogFilter
{
  public abstract boolean isLoggable(Bundle paramBundle, String paramString, int paramInt);
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.log.LogFilter
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.log;

import java.security.Permission;
import java.security.PermissionCollection;

public class LogPermission
  extends Permission
{
  private static final long serialVersionUID = -441193976837153362L;
  private static final String ALL = "*";
  public static final String LOG = "log";
  
  public LogPermission(String name, String actions)
  {
    super(name);
    if (!name.equals("*")) {
      throw new IllegalArgumentException("name must be *");
    }
    actions = actions.trim();
    if ((!actions.equalsIgnoreCase("log")) && (!actions.equals("*"))) {
      throw new IllegalArgumentException("actions must be * or log");
    }
  }
  
  public boolean equals(Object obj)
  {
    return obj instanceof LogPermission;
  }
  
  public String getActions()
  {
    return "log";
  }
  
  public int hashCode()
  {
    return LogPermission.class.hashCode();
  }
  
  public boolean implies(Permission permission)
  {
    return permission instanceof LogPermission;
  }
  
  public PermissionCollection newPermissionCollection()
  {
    return new LogPermissionCollection();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.log.LogPermission
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.log;

import java.security.Permission;
import java.util.Enumeration;
import java.util.NoSuchElementException;

class LogPermissionCollection$1
  implements Enumeration<Permission>
{
  private boolean hasMore;
  final LogPermissionCollection this$0;
  
  LogPermissionCollection$1(LogPermissionCollection paramLogPermissionCollection)
  {
    hasMore = (logPermission != null);
  }
  
  public boolean hasMoreElements()
  {
    return hasMore;
  }
  
  public Permission nextElement()
  {
    if (hasMore)
    {
      hasMore = false;
      return this$0.logPermission;
    }
    throw new NoSuchElementException();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.log.LogPermissionCollection.1
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.log;

import java.security.Permission;
import java.security.PermissionCollection;
import java.util.Enumeration;
import java.util.NoSuchElementException;

public final class LogPermissionCollection
  extends PermissionCollection
{
  private static final long serialVersionUID = -1955409691185916778L;
  LogPermission logPermission;
  
  public void add(Permission permission)
  {
    if (!(permission instanceof LogPermission)) {
      throw new IllegalArgumentException("invalid permission: " + permission);
    }
    if (isReadOnly()) {
      throw new SecurityException("attempt to add a LogPermission to a readonly LogPermissionCollection");
    }
    if (permission != null) {
      logPermission = ((LogPermission)permission);
    }
  }
  
  public Enumeration<Permission> elements()
  {
    new Enumeration()
    {
      private boolean hasMore = logPermission != null;
      
      public boolean hasMoreElements()
      {
        return hasMore;
      }
      
      public Permission nextElement()
      {
        if (hasMore)
        {
          hasMore = false;
          return logPermission;
        }
        throw new NoSuchElementException();
      }
    };
  }
  
  public boolean implies(Permission permission)
  {
    return (logPermission != null) && (logPermission.implies(permission));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.log.LogPermissionCollection
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.log;

import org.osgi.framework.ServiceReference;

public abstract interface Logger
{
  public abstract void log(int paramInt, String paramString);
  
  public abstract void log(int paramInt, String paramString, Throwable paramThrowable);
  
  public abstract void log(ServiceReference<?> paramServiceReference, int paramInt, String paramString);
  
  public abstract void log(ServiceReference<?> paramServiceReference, int paramInt, String paramString, Throwable paramThrowable);
  
  public abstract void log(Object paramObject, int paramInt, String paramString);
  
  public abstract void log(Object paramObject, int paramInt, String paramString, Throwable paramThrowable);
  
  public abstract boolean isLoggable(int paramInt);
  
  public abstract String getName();
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.log.Logger
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.log;

import org.osgi.service.log.LogListener;

public abstract interface SynchronousLogListener
  extends LogListener
{}

/* Location:
 * Qualified Name:     org.eclipse.equinox.log.SynchronousLogListener
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.log.internal;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class BasicReadWriteLock
{
  private List<Thread> currentReaders = new ArrayList(2);
  private int writersWaiting = 0;
  private Thread writing = null;
  
  public synchronized int readLock()
  {
    while ((writing != null) || (writersWaiting != 0)) {
      try
      {
        if (writing == Thread.currentThread()) {
          throw new IllegalStateException("Attempted to nest read lock inside a write lock");
        }
        wait();
      }
      catch (InterruptedException localInterruptedException)
      {
        Thread.currentThread().interrupt();
      }
    }
    currentReaders.add(Thread.currentThread());
    if (currentReaders.size() == 1) {
      return 1;
    }
    Thread current = Thread.currentThread();
    int result = 0;
    for (Iterator localIterator = currentReaders.iterator(); localIterator.hasNext();)
    {
      Thread reader = (Thread)localIterator.next();
      if (reader == current) {
        result++;
      }
    }
    return result;
  }
  
  public synchronized void readUnlock()
  {
    currentReaders.remove(Thread.currentThread());
    notifyAll();
  }
  
  /* Error */
  public synchronized void writeLock()
  {
    // Byte code:
    //   0: aload_0
    //   1: dup
    //   2: getfield 75	org/eclipse/equinox/log/internal/BasicReadWriteLock:writersWaiting	I
    //   5: iconst_1
    //   6: iadd
    //   7: putfield 75	org/eclipse/equinox/log/internal/BasicReadWriteLock:writersWaiting	I
    //   10: goto +52 -> 62
    //   13: aload_0
    //   14: getfield 76	org/eclipse/equinox/log/internal/BasicReadWriteLock:writing	Ljava/lang/Thread;
    //   17: invokestatic 83	java/lang/Thread:currentThread	()Ljava/lang/Thread;
    //   20: if_acmpeq +18 -> 38
    //   23: aload_0
    //   24: getfield 77	org/eclipse/equinox/log/internal/BasicReadWriteLock:currentReaders	Ljava/util/List;
    //   27: invokestatic 83	java/lang/Thread:currentThread	()Ljava/lang/Thread;
    //   30: invokeinterface 89 2 0
    //   35: ifeq +13 -> 48
    //   38: new 41	java/lang/IllegalStateException
    //   41: dup
    //   42: ldc 2
    //   44: invokespecial 78	java/lang/IllegalStateException:<init>	(Ljava/lang/String;)V
    //   47: athrow
    //   48: aload_0
    //   49: invokevirtual 81	java/lang/Object:wait	()V
    //   52: goto +10 -> 62
    //   55: pop
    //   56: invokestatic 83	java/lang/Thread:currentThread	()Ljava/lang/Thread;
    //   59: invokevirtual 82	java/lang/Thread:interrupt	()V
    //   62: aload_0
    //   63: getfield 76	org/eclipse/equinox/log/internal/BasicReadWriteLock:writing	Ljava/lang/Thread;
    //   66: ifnonnull -53 -> 13
    //   69: aload_0
    //   70: getfield 77	org/eclipse/equinox/log/internal/BasicReadWriteLock:currentReaders	Ljava/util/List;
    //   73: invokeinterface 87 1 0
    //   78: ifne -65 -> 13
    //   81: goto +16 -> 97
    //   84: astore_1
    //   85: aload_0
    //   86: dup
    //   87: getfield 75	org/eclipse/equinox/log/internal/BasicReadWriteLock:writersWaiting	I
    //   90: iconst_1
    //   91: isub
    //   92: putfield 75	org/eclipse/equinox/log/internal/BasicReadWriteLock:writersWaiting	I
    //   95: aload_1
    //   96: athrow
    //   97: aload_0
    //   98: dup
    //   99: getfield 75	org/eclipse/equinox/log/internal/BasicReadWriteLock:writersWaiting	I
    //   102: iconst_1
    //   103: isub
    //   104: putfield 75	org/eclipse/equinox/log/internal/BasicReadWriteLock:writersWaiting	I
    //   107: aload_0
    //   108: invokestatic 83	java/lang/Thread:currentThread	()Ljava/lang/Thread;
    //   111: putfield 76	org/eclipse/equinox/log/internal/BasicReadWriteLock:writing	Ljava/lang/Thread;
    //   114: return
    // Line number table:
    //   Java source line #47	-> byte code offset #0
    //   Java source line #49	-> byte code offset #10
    //   Java source line #51	-> byte code offset #13
    //   Java source line #52	-> byte code offset #38
    //   Java source line #53	-> byte code offset #48
    //   Java source line #54	-> byte code offset #55
    //   Java source line #56	-> byte code offset #56
    //   Java source line #49	-> byte code offset #62
    //   Java source line #59	-> byte code offset #84
    //   Java source line #60	-> byte code offset #85
    //   Java source line #61	-> byte code offset #95
    //   Java source line #60	-> byte code offset #97
    //   Java source line #62	-> byte code offset #107
    //   Java source line #63	-> byte code offset #114
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	115	0	this	BasicReadWriteLock
    //   84	12	1	localObject	Object
    //   55	1	2	localInterruptedException	InterruptedException
    // Exception table:
    //   from	to	target	type
    //   13	52	55	java/lang/InterruptedException
    //   10	84	84	finally
  }
  
  public synchronized void writeUnlock()
  {
    writing = null;
    notifyAll();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.log.internal.BasicReadWriteLock
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.log.internal;

import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.util.tracker.ServiceTracker;
import org.osgi.util.tracker.ServiceTrackerCustomizer;

public class EventAdminAdapter
  implements ServiceTrackerCustomizer<Object, Object>
{
  public static final String EVENT_TOPIC = "event.topics";
  private static final String[] LOG_TOPICS_ARRAY = { "*", "org/*", "org/osgi/*", "org/osgi/service/*", "org/osgi/service/log/*", "org/osgi/service/log/LogEntry/*", "org/osgi/service/log/LogEntry/LOG_ERROR", "org/osgi/service/log/LogEntry/LOG_WARNING", "org/osgi/service/log/LogEntry/LOG_INFO", "org/osgi/service/log/LogEntry/LOG_DEBUG", "org/osgi/service/log/LogEntry/LOG_OTHER" };
  private static final Object LOG_TOPIC_TOKEN = new Object();
  private static Collection<String> logTopics = new HashSet(Arrays.asList(LOG_TOPICS_ARRAY));
  private static Collection<String> eventAdminObjectClass = Arrays.asList(new String[] { "org.osgi.service.event.EventAdmin" });
  private static Collection<String> eventHandlerObjectClass = Arrays.asList(new String[] { "org.osgi.service.event.EventHandler" });
  private ServiceTracker<Object, Object> eventAdminTracker;
  private ServiceTracker<Object, Object> eventHandlerTracker;
  private BundleContext context;
  private ServiceReference<Object> eventAdmin;
  private int logEventHandlers;
  private ExtendedLogReaderServiceFactory logReaderServiceFactory;
  private EventAdminLogListener logListener;
  
  public EventAdminAdapter(BundleContext context, ExtendedLogReaderServiceFactory logReaderServiceFactory)
  {
    this.context = context;
    this.logReaderServiceFactory = logReaderServiceFactory;
    eventAdminTracker = new ServiceTracker(context, "org.osgi.service.event.EventAdmin", this);
    eventHandlerTracker = new ServiceTracker(context, "org.osgi.service.event.EventHandler", this);
  }
  
  public void start()
  {
    eventAdminTracker.open();
    eventHandlerTracker.open();
  }
  
  public void stop()
  {
    eventAdminTracker.close();
    eventHandlerTracker.close();
  }
  
  public Object addingService(ServiceReference<Object> reference)
  {
    Object toTrack = null;
    Object objectClass = reference.getProperty("objectClass");
    Object topics = reference.getProperty("event.topics");
    if ((checkServiceProp(objectClass, eventAdminObjectClass)) && (eventAdmin == null))
    {
      toTrack = reference;
      eventAdmin = reference;
    }
    else if ((checkServiceProp(objectClass, eventHandlerObjectClass)) && (checkServiceProp(topics, logTopics)))
    {
      logEventHandlers += 1;
      toTrack = LOG_TOPIC_TOKEN;
    }
    if ((eventAdmin != null) && (logEventHandlers > 0) && (logListener == null))
    {
      try
      {
        logListener = new EventAdminLogListener(context.getService(eventAdmin));
      }
      catch (ClassNotFoundException e)
      {
        e.printStackTrace();
      }
      catch (NoSuchMethodException e)
      {
        e.printStackTrace();
      }
      logReaderServiceFactory.addLogListener(logListener, ExtendedLogReaderServiceFactory.NULL_LOGGER_FILTER);
    }
    return toTrack;
  }
  
  public void modifiedService(ServiceReference<Object> reference, Object tracked)
  {
    removedService(reference, tracked);
    addingService(reference);
  }
  
  public void removedService(ServiceReference<Object> reference, Object tracked)
  {
    if (tracked == eventAdmin)
    {
      eventAdmin = null;
      context.ungetService(reference);
    }
    else if (LOG_TOPIC_TOKEN == tracked)
    {
      logEventHandlers -= 1;
    }
    if ((logListener != null) && ((eventAdmin == null) || (logEventHandlers == 0)))
    {
      logReaderServiceFactory.removeLogListener(logListener);
      logListener = null;
    }
  }
  
  private static boolean checkServiceProp(Object property, Collection<String> check)
  {
    if ((property instanceof String)) {
      return check.contains(property);
    }
    int i;
    if ((property instanceof String[]))
    {
      String[] topics = (String[])property;
      for (i = 0; i < topics.length; i++) {
        if (check.contains(topics[i])) {
          return true;
        }
      }
    }
    if ((property instanceof Collection)) {
      for (i = ((Collection)property).iterator(); i.hasNext();)
      {
        Object prop = i.next();
        if (check.contains(prop)) {
          return true;
        }
      }
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.log.internal.EventAdminAdapter
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.log.internal;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Dictionary;
import java.util.Hashtable;
import org.eclipse.equinox.log.SynchronousLogListener;
import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceReference;
import org.osgi.service.log.LogEntry;

public class EventAdminLogListener
  implements SynchronousLogListener
{
  public static final String TOPIC = "org/osgi/service/log/LogEntry";
  public static final char TOPIC_SEPARATOR = '/';
  public static final String LOG_ERROR = "LOG_ERROR";
  public static final String LOG_WARNING = "LOG_WARNING";
  public static final String LOG_INFO = "LOG_INFO";
  public static final String LOG_DEBUG = "LOG_DEBUG";
  public static final String LOG_OTHER = "LOG_OTHER";
  public static final String TIMESTAMP = "timestamp";
  public static final String MESSAGE = "message";
  public static final String LOG_LEVEL = "log.level";
  public static final String LOG_ENTRY = "log.entry";
  public static final String SERVICE = "service";
  public static final String SERVICE_ID = "service.id";
  public static final String SERVICE_OBJECTCLASS = "service.objectClass";
  public static final String SERVICE_PID = "service.pid";
  public static final String BUNDLE = "bundle";
  public static final String BUNDLE_ID = "bundle.id";
  public static final String BUNDLE_SYMBOLICNAME = "bundle.symbolicName";
  public static final String EVENT = "event";
  public static final String EXCEPTION = "exception";
  public static final String EXCEPTION_CLASS = "exception.class";
  public static final String EXCEPTION_MESSAGE = "exception.message";
  private final Object eventAdmin;
  private final Method postEvent;
  private final Constructor<?> event;
  
  public EventAdminLogListener(Object eventAdmin)
    throws ClassNotFoundException, NoSuchMethodException
  {
    this.eventAdmin = eventAdmin;
    Class<?> eventAdminClass = eventAdmin.getClass();
    ClassLoader cl = eventAdminClass.getClassLoader();
    Class<?> eventClass = cl.loadClass("org.osgi.service.event.Event");
    
    postEvent = eventAdminClass.getMethod("postEvent", new Class[] { eventClass });
    event = eventClass.getConstructor(new Class[] { String.class, Dictionary.
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-2019. Infinite Loop Ltd