org.eclipse.osgi_3.8.2.v20130124-134944

   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;
      }
    }
    if (value != orig) {
      dirty = true;
    }
    return value;
  }
  
  public void save()
    throws IOException
  {
    adaptor.getStorage().save(this);
  }
  
  public boolean isDirty()
  {
    return dirty;
  }
  
  public void setDirty(boolean dirty)
  {
    this.dirty = dirty;
  }
  
  public final String getSymbolicName()
  {
    return symbolicName;
  }
  
  public final void setSymbolicName(String symbolicName)
  {
    this.symbolicName = symbolicName;
  }
  
  public final Version getVersion()
  {
    return version;
  }
  
  public final void setVersion(Version version)
  {
    this.version = version;
  }
  
  public final int getType()
  {
    return type;
  }
  
  public final void setType(int type)
  {
    this.type = type;
  }
  
  public final String[] getClassPath()
    throws BundleException
  {
    ManifestElement[] classpathElements = ManifestElement.parseHeader("Bundle-ClassPath", classpath);
    return getClassPath(classpathElements);
  }
  
  public String getClassPathString()
  {
    return classpath;
  }
  
  public void setClassPathString(String classpath)
  {
    this.classpath = classpath;
  }
  
  public final String getActivator()
  {
    return activator;
  }
  
  public final void setActivator(String activator)
  {
    this.activator = activator;
  }
  
  public final String getExecutionEnvironment()
  {
    return executionEnvironment;
  }
  
  public void setExecutionEnvironment(String executionEnvironment)
  {
    this.executionEnvironment = executionEnvironment;
  }
  
  public final String getDynamicImports()
  {
    return dynamicImports;
  }
  
  public void setDynamicImports(String dynamicImports)
  {
    this.dynamicImports = dynamicImports;
  }
  
  public final BaseAdaptor getAdaptor()
  {
    return adaptor;
  }
  
  public synchronized BundleFile getBundleFile()
    throws IllegalArgumentException
  {
    if (bundleFile == null) {
      try
      {
        bundleFile = adaptor.createBundleFile(null, this);
      }
      catch (IOException e)
      {
        throw ((IllegalArgumentException)new IllegalArgumentException(e.getMessage()).initCause(e));
      }
    }
    return bundleFile;
  }
  
  public synchronized BundleFile getBundleFile(Object content, boolean base)
  {
    return bundleFiles == null ? null : base ? bundleFile : (BundleFile)bundleFiles.get(content);
  }
  
  public synchronized void setBundleFile(Object content, BundleFile bundleFile)
  {
    if (bundleFiles == null) {
      bundleFiles = new ArrayMap(1);
    }
    bundleFiles.put(content, bundleFile);
  }
  
  private static String[] getClassPath(ManifestElement[] classpath)
  {
    if (classpath == null)
    {
      if (Debug.DEBUG_LOADER) {
        Debug.println("  no classpath");
      }
      return new String[] { "." };
    }
    List<String> result = new ArrayList(classpath.length);
    for (int i = 0; i < classpath.length; i++)
    {
      if (Debug.DEBUG_LOADER) {
        Debug.println("  found classpath entry " + classpath[i].getValueComponents());
      }
      String[] paths = classpath[i].getValueComponents();
      for (int j = 0; j < paths.length; j++) {
        result.add(paths[j]);
      }
    }
    return (String[])result.toArray(new String[result.size()]);
  }
  
  public StorageHook getStorageHook(String key)
  {
    if (storageHooks == null) {
      return null;
    }
    for (int i = 0; i < storageHooks.length; i++) {
      if (storageHooks[i].getKey().equals(key)) {
        return storageHooks[i];
      }
    }
    return null;
  }
  
  public void setStorageHooks(StorageHook[] storageHooks)
  {
    if (this.storageHooks != null) {
      return;
    }
    this.storageHooks = storageHooks;
  }
  
  public StorageHook[] getStorageHooks()
  {
    return storageHooks == null ? new StorageHook[0] : storageHooks;
  }
  
  public File getExtractFile(String path)
  {
    return adaptor.getStorage().getExtractFile(this, path);
  }
  
  public void setFileName(String fileName)
  {
    this.fileName = fileName;
  }
  
  public String toString()
  {
    String name = getSymbolicName();
    if (name == null) {
      return getLocation();
    }
    Version ver = getVersion();
    if (ver == null) {
      return name;
    }
    return name + "_" + ver;
  }
  
  public Enumeration<URL> findLocalResources(String path)
  {
    String[] cp;
    try
    {
      cp = getClassPath();
    }
    catch (BundleException localBundleException)
    {
      String[] cp;
      cp = new String[0];
    }
    if (cp == null) {
      cp = new String[0];
    }
    ClasspathManager cm = new ClasspathManager(this, cp, null);
    cm.initialize();
    Enumeration<URL> result = cm.findLocalResources(path);
    
    return result;
  }
}

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

