org.eclipse.equinox.p2.core_2.2.0.v20120430-0525

16:44:04.811 INFO  jd.cli.Main - Decompiling org.eclipse.equinox.p2.core_2.2.0.v20120430-0525.jar
package org.eclipse.equinox.internal.p2.core;

import java.io.File;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Dictionary;
import java.util.Hashtable;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.URIUtil;
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
import org.eclipse.equinox.p2.core.IAgentLocation;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.core.IProvisioningAgentProvider;
import org.eclipse.osgi.framework.log.FrameworkLog;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
import org.osgi.util.tracker.ServiceTracker;

public class Activator
  implements BundleActivator
{
  public static IAgentLocation agentDataLocation = null;
  public static BundleContext context;
  private static final String DEFAULT_AGENT_LOCATION = "../p2";
  public static final String ID = "org.eclipse.equinox.p2.core";
  private static Activator instance;
  private static final String NO_DEFAULT = "@noDefault";
  private static final String NONE = "@none";
  private static final String PROP_AGENT_DATA_AREA = "eclipse.p2.data.area";
  private static final String PROP_CONFIG_DIR = "osgi.configuration.area";
  private static final String PROP_USER_DIR = "user.dir";
  private static final String PROP_USER_HOME = "user.home";
  public static final String READ_ONLY_AREA_SUFFIX = ".readOnly";
  private static final String VAR_CONFIG_DIR = "@config.dir";
  private static final String VAR_USER_DIR = "@user.dir";
  private static final String VAR_USER_HOME = "@user.home";
  private IProvisioningAgent agent;
  private ServiceRegistration<IAgentLocation> agentLocationRegistration = null;
  ServiceTracker<FrameworkLog, FrameworkLog> logTracker;
  
  private static URI adjustTrailingSlash(URI url, boolean trailingSlash)
    throws URISyntaxException
  {
    String file = url.toString();
    if (trailingSlash == file.endsWith("/")) {
      return url;
    }
    file = trailingSlash ? file + "/" : file.substring(0, file.length() - 1);
    return new URI(file);
  }
  
  private static URI buildURL(String spec, boolean trailingSlash)
  {
    if (spec == null) {
      return null;
    }
    boolean isFile = spec.startsWith("file:");
    try
    {
      if (isFile) {
        return adjustTrailingSlash(new File(spec.substring(5)).toURI(), trailingSlash);
      }
      new URL(spec);
      return new URI(spec);
    }
    catch (Exception localException)
    {
      if (isFile) {
        return null;
      }
      try
      {
        return adjustTrailingSlash(new File(spec).toURI(), trailingSlash);
      }
      catch (URISyntaxException localURISyntaxException) {}
    }
    return null;
  }
  
  public static BundleContext getContext()
  {
    return context;
  }
  
  public static FrameworkLog getFrameworkLog()
  {
    Activator a = instance;
    if (a == null) {
      return null;
    }
    ServiceTracker<FrameworkLog, FrameworkLog> tracker = a.getLogTracker();
    if (tracker == null) {
      return null;
    }
    return (FrameworkLog)tracker.getService();
  }
  
  private static String substituteVar(String source, String var, String prop)
  {
    String value = context.getProperty(prop);
    if (value == null) {
      value = "";
    }
    return value + source.substring(var.length());
  }
  
  private IAgentLocation buildLocation(String property, URI defaultLocation, boolean readOnlyDefault, boolean addTrailingSlash)
  {
    String location = context.getProperty(property);
    if (location == null) {
      return new AgentLocation(defaultLocation);
    }
    if (location.equalsIgnoreCase("@none")) {
      return null;
    }
    if (location.equalsIgnoreCase("@noDefault")) {
      return new AgentLocation(null);
    }
    if (location.startsWith("@user.home"))
    {
      String base = substituteVar(location, "@user.home", "user.home");
      location = new Path(base).toFile().getAbsolutePath();
    }
    else if (location.startsWith("@user.dir"))
    {
      String base = substituteVar(location, "@user.dir", "user.dir");
      location = new Path(base).toFile().getAbsolutePath();
    }
    else if (location.startsWith("@config.dir"))
    {
      location = substituteVar(location, "@config.dir", "osgi.configuration.area");
    }
    URI url = buildURL(location, addTrailingSlash);
    AgentLocation result = null;
    if (url != null) {
      result = new AgentLocation(url);
    }
    return result;
  }
  
  private ServiceTracker<FrameworkLog, FrameworkLog> getLogTracker()
  {
    if (logTracker != null) {
      return logTracker;
    }
    if (context == null) {
      return null;
    }
    logTracker = new ServiceTracker(context, FrameworkLog.class, null);
    logTracker.open();
    return logTracker;
  }
  
  private void registerAgent()
  {
    if (agentDataLocation == null) {
      return;
    }
    ServiceReference<IProvisioningAgentProvider> agentProviderRef = context.getServiceReference(IProvisioningAgentProvider.class);
    IProvisioningAgentProvider provider = null;
    if (agentProviderRef != null) {
      provider = (IProvisioningAgentProvider)context.getService(agentProviderRef);
    }
    if (provider == null)
    {
      provider = new DefaultAgentProvider();
      ((DefaultAgentProvider)provider).activate(context);
    }
    try
    {
      agent = provider.createAgent(null);
    }
    catch (Exception e)
    {
      String msg = "Unable to instantiate p2 agent at location " + agentDataLocation.getRootLocation();
      LogHelper.log(new Status(4, "org.eclipse.equinox.p2.core", msg, e));
    }
  }
  
  public void start(BundleContext aContext)
    throws Exception
  {
    instance = this;
    context = aContext;
    URI defaultLocation = URIUtil.fromString(aContext.getProperty("osgi.configuration.area") + "../p2" + '/');
    agentDataLocation = buildLocation("eclipse.p2.data.area", defaultLocation, false, true);
    Dictionary<String, Object> locationProperties = new Hashtable();
    if (agentDataLocation != null)
    {
      locationProperties.put("type", "eclipse.p2.data.area");
      agentLocationRegistration = aContext.registerService(IAgentLocation.class, agentDataLocation, locationProperties);
    }
    registerAgent();
  }
  
  public void stop(BundleContext aContext)
    throws Exception
  {
    unregisterAgent();
    instance = null;
    agentDataLocation = null;
    if (agentLocationRegistration != null) {
      agentLocationRegistration.unregister();
    }
    if (logTracker != null)
    {
      logTracker.close();
      logTracker = null;
    }
    context = null;
  }
  
  private void unregisterAgent()
  {
    if (agent != null)
    {
      agent.stop();
      agent = null;
    }
  }
}

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

