org.eclipse.osgi_3.8.2.v20130124-134944

 ((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.class });
  }
  
  public void logged(LogEntry entry)
  {
    try
    {
      Object convertedEvent = convertEvent(entry);
      postEvent.invoke(eventAdmin, new Object[] { convertedEvent });
    }
    catch (InvocationTargetException e)
    {
      Throwable t = e.getTargetException();
      if ((t instanceof RuntimeException)) {
        throw ((RuntimeException)t);
      }
      if ((t instanceof Error)) {
        throw ((Error)t);
      }
      throw new RuntimeException(e);
    }
    catch (IllegalAccessException e)
    {
      throw new RuntimeException(e);
    }
    catch (InstantiationException e)
    {
      throw new RuntimeException(e);
    }
  }
  
  private Object convertEvent(LogEntry entry)
    throws InstantiationException, IllegalAccessException, InvocationTargetException
  {
    String topic = "org/osgi/service/log/LogEntry";
    int level = entry.getLevel();
    switch (level)
    {
    case 1: 
      topic = topic + "/LOG_ERROR";
      break;
    case 2: 
      topic = topic + "/LOG_WARNING";
      break;
    case 3: 
      topic = topic + "/LOG_INFO";
      break;
    case 4: 
      topic = topic + "/LOG_DEBUG";
      break;
    default: 
      topic = topic + "/LOG_OTHER";
    }
    Hashtable<String, Object> properties = new Hashtable();
    Bundle bundle = entry.getBundle();
    if (bundle == null) {
      throw new RuntimeException("LogEntry.getBundle() returns null");
    }
    putBundleProperties(properties, bundle);
    Throwable t = entry.getException();
    if (t != null) {
      putExceptionProperties(properties, t);
    }
    ServiceReference<?> ref = entry.getServiceReference();
    if (ref != null) {
      putServiceReferenceProperties(properties, ref);
    }
    properties.put("log.entry", entry);
    properties.put("log.level", new Integer(entry.getLevel()));
    if (entry.getMessage() != null) {
      properties.put("message", entry.getMessage());
    }
    properties.put("timestamp", new Long(entry.getTime()));
    return event.newInstance(new Object[] { topic, properties });
  }
  
  public static void putServiceReferenceProperties(Hashtable<String, Object> properties, ServiceReference<?> ref)
  {
    properties.put("service", ref);
    properties.put("service.id", ref.getProperty("service.id"));
    Object o = ref.getProperty("service.pid");
    if ((o != null) && ((o instanceof String))) {
      properties.put("service.pid", o);
    }
    Object o2 = ref.getProperty("objectClass");
    if ((o2 != null) && ((o2 instanceof String[]))) {
      properties.put("service.objectClass", o2);
    }
  }
  
  public static void putBundleProperties(Hashtable<String, Object> properties, Bundle bundle)
  {
    properties.put("bundle.id", new Long(bundle.getBundleId()));
    String symbolicName = bundle.getSymbolicName();
    if (symbolicName != null) {
      properties.put("bundle.symbolicName", symbolicName);
    }
    properties.put("bundle", bundle);
  }
  
  public static void putExceptionProperties(Hashtable<String, Object> properties, Throwable t)
  {
    properties.put("exception", t);
    properties.put("exception.class", t.getClass().getName());
    String message = t.getMessage();
    if (message != null) {
      properties.put("exception.message", t.getMessage());
    }
  }
}

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

import java.util.Map;
import java.util.WeakHashMap;
import org.eclipse.equinox.log.ExtendedLogEntry;
import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceReference;
import org.osgi.service.log.LogEntry;