public abstract interface HookConfigurator
{
  public abstract void addHooks(HookRegistry paramHookRegistry);
}

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

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.osgi.baseadaptor.hooks.AdaptorHook;
import org.eclipse.osgi.baseadaptor.hooks.BundleFileFactoryHook;
import org.eclipse.osgi.baseadaptor.hooks.BundleFileWrapperFactoryHook;
import org.eclipse.osgi.baseadaptor.hooks.ClassLoadingHook;
import org.eclipse.osgi.baseadaptor.hooks.ClassLoadingStatsHook;
import org.eclipse.osgi.baseadaptor.hooks.StorageHook;
import org.eclipse.osgi.framework.adaptor.BundleWatcher;
import org.eclipse.osgi.framework.adaptor.ClassLoaderDelegateHook;
import org.eclipse.osgi.framework.internal.core.FrameworkProperties;
import org.eclipse.osgi.framework.log.FrameworkLogEntry;
import org.eclipse.osgi.util.ManifestElement;

public final class HookRegistry
{
  public static final String HOOK_CONFIGURATORS_FILE = "hookconfigurators.properties";
  public static final String HOOK_CONFIGURATORS = "hook.configurators";
  public static final String PROP_HOOK_CONFIGURATORS_INCLUDE = "osgi.hook.configurators.include";
  public static final String PROP_HOOK_CONFIGURATORS_EXCLUDE = "osgi.hook.configurators.exclude";
  public static final String PROP_HOOK_CONFIGURATORS = "osgi.hook.configurators";
  private static final String BUILTIN_HOOKS = "builtin.hooks";
  private BaseAdaptor adaptor;
  private boolean readonly = false;
  private AdaptorHook[] adaptorHooks = new AdaptorHook[0];
  private BundleWatcher[] watchers = new BundleWatcher[0];
  private ClassLoadingHook[] classLoadingHooks = new ClassLoadingHook[0];
  private ClassLoadingStatsHook[] classLoadingStatsHooks = new ClassLoadingStatsHook[0];
  private ClassLoaderDelegateHook[] classLoaderDelegateHooks = new ClassLoaderDelegateHook[0];
  private StorageHook[] storageHooks = new StorageHook[0];
  private BundleFileFactoryHook[] bundleFileFactoryHooks = new BundleFileFactoryHook[0];
  private BundleFileWrapperFactoryHook[] bundleFileWrapperFactoryHooks = new BundleFileWrapperFactoryHook[0];
  
  public HookRegistry(BaseAdaptor adaptor)
  {
    this.adaptor = adaptor;
  }
  
  public FrameworkLogEntry[] initialize()
  {
    List<String> configurators = new ArrayList(5);
    List<FrameworkLogEntry> errors = new ArrayList(0);
    mergeFileHookConfigurators(configurators, errors);
    mergePropertyHookConfigurators(configurators);
    loadConfigurators(configurators, errors);
    
    readonly = true;
    return (FrameworkLogEntry[])errors.toArray(new FrameworkLogEntry[errors.size()]);
  }
  