import java.net.URI;
import org.eclipse.core.runtime.URIUtil;
import org.eclipse.equinox.p2.core.IAgentLocation;

public class AgentLocation
  implements IAgentLocation
{
  private URI location = null;
  
  public AgentLocation(URI location)
  {
    this.location = location;
  }
  
  public synchronized URI getRootLocation()
  {
    return location;
  }
  
  public URI getDataArea(String touchpointId)
  {
    return URIUtil.append(getRootLocation(), touchpointId + '/');
  }
}

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

import java.net.URI;
import java.util.Dictionary;
import java.util.Hashtable;
import org.eclipse.equinox.p2.core.IAgentLocation;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.core.IProvisioningAgentProvider;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;

public class DefaultAgentProvider
  implements IProvisioningAgentProvider
{
  private BundleContext context;
  
  public void activate(BundleContext aContext)
  {
    context = aContext;
  }
  
  public IProvisioningAgent createAgent(URI location)
  {
    ProvisioningAgent result = new ProvisioningAgent();
    result.setBundleContext(context);
    result.setLocation(location);
    IAgentLocation agentLocation = (IAgentLocation)result.getService(IAgentLocation.SERVICE_NAME);
    Dictionary<String, Object> properties = new Hashtable(5);
    if (agentLocation != null) {
      properties.put("locationURI", String.valueOf(agentLocation.getRootLocation()));
    }
    if (location == null)
    {
      properties.put("service.ranking", new Integer(100));
      properties.put("agent.current", Boolean.TRUE.toString());
    }
    ServiceRegistration<IProvisioningAgent> reg = context.registerService(IProvisioningAgent.class, result, properties);
    result.setServiceRegistration(reg);
    return result;
  }
}

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

import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.core.spi.IAgentServiceFactory;

public class EventBusComponent
  implements IAgentServiceFactory
{
  public Object createService(IProvisioningAgent agent)
  {
    return new ProvisioningEventBus();
  }
}

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

import java.net.URI;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.eclipse.equinox.p2.core.IAgentLocation;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.core.spi.IAgentService;
import org.eclipse.equinox.p2.core.spi.IAgentServiceFactory;
import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
import org.osgi.util.tracker.ServiceTracker;
import org.osgi.util.tracker.ServiceTrackerCustomizer;

