org.eclipse.osgi_3.7.2.v20120110-1415

ring name)
    {
      return null;
    }
    
    public Enumeration<String> getEntryPaths(String path)
    {
      return null;
    }
    
    public URL getEntry(String path)
    {
      return null;
    }
    
    public long getLastModified()
    {
      return System.currentTimeMillis();
    }
    
    public Enumeration<URL> findEntries(String path, String filePattern, boolean recurse)
    {
      return null;
    }
    
    public BundleContext getBundleContext()
    {
      return null;
    }
    
    public Map<X509Certificate, List<X509Certificate>> getSignerCertificates(int signersType)
    {
      return new HashMap();
    }
    
    public Version getVersion()
    {
      return new Version(0, 0, 0);
    }
    
    public <A> A adapt(Class<A> type)
    {
      return null;
    }
    
    public File getDataFile(String filename)
    {
      return null;
    }
  }
}

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

import org.eclipse.equinox.log.Logger;
import org.osgi.framework.ServiceReference;

public class LoggerImpl
  implements Logger
{
  private final ExtendedLogServiceImpl logServiceImpl;
  private final String name;
  
  public LoggerImpl(ExtendedLogServiceImpl logServiceImpl, String name)
  {
    this.logServiceImpl = logServiceImpl;
    this.name = name;
  }
  
  public String getName()
  {
    return name;
  }
  
  public boolean isLoggable(int level)
  {
    return logServiceImpl.isLoggable(name, level);
  }
  
  public void log(int level, String message)
  {
    log(null, level, message, null);
  }
  
  public void log(int level, String message, Throwable exception)
  {
    log(null, level, message, exception);
  }
  
  public void log(ServiceReference sr, int level, String message)
  {
    log(sr, level, message, null);
  }
  
  public void log(ServiceReference sr, int level, String message, Throwable exception)
  {
    logServiceImpl.log(name, sr, level, message, exception);
  }
  
  public void log(Object context, int level, String message)
  {
    log(context, level, message, null);
  }
  
  public void log(Object context, int level, String message, Throwable exception)
  {
    logServiceImpl.log(name, context, level, message, exception);
  }
}

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

class SerializedTaskQueue$1
  extends Thread
{
  final SerializedTaskQueue this$0;
  
  SerializedTaskQueue$1(SerializedTaskQueue paramSerializedTaskQueue, String $anonymous0)
  {
    super($anonymous0);
  }
  
  public void run()
  {
    Runnable task = this$0.nextTask(5000);
    while (task != null)
    {
      task.run();
      task = this$0.nextTask(5000);
    }
  }
}

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

import java.util.LinkedList;

public class SerializedTaskQueue
{
  private static final int MAX_WAIT = 5000;
  private final LinkedList<Runnable> tasks = new LinkedList();
  private Thread thread;
  private final String queueName;
  
  public SerializedTaskQueue(String queueName)
  {
    this.queueName = queueName;
  }
  
  public synchronized void put(Runnable newTask)
  {
    tasks.add(newTask);
    if (thread == null)
    {
      thread = new Thread(queueName)
      {
        public void run()
        {
          Runnable task = nextTask(5000);
          while (task != null)
          {
            task.run();
            task = nextTask(5000);
          }
        }
      };
      thread.start();
    }
    else
    {
      notify();
    }
  }
  
  synchronized Runnable nextTask(int maxWait)
  {
    if (tasks.isEmpty())
    {
      try
      {
        wait(maxWait);
      }
      catch (InterruptedException localInterruptedException) {}
      if (tasks.isEmpty())
      {
        thread = null;
        return null;
      }
    }
    return (Runnable)tasks.removeFirst();
  }
}

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