  /* Error */
  private void mergeFileHookConfigurators(List<String> configuratorList, List<FrameworkLogEntry> errors)
  {
    // Byte code:
    //   0: aload_0
    //   1: invokevirtual 349	java/lang/Object:getClass	()Ljava/lang/Class;
    //   4: invokevirtual 342	java/lang/Class:getClassLoader	()Ljava/lang/ClassLoader;
    //   7: astore_3
    //   8: aload_3
    //   9: ifnull +12 -> 21
    //   12: aload_3
    //   13: ldc 6
    //   15: invokevirtual 345	java/lang/ClassLoader:getResources	(Ljava/lang/String;)Ljava/util/Enumeration;
    //   18: goto +8 -> 26
    //   21: ldc 6
    //   23: invokestatic 346	java/lang/ClassLoader:getSystemResources	(Ljava/lang/String;)Ljava/util/Enumeration;
    //   26: astore 4
    //   28: goto +30 -> 58
    //   31: astore 5
    //   33: aload_2
    //   34: new 207	org/eclipse/osgi/framework/log/FrameworkLogEntry
    //   37: dup
    //   38: ldc 7
    //   40: iconst_4
    //   41: iconst_0
    //   42: ldc 4
    //   44: iconst_0
    //   45: aload 5
    //   47: aconst_null
    //   48: invokespecial 365	org/eclipse/osgi/framework/log/FrameworkLogEntry:<init>	(Ljava/lang/String;IILjava/lang/String;ILjava/lang/Throwable;[Lorg/eclipse/osgi/framework/log/FrameworkLogEntry;)V
    //   51: invokeinterface 374 2 0
    //   56: pop
    //   57: return
    //   58: iconst_0
    //   59: istore 5
    //   61: goto +260 -> 321
    //   64: aload 4
    //   66: invokeinterface 368 1 0
    //   71: checkcast 190	java/net/URL
    //   74: astore 6
    //   76: aconst_null
    //   77: astore 7
    //   79: new 195	java/util/Properties
    //   82: dup
    //   83: invokespecial 357	java/util/Properties:<init>	()V
    //   86: astore 8
    //   88: aload 6
    //   90: invokevirtual 354	java/net/URL:openStream	()Ljava/io/InputStream;
    //   93: astore 7
    //   95: aload 8
    //   97: aload 7
    //   99: invokevirtual 358	java/util/Properties:load	(Ljava/io/InputStream;)V
    //   102: aload 8
    //   104: ldc 5
    //   106: invokevirtual 359	java/util/Properties:getProperty	(Ljava/lang/String;)Ljava/lang/String;
    //   109: astore 9
    //   111: aload 9
    //   113: ifnonnull +20 -> 133
    //   116: aload 7
    //   118: ifnull +203 -> 321
    //   121: aload 7
    //   123: invokevirtual 339	java/io/InputStream:close	()V
    //   126: goto +195 -> 321
    //   129: pop
    //   130: goto +191 -> 321
    //   133: aload 8
    //   135: ldc 2
    //   137: invokevirtual 359	java/util/Properties:getProperty	(Ljava/lang/String;)Ljava/lang/String;
    //   140: invokestatic 341	java/lang/Boolean:valueOf	(Ljava/lang/String;)Ljava/lang/Boolean;
    //   143: invokevirtual 340	java/lang/Boolean:booleanValue	()Z
    //   146: istore 10
    //   148: aload 9
    //   150: ldc 1
    //   152: invokestatic 366	org/eclipse/osgi/util/ManifestElement:getArrayFromList	(Ljava/lang/String;Ljava/lang/String;)[Ljava/lang/String;
    //   155: astore 11
    //   157: iconst_0
    //   158: istore 12
    //   160: goto +56 -> 216
    //   163: aload_1
    //   164: aload 11
    //   166: iload 12
    //   168: aaload
    //   169: invokeinterface 375 2 0
    //   174: ifne +39 -> 213
    //   177: iload 10
    //   179: ifeq +22 -> 201
    //   182: aload_1
    //   183: iload 5
    //   185: iinc 5 1
    //   188: aload 11
    //   190: iload 12
    //   192: aaload
    //   193: invokeinterface 373 3 0
    //   198: goto +15 -> 213
    //   201: aload_1
    //   202: aload 11
    //   204: iload 12
    //   206: aaload
    //   207: invokeinterface 374 2 0
    //   212: pop
    //   213: iinc 12 1
    //   216: iload 12
    //   218: aload 11
    //   220: arraylength
    //   221: if_icmplt -58 -> 163
    //   224: goto +83 -> 307
    //   227: astore 8
    //   229: aload_2
    //   230: new 207	org/eclipse/osgi/framework/log/FrameworkLogEntry
    //   233: dup
    //   234: ldc 7
    //   236: iconst_4
    //   237: iconst_0
    //   238: new 187	java/lang/StringBuffer
    //   241: dup
    //   242: ldc 3
    //   244: invokespecial 351	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   247: aload 6
    //   249: invokevirtual 355	java/net/URL:toExternalForm	()Ljava/lang/String;
    //   252: invokevirtual 352	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   255: invokevirtual 350	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   258: iconst_0
    //   259: aload 8
    //   261: aconst_null
    //   262: invokespecial 365	org/eclipse/osgi/framework/log/FrameworkLogEntry:<init>	(Ljava/lang/String;IILjava/lang/String;ILjava/lang/Throwable;[Lorg/eclipse/osgi/framework/log/FrameworkLogEntry;)V
    //   265: invokeinterface 374 2 0
    //   270: pop
    //   271: aload 7
    //   273: ifnull +48 -> 321
    //   276: aload 7
    //   278: invokevirtual 339	java/io/InputStream:close	()V
    //   281: goto +40 -> 321
    //   284: pop
    //   285: goto +36 -> 321
    //   288: astore 13
    //   290: aload 7
    //   292: ifnull +12 -> 304
    //   295: aload 7
    //   297: invokevirtual 339	java/io/InputStream:close	()V
    //   300: goto +4 -> 304
    //   303: pop
    //   304: aload 13
    //   306: athrow
    //   307: aload 7
    //   309: ifnull +12 -> 321
    //   312: aload 7
    //   314: invokevirtual 339	java/io/InputStream:close	()V
    //   317: goto +4 -> 321
    //   320: pop
    //   321: aload 4
    //   323: invokeinterface 367 1 0
    //   328: ifne -264 -> 64
    //   331: return
    // Line number table:
    //   Java source line #107	-> byte code offset #0
    //   Java source line #111	-> byte code offset #8
    //   Java source line #112	-> byte code offset #28
    //   Java source line #113	-> byte code offset #33
    //   Java source line #114	-> byte code offset #57
    //   Java source line #116	-> byte code offset #58
    //   Java source line #117	-> byte code offset #61
    //   Java source line #118	-> byte code offset #64
    //   Java source line #119	-> byte code offset #76
    //   Java source line #122	-> byte code offset #79
    //   Java source line #123	-> byte code offset #88
    //   Java source line #124	-> byte code offset #95
    //   Java source line #125	-> byte code offset #102
    //   Java source line #126	-> byte code offset #111
    //   Java source line #141	-> byte code offset #116
    //   Java source line #143	-> byte code offset #121
    //   Java source line #144	-> byte code offset #126
    //   Java source line #127	-> byte code offset #130
    //   Java source line #128	-> byte code offset #133
    //   Java source line #129	-> byte code offset #148
    //   Java source line #130	-> byte code offset #157
    //   Java source line #131	-> byte code offset #163
    //   Java source line #132	-> byte code offset #177
    //   Java source line #133	-> byte code offset #182
    //   Java source line #135	-> byte code offset #201
    //   Java source line #130	-> byte code offset #213
    //   Java source line #137	-> byte code offset #224
    //   Java source line #138	-> byte code offset #229
    //   Java source line #141	-> byte code offset #271
    //   Java source line #143	-> byte code offset #276
    //   Java source line #144	-> byte code offset #281
    //   Java source line #140	-> byte code offset #288
    //   Java source line #141	-> byte code offset #290
    //   Java source line #143	-> byte code offset #295
    //   Java source line #144	-> byte code offset #300
    //   Java source line #147	-> byte code offset #304
    //   Java source line #141	-> byte code offset #307
    //   Java source line #143	-> byte code offset #312
    //   Java source line #144	-> byte code offset #317
    //   Java source line #117	-> byte code offset #321
    //   Java source line #149	-> byte code offset #331
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	332	0	this	HookRegistry
    //   0	332	1	configuratorList	List<String>
    //   0	332	2	errors	List<FrameworkLogEntry>
    //   7	6	3	cl	ClassLoader
    //   26	3	4	hookConfigurators	java.util.Enumeration<java.net.URL>
    //   58	264	4	hookConfigurators	java.util.Enumeration<java.net.URL>
    //   31	15	5	e	java.io.IOException
    //   59	125	5	curBuiltin	int
    //   74	174	6	url	java.net.URL
    //   77	236	7	input	java.io.InputStream
    //   86	17	8	configuratorProps	java.util.Properties
    //   133	1	8	configuratorProps	java.util.Properties
    //   227	33	8	e	java.io.IOException
    //   109	3	9	hooksValue	String
    //   133	16	9	hooksValue	String
    //   146	32	10	builtin	boolean
    //   155	64	11	configurators	String[]
    //   158	59	12	i	int
    //   288	17	13	localObject	Object
    //   129	1	19	localIOException1	java.io.IOException
    //   284	1	20	localIOException2	java.io.IOException
    //   303	1	21	localIOException3	java.io.IOException
    //   320	1	22	localIOException4	java.io.IOException
    // Exception table:
    //   from	to	target	type
    //   8	28	31	java/io/IOException
    //   121	126	129	java/io/IOException
    //   79	116	227	java/io/IOException
    //   133	224	227	java/io/IOException
    //   276	281	284	java/io/IOException
    //   79	116	288	finally
    //   133	271	288	finally
    //   295	300	303	java/io/IOException
    //   312	317	320	java/io/IOException
  }
  