public class ProvisioningAgent
  implements IProvisioningAgent, ServiceTrackerCustomizer<IAgentServiceFactory, Object>
{
  private final Map<String, Object> agentServices = Collections.synchronizedMap(new HashMap());
  private BundleContext context;
  private volatile boolean stopped = false;
  private ServiceRegistration<IProvisioningAgent> reg;
  private final Map<ServiceReference<IAgentServiceFactory>, ServiceTracker<IAgentServiceFactory, Object>> trackers = Collections.synchronizedMap(new HashMap());
  
  public ProvisioningAgent()
  {
    registerService("org.eclipse.equinox.p2.installer.agent", this);
    registerService("org.eclipse.equinox.p2.installer.profile.id", "_SELF_");
  }
  
  public Object getService(String serviceName)
  {
    synchronized (agentServices)
    {
      checkRunning();
      Object service = agentServices.get(serviceName);
      if (service != null) {
        return service;
      }
      try
      {
        refs = context.getServiceReferences(IAgentServiceFactory.class, "(p2.agent.servicename=" + serviceName + ')');
      }
      catch (InvalidSyntaxException e)
      {
        Collection<ServiceReference<IAgentServiceFactory>> refs;
        e.printStackTrace();
        return null;
      }
      Collection<ServiceReference<IAgentServiceFactory>> refs;
      if ((refs == null) || (refs.isEmpty())) {
        return null;
      }
      ServiceReference<IAgentServiceFactory> firstRef = (ServiceReference)refs.iterator().next();
      
      ServiceTracker<IAgentServiceFactory, Object> tracker = new ServiceTracker(context, firstRef, this);
      tracker.open();
      IAgentServiceFactory factory = (IAgentServiceFactory)tracker.getService();
      if (factory == null)
      {
        tracker.close();
        return null;
      }
      service = factory.createService(this);
      if (service == null)
      {
        tracker.close();
        return null;
      }
      registerService(serviceName, service);
      trackers.put(firstRef, tracker);
      return service;
    }
  }
  
  private void checkRunning()
  {
    if (stopped) {
      throw new IllegalStateException("Attempt to access stopped agent: " + this);
    }
  }
  
  public void registerService(String serviceName, Object service)
  {
    checkRunning();
    agentServices.put(serviceName, service);
    if ((service instanceof IAgentService)) {
      ((IAgentService)service).start();
    }
  }
  
  public void setBundleContext(BundleContext context)
  {
    this.context = context;
  }
  
  public void setLocation(URI location)
  {
    IAgentLocation agentLocation = null;
    if (location == null)
    {
      ServiceReference<IAgentLocation> ref = context.getServiceReference(IAgentLocation.class);
      if (ref != null)
      {
        agentLocation = (IAgentLocation)context.getService(ref);
        context.ungetService(ref);
      }
    }
    else
    {
      agentLocation = new AgentLocation(location);
    }
    registerService(IAgentLocation.SERVICE_NAME, agentLocation);
  }
  
  public void unregisterService(String serviceName, Object service)
  {
    synchronized (agentServices)
    {
      if (stopped) {
        return;
      }
      if (agentServices.get(serviceName) == service) {
        agentServices.remove(serviceName);
      }
    }
    if ((service instanceof IAgentService)) {
      ((IAgentService)service).stop();
    }
  }
  
  public void stop()
  {
    List<Object> toStop;
    synchronized (agentServices)
    {
      toStop = new ArrayList(agentServices.values());
    }
    List<Object> toStop;
    for (Iterator localIterator1 = toStop.iterator(); localIterator1.hasNext();)
    {
      Object service = localIterator1.next();
      if (((service instanceof IAgentService)) && 
        (service != this)) {
        ((IAgentService)service).stop();
      }
    }
    stopped = true;
    synchronized (trackers)
    {
      for (Iterator localIterator2 = trackers.values().iterator(); localIterator2.hasNext();)
      {
        Object t = (ServiceTracker)localIterator2.next();
        ((ServiceTracker)t).close();
      }
      trackers.clear();
    }
    if (reg != null)
    {
      reg.unregister();
      reg = null;
    }
  }
  
  public void setServiceRegistration(ServiceRegistration<IProvisioningAgent> reg)
  {
    this.reg = reg;
  }
  
  public Object addingService(ServiceReference<IAgentServiceFactory> reference)
  {
    if (stopped) {
      return null;
    }
    return context.getService(reference);
  }
  
  public void modifiedService(ServiceReference<IAgentServiceFactory> reference, Object service) {}
  
  public void removedService(ServiceReference<IAgentServiceFactory> reference, Object factoryService)
  {
    if (stopped) {
      return;
    }
    String serviceName = (String)reference.getProperty("p2.agent.servicename");
    if (serviceName == null) {
      return;
    }
    Object registered = agentServices.get(serviceName);
    if (registered == null) {
      return;
    }
    if (FrameworkUtil.getBundle(registered.getClass()) == FrameworkUtil.getBundle(factoryService.getClass()))
    {
      unregisterService(serviceName, registered);
      ServiceTracker<IAgentServiceFactory, Object> toRemove = (ServiceTracker)trackers.remove(reference);
      if (toRemove != null) {
        toRemove.close();
      }
    }
  }
}

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