class BaseAdaptor$1
  extends ClassLoader
{
  BaseAdaptor$1(ClassLoader $anonymous0)
  {
    super($anonymous0);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.baseadaptor.BaseAdaptor.1
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.baseadaptor;

import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
import java.io.Writer;
import org.eclipse.osgi.framework.log.FrameworkLog;
import org.eclipse.osgi.framework.log.FrameworkLogEntry;
import org.osgi.framework.Bundle;
import org.osgi.framework.FrameworkEvent;

class BaseAdaptor$2
  implements FrameworkLog
{
  final BaseAdaptor this$0;
  
  BaseAdaptor$2(BaseAdaptor paramBaseAdaptor) {}
  
  public void log(FrameworkEvent frameworkEvent)
  {
    log(new FrameworkLogEntry(frameworkEvent.getBundle().getSymbolicName() == null ? frameworkEvent.getBundle().getLocation() : frameworkEvent.getBundle().getSymbolicName(), 4, 0, "FrameworkEvent.ERROR", 0, frameworkEvent.getThrowable(), null));
  }
  
  public void log(FrameworkLogEntry logEntry)
  {
    System.err.print(logEntry.getEntry() + " ");
    System.err.println(logEntry.getMessage());
    if (logEntry.getThrowable() != null) {
      logEntry.getThrowable().printStackTrace(System.err);
    }
  }
  
  public void setWriter(Writer newWriter, boolean append) {}
  
  public void setFile(File newFile, boolean append)
    throws IOException
  {}
  
  public File getFile()
  {
    return null;
  }
  
  public void setConsoleLog(boolean consoleLog) {}
  
  public void close() {}
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.baseadaptor.BaseAdaptor.2
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.baseadaptor;

import org.eclipse.osgi.framework.adaptor.BundleWatcher;
import org.osgi.framework.Bundle;

class BaseAdaptor$3
  implements BundleWatcher
{
  final BaseAdaptor this$0;
  
  BaseAdaptor$3(BaseAdaptor paramBaseAdaptor, BundleWatcher[] paramArrayOfBundleWatcher) {}
  
  public void watchBundle(Bundle bundle, int type)
  {
    for (int i = 0; i < val$watchers.length; i++) {
      val$watchers[i].watchBundle(bundle, type);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.baseadaptor.BaseAdaptor.3
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.baseadaptor;

import java.net.URL;
import java.util.Enumeration;
import java.util.NoSuchElementException;
import org.eclipse.osgi.framework.adaptor.BundleData;

class BaseAdaptor$4
  implements Enumeration<URL>
{
  private int curPathIndex = 0;
  private int curDataIndex = 0;
  private URL nextElement = null;
  final BaseAdaptor this$0;
  
  BaseAdaptor$4(BaseAdaptor paramBaseAdaptor, String[] paramArrayOfString, BundleData[] paramArrayOfBundleData) {}
  
  public boolean hasMoreElements()
  {
    if (nextElement != null) {
      return true;
    }
    getNextElement();
    return nextElement != null;
  }
  
  public URL nextElement()
  {
    if (!hasMoreElements()) {
      throw new NoSuchElementException();
    }
    URL result = nextElement;
    
    getNextElement();
    return result;
  }
  
  private void getNextElement()
  {
    nextElement = null;
    if (curPathIndex >= val$pathArray.length) {
      return;
    }
    while ((nextElement == null) && (curPathIndex < val$pathArray.length))
    {
      String curPath = val$pathArray[curPathIndex];
      while ((nextElement == null) && (curDataIndex < val$dataArray.length)) {
        nextElement = val$dataArray[(curDataIndex++)].getEntry(curPath);
      }
      if (curDataIndex >= val$dataArray.length)
      {
        curPathIndex += 1;
        curDataIndex = 0;
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.baseadaptor.BaseAdaptor.4
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.baseadaptor;

import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
import java.io.Writer;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
import org.eclipse.core.runtime.adaptor.LocationManager;
import org.eclipse.osgi.baseadaptor.bundlefile.BundleFile;
import org.eclipse.osgi.baseadaptor.hooks.AdaptorHook;
import org.eclipse.osgi.baseadaptor.hooks.ClassLoadingHook;
import org.eclipse.osgi.baseadaptor.hooks.StorageHook;
import org.eclipse.osgi.framework.adaptor.BundleData;
import org.eclipse.osgi.framework.adaptor.BundleOperation;
import org.eclipse.osgi.framework.adaptor.BundleWatcher;
import org.eclipse.osgi.framework.adaptor.EventPublisher;
import org.eclipse.osgi.framework.adaptor.FrameworkAdaptor;
import org.eclipse.osgi.framework.adaptor.PermissionStorage;
import org.eclipse.osgi.framework.internal.core.FilterImpl;
import org.eclipse.osgi.framework.internal.core.Framework;
import org.eclipse.osgi.framework.internal.core.FrameworkProperties;
import org.eclipse.osgi.framework.log.FrameworkLog;
import org.eclipse.osgi.framework.log.FrameworkLogEntry;
import org.eclipse.osgi.internal.baseadaptor.AdaptorMsg;
import org.eclipse.osgi.internal.baseadaptor.BaseStorage;
import org.eclipse.osgi.internal.baseadaptor.BaseStorageHook;
import org.eclipse.osgi.internal.baseadaptor.StateManager;
import org.eclipse.osgi.internal.baseadaptor.SystemBundleData;
import org.eclipse.osgi.service.resolver.PlatformAdmin;
import org.eclipse.osgi.service.resolver.State;
import org.eclipse.osgi.util.NLS;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
import org.osgi.framework.Filter;
import org.osgi.framework.FrameworkEvent;
import org.osgi.framework.InvalidSyntaxException;

public class BaseAdaptor
  implements FrameworkAdaptor
{
  private static final String PROP_PARENT_CLASSLOADER = "osgi.parentClassloader";
  private static final String PARENT_CLASSLOADER_APP = "app";
  private static final String PARENT_CLASSLOADER_EXT = "ext";
  private static final String PARENT_CLASSLOADER_BOOT = "boot";
  private static final String PARENT_CLASSLOADER_FWK = "fwk";
  private static ClassLoader bundleClassLoaderParent;
  private Framework eventPublisher;
  private boolean stopping;
  private HookRegistry hookRegistry;
  private FrameworkLog log;
  private BundleContext context;
  private BaseStorage storage;
  private BundleWatcher bundleWatcher;
  
  static
  {
    String type = FrameworkProperties.getProperty("org.osgi.framework.bundle.parent");
    if (type != null)
    {
      if ("framework".equals(type)) {
        type = "fwk";
      }
    }
    else {
      type = FrameworkProperties.getProperty("osgi.parentClassloader", "boot");
    }
    if ("fwk".equalsIgnoreCase(type))
    {
      bundleClassLoaderParent = FrameworkAdaptor.class.getClassLoader();
    }
    else if ("app".equalsIgnoreCase(type))
    {
      bundleClassLoaderParent = ClassLoader.getSystemClassLoader();
    }
    else if ("ext".equalsIgnoreCase(type))
    {
      ClassLoader appCL = ClassLoader.getSystemClassLoader();
      if (appCL != null) {
        bundleClassLoaderParent = appCL.getParent();
      }
    }
    if (bundleClassLoaderParent == null) {
      bundleClassLoaderParent = new ClassLoader(Object.class.getClassLoader()) {};
    }
  }
  
  public BaseAdaptor(String[] args)
  {
    if (LocationManager.getConfigurationLocation() == null) {
      LocationManager.initializeLocations();
    }
    hookRegistry = new HookRegistry(this);
    FrameworkLogEntry[] errors = hookRegistry.initialize();
    if (errors.length > 0) {
      for (int i = 0; i < errors.length; i++) {
        getFrameworkLog().log(errors[i]);
      }
    }
    storage = getStorage();
  }
  
  public void initialize(EventPublisher publisher)
  {
    eventPublisher = ((Framework)publisher);
    
    AdaptorHook[] adaptorHooks = getHookRegistry().getAdaptorHooks();
    for (int i = 0; i < adaptorHooks.length; i++) {
      adaptorHooks[i].initialize(this);
    }
  }
  
  public void initializeStorage()
    throws IOException
  {
    storage.initialize(this);
  }
  
  public void compactStorage()
    throws IOException
  {
    storage.compact();
  }
  
  /* Error */
  public java.util.Properties getProperties()
  {
    // Byte code:
    //   0: new 277	java/util/Properties
    //   3: dup
    //   4: invokespecial 569	java/util/Properties:<init>	()V
    //   7: astore_1
    //   8: ldc 10
    //   10: ldc 12
    //   12: invokestatic 597	org/eclipse/osgi/framework/internal/core/FrameworkProperties:getProperty	(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    //   15: astore_2
    //   16: aconst_null
    //   17: astore_3
    //   18: new 259	java/io/File
    //   21: dup
    //   22: aload_2
    //   23: invokespecial 535	java/io/File:<init>	(Ljava/lang/String;)V
    //   26: astore 4
    //   28: aload 4
    //   30: invokevirtual 534	java/io/File:exists	()Z
    //   33: ifeq +13 -> 46
    //   36: new 260	java/io/FileInputStream
    //   39: dup
    //   40: aload 4
    //   42: invokespecial 536	java/io/FileInputStream:<init>	(Ljava/io/File;)V
    //   45: astore_3
    //   46: aload_3
    //   47: ifnonnull +12 -> 59
    //   50: aload_0
    //   51: invokevirtual 546	java/lang/Object:getClass	()Ljava/lang/Class;
    //   54: aload_2
    //   55: invokevirtual 540	java/lang/Class:getResourceAsStream	(Ljava/lang/String;)Ljava/io/InputStream;
    //   58: astore_3
    //   59: aload_3
    //   60: ifnull +42 -> 102
    //   63: aload_1
    //   64: new 258	java/io/BufferedInputStream
    //   67: dup
    //   68: aload_3
    //   69: invokespecial 533	java/io/BufferedInputStream:<init>	(Ljava/io/InputStream;)V
    //   72: invokevirtual 570	java/util/Properties:load	(Ljava/io/InputStream;)V
    //   75: goto +16 -> 91
    //   78: astore 5
    //   80: aload_3
    //   81: invokevirtual 538	java/io/InputStream:close	()V
    //   84: goto +4 -> 88
    //   87: pop
    //   88: aload 5
    //   90: athrow
    //   91: aload_3
    //   92: invokevirtual 538	java/io/InputStream:close	()V
    //   95: goto +65 -> 160
    //   98: pop
    //   99: goto +61 -> 160
    //   102: getstatic 531	org/eclipse/osgi/framework/debug/Debug:DEBUG_GENERAL	Z
    //   105: ifeq +55 -> 160
    //   108: new 269	java/lang/StringBuffer
    //   111: dup
    //   112: ldc 1
    //   114: invokespecial 559	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   117: aload_2
    //   118: invokevirtual 561	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   121: invokevirtual 558	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   124: invokestatic 592	org/eclipse/osgi/framework/debug/Debug:println	(Ljava/lang/String;)V
    //   127: goto +33 -> 160
    //   130: astore_3
    //   131: getstatic 531	org/eclipse/osgi/framework/debug/Debug:DEBUG_GENERAL	Z
    //   134: ifeq +26 -> 160
    //   137: new 269	java/lang/StringBuffer
    //   140: dup
    //   141: ldc_w 254
    //   144: invokespecial 559	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   147: aload_3
    //   148: invokevirtual 537	java/io/IOException:getMessage	()Ljava/lang/String;
    //   151: invokevirtual 561	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   154: invokevirtual 558	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   157: invokestatic 592	org/eclipse/osgi/framework/debug/Debug:println	(Ljava/lang/String;)V
    //   160: aload_0
    //   161: getfield 529	org/eclipse/osgi/baseadaptor/BaseAdaptor:storage	Lorg/eclipse/osgi/internal/baseadaptor/BaseStorage;
    //   164: aload_1
    //   165: invokevirtual 603	org/eclipse/osgi/internal/baseadaptor/BaseStorage:addProperties	(Ljava/util/Properties;)V
    //   168: aload_0
    //   169: invokevirtual 573	org/eclipse/osgi/baseadaptor/BaseAdaptor:getHookRegistry	()Lorg/eclipse/osgi/baseadaptor/HookRegistry;
    //   172: invokevirtual 585	org/eclipse/osgi/baseadaptor/HookRegistry:getAdaptorHooks	()[Lorg/eclipse/osgi/baseadaptor/hooks/AdaptorHook;
    //   175: astore_3
    //   176: iconst_0
    //   177: istore 4
    //   179: goto +16 -> 195
    //   182: aload_3
    //   183: iload 4
    //   185: aaload
    //   186: aload_1
    //   187: invokeinterface 631 2 0
    //   192: iinc 4 1
    //   195: iload 4
    //   197: aload_3
    //   198: arraylength
    //   199: if_icmplt -17 -> 182
    //   202: aload_1
    //   203: areturn
    // Line number table:
    //   Java source line #139	-> byte code offset #0
    //   Java source line #140	-> byte code offset #8
    //   Java source line #142	-> byte code offset #16
    //   Java source line #143	-> byte code offset #18
    //   Java source line #144	-> byte code offset #28
    //   Java source line #145	-> byte code offset #36
    //   Java source line #146	-> byte code offset #46
    //   Java source line #147	-> byte code offset #50
    //   Java source line #148	-> byte code offset #59
    //   Java source line #150	-> byte code offset #63
    //   Java source line #151	-> byte code offset #78
    //   Java source line #153	-> byte code offset #80
    //   Java source line #154	-> byte code offset #87
    //   Java source line #157	-> byte code offset #88
    //   Java source line #153	-> byte code offset #91
    //   Java source line #154	-> byte code offset #98
    //   Java source line #159	-> byte code offset #102
    //   Java source line #160	-> byte code offset #108
    //   Java source line #162	-> byte code offset #130
    //   Java source line #163	-> byte code offset #131
    //   Java source line #164	-> byte code offset #137
    //   Java source line #167	-> byte code offset #160
    //   Java source line #169	-> byte code offset #168
    //   Java source line #170	-> byte code offset #176
    //   Java source line #171	-> byte code offset #182
    //   Java source line #170	-> byte code offset #192
    //   Java source line #172	-> byte code offset #202
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	204	0	this	BaseAdaptor
    //   7	196	1	props	java.util.Properties
    //   15	103	2	resource	String
    //   17	75	3	in	java.io.InputStream
    //   130	18	3	e	IOException
    //   175	23	3	adaptorHooks	AdaptorHook[]
    //   26	15	4	file	File
    //   177	19	4	i	int
    //   78	11	5	localObject	Object
    //   87	1	9	localIOException1	IOException
    //   98	1	10	localIOException2	IOException
    // Exception table:
    //   from	to	target	type
    //   63	78	78	finally
    //   80	84	87	java/io/IOException
    //   91	95	98	java/io/IOException
    //   16	127	130	java/io/IOException
  }
  
  public BundleData[] getInstalledBundles()
  {
    return storage.getInstalledBundles();
  }
  
  public URLConnection mapLocationToURLConnection(String location)
    throws BundleException
  {
    try
    {
      URLConnection result = null;
      
      AdaptorHook[] adaptorHooks = getHookRegistry().getAdaptorHooks();
      for (int i = 0; i < adaptorHooks.length; i++)
      {
        result = adaptorHooks[i].mapLocationToURLConnection(location);
        if (result != null) {
          return result;
        }
      }
      return new URL(location).openConnection();
    }
    catch (IOException e)
    {
      throw new BundleException(NLS.bind(AdaptorMsg.ADAPTOR_URL_CREATE_EXCEPTION, location), e);
    }
  }
  
  public BundleOperation installBundle(String location, URLConnection source)
  {
    return storage.installBundle(location, source);
  }
  
  public BundleOperation updateBundle(BundleData bundledata, URLConnection source)
  {
    return storage.updateBundle((BaseData)bundledata, source);
  }
  
  public BundleOperation uninstallBundle(BundleData bundledata)
  {
    return storage.uninstallBundle((BaseData)bundledata);
  }
  
  public long getTotalFreeSpace()
    throws IOException
  {
    return storage.getFreeSpace();
  }
  
  public PermissionStorage getPermissionStorage()
    throws IOException
  {
    return storage.getPermissionStorage();
  }
  
  public void frameworkStart(BundleContext fwContext)
    throws BundleException
  {
    context = fwContext;
    stopping = false;
    
    storage.frameworkStart(fwContext);
    AdaptorHook[] adaptorHooks = getHookRegistry().getAdaptorHooks();
    for (int i = 0; i < adaptorHooks.length; i++) {
      adaptorHooks[i].frameworkStart(fwContext);
    }
  }
  
  public void frameworkStop(BundleContext fwContext)
    throws BundleException
  {
    AdaptorHook[] adaptorHooks = getHookRegistry().getAdaptorHooks();
    for (int i = 0; i < adaptorHooks.length; i++) {
      adaptorHooks[i].frameworkStop(fwContext);
    }
    storage.frameworkStop(fwContext);
  }
  
  public void frameworkStopping(BundleContext fwContext)
  {
    stopping = true;
    
    storage.frameworkStopping(fwContext);
    
    AdaptorHook[] adaptorHooks = getHookRegistry().getAdaptorHooks();
    for (int i = 0; i < adaptorHooks.length; i++) {
      adaptorHooks[i].frameworkStopping(fwContext);
    }
  }
  
  public int getInitialBundleStartLevel()
  {
    return storage.getInitialBundleStartLevel();
  }
  
  public void setInitialBundleStartLevel(int value)
  {
    storage.setInitialBundleStartLevel(value);
  }
  
  public FrameworkLog getFrameworkLog()
  {
    if (log != null) {
      return log;
    }
    AdaptorHook[] adaptorHooks = getHookRegistry().getAdaptorHooks();
    for (int i = 0; i < adaptorHooks.length; i++)
    {
      log = adaptorHooks[i].createFrameworkLog();
      if (log != null) {
        return log;
      }
    }
    log = new FrameworkLog()
    {
      public void log(FrameworkEvent frameworkEvent)
      {
        log(new FrameworkLogEntry(frameworkEvent.getBundle().getSymbolicName() == null ? frameworkEvent.getBundle().getLocation() : frameworkEvent.getBundle().getSymbolicName(), 4, 0, "FrameworkEvent.ERROR", 0, frameworkEvent.getThrowable(), null));
      }
      
      public void log(FrameworkLogEntry logEntry)
      {
        System.err.print(logEntry.getEntry() + " ");
        System.err.println(logEntry.getMessage());
        if (logEntry.getThrowable() != null) {
          logEntry.getThrowable().printStackTrace(System.err);
        }
      }
      
      public void setWriter(Writer newWriter, boolean append) {}
      
      public void setFile(File newFile, boolean append)
        throws IOException
      {}
      
      public File getFile()
      {
        return null;
      }
      
      public void setConsoleLog(boolean consoleLog) {}
      
      public void close() {}
    };
    return log;
  }
  
  public BundleData createSystemBundleData()
    throws BundleException
  {
    return new SystemBundleData(this);
  }
  
  public BundleWatcher getBundleWatcher()
  {
    if (bundleWatcher != null) {
      return bundleWatcher;
    }
    final BundleWatcher[] watchers = hookRegistry.getWatchers();
    if (watchers.length == 0) {
      return null;
    }
    bundleWatcher = new BundleWatcher()
    {
      public void watchBundle(Bundle bundle, int type)
      {
        for (int i = 0; i < watchers.length; i++) {
          watchers[i].watchBundle(bundle, type);
        }
      }
    };
    return bundleWatcher;
  }
  
  public PlatformAdmin getPlatformAdmin()
  {
    return storage.getStateManager();
  }
  
  public State getState()
  {
    return storage.getStateManager().getSystemState();
  }
  
  public ClassLoader getBundleClassLoaderParent()
  {
    ClassLoader result = null;
    ClassLoadingHook[] cpManagerHooks = getHookRegistry().getClassLoadingHooks();
    for (int i = 0; i < cpManagerHooks.length; i++)
    {
      result = cpManagerHooks[i].getBundleClassLoaderParent();
      if (result != null) {
        return result;
      }
    }
    return bundleClassLoaderParent;
  }
  
  public void handleRuntimeError(Throwable error)
  {
    AdaptorHook[] adaptorHooks = getHookRegistry().getAdaptorHooks();
    for (int i = 0; i < adaptorHooks.length; i++) {
      adaptorHooks[i].handleRuntimeError(error);
    }
  }
  
  public boolean isStopping()
  {
    return stopping;
  }
  
  public EventPublisher getEventPublisher()
  {
    return eventPublisher;
  }
  
  public HookRegistry getHookRegistry()
  {
    return hookRegistry;
  }
  
  public BundleContext getContext()
  {
    return context;
  }
  
  public Bundle getBundle(long id)
  {
    return eventPublisher.getBundle(id);
  }
  
  public BundleFile createBundleFile(Object content, BaseData data)
    throws IOException
  {
    return storage.createBundleFile(content, data);
  }
  
  public boolean isReadOnly()
  {
    return storage.isReadOnly();
  }
  
  protected BaseStorage getStorage()
  {
    if (storage != null) {
      return storage;
    }
    StorageHook[] hooks = hookRegistry.getStorageHooks();
    for (int i = 0; (i < hooks.length) && (storage == null); i++) {
      if ((hooks[i] instanceof BaseStorageHook)) {
        storage = ((BaseStorageHook)hooks[i]).getStorage();
      }
    }
    return storage;
  }
  
  public Enumeration<URL> findEntries(List<BundleData> datas, String path, String filePattern, int options)
  {
    List<BundleFile> bundleFiles = new ArrayList(datas.size());
    for (Iterator localIterator = datas.iterator(); localIterator.hasNext();)
    {
      BundleData data = (BundleData)localIterator.next();
      bundleFiles.add(((BaseData)data).getBundleFile());
    }
    List<String> pathList = listEntryPaths(bundleFiles, path, filePattern, options);
    if (pathList.size() == 0) {
      return null;
    }
    final String[] pathArray = (String[])pathList.toArray(new String[pathList.size()]);
    final BundleData[] dataArray = (BundleData[])datas.toArray(new BundleData[datas.size()]);
    new Enumeration()
    {
      private int curPathIndex = 0;
      private int curDataIndex = 0;
      private URL nextElement = null;
      
      public boolean hasMoreElements()
      {
        if (nextElement != null) {
          return true;
        }
        getNextElement();
        return nextElement != null;
      }
      
      public URL nextElement()
      {
        if (!hasMoreElements()) {
          throw new NoSuchElementException();
        }
        URL result = nextElement;
        
        getNextElement();
        return result;
      }
      
      private void getNextElement()
      {
        nextElement = null;
        if (curPathIndex >= pathArray.length) {
          return;
        }
        while ((nextElement == null) && (curPathIndex < pathArray.length))
        {
          String curPath = pathArray[curPathIndex];
          while ((nextElement == null) && (curDataIndex < dataArray.length)) {
            nextElement = dataArray[(curDataIndex++)].getEntry(curPath);
          }
          if (curDataIndex >= dataArray.length)
          {
            curPathIndex += 1;
            curDataIndex = 0;
          }
        }
      }
    };
  }
  
  public List<String> listEntryPaths(List<BundleFile> bundleFiles, String path, String filePattern, int options)
  {
    List<String> pathList = new ArrayList();
    Filter patternFilter = null;
    Hashtable<String, String> patternProps = null;
    if (filePattern != null)
    {
      if (((options & 0x1) == 0) && (filePattern.indexOf('*') == -1) && (filePattern.indexOf('\\') == -1))
      {
        if (path.length() == 0) {
          path = filePattern;
        } else {
          path = path + (path.charAt(path.length() - 1) == '/' ? filePattern : new StringBuffer(String.valueOf('/')).append(filePattern).toString());
        }
        for (Iterator localIterator = bundleFiles.iterator(); localIterator.hasNext();)
        {
          BundleFile bundleFile = (BundleFile)localIterator.next();
          if ((bundleFile.getEntry(path) != null) && (!pathList.contains(path))) {
            pathList.add(path);
          }
        }
        return pathList;
      }
      try
      {
        patternFilter = FilterImpl.newInstance("(filename=" + sanitizeFilterInput(filePattern) + ")");
        
        patternProps = new Hashtable(2);
      }
      catch (InvalidSyntaxException e)
      {
        b = context == null ? null : context.getBundle();
        eventPublisher.publishFrameworkEvent(2, (Bundle)b, e);
        return pathList;
      }
    }
    for (Object b = bundleFiles.iterator(); ((Iterator)b).hasNext();)
    {
      BundleFile bundleFile = (BundleFile)((Iterator)b).next();
      listEntryPaths(bundleFile, path, patternFilter, patternProps, options, pathList);
    }
    return pathList;
  }
  
  private String sanitizeFilterInput(String filePattern)
    throws InvalidSyntaxException
  {
    StringBuffer buffer = null;
    boolean foundEscape = false;
    for (int i = 0; i < filePattern.length(); i++)
    {
      char c = filePattern.charAt(i);
      switch (c)
      {
      case '\\': 
        foundEscape = !foundEscape;
        if (buffer != null) {
          buffer.append(c);
        }
        break;
      case '(': 
      case ')': 
        if (!foundEscape)
        {
          if (buffer == null)
          {
            buffer = new StringBuffer(filePattern.length() + 16);
            buffer.append(filePattern.substring(0, i));
          }
          buffer.append('\\');
        }
        else
        {
          foundEscape = false;
        }
        if (buffer != null) {
          buffer.append(c);
        }
        break;
      default: 
        foundEscape = false;
        if (buffer != null) {
          buffer.append(c);
        }
        break;
      }
    }
    if (foundEscape) {
      throw new InvalidSyntaxException("Trailing escape characters must be escaped.", filePattern);
    }
    return buffer == null ? filePattern : buffer.toString();
  }
  
  private List<String> listEntryPaths(BundleFile bundleFile, String path, Filter patternFilter, Hashtable<String, String> patternProps, int options, List<String> pathList)
  {
    if (pathList == null) {
      pathList = new ArrayList();
    }
    Enumeration<String> entryPaths = bundleFile.getEntryPaths(path);
    if (entryPaths == null) {
      return pathList;
    }
    while (entryPaths.hasMoreElements())
    {
      String entry = (String)entryPaths.nextElement();
      int lastSlash = entry.lastIndexOf('/');
      if (patternProps != null)
      {
        int secondToLastSlash = entry.lastIndexOf('/', lastSlash - 1);
        
        int fileEnd = entry.length();
        int fileStart;
        int fileStart;
        if (lastSlash < 0)
        {
          fileStart = 0;
        }
        else
        {
          int fileStart;
          if (lastSlash != entry.length() - 1)
          {
            fileStart = lastSlash + 1;
          }
          else
          {
            fileEnd = lastSlash;
            int fileStart;
            if (secondToLastSlash < 0) {
              fileStart = 0;
            } else {
              fileStart = secondToLastSlash + 1;
            }
          }
        }
        String fileName = entry.substring(fileStart, fileEnd);
        
        patternProps.put("filename", fileName);
      }
      if ((!pathList.contains(entry)) && ((patternFilter == null) || (patternFilter.matchCase(patternProps)))) {
        pathList.add(entry);
      }
      if (((options & 0x1) != 0) && (!entry.equals(path)) && (entry.length() > 0) && (lastSlash == entry.length() - 1)) {
        listEntryPaths(bundleFile, entry, patternFilter, patternProps, options, pathList);
      }
    }
    return pathList;
  }
}

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

import java.net.URL;
import java.security.PrivilegedAction;

class BaseData$1
  implements PrivilegedAction<URL>
{
  final BaseData this$0;
  
  BaseData$1(BaseData paramBaseData, String paramString) {}
  
  public URL run()
  {
    return this$0.getEntry0(val$path);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.baseadaptor.BaseData.1
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.baseadaptor;

import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Dictionary;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
import org.eclipse.osgi.baseadaptor.bundlefile.BundleEntry;
import org.eclipse.osgi.baseadaptor.bundlefile.BundleFile;
import org.eclipse.osgi.baseadaptor.hooks.ClassLoadingHook;
import org.eclipse.osgi.baseadaptor.hooks.StorageHook;
import org.eclipse.osgi.baseadaptor.loader.BaseClassLoader;
import org.eclipse.osgi.baseadaptor.loader.ClasspathManager;
import org.eclipse.osgi.framework.adaptor.BundleClassLoader;
import org.eclipse.osgi.framework.adaptor.BundleData;
import org.eclipse.osgi.framework.adaptor.BundleProtectionDomain;
import org.eclipse.osgi.framework.adaptor.ClassLoaderDelegate;
import org.eclipse.osgi.framework.debug.Debug;
import org.eclipse.osgi.framework.internal.core.FrameworkProperties;
import org.eclipse.osgi.framework.internal.protocol.bundleentry.Handler;
import org.eclipse.osgi.framework.log.FrameworkLog;
import org.eclipse.osgi.framework.log.FrameworkLogEntry;
import org.eclipse.osgi.internal.baseadaptor.ArrayMap;
import org.eclipse.osgi.internal.baseadaptor.BaseStorage;
import org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader;
import org.eclipse.osgi.util.ManifestElement;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
import org.osgi.framework.Version;

public class BaseData
  implements BundleData
{
  private static final boolean COPY_NATIVES = Boolean.valueOf(FrameworkProperties.getProperty("osgi.classloader.copy.natives")).booleanValue();
  private long id;
  private BaseAdaptor adaptor;
  private Bundle bundle;
  private int startLevel = -1;
  private int status = 0;
  private StorageHook[] storageHooks;
  private String location;
  private long lastModified;
  protected BundleFile bundleFile;
  private ArrayMap<Object, BundleFile> bundleFiles;
  private boolean dirty = false;
  protected Dictionary<String, String> manifest;
  protected String fileName;
  protected Collection<String> loadedNativeCode;
  private String symbolicName;
  private Version version;
  private String activator;
  private String classpath;
  private String executionEnvironment;
  private String dynamicImports;
  private int type;
  
  public BaseData(long id, BaseAdaptor adaptor)
  {
    this.id = id;
    this.adaptor = adaptor;
  }
  
  public BundleClassLoader createClassLoader(ClassLoaderDelegate delegate, BundleProtectionDomain domain, String[] bundleclasspath)
  {
    ClassLoadingHook[] hooks = adaptor.getHookRegistry().getClassLoadingHooks();
    ClassLoader parent = adaptor.getBundleClassLoaderParent();
    BaseClassLoader cl = null;
    for (int i = 0; (i < hooks.length) && (cl == null); i++) {
      cl = hooks[i].createClassLoader(parent, delegate, domain, this, bundleclasspath);
    }
    if (cl == null) {
      cl = new DefaultClassLoader(parent, delegate, domain, this, bundleclasspath);
    }
    return cl;
  }
  
  public final URL getEntry(final String path)
  {
    if (System.getSecurityManager() == null) {
      return getEntry0(path);
    }
    (URL)AccessController.doPrivileged(new PrivilegedAction()
    {
      public URL run()
      {
        return getEntry0(path);
      }
    });
  }
  
  final URL getEntry0(String path)
  {
    BundleEntry entry = getBundleFile().getEntry(path);
    if (entry == null) {
      return null;
    }
    path = BundleFile.fixTrailingSlash(path, entry);
    try
    {
      return new URL("bundleentry", Long.toString(id) + ".fwk" + Integer.toString(adaptor.hashCode()), 0, path, new Handler(entry, adaptor));
    }
    catch (MalformedURLException localMalformedURLException) {}
    return null;
  }
  
  public final Enumeration<String> getEntryPaths(String path)
  {
    return getBundleFile().getEntryPaths(path);
  }
  
  public String findLibrary(String libname)
  {
    ClassLoadingHook[] hooks = adaptor.getHookRegistry().getClassLoadingHooks();
    String result = null;
    for (int i = 0; i < hooks.length; i++)
    {
      result = hooks[i].findLibrary(this, libname);
      if (result != null) {
        break;
      }
    }
    if (result != null) {
      synchronized (this)
      {
        if (loadedNativeCode == null) {
          loadedNativeCode = new ArrayList(1);
        }
        if ((loadedNativeCode.contains(result)) || (COPY_NATIVES))
        {
          String temp = copyToTempLibrary(result);
          if (temp != null) {
            result = temp;
          }
        }
        else
        {
          loadedNativeCode.add(result);
        }
      }
    }
    return result;
  }
  
  private String copyToTempLibrary(String result)
  {
    try
    {
      return adaptor.getStorage().copyToTempLibrary(this, result);
    }
    catch (IOException e)
    {
      adaptor.getFrameworkLog().log(new FrameworkLogEntry("org.eclipse.osgi", 4, 0, e.getMessage(), 0, e, null));
    }
    return null;
  }
  
  public void installNativeCode(String[] nativepaths)
    throws BundleException
  {
    adaptor.getStorage().installNativeCode(this, nativepaths);
  }
  
  public File getDataFile(String path)
  {
    return adaptor.getStorage().getDataFile(this, path);
  }
  
  public Dictionary<String, String> getManifest()
    throws BundleException
  {
    if (manifest == null) {
      manifest = adaptor.getStorage().loadManifest(this);
    }
    return manifest;
  }
  
  public long getBundleID()
  {
    return id;
  }
  
  public final String getLocation()
  {
    return location;
  }
  
  public final void setLocation(String location)
  {
    this.location = location;
  }
  
  public final long getLastModified()
  {
    return lastModified;
  }
  
  public final void setLastModified(long lastModified)
  {
    this.lastModified = lastModified;
  }
  
  public synchronized void close()
    throws IOException
  {
    if (bundleFile != null) {
      getBundleFile().close();
    }
    if (bundleFiles != null)
    {
      for (Iterator localIterator = bundleFiles.getValues().iterator(); localIterator.hasNext();)
      {
        BundleFile bundlefile = (BundleFile)localIterator.next();
        bundlefile.close();
      }
      bundleFiles.clear();
    }
  }
  
  public void open()
    throws IOException
  {
    getBundleFile().open();
  }
  
  public final void setBundle(Bundle bundle)
  {
    this.bundle = bundle;
  }
  
  public final Bundle getBundle()
  {
    return bundle;
  }
  
  public int getStartLevel()
  {
    return startLevel;
  }
  
  public int getStatus()
  {
    return status;
  }
  
  public void setStartLevel(int value)
  {
    startLevel = setPersistentData(value, true, startLevel);
  }
  
  public void setStatus(int value)
  {
    status = setPersistentData(value, false, status);
  }
  
  private int setPersistentData(int value, boolean isStartLevel, int orig)
  {
    StorageHook[] hooks = getStorageHooks();
    for (int i = 0; i < hooks.length; i++) {
      if (isStartLevel)
      {
        if (hooks[i].forgetStartLevelChange(value)) {
          return value;
        }
      }
      else if (hooks[i].forgetStatusChange(value)) {
        return value;
      }
    }
    i
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