  private void mergePropertyHookConfigurators(List<String> configuratorList)
  {
    String[] configurators = ManifestElement.getArrayFromList(FrameworkProperties.getProperty("osgi.hook.configurators"), ",");
    if (configurators.length > 0)
    {
      configuratorList.clear();
      for (int i = 0; i < configurators.length; i++) {
        if (!configuratorList.contains(configurators[i])) {
          configuratorList.add(configurators[i]);
        }
      }
      return;
    }
    String[] includeConfigurators = ManifestElement.getArrayFromList(FrameworkProperties.getProperty("osgi.hook.configurators.include"), ",");
    for (int i = 0; i < includeConfigurators.length; i++) {
      if (!configuratorList.contains(includeConfigurators[i])) {
        configuratorList.add(includeConfigurators[i]);
      }
    }
    String[] excludeHooks = ManifestElement.getArrayFromList(FrameworkProperties.getProperty("osgi.hook.configurators.exclude"), ",");
    for (int i = 0; i < excludeHooks.length; i++) {
      configuratorList.remove(excludeHooks[i]);
    }
  }
  
  private void loadConfigurators(List<String> configurators, List<FrameworkLogEntry> errors)
  {
    for (Iterator<String> iHooks = configurators.iterator(); iHooks.hasNext();)
    {
      String hookName = (String)iHooks.next();
      try
      {
        Class<?> clazz = Class.forName(hookName);
        HookConfigurator configurator = (HookConfigurator)clazz.newInstance();
        configurator.addHooks(this);
      }
      catch (Throwable t)
      {
        errors.add(new FrameworkLogEntry("org.eclipse.osgi", 4, 0, "error loading hook: " + hookName, 0, t, null));
      }
    }
  }
  