import java.util.EventObject;
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus;
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.ProvisioningListener;
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.SynchronousProvisioningListener;
import org.eclipse.equinox.p2.core.spi.IAgentService;
import org.eclipse.osgi.framework.eventmgr.CopyOnWriteIdentityMap;
import org.eclipse.osgi.framework.eventmgr.EventDispatcher;
import org.eclipse.osgi.framework.eventmgr.EventManager;
import org.eclipse.osgi.framework.eventmgr.ListenerQueue;

public class ProvisioningEventBus
  implements EventDispatcher<ProvisioningListener, ProvisioningListener, EventObject>, IProvisioningEventBus, IAgentService
{
  private final CopyOnWriteIdentityMap<ProvisioningListener, ProvisioningListener> syncListeners = new CopyOnWriteIdentityMap();
  private final CopyOnWriteIdentityMap<ProvisioningListener, ProvisioningListener> asyncListeners = new CopyOnWriteIdentityMap();
  private EventManager eventManager = new EventManager("Provisioning Event Dispatcher");
  private Object dispatchEventLock = new Object();
  private boolean closed = false;
  private int dispatchingEvents = 0;
  
  public void addListener(ProvisioningListener toAdd)
  {
    if ((toAdd instanceof SynchronousProvisioningListener)) {
      synchronized (syncListeners)
      {
        syncListeners.put(toAdd, toAdd);
      }
    }
    synchronized (asyncListeners)
    {
      asyncListeners.put(toAdd, toAdd);
    }
  }
  
  public void removeListener(ProvisioningListener toRemove)
  {
    if ((toRemove instanceof SynchronousProvisioningListener)) {
      synchronized (syncListeners)
      {
        syncListeners.remove(toRemove);
      }
    }
    synchronized (asyncListeners)
    {
      asyncListeners.remove(toRemove);
    }
  }
  
  public void publishEvent(EventObject event)
  {
    synchronized (dispatchEventLock)
    {
      if (closed) {
        return;
      }
    }
    ListenerQueue<ProvisioningListener, ProvisioningListener, EventObject> listeners = new ListenerQueue(eventManager);
    synchronized (syncListeners)
    {
      listeners.queueListeners(syncListeners.entrySet(), this);
      
      listeners.dispatchEventSynchronous(0, event);
    }
    listeners = new ListenerQueue(eventManager);
    synchronized (asyncListeners)
    {
      listeners.queueListeners(asyncListeners.entrySet(), this);
      synchronized (dispatchEventLock)
      {
        if (!closed) {
          listeners.dispatchEventAsynchronous(0, event);
        }
      }
    }
  }
  
  /* Error */
  public void dispatchEvent(ProvisioningListener eventListener, ProvisioningListener listenerObject, int eventAction, EventObject eventObject)
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 138	org/eclipse/equinox/internal/p2/core/ProvisioningEventBus:dispatchEventLock	Ljava/lang/Object;
    //   4: dup
    //   5: astore 5
    //   7: monitorenter
    //   8: aload_0
    //   9: getfield 137	org/eclipse/equinox/internal/p2/core/ProvisioningEventBus:closed	Z
    //   12: ifeq +7 -> 19
    //   15: aload 5
    //   17: monitorexit
    //   18: return
    //   19: aload_0
    //   20: dup
    //   21: getfield 136	org/eclipse/equinox/internal/p2/core/ProvisioningEventBus:dispatchingEvents	I
    //   24: iconst_1
    //   25: iadd
    //   26: putfield 136	org/eclipse/equinox/internal/p2/core/ProvisioningEventBus:dispatchingEvents	I
    //   29: aload 5
    //   31: monitorexit
    //   32: goto +7 -> 39
    //   35: aload 5
    //   37: monitorexit
    //   38: athrow
    //   39: aload_1
    //   40: aload 4
    //   42: invokeinterface 161 2 0
    //   47: goto +111 -> 158
    //   50: astore 5
    //   52: new 76	org/eclipse/core/runtime/Status
    //   55: dup
    //   56: iconst_4
    //   57: ldc 3
    //   59: ldc 1
    //   61: aload 5
    //   63: invokespecial 147	org/eclipse/core/runtime/Status:<init>	(ILjava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V
    //   66: invokestatic 150	org/eclipse/equinox/internal/p2/core/helpers/LogHelper:log	(Lorg/eclipse/core/runtime/IStatus;)V
    //   69: aload_0
    //   70: getfield 138	org/eclipse/equinox/internal/p2/core/ProvisioningEventBus:dispatchEventLock	Ljava/lang/Object;
    //   73: dup
    //   74: astore 7
    //   76: monitorenter
    //   77: aload_0
    //   78: dup
    //   79: getfield 136	org/eclipse/equinox/internal/p2/core/ProvisioningEventBus:dispatchingEvents	I
    //   82: iconst_1
    //   83: isub
    //   84: putfield 136	org/eclipse/equinox/internal/p2/core/ProvisioningEventBus:dispatchingEvents	I
    //   87: aload_0
    //   88: getfield 136	org/eclipse/equinox/internal/p2/core/ProvisioningEventBus:dispatchingEvents	I
    //   91: ifne +10 -> 101
    //   94: aload_0
    //   95: getfield 138	org/eclipse/equinox/internal/p2/core/ProvisioningEventBus:dispatchEventLock	Ljava/lang/Object;
    //   98: invokevirtual 143	java/lang/Object:notifyAll	()V
    //   101: aload 7
    //   103: monitorexit
    //   104: goto +96 -> 200
    //   107: aload 7
    //   109: monitorexit
    //   110: athrow
    //   111: astore 6
    //   113: aload_0
    //   114: getfield 138	org/eclipse/equinox/internal/p2/core/ProvisioningEventBus:dispatchEventLock	Ljava/lang/Object;
    //   117: dup
    //   118: astore 7
    //   120: monitorenter
    //   121: aload_0
    //   122: dup
    //   123: getfield 136	org/eclipse/equinox/internal/p2/core/ProvisioningEventBus:dispatchingEvents	I
    //   126: iconst_1
    //   127: isub
    //   128: putfield 136	org/eclipse/equinox/internal/p2/core/ProvisioningEventBus:dispatchingEvents	I
    //   131: aload_0
    //   132: getfield 136	org/eclipse/equinox/internal/p2/core/ProvisioningEventBus:dispatchingEvents	I
    //   135: ifne +10 -> 145
    //   138: aload_0
    //   139: getfield 138	org/eclipse/equinox/internal/p2/core/ProvisioningEventBus:dispatchEventLock	Ljava/lang/Object;
    //   142: invokevirtual 143	java/lang/Object:notifyAll	()V
    //   145: aload 7
    //   147: monitorexit
    //   148: goto +7 -> 155
    //   151: aload 7
    //   153: monitorexit
    //   154: athrow
    //   155: aload 6
    //   157: athrow
    //   158: aload_0
    //   159: getfield 138	org/eclipse/equinox/internal/p2/core/ProvisioningEventBus:dispatchEventLock	Ljava/lang/Object;
    //   162: dup
    //   163: astore 7
    //   165: monitorenter
    //   166: aload_0
    //   167: dup
    //   168: getfield 136	org/eclipse/equinox/internal/p2/core/ProvisioningEventBus:dispatchingEvents	I
    //   171: iconst_1
    //   172: isub
    //   173: putfield 136	org/eclipse/equinox/internal/p2/core/ProvisioningEventBus:dispatchingEvents	I
    //   176: aload_0
    //   177: getfield 136	org/eclipse/equinox/internal/p2/core/ProvisioningEventBus:dispatchingEvents	I
    //   180: ifne +10 -> 190
    //   183: aload_0
    //   184: getfield 138	org/eclipse/equinox/internal/p2/core/ProvisioningEventBus:dispatchEventLock	Ljava/lang/Object;
    //   187: invokevirtual 143	java/lang/Object:notifyAll	()V
    //   190: aload 7
    //   192: monitorexit
    //   193: goto +7 -> 200
    //   196: aload 7
    //   198: monitorexit
    //   199: athrow
    //   200: return
    // Line number table:
    //   Java source line #102	-> byte code offset #0
    //   Java source line #103	-> byte code offset #8
    //   Java source line #104	-> byte code offset #15
    //   Java source line #105	-> byte code offset #19
    //   Java source line #102	-> byte code offset #29
    //   Java source line #108	-> byte code offset #39
    //   Java source line #109	-> byte code offset #50
    //   Java source line #110	-> byte code offset #52
    //   Java source line #112	-> byte code offset #69
    //   Java source line #113	-> byte code offset #77
    //   Java source line #114	-> byte code offset #87
    //   Java source line #115	-> byte code offset #94
    //   Java source line #112	-> byte code offset #101
    //   Java source line #111	-> byte code offset #111
    //   Java source line #112	-> byte code offset #113
    //   Java source line #113	-> byte code offset #121
    //   Java source line #114	-> byte code offset #131
    //   Java source line #115	-> byte code offset #138
    //   Java source line #112	-> byte code offset #145
    //   Java source line #117	-> byte code offset #155
    //   Java source line #112	-> byte code offset #158
    //   Java source line #113	-> byte code offset #166
    //   Java source line #114	-> byte code offset #176
    //   Java source line #115	-> byte code offset #183
    //   Java source line #112	-> byte code offset #190
    //   Java source line #118	-> byte code offset #200
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	201	0	this	ProvisioningEventBus
    //   0	201	1	eventListener	ProvisioningListener
    //   0	201	2	listenerObject	ProvisioningListener
    //   0	201	3	eventAction	int
    //   0	201	4	eventObject	EventObject
    //   5	31	5	Ljava/lang/Object;	Object
    //   50	12	5	e	Exception
    //   111	45	6	localObject1	Object
    //   74	34	7	Ljava/lang/Object;	Object
    //   118	34	7	Ljava/lang/Object;	Object
    //   163	34	7	Ljava/lang/Object;	Object
    // Exception table:
    //   from	to	target	type
    //   8	18	35	finally
    //   19	32	35	finally
    //   35	38	35	finally
    //   39	47	50	java/lang/Exception
    //   77	104	107	finally
    //   107	110	107	finally
    //   39	69	111	finally
    //   121	148	151	finally
    //   151	154	151	finally
    //   166	193	196	finally
    //   196	199	196	finally
  }
  
  public void close()
  {
    boolean interrupted = false;
    synchronized (dispatchEventLock)
    {
      eventManager.close();
      closed = true;
      while (dispatchingEvents != 0) {
        try
        {
          dispatchEventLock.wait(30000L);
        }
        catch (InterruptedException localInterruptedException)
        {
          interrupted = true;
        }
      }
    }
    if (interrupted) {
      Thread.currentThread().interrupt();
    }
  }
  
  public void start() {}
  
  public void stop()
  {
    close();
  }
}

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