public class ExtendedLogEntryImpl
  implements ExtendedLogEntry, LogEntry
{
  private static long nextSequenceNumber = 1L;
  private static long nextThreadId = 1L;
  private static final Map<Thread, Long> threadIds = createThreadIdMap();
  private final String loggerName;
  private final Bundle bundle;
  private final int level;
  private final String message;
  private final Throwable throwable;
  private final Object contextObject;
  private final long time;
  private final long threadId;
  private final String threadName;
  private final long sequenceNumber;
  
  private static Map<Thread, Long> createThreadIdMap()
  {
    try
    {
      Thread.class.getMethod("getId", null);
    }
    catch (NoSuchMethodException localNoSuchMethodException)
    {
      return new WeakHashMap();
    }
    return null;
  }
  
  private static long getId(Thread thread)
  {
    if (threadIds == null) {
      return thread.getId();
    }
    Long threadId = (Long)threadIds.get(thread);
    if (threadId == null)
    {
      threadId = new Long(nextThreadId++);
      threadIds.put(thread, threadId);
    }
    return threadId.longValue();
  }
  
  public ExtendedLogEntryImpl(Bundle bundle, String loggerName, Object contextObject, int level, String message, Throwable throwable)
  {
    time = System.currentTimeMillis();
    this.loggerName = loggerName;
    this.bundle = bundle;
    this.level = level;
    this.message = message;
    this.throwable = throwable;
    this.contextObject = contextObject;
    
    Thread currentThread = Thread.currentThread();
    threadName = currentThread.getName();
    synchronized (ExtendedLogEntryImpl.class)
    {
      threadId = getId(currentThread);
      sequenceNumber = (nextSequenceNumber++);
    }
  }
  
  public String getLoggerName()
  {
    return loggerName;
  }
  
  public long getSequenceNumber()
  {
    return sequenceNumber;
  }
  
  public long getThreadId()
  {
    return threadId;
  }
  
  public String getThreadName()
  {
    return threadName;
  }
  
  public Bundle getBundle()
  {
    return bundle;
  }
  
  public Throwable getException()
  {
    return throwable;
  }
  
  public int getLevel()
  {
    return level;
  }
  
  public String getMessage()
  {
    return message;
  }
  
  public ServiceReference getServiceReference()
  {
    if ((contextObject != null) && ((contextObject instanceof ServiceReference))) {
      return (ServiceReference)contextObject;
    }
    return null;
  }
  
  public long getTime()
  {
    return time;
  }
  
  public Object getContext()
  {
    return contextObject;
  }
}

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

import org.eclipse.equinox.log.LogFilter;
import org.osgi.framework.Bundle;

class ExtendedLogReaderServiceFactory$1
  implements LogFilter
{
  public boolean isLoggable(Bundle b, String loggerName, int logLevel)
  {
    return true;
  }
}

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

import java.security.PrivilegedAction;
import org.osgi.framework.Bundle;

class ExtendedLogReaderServiceFactory$2
  implements PrivilegedAction<Boolean>
{
  final ExtendedLogReaderServiceFactory this$0;
  
  ExtendedLogReaderServiceFactory$2(ExtendedLogReaderServiceFactory paramExtendedLogReaderServiceFactory, Bundle paramBundle, String paramString, int paramInt) {}
  
  public Boolean run()
  {
    return new Boolean(this$0.isLoggablePrivileged(val$bundle, val$name, val$level));
  }
}

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

import java.security.PrivilegedAction;
import org.osgi.framework.Bundle;

class ExtendedLogReaderServiceFactory$3
  implements PrivilegedAction<Object>
{
  final ExtendedLogReaderServiceFactory this$0;
  
  ExtendedLogReaderServiceFactory$3(ExtendedLogReaderServiceFactory paramExtendedLogReaderServiceFactory, Bundle paramBundle, String paramString1, Object paramObject, int paramInt, String paramString2, Throwable paramThrowable) {}
  
  public Object run()
  {
    this$0.logPrivileged(val$bundle, val$name, val$context, val$level, val$message, val$exception);
    return null;
  }
}

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

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

final class ExtendedLogReaderServiceFactory$LogTask
  implements Runnable
{
  private final LogEntry logEntry;
  private final LogListener listener;
  
  ExtendedLogReaderServiceFactory$LogTask(LogEntry logEntry, LogListener listener)
  {
    this.logEntry = logEntry;
    this.listener = listener;
  }
  
  public void run()
  {
    ExtendedLogReaderServiceFactory.safeLogged(listener, logEntry);
  }
}

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

import java.io.PrintStream;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
import org.eclipse.equinox.log.LogFilter;
import org.eclipse.osgi.internal.baseadaptor.ArrayMap;
import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceFactory;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.log.LogEntry;
import org.osgi.service.log.LogListener;