  public AdaptorHook[] getAdaptorHooks()
  {
    return adaptorHooks;
  }
  
  public BundleWatcher[] getWatchers()
  {
    return watchers;
  }
  
  public ClassLoadingHook[] getClassLoadingHooks()
  {
    return classLoadingHooks;
  }
  
  public ClassLoadingStatsHook[] getClassLoadingStatsHooks()
  {
    return classLoadingStatsHooks;
  }
  
  public ClassLoaderDelegateHook[] getClassLoaderDelegateHooks()
  {
    return classLoaderDelegateHooks;
  }
  
  public StorageHook[] getStorageHooks()
  {
    return storageHooks;
  }
  
  public BundleFileFactoryHook[] getBundleFileFactoryHooks()
  {
    return bundleFileFactoryHooks;
  }
  
  public BundleFileWrapperFactoryHook[] getBundleFileWrapperFactoryHooks()
  {
    return bundleFileWrapperFactoryHooks;
  }
  
  public void addAdaptorHook(AdaptorHook adaptorHook)
  {
    adaptorHooks = ((AdaptorHook[])add(adaptorHook, adaptorHooks, new AdaptorHook[adaptorHooks.length + 1]));
  }
  
  public void addWatcher(BundleWatcher watcher)
  {
    watchers = ((BundleWatcher[])add(watcher, watchers, new BundleWatcher[watchers.length + 1]));
  }
  