import java.util.ListIterator;
import java.util.NoSuchElementException;

class CollectionUtils$UnmodifiableArrayList$1
  implements ListIterator<E>
{
  private int index = 0;
  final CollectionUtils.UnmodifiableArrayList this$1;
  
  CollectionUtils$UnmodifiableArrayList$1(CollectionUtils.UnmodifiableArrayList paramUnmodifiableArrayList) {}
  
  public boolean hasNext()
  {
    return index < this$1.array.length;
  }
  
  public E next()
  {
    if (index >= this$1.array.length) {
      throw new NoSuchElementException();
    }
    return (E)this$1.array[(index++)];
  }
  
  public boolean hasPrevious()
  {
    return index > 0;
  }
  
  public E previous()
  {
    if (--index < 0)
    {
      index += 1;
      throw new NoSuchElementException();
    }
    return (E)this$1.array[index];
  }
  
  public int nextIndex()
  {
    return index;
  }
  
  public int previousIndex()
  {
    return index - 1;
  }
  
  public void remove()
  {
    throw new UnsupportedOperationException();
  }
  
  public void set(E e)
  {
    throw new UnsupportedOperationException();
  }
  
  public void add(E e)
  {
    throw new UnsupportedOperationException();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils.UnmodifiableArrayList.1
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.p2.core.helpers;

import java.io.Serializable;
import java.lang.reflect.Array;
import java.util.AbstractList;
import java.util.Iterator;
import java.util.ListIterator;
import java.util.NoSuchElementException;
import java.util.RandomAccess;

class CollectionUtils$UnmodifiableArrayList<E>
  extends AbstractList<E>
  implements RandomAccess, Serializable
{
  private static final long serialVersionUID = 7435304230643855579L;
  final E[] array;
  
  CollectionUtils$UnmodifiableArrayList(E[] array)
  {
    this.array = array;
  }
  
  public boolean contains(Object o)
  {
    return indexOf(o) != -1;
  }
  
  public E get(int index)
  {
    return (E)array[index];
  }
  
  public int indexOf(Object o)
  {
    int size = array.length;
    if (o == null) {
      for (int i = 0; i < size; i++) {
        if (array[i] == null) {
          return i;
        }
      }
    } else {
      for (int i = 0; i < size; i++) {
        if (o.equals(array[i])) {
          return i;
        }
      }
    }
    return -1;
  }
  
  public Iterator<E> iterator()
  {
    return listIterator();
  }
  
  public ListIterator<E> listIterator()
  {
    new ListIterator()
    {
      private int index = 0;
      
      public boolean hasNext()
      {
        return index < array.length;
      }
      
      public E next()
      {
        if (index >= array.length) {
          throw new NoSuchElementException();
        }
        return (E)array[(index++)];
      }
      
      public boolean hasPrevious()
      {
        return index > 0;
      }
      
      public E previous()
      {
        if (--index < 0)
        {
          index += 1;
          throw new NoSuchElementException();
        }
        return (E)array[index];
      }
      
      public int nextIndex()
      {
        return index;
      }
      
      public int previousIndex()
      {
        return index - 1;
      }
      
      public void remove()
      {
        throw new UnsupportedOperationException();
      }
      
      public void set(E e)
      {
        throw new UnsupportedOperationException();
      }
      
      public void add(E e)
      {
        throw new UnsupportedOperationException();
      }
    };
  }
  
  public int lastIndexOf(Object o)
  {
    int idx = array.length;
    if (o == null) {
      do
      {
        if (array[idx] == null) {
          return idx;
        }
        idx--;
      } while (idx >= 0);
    } else {
      do
      {
        if (o.equals(array[idx])) {
          return idx;
        }
        idx--;
      } while (idx >= 0);
    }
    return -1;
  }
  
  public E set(int index, E element)
  {
    throw new UnsupportedOperationException();
  }
  
  public int size()
  {
    return array.length;
  }
  
  public Object[] toArray()
  {
    return (Object[])array.clone();
  }
  
  public <T> T[] toArray(T[] a)
  {
    int size = array.length;
    if (a.length < size) {
      a = (Object[])Array.newInstance(a.getClass().getComponentType(), size);
    }
    System.arraycopy(array, 0, a, 0, size);
    while (size < a.length) {
      a[(size++)] = null;
    }
    return a;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils.UnmodifiableArrayList
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.p2.core.helpers;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Serializable;
import java.lang.reflect.Array;
import java.util.AbstractList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Properties;
import java.util.RandomAccess;
import java.util.Set;

public class CollectionUtils
{
  private static class UnmodifiableArrayList<E>
    extends AbstractList<E>
    implements RandomAccess, Serializable
  {
    private static final long serialVersionUID = 7435304230643855579L;
    final E[] array;
    
    UnmodifiableArrayList(E[] array)
    {
      this.array = array;
    }
    
    public boolean contains(Object o)
    {
      return indexOf(o) != -1;
    }
    
    public E get(int index)
    {
      return (E)array[index];
    }
    
    public int indexOf(Object o)
    {
      int size = array.length;
      if (o == null) {
        for (int i = 0; i < size; i++) {
          if (array[i] == null) {
            return i;
          }
        }
      } else {
        for (int i = 0; i < size; i++) {
          if (o.equals(array[i])) {
            return i;
          }
        }
      }
      return -1;
    }
    
    public Iterator<E> iterator()
    {
      return listIterator();
    }
    
    public ListIterator<E> listIterator()
    {
      new ListIterator()
      {
        private int index = 0;
        
        public boolean hasNext()
        {
          return index < array.length;
        }
        
        public E next()
        {
          if (index >= array.length) {
            throw new NoSuchElementException();
          }
          return (E)array[(index++)];
        }
        
        public boolean hasPrevious()
        {
          return index > 0;
        }
        
        public E previous()
        {
          if (--index < 0)
          {
            index += 1;
            throw new NoSuchElementException();
          }
          return (E)array[index];
        }
        
        public int nextIndex()
        {
          return index;
        }
        
        public int previousIndex()
        {
          return index - 1;
        }
        
        public void remove()
        {
          throw new UnsupportedOperationException();
        }
        
        public void set(E e)
        {
          throw new UnsupportedOperationException();
        }
        
        public void add(E e)
        {
          throw new UnsupportedOperationException();
        }
      };
    }
    
    public int lastIndexOf(Object o)
    {
      int idx = array.length;
      if (o == null) {
        do
        {
          if (array[idx] == null) {
            return idx;
          }
          idx--;
        } while (idx >= 0);
      } else {
        do
        {
          if (o.equals(array[idx])) {
            return idx;
          }
          idx--;
        } while (idx >= 0);
      }
      return -1;
    }
    
    public E set(int index, E element)
    {
      throw new UnsupportedOperationException();
    }
    
    public int size()
    {
      return array.length;
    }
    
    public Object[] toArray()
    {
      return (Object[])array.clone();
    }
    
    public <T> T[] toArray(T[] a)
    {
      int size = array.length;
      if (a.length < size) {
        a = (Object[])Array.newInstance(a.getClass().getComponentType(), size);
      }
      System.arraycopy(array, 0, a, 0, size);
      while (size < a.length) {
        a[(size++)] = null;
      }
      return a;
    }
  }
  
  public static int hashCode(Object[] objects)
  {
    if (objects == null) {
      return 0;
    }
    int result = 1;
    int idx = objects.length;
    do
    {
      Object object = objects[idx];
      result = 17 * result + (object == null ? 0 : object.hashCode());idx--;
    } while (idx >= 0);
    return result;
  }
  
  public static <T> List<T> emptyList()
  {
    return Collections.EMPTY_LIST;
  }
  
  public static <T> Set<T> emptySet()
  {
    return Collections.EMPTY_SET;
  }
  
  public static <K, V> Map<K, V> emptyMap()
  {
    return Collections.EMPTY_MAP;
  }
  
  public static <T> List<T> unmodifiableList(T[] array)
  {
    return (array == null) || (array.length == 0) ? emptyList() : new UnmodifiableArrayList(array);
  }
  
  public static Map<String, String> loadProperties(InputStream stream)
    throws IOException
  {
    Properties properties = new Properties();
    properties.load(stream);
    return toMap(properties);
  }
  
  public static Map<String, String> toMap(Properties properties)
  {
    if ((properties == null) || (properties.isEmpty())) {
      return emptyMap();
    }
    Map<String, String> props = new HashMap(properties.size());
    putAll(properties, props);
    return props;
  }
  
  public static void putAll(Properties properties, Map<String, String> result)
  {
    for (Enumeration<Object> keys = properties.keys(); keys.hasMoreElements();)
    {
      String key = (String)keys.nextElement();
      result.put(key, properties.getProperty(key));
    }
  }
  
  public static void storeProperties(Map<String, String> properties, OutputStream stream, String comment)
    throws IOException
  {
    Properties props = new Properties();
    props.putAll(properties);
    props.store(stream, comment);
  }
}

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

import java.io.File;
import java.util.Comparator;
import org.eclipse.core.runtime.Path;

class FileUtils$1
  implements Comparator<File>
{
  public int compare(File arg0, File arg1)
  {
    Path a = new Path(arg0.getAbsolutePath());
    Path b = new Path(arg1.getAbsolutePath());
    if (a.segmentCount() == b.segmentCount())
    {
      if ((arg0.isDirectory()) && (arg1.isFile())) {
        return 1;
      }
      if ((arg0.isDirectory()) && (arg1.isDirectory())) {
        return 0;
      }
      if ((arg0.isFile()) && (arg1.isDirectory())) {
        return -1;
      }
      return 0;
    }
    return a.segmentCount() - b.segmentCount();
  }
}

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

import java.io.File;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;

class FileUtils$2
  implements FileUtils.IPathComputer
{
  private final File val$root;
  
  FileUtils$2(File paramFile) {}
  
  public IPath computePath(File source)
  {
    IPath result = new Path(source.getAbsolutePath());
    IPath rootPath = new Path(val$root.getAbsolutePath());
    result = result.removeFirstSegments(rootPath.matchingFirstSegments(result));
    return result.setDevice(null);
  }
  
  public void reset() {}
}

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

import java.io.File;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;

class FileUtils$3
  implements FileUtils.IPathComputer
{
  FileUtils.IPathComputer computer = null;
  private final int val$segmentsToKeep;
  
  FileUtils$3(int paramInt) {}
  
  public IPath computePath(File source)
  {
    if (computer == null)
    {
      IPath sourcePath = new Path(source.getAbsolutePath());
      sourcePath = sourcePath.removeLastSegments(val$segmentsToKeep);
      computer = FileUtils.createRootPathComputer(sourcePath.toFile());
    }
    return computer.computePath(source);
  }
  
  public void reset()
  {
    computer = null;
  }
}

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

import java.io.File;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;

class FileUtils$4
  implements FileUtils.IPathComputer
{
  private final int val$segmentsToKeep;
  
  FileUtils$4(int paramInt) {}
  
  public IPath computePath(File source)
  {
    IPath sourcePath = new Path(source.getAbsolutePath());
    sourcePath = sourcePath.removeFirstSegments(Math.max(0, sourcePath.segmentCount() - val$segmentsToKeep));
    return s
1 2 3 4

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