public class ExtendedLogReaderServiceFactory
  implements ServiceFactory<ExtendedLogReaderServiceImpl>
{
  static final int MAX_RECURSIONS = 50;
  
  static final class LogTask
    implements Runnable
  {
    private final LogEntry logEntry;
    private final LogListener listener;
    
    LogTask(LogEntry logEntry, LogListener listener)
    {
      this.logEntry = logEntry;
      this.listener = listener;
    }
    
    public void run()
    {
      ExtendedLogReaderServiceFactory.safeLogged(listener, logEntry);
    }
  }
  
  private static final Enumeration<?> EMPTY_ENUMERATION = Collections.enumeration(Collections.EMPTY_LIST);
  static final LogFilter NULL_LOGGER_FILTER = new LogFilter()
  {
    public boolean isLoggable(Bundle b, String loggerName, int logLevel)
    {
      return true;
    }
  };
  private static final LogFilter[] ALWAYS_LOG = new LogFilter[0];
  private static PrintStream errorStream;
  private final BasicReadWriteLock listenersLock = new BasicReadWriteLock();
  private ArrayMap<LogListener, Object[]> listeners = new ArrayMap(5);
  private LogFilter[] filters = null;
  private final ThreadLocal<int[]> nestedCallCount = new ThreadLocal();
  
  static boolean safeIsLoggable(LogFilter filter, Bundle bundle, String name, int level)
  {
    try
    {
      return filter.isLoggable(bundle, name, level);
    }
    catch (RuntimeException e)
    {
      getErrorStream().println("LogFilter.isLoggable threw a non-fatal unchecked exception as follows:");
      e.printStackTrace(getErrorStream());
    }
    catch (LinkageError e)
    {
      getErrorStream().println("LogFilter.isLoggable threw a non-fatal unchecked exception as follows:");
      e.printStackTrace(getErrorStream());
    }
    return false;
  }
  
  private static synchronized PrintStream getErrorStream()
  {
    if (errorStream == null) {
      return System.err;
    }
    return errorStream;
  }
  
  public static synchronized void setErrorStream(PrintStream ps)
  {
    errorStream = ps;
  }
  
  static void safeLogged(LogListener listener, LogEntry logEntry)
  {
    try
    {
      listener.logged(logEntry);
    }
    catch (RuntimeException e)
    {
      getErrorStream().println("LogListener.logged threw a non-fatal unchecked exception as follows:");
      e.printStackTrace(getErrorStream());
    }
    catch (LinkageError e)
    {
      getErrorStream().println("LogListener.logged threw a non-fatal unchecked exception as follows:");
      e.printStackTrace(getErrorStream());
    }
  }
  
  public ExtendedLogReaderServiceImpl getService(Bundle bundle, ServiceRegistration<ExtendedLogReaderServiceImpl> registration)
  {
    return new ExtendedLogReaderServiceImpl(this);
  }
  
  public void ungetService(Bundle bundle, ServiceRegistration<ExtendedLogReaderServiceImpl> registration, ExtendedLogReaderServiceImpl service)
  {
    service.shutdown();
  }
  
  boolean isLoggable(final Bundle bundle, final String name, final int level)
  {
    if (System.getSecurityManager() != null) {
      ((Boolean)AccessController.doPrivileged(new PrivilegedAction()
      {
        public Boolean run()
        {
          return new Boolean(isLoggablePrivileged(bundle, name, level));
        }
      })).booleanValue();
    }
    return isLoggablePrivileged(bundle, name, level);
  }
  
  /* Error */
  boolean isLoggablePrivileged(Bundle bundle, String name, int level)
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 277	org/eclipse/equinox/log/internal/ExtendedLogReaderServiceFactory:listenersLock	Lorg/eclipse/equinox/log/internal/BasicReadWriteLock;
    //   4: invokevirtual 292	org/eclipse/equinox/log/internal/BasicReadWriteLock:readLock	()I
    //   7: pop
    //   8: aload_0
    //   9: getfield 276	org/eclipse/equinox/log/internal/ExtendedLogReaderServiceFactory:filters	[Lorg/eclipse/equinox/log/LogFilter;
    //   12: astore 4
    //   14: goto +15 -> 29
    //   17: astore 5
    //   19: aload_0
    //   20: getfield 277	org/eclipse/equinox/log/internal/ExtendedLogReaderServiceFactory:listenersLock	Lorg/eclipse/equinox/log/internal/BasicReadWriteLock;
    //   23: invokevirtual 294	org/eclipse/equinox/log/internal/BasicReadWriteLock:readUnlock	()V
    //   26: aload 5
    //   28: athrow
    //   29: aload_0
    //   30: getfield 277	org/eclipse/equinox/log/internal/ExtendedLogReaderServiceFactory:listenersLock	Lorg/eclipse/equinox/log/internal/BasicReadWriteLock;
    //   33: invokevirtual 294	org/eclipse/equinox/log/internal/BasicReadWriteLock:readUnlock	()V
    //   36: aload_0
    //   37: invokespecial 298	org/eclipse/equinox/log/internal/ExtendedLogReaderServiceFactory:incrementNestedCount	()I
    //   40: bipush 50
    //   42: if_icmpne +9 -> 51
    //   45: aload_0
    //   46: invokespecial 299	org/eclipse/equinox/log/internal/ExtendedLogReaderServiceFactory:decrementNestedCount	()V
    //   49: iconst_0
    //   50: ireturn
    //   51: aload 4
    //   53: ifnonnull +6 -> 59
    //   56: goto -11 -> 45
    //   59: aload 4
    //   61: getstatic 275	org/eclipse/equinox/log/internal/ExtendedLogReaderServiceFactory:ALWAYS_LOG	[Lorg/eclipse/equinox/log/LogFilter;
    //   64: if_acmpne +9 -> 73
    //   67: aload_0
    //   68: invokespecial 299	org/eclipse/equinox/log/internal/ExtendedLogReaderServiceFactory:decrementNestedCount	()V
    //   71: iconst_1
    //   72: ireturn
    //   73: aload 4
    //   75: arraylength
    //   76: istore 5
    //   78: iconst_0
    //   79: istore 6
    //   81: goto +30 -> 111
    //   84: aload 4
    //   86: iload 6
    //   88: aaload
    //   89: astore 7
    //   91: aload 7
    //   93: aload_1
    //   94: aload_2
    //   95: iload_3
    //   96: invokestatic 305	org/eclipse/equinox/log/internal/ExtendedLogReaderServiceFactory:safeIsLoggable	(Lorg/eclipse/equinox/log/LogFilter;Lorg/osgi/framework/Bundle;Ljava/lang/String;I)Z
    //   99: ifeq +9 -> 108
    //   102: aload_0
    //   103: invokespecial 299	org/eclipse/equinox/log/internal/ExtendedLogReaderServiceFactory:decrementNestedCount	()V
    //   106: iconst_1
    //   107: ireturn
    //   108: iinc 6 1
    //   111: iload 6
    //   113: iload 5
    //   115: if_icmplt -31 -> 84
    //   118: goto +12 -> 130
    //   121: astore 8
    //   123: aload_0
    //   124: invokespecial 299	org/eclipse/equinox/log/internal/ExtendedLogReaderServiceFactory:decrementNestedCount	()V
    //   127: aload 8
    //   129: athrow
    //   130: aload_0
    //   131: invokespecial 299	org/eclipse/equinox/log/internal/ExtendedLogReaderServiceFactory:decrementNestedCount	()V
    //   134: iconst_0
    //   135: ireturn
    // Line number table:
    //   Java source line #120	-> byte code offset #0
    //   Java source line #122	-> byte code offset #8
    //   Java source line #123	-> byte code offset #14
    //   Java source line #124	-> byte code offset #19
    //   Java source line #125	-> byte code offset #26
    //   Java source line #124	-> byte code offset #29
    //   Java source line #127	-> byte code offset #36
    //   Java source line #142	-> byte code offset #45
    //   Java source line #128	-> byte code offset #49
    //   Java source line #129	-> byte code offset #51
    //   Java source line #130	-> byte code offset #56
    //   Java source line #132	-> byte code offset #59
    //   Java source line #142	-> byte code offset #67
    //   Java source line #133	-> byte code offset #71
    //   Java source line #135	-> byte code offset #73
    //   Java source line #136	-> byte code offset #78
    //   Java source line #137	-> byte code offset #84
    //   Java source line #138	-> byte code offset #91
    //   Java source line #142	-> byte code offset #102
    //   Java source line #139	-> byte code offset #106
    //   Java source line #136	-> byte code offset #108
    //   Java source line #141	-> byte code offset #118
    //   Java source line #142	-> byte code offset #123
    //   Java source line #143	-> byte code offset #127
    //   Java source line #142	-> byte code offset #130
    //   Java source line #144	-> byte code offset #134
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	136	0	this	ExtendedLogReaderServiceFactory
    //   0	136	1	bundle	Bundle
    //   0	136	2	name	String
    //   0	136	3	level	int
    //   12	3	4	filtersCopy	LogFilter[]
    //   29	56	4	filtersCopy	LogFilter[]
    //   17	10	5	localObject1	Object
    //   76	40	5	filtersLength	int
    //   79	37	6	i	int
    //   89	3	7	filter	LogFilter
    //   121	7	8	localObject2	Object
    // Exception table:
    //   from	to	target	type
    //   8	17	17	finally
    //   36	45	121	finally
    //   51	67	121	finally
    //   73	102	121	finally
    //   108	121	121	finally
  }
  
  private int incrementNestedCount()
  {
    int[] count = getCount();
    count[0] += 1;
    return count[0];
  }
  
  private void decrementNestedCount()
  {
    int[] count = getCount();
    if (count[0] == 0) {
      return;
    }
    count[0] -= 1;
  }
  
  private int[] getCount()
  {
    int[] count = (int[])nestedCallCount.get();
    if (count == null)
    {
      count = new int[1];
      nestedCallCount.set(count);
    }
    return count;
  }
  
  void log(final Bundle bundle, final String name, final Object context, final int level, final String message, final Throwable exception)
  {
    if (System.getSecurityManager() != null) {
      AccessController.doPrivileged(new PrivilegedAction()
      {
        public Object run()
        {
          logPrivileged(bundle, name, context, level, message, exception);
          return null;
        }
      });
    } else {
      logPrivileged(bundle, name, context, level, message, exception);
    }
  }
  
  /* Error */
  void logPrivileged(Bundle bundle, String name, Object context, int level, String message, Throwable exception)
  {
    // Byte code:
    //   0: new 136	org/eclipse/equinox/log/internal/ExtendedLogEntryImpl
    //   3: dup
    //   4: aload_1
    //   5: aload_2
    //   6: aload_3
    //   7: iload 4
    //   9: aload 5
    //   11: aload 6
    //   13: invokespecial 297	org/eclipse/equinox/log/internal/ExtendedLogEntryImpl:<init>	(Lorg/osgi/framework/Bundle;Ljava/lang/String;Ljava/lang/Object;ILjava/lang/String;Ljava/lang/Throwable;)V
    //   16: astore 7
    //   18: aload_0
    //   19: getfield 277	org/eclipse/equinox/log/internal/ExtendedLogReaderServiceFactory:listenersLock	Lorg/eclipse/equinox/log/internal/BasicReadWriteLock;
    //   22: invokevirtual 292	org/eclipse/equinox/log/internal/BasicReadWriteLock:readLock	()I
    //   25: pop
    //   26: aload_0
    //   27: getfield 278	org/eclipse/equinox/log/internal/ExtendedLogReaderServiceFactory:listeners	Lorg/eclipse/osgi/internal/baseadaptor/ArrayMap;
    //   30: astore 8
    //   32: goto +15 -> 47
    //   35: astore 9
    //   37: aload_0
    //   38: getfield 277	org/eclipse/equinox/log/internal/ExtendedLogReaderServiceFactory:listenersLock	Lorg/eclipse/equinox/log/internal/BasicReadWriteLock;
    //   41: invokevirtual 294	org/eclipse/equinox/log/internal/BasicReadWriteLock:readUnlock	()V
    //   44: aload 9
    //   46: athrow
    //   47: aload_0
    //   48: getfield 277	org/eclipse/equinox/log/internal/ExtendedLogReaderServiceFactory:listenersLock	Lorg/eclipse/equinox/log/internal/BasicReadWriteLock;
    //   51: invokevirtual 294	org/eclipse/equinox/log/internal/BasicReadWriteLock:readUnlock	()V
    //   54: aload_0
    //   55: invokespecial 298	org/eclipse/equinox/log/internal/ExtendedLogReaderServiceFactory:incrementNestedCount	()I
    //   58: bipush 50
    //   60: if_icmplt +8 -> 68
    //   63: aload_0
    //   64: invokespecial 299	org/eclipse/equinox/log/internal/ExtendedLogReaderServiceFactory:decrementNestedCount	()V
    //   67: return
    //   68: aload 8
    //   70: invokevirtual 317	org/eclipse/osgi/internal/baseadaptor/ArrayMap:size	()I
    //   73: istore 9
    //   75: iconst_0
    //   76: istore 10
    //   78: goto +91 -> 169
    //   81: aload 8
    //   83: iload 10
    //   85: invokevirtual 320	org/eclipse/osgi/internal/baseadaptor/ArrayMap:getValue	(I)Ljava/lang/Object;
    //   88: checkcast 120	[Ljava/lang/Object;
    //   91: astore 11
    //   93: aload 11
    //   95: iconst_0
    //   96: aaload
    //   97: checkcast 133	org/eclipse/equinox/log/LogFilter
    //   100: astore 12
    //   102: aload 12
    //   104: aload_1
    //   105: aload_2
    //   106: iload 4
    //   108: invokestatic 305	org/eclipse/equinox/log/internal/ExtendedLogReaderServiceFactory:safeIsLoggable	(Lorg/eclipse/equinox/log/LogFilter;Lorg/osgi/framework/Bundle;Ljava/lang/String;I)Z
    //   111: ifeq +55 -> 166
    //   114: aload 8
    //   116: iload 10
    //   118: invokevirtual 319	org/eclipse/osgi/internal/baseadaptor/ArrayMap:getKey	(I)Ljava/lang/Object;
    //   121: checkcast 147	org/osgi/service/log/LogListener
    //   124: astore 13
    //   126: aload 11
    //   128: iconst_1
    //   129: aaload
    //   130: checkcast 143	org/eclipse/equinox/log/internal/SerializedTaskQueue
    //   133: astore 14
    //   135: aload 14
    //   137: ifnull +22 -> 159
    //   140: aload 14
    //   142: new 141	org/eclipse/equinox/log/internal/ExtendedLogReaderServiceFactory$LogTask
    //   145: dup
    //   146: aload 7
    //   148: aload 13
    //   150: invokespecial 312	org/eclipse/equinox/log/internal/ExtendedLogReaderServiceFactory$LogTask:<init>	(Lorg/osgi/service/log/LogEntry;Lorg/osgi/service/log/LogListener;)V
    //   153: invokevirtual 315	org/eclipse/equinox/log/internal/SerializedTaskQueue:put	(Ljava/lang/Runnable;)V
    //   156: goto +10 -> 166
    //   159: aload 13
    //   161: aload 7
    //   163: invokestatic 304	org/eclipse/equinox/log/internal/ExtendedLogReaderServiceFactory:safeLogged	(Lorg/osgi/service/log/LogListener;Lorg/osgi/service/log/LogEntry;)V
    //   166: iinc 10 1
    //   169: iload 10
    //   171: iload 9
    //   173: if_icmplt -92 -> 81
    //   176: goto +12 -> 188
    //   179: astore 15
    //   181: aload_0
    //   182: invokespecial 299	org/eclipse/equinox/log/internal/ExtendedLogReaderServiceFactory:decrementNestedCount	()V
    //   185: aload 15
    //   187: athrow
    //   188: aload_0
    //   189: invokespecial 299	org/eclipse/equinox/log/internal/ExtendedLogReaderServiceFactory:decrementNestedCount	()V
    //   192: return
    // Line number table:
    //   Java source line #183	-> byte code offset #0
    //   Java source line #185	-> byte code offset #18
    //   Java source line #187	-> byte code offset #26
    //   Java source line #188	-> byte code offset #32
    //   Java source line #189	-> byte code offset #37
    //   Java source line #190	-> byte code offset #44
    //   Java source line #189	-> byte code offset #47
    //   Java source line #192	-> byte code offset #54
    //   Java source line #210	-> byte code offset #63
    //   Java source line #193	-> byte code offset #67
    //   Java source line #194	-> byte code offset #68
    //   Java source line #195	-> byte code offset #75
    //   Java source line #196	-> byte code offset #81
    //   Java source line #197	-> byte code offset #93
    //   Java source line #198	-> byte code offset #102
    //   Java source line #199	-> byte code offset #114
    //   Java source line #200	-> byte code offset #126
    //   Java source line #201	-> byte code offset #135
    //   Java source line #202	-> byte code offset #140
    //   Java source line #203	-> byte code offset #156
    //   Java source line #205	-> byte code offset #159
    //   Java source line #195	-> byte code offset #166
    //   Java source line #209	-> byte code offset #176
    //   Java source line #210	-> byte code offset #181
    //   Java source line #211	-> byte code offset #185
    //   Java source line #210	-> byte code offset #188
    //   Java source line #212	-> byte code offset #192
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	193	0	this	ExtendedLogReaderServiceFactory
    //   0	193	1	bundle	Bundle
    //   0	193	2	name	String
    //   0	193	3	context	Object
    //   0	193	4	level	int
    //   0	193	5	message	String
    //   0	193	6	exception	Throwable
    //   16	146	7	logEntry	LogEntry
    //   30	3	8	listenersCopy	ArrayMap<LogListener, Object[]>
    //   47	68	8	listenersCopy	ArrayMap<LogListener, Object[]>
    //   35	10	9	localObject1	Object
    //   73	101	9	size	int
    //   76	98	10	i	int
    //   91	36	11	listenerObjects	Object[]
    //   100	3	12	filter	LogFilter
    //   124	36	13	listener	LogListener
    //   133	8	14	taskQueue	SerializedTaskQueue
    //   179	7	15	localObject2	Object
    // Exception table:
    //   from	to	target	type
    //   26	35	35	finally
    //   54	63	179	finally
    //   68	179	179	finally
  }
  
  /* Error */
  void addLogListener(LogListener listener, LogFilter filter)
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 277	org/eclipse/equinox/log/internal/ExtendedLogReaderServiceFactory:listenersLock	Lorg/eclipse/equinox/log/internal/BasicReadWriteLock;
    //   4: invokevirtual 295	org/eclipse/equinox/log/internal/BasicReadWriteLock:writeLock	()V
    //   7: new 144	org/eclipse/osgi/internal/baseadaptor/ArrayMap
    //   10: dup
    //   11: aload_0
    //   12: getfield 278	org/eclipse/equinox/log/internal/ExtendedLogReaderServiceFactory:listeners	Lorg/eclipse/osgi/internal/baseadaptor/ArrayMap;
    //   15: invokevirtual 322	org/eclipse/osgi/internal/baseadaptor/ArrayMap:getKeys	()Ljava/util/List;
    //   18: aload_0
    //   19: getfield 278	org/eclipse/equinox/log/internal/ExtendedLogReaderServiceFactory:listeners	Lorg/eclipse/osgi/internal/baseadaptor/ArrayMap;
    //   22: invokevirtual 323	org/eclipse/osgi/internal/baseadaptor/ArrayMap:getValues	()Ljava/util/List;
    //   25: invokespecial 326	org/eclipse/osgi/internal/baseadaptor/ArrayMap:<init>	(Ljava/util/List;Ljava/util/List;)V
    //   28: astore_3
    //   29: aload_3
    //   30: aload_1
    //   31: invokevirtual 324	org/eclipse/osgi/internal/baseadaptor/ArrayMap:get	(Ljava/lang/Object;)Ljava/lang/Object;
    //   34: checkcast 120	[Ljava/lang/Object;
    //   37: astore 4
    //   39: aload 4
    //   41: ifnonnull +45 -> 86
    //   44: aload_1
    //   45: instanceof 134
    //   48: ifeq +7 -> 55
    //   51: aconst_null
    //   52: goto +14 -> 66
    //   55: new 143	org/eclipse/equinox/log/internal/SerializedTaskQueue
    //   58: dup
    //   59: aload_1
    //   60: invokevirtual 283	java/lang/Object:toString	()Ljava/lang/String;
    //   63: invokespecial 316	org/eclipse/equinox/log/internal/SerializedTaskQueue:<init>	(Ljava/lang/String;)V
    //   66: astore 5
    //   68: iconst_2
    //   69: anewarray 125	java/lang/Object
    //   72: dup
    //   73: iconst_0
    //   74: aload_2
    //   75: aastore
    //   76: dup
    //   77: iconst_1
    //   78: aload 5
    //   80: aastore
    //   81: astore 4
    //   83: goto +16 -> 99
    //   86: aload_2
    //   87: aload 4
    //   89: iconst_0
    //   90: aaload
    //   91: if_acmpeq +8 -> 99
    //   94: aload 4
    //   96: iconst_0
    //   97: aload_2
    //   98: aastore
    //   99: aload_3
    //   100: aload_1
    //   101: aload 4
    //   103: invokevirtual 325	org/eclipse/osgi/internal/baseadaptor/ArrayMap:put	(Ljava/lang/Object;Ljava/lang/Object;)V
    //   106: aload_0
    //   107: aload_3
    //   108: invokespecial 302	org/eclipse/equinox/log/internal/ExtendedLogReaderServiceFactory:recalculateFilters	(Lorg/eclipse/osgi/internal/baseadaptor/ArrayMap;)V
    //   111: aload_0
    //   112: aload_3
    //   113: putfield 278	org/eclipse/equinox/log/internal/ExtendedLogReaderServiceFactory:listeners	Lorg/eclipse/osgi/internal/baseadaptor/ArrayMap;
    //   116: goto +15 -> 131
    //   119: astore 6
    //   121: aload_0
    //   122: getfield 277	org/eclipse/equinox/log/internal/ExtendedLogReaderServiceFactory:listenersLock	Lorg/eclipse/equinox/log/internal/BasicReadWriteLock;
    //   125: invokevirtual 296	org/eclipse/equinox/log/internal/BasicReadWriteLock:writeUnlock	()V
    //   128: aload 6
    //   130: athrow
    //   131: aload_0
    //   132: getfield 277	org/eclipse/equinox/log/internal/ExtendedLogReaderServiceFactory:listenersLock	Lorg/eclipse/equinox/log/internal/BasicReadWriteLock;
    //   135: invokevirtual 296	org/eclipse/equinox/log/internal/BasicReadWriteLock:writeUnlock	()V
    //   138: return
    // Line number table:
    //   Java source line #215	-> byte code offset #0
    //   Java source line #217	-> byte code offset #7
    //   Java source line #218	-> byte code offset #29
    //   Java source line #219	-> byte code offset #39
    //   Java source line #221	-> byte code offset #44
    //   Java source line #222	-> byte code offset #68
    //   Java source line #223	-> byte code offset #83
    //   Java source line #225	-> byte code offset #94
    //   Java source line #227	-> byte code offset #99
    //   Java source line #228	-> byte code offset #106
    //   Java source line #229	-> byte code offset #111
    //   Java source line #230	-> byte code offset #116
    //   Java source line #231	-> byte code offset #121
    //   Java source line #232	-> byte code offset #128
    //   Java source line #231	-> byte code offset #131
    //   Java source line #233	-> byte code offset #138
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	139	0	this	ExtendedLogReaderServiceFactory
    //   0	139	1	listener	LogListener
    //   0	139	2	filter	LogFilter
    //   28	85	3	listenersCopy	ArrayMap<LogListener, Object[]>
    //   37	65	4	listenerObjects	Object[]
    //   66	13	5	taskQueue	SerializedTaskQueue
    //   119	10	6	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   7	119	119	finally
  }
  
  private void recalculateFilters(ArrayMap<LogListener, Object[]> listenersCopy)
  {
    List<LogFilter> filtersList = new ArrayList();
    int size = listenersCopy.size();
    for (int i = 0; i < size; i++)
    {
      Object[] listenerObjects = (Object[])listenersCopy.getValue(i);
      LogFilter filter = (LogFilter)listenerObjects[0];
      if (filter == NULL_LOGGER_FILTER)
      {
        filters = ALWAYS_LOG;
        return;
      }
      filtersList.add(filter);
    }
    if (filtersList.isEmpty()) {
      filters = null;
    }
    filters = ((LogFilter[])filtersList.toArray(new LogFilter[filtersList.size()]));
  }
  
  /* Error */
  void removeLogListener(LogListener listener)
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 277	org/eclipse/equinox/log/internal/ExtendedLogReaderServiceFactory:listenersLock	Lorg/eclipse/equinox/log/internal/BasicReadWriteLock;
    //   4: invokevirtual 295	org/eclipse/equinox/log/internal/BasicReadWriteLock:writeLock	()V
    //   7: new 144	org/eclipse/osgi/internal/baseadaptor/ArrayMap
    //   10: dup
    //   11: aload_0
    //   12: getfield 278	org/eclipse/equinox/log/internal/ExtendedLogReaderServiceFactory:listeners	Lorg/eclipse/osgi/internal/baseadaptor/ArrayMap;
    //   15: invokevirtual 322	org/eclipse/osgi/internal/baseadaptor/ArrayMap:getKeys	()Ljava/util/List;
    //   18: aload_0
    //   19: getfield 278	org/eclipse/equinox/log/internal/ExtendedLogReaderServiceFactory:listeners	Lorg/eclipse/osgi/internal/baseadaptor/ArrayMap;
    //   22: invokevirtual 323	org/eclipse/osgi/internal/baseadaptor/ArrayMap:getValues	()Ljava/util/List;
    //   25: invokespecial 326	org/eclipse/osgi/internal/baseadaptor/ArrayMap:<init>	(Ljava/util/List;Ljava/util/List;)V
    //   28: astore_2
    //   29: aload_2
    //   30: aload_1
    //   31: invokevirtual 321	org/eclipse/osgi/internal/baseadaptor/ArrayMap:remove	(Ljava/lang/Object;)Z
    //   34: pop
    //   35: aload_0
    //   36: aload_2
    //   37: invokespecial 302	org/eclipse/equinox/log/internal/ExtendedLogReaderServiceFactory:recalculateFilters	(Lorg/eclipse/osgi/internal/baseadaptor/ArrayMap;)V
    //   40: aload_0
    //   41: aload_2
    //   42: putfield 278	org/eclipse/equinox/log/internal/ExtendedLogReaderServiceFactory:listeners	Lorg/eclipse/osgi/internal/baseadaptor/ArrayMap;
    //   45: goto +13 -> 58
    //   48: astore_3
    //   49: aload_0
    //   50: getfield 277	org/eclipse/equinox/log/internal/ExtendedLogReaderServiceFactory:listenersLock	Lorg/eclipse/equinox/log/internal/BasicReadWriteLock;
    //   53: invokevirtual 296	org/eclipse/equinox/log/internal/BasicReadWriteLock:writeUnlock	()V
    //   56: aload_3
    //   57: athrow
    //   58: aload_0
    //   59: getfield 277	org/eclipse/equinox/log/internal/ExtendedLogReaderServiceFactory:listenersLock	Lorg/eclipse/equinox/log/internal/BasicReadWriteLock;
    //   62: invokevirtual 296	org/eclipse/equinox/log/internal/BasicReadWriteLock:writeUnlock	()V
    //   65: return
    // Line number table:
    //   Java source line #255	-> byte code offset #0
    //   Java source line #257	-> byte code offset #7
    //   Java source line #258	-> byte code offset #29
    //   Java source line #259	-> byte code offset #35
    //   Java source line #260	-> byte code offset #40
    //   Java source line #261	-> byte code offset #45
    //   Java source line #262	-> byte code offset #49
    //   Java source line #263	-> byte code offset #56
    //   Java source line #262	-> byte code offset #58
    //   Java source line #264	-> byte code offset #65
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	66	0	this	ExtendedLogReaderServiceFactory
    //   0	66	1	listener	LogListener
    //   28	14	2	listenersCopy	ArrayMap<LogListener, Object[]>
    //   48	9	3	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   7	48	48	finally
  }
  
  Enumeration<?> getLog()
  {
    return EMPTY_ENUMERATION;
  }
}

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

import java.util.Enumeration;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.eclipse.equinox.log.ExtendedLogReaderService;
import org.eclipse.equinox.log.LogFilter;
import org.osgi.service.log.LogListener;

public class ExtendedLogReaderServiceImpl
  implements ExtendedLogReaderService
{
  private final ExtendedLogReaderServiceFactory factory;
  private Set<LogListener> listeners = new HashSet();
  
  ExtendedLogReaderServiceImpl(ExtendedLogReaderServiceFactory factory)
  {
    this.factory = factory;
  }
  
  public synchronized void addLogListener(LogListener listener, LogFilter filter)
  {
    checkShutdown();
    if (listener == null) {
      throw new IllegalArgumentException("LogListener must not be null");
    }
    if (filter == null) {
      throw new IllegalArgumentException("LogFilter must not be null");
    }
    listeners.add(listener);
    factory.addLogListener(listener, filter);
  }
  
  public void addLogListener(LogListener listener)
  {
    addLogListener(listener, ExtendedLogReaderServiceFactory.NULL_LOGGER_FILTER);
  }
  
  public Enumeration getLog()
  {
    checkShutdown();
    return factory.getLog();
  }
  
  public synchronized void removeLogListener(LogListener listener)
  {
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 85 86 87

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