  public void addClassLoadingHook(ClassLoadingHook classLoadingHook)
  {
    classLoadingHooks = ((ClassLoadingHook[])add(classLoadingHook, classLoadingHooks, new ClassLoadingHook[classLoadingHooks.length + 1]));
  }
  
  public void addClassLoadingStatsHook(ClassLoadingStatsHook classLoadingStatsHook)
  {
    classLoadingStatsHooks = ((ClassLoadingStatsHook[])add(classLoadingStatsHook, classLoadingStatsHooks, new ClassLoadingStatsHook[classLoadingStatsHooks.length + 1]));
  }
  
  public void addClassLoaderDelegateHook(ClassLoaderDelegateHook classLoaderDelegateHook)
  {
    classLoaderDelegateHooks = ((ClassLoaderDelegateHook[])add(classLoaderDelegateHook, classLoaderDelegateHooks, new ClassLoaderDelegateHook[classLoaderDelegateHooks.length + 1]));
  }
  
  public void addStorageHook(StorageHook storageHook)
  {
    storageHooks = ((StorageHook[])add(storageHook, storageHooks, new StorageHook[storageHooks.length + 1]));
  }
  
  public void addBundleFileFactoryHook(BundleFileFactoryHook factory)
  {
    bundleFileFactoryHooks = ((BundleFileFactoryHook[])add(factory, bundleFileFactoryHooks, new BundleFileFactoryHook[bundleFileFactoryHooks.length + 1]));
  }
  
  public void addBundleFileWrapperFactoryHook(BundleFileWrapperFactoryHook factory)
  {
    bundleFileWrapperFactoryHooks = ((BundleFileWrapperFactoryHook[])add(factory, bundleFileWrapperFactoryHooks, new BundleFileWrapperFactoryHook[bundleFileWrapperFactoryHooks.length + 1]));
  }
  
  private Object[] add(Object newValue, Object[] oldValues, Object[] newValues)
  {
    if (readonly) {
      throw new IllegalStateException("Cannot add hooks dynamically.");
    }
    if (oldValues.length > 0) {
      System.arraycopy(oldValues, 0, newValues, 0, oldValues.length);
    }
    newValues[oldValues.length] = newValue;
    return newValues;
  }
  
  public BaseAdaptor getAdaptor()
  {
    return adaptor;
  }
}

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

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import org.eclipse.osgi.framework.debug.Debug;
import org.eclipse.osgi.internal.baseadaptor.AdaptorUtil;

public abstract class BundleEntry
{
  protected static final int BUF_SIZE = 8192;
  
  public abstract InputStream getInputStream()
    throws IOException;
  
  public abstract long getSize();
  
  public abstract String getName();
  
  public abstract long getTime();
  
  public abstract URL getLocalURL();
  
  public abstract URL getFileURL();
  
  public String toString()
  {
    return getName();
  }
  
  public byte[] getBytes()
    throws IOException
  {
    InputStream in = getInputStream();
    int length = (int)getSize();
    if (Debug.DEBUG_LOADER) {
      Debug.println("  about to read " + length + " bytes from " + getName());
    }
    return AdaptorUtil.getBytes(in, length, 8192);
  }
}

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

import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.AccessController;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import org.eclipse.osgi.baseadaptor.BaseData;
import org.eclipse.osgi.framework.internal.core.FrameworkProperties;
import org.eclipse.osgi.framework.internal.protocol.bundleresource.Handler;
import org.eclipse.osgi.framework.util.SecureAction;
import org.eclipse.osgi.util.ManifestElement;

public 
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