org.eclipse.osgi_3.8.2.v20130124-134944

d 5
      //   73: astore_1
      //   74: goto +28 -> 102
      //   77: aload 5
      //   79: getfield 135	org/eclipse/osgi/framework/internal/core/CoreResolverHookFactory$HookReference:hook	Lorg/osgi/framework/hooks/resolver/ResolverHook;
      //   82: invokeinterface 150 1 0
      //   87: goto +15 -> 102
      //   90: astore 6
      //   92: aload_2
      //   93: ifnonnull +9 -> 102
      //   96: aload 6
      //   98: astore_2
      //   99: aload 5
      //   101: astore_3
      //   102: aload 4
      //   104: invokeinterface 146 1 0
      //   109: ifne -65 -> 44
      //   112: aload_1
      //   113: ifnull +17 -> 130
      //   116: aload_0
      //   117: getfield 133	org/eclipse/osgi/framework/internal/core/CoreResolverHookFactory$CoreResolverHook:this$0	Lorg/eclipse/osgi/framework/internal/core/CoreResolverHookFactory;
      //   120: aconst_null
      //   121: aload_1
      //   122: getfield 135	org/eclipse/osgi/framework/internal/core/CoreResolverHookFactory$HookReference:hook	Lorg/osgi/framework/hooks/resolver/ResolverHook;
      //   125: ldc 7
      //   127: invokevirtual 143	org/eclipse/osgi/framework/internal/core/CoreResolverHookFactory:handleHookException	(Ljava/lang/Throwable;Ljava/lang/Object;Ljava/lang/String;)V
      //   130: aload_2
      //   131: ifnull +36 -> 167
      //   134: aload_0
      //   135: getfield 133	org/eclipse/osgi/framework/internal/core/CoreResolverHookFactory$CoreResolverHook:this$0	Lorg/eclipse/osgi/framework/internal/core/CoreResolverHookFactory;
      //   138: aload_2
      //   139: aload_3
      //   140: getfield 135	org/eclipse/osgi/framework/internal/core/CoreResolverHookFactory$HookReference:hook	Lorg/osgi/framework/hooks/resolver/ResolverHook;
      //   143: ldc 7
      //   145: invokevirtual 143	org/eclipse/osgi/framework/internal/core/CoreResolverHookFactory:handleHookException	(Ljava/lang/Throwable;Ljava/lang/Object;Ljava/lang/String;)V
      //   148: goto +19 -> 167
      //   151: astore 7
      //   153: aload_0
      //   154: getfield 133	org/eclipse/osgi/framework/internal/core/CoreResolverHookFactory$CoreResolverHook:this$0	Lorg/eclipse/osgi/framework/internal/core/CoreResolverHookFactory;
      //   157: aload_0
      //   158: getfield 132	org/eclipse/osgi/framework/internal/core/CoreResolverHookFactory$CoreResolverHook:hooks	Ljava/util/List;
      //   161: invokevirtual 142	org/eclipse/osgi/framework/internal/core/CoreResolverHookFactory:releaseHooks	(Ljava/util/List;)V
      //   164: aload 7
      //   166: athrow
      //   167: aload_0
      //   168: getfield 133	org/eclipse/osgi/framework/internal/core/CoreResolverHookFactory$CoreResolverHook:this$0	Lorg/eclipse/osgi/framework/internal/core/CoreResolverHookFactory;
      //   171: aload_0
      //   172: getfield 132	org/eclipse/osgi/framework/internal/core/CoreResolverHookFactory$CoreResolverHook:hooks	Ljava/util/List;
      //   175: invokevirtual 142	org/eclipse/osgi/framework/internal/core/CoreResolverHookFactory:releaseHooks	(Ljava/util/List;)V
      //   178: return
      // Line number table:
      //   Java source line #179	-> byte code offset #0
      //   Java source line #180	-> byte code offset #6
      //   Java source line #182	-> byte code offset #11
      //   Java source line #183	-> byte code offset #23
      //   Java source line #185	-> byte code offset #24
      //   Java source line #186	-> byte code offset #26
      //   Java source line #187	-> byte code offset #28
      //   Java source line #188	-> byte code offset #30
      //   Java source line #189	-> byte code offset #44
      //   Java source line #191	-> byte code offset #56
      //   Java source line #192	-> byte code offset #67
      //   Java source line #193	-> byte code offset #71
      //   Java source line #194	-> byte code offset #74
      //   Java source line #196	-> byte code offset #77
      //   Java source line #197	-> byte code offset #87
      //   Java source line #200	-> byte code offset #92
      //   Java source line #201	-> byte code offset #96
      //   Java source line #202	-> byte code offset #99
      //   Java source line #188	-> byte code offset #102
      //   Java source line #207	-> byte code offset #112
      //   Java source line #208	-> byte code offset #116
      //   Java source line #209	-> byte code offset #130
      //   Java source line #210	-> byte code offset #134
      //   Java source line #211	-> byte code offset #148
      //   Java source line #212	-> byte code offset #153
      //   Java source line #213	-> byte code offset #164
      //   Java source line #212	-> byte code offset #167
      //   Java source line #214	-> byte code offset #178
      // Local variable table:
      //   start	length	slot	name	signature
      //   0	179	0	this	CoreResolverHook
      //   25	97	1	missingHook	CoreResolverHookFactory.HookReference
      //   27	112	2	endError	Throwable
      //   29	111	3	endBadHook	CoreResolverHookFactory.HookReference
      //   39	64	4	iHooks	Iterator<CoreResolverHookFactory.HookReference>
      //   54	46	5	hookRef	CoreResolverHookFactory.HookReference
      //   90	7	6	t	Throwable
      //   151	14	7	localObject	Object
      // Exception table:
      //   from	to	target	type
      //   77	87	90	java/lang/Throwable
      //   24	151	151	finally
    }
  }
}

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

import java.security.PrivilegedAction;

class EquinoxLauncher$1
  implements PrivilegedAction<Object>
{
  final EquinoxLauncher this$0;
  
  EquinoxLauncher$1(EquinoxLauncher paramEquinoxLauncher) {}
  
  public Object run()
  {
    this$0.internalInit();
    return null;
  }
}

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

import java.security.PrivilegedExceptionAction;

class EquinoxLauncher$2
  implements PrivilegedExceptionAction<Object>
{
  final EquinoxLauncher this$0;
  
  EquinoxLauncher$2(EquinoxLauncher paramEquinoxLauncher) {}
  
  public Object run()
  {
    this$0.internalStart();
    return null;
  }
}

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

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.security.cert.X509Certificate;
import java.util.Collections;
import java.util.Dictionary;
import java.util.Enumeration;
import java.util.List;
import java.util.Map;
import org.osgi.framework.AdminPermission;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
import org.osgi.framework.FrameworkEvent;
import org.osgi.framework.FrameworkListener;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.Version;

public class EquinoxLauncher
  implements org.osgi.framework.launch.Framework
{
  private volatile Framework framework;
  private volatile Bundle systemBundle;
  private final Map<String, String> configuration;
  private volatile ConsoleManager consoleMgr = null;
  
  public EquinoxLauncher(Map<String, String> configuration)
  {
    this.configuration = configuration;
  }
  
  public void init()
  {
    checkAdminPermission("execute");
    if (System.getSecurityManager() == null) {
      internalInit();
    } else {
      AccessController.doPrivileged(new PrivilegedAction()
      {
        public Object run()
        {
          internalInit();
          return null;
        }
      });
    }
  }
  
  /* Error */
  synchronized Framework internalInit()
  {
    // Byte code:
    //   0: aload_0
    //   1: invokevirtual 371	org/eclipse/osgi/framework/internal/core/EquinoxLauncher:getState	()I
    //   4: bipush 56
    //   6: iand
    //   7: ifeq +8 -> 15
    //   10: aload_0
    //   11: getfield 346	org/eclipse/osgi/framework/internal/core/EquinoxLauncher:framework	Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   14: areturn
    //   15: invokestatic 361	java/lang/System:getSecurityManager	()Ljava/lang/SecurityManager;
    //   18: ifnull +27 -> 45
    //   21: aload_0
    //   22: getfield 344	org/eclipse/osgi/framework/internal/core/EquinoxLauncher:configuration	Ljava/util/Map;
    //   25: ldc 7
    //   27: invokeinterface 394 2 0
    //   32: ifnull +13 -> 45
    //   35: new 174	java/lang/SecurityException
    //   38: dup
    //   39: ldc 1
    //   41: invokespecial 357	java/lang/SecurityException:<init>	(Ljava/lang/String;)V
    //   44: athrow
    //   45: aload_0
    //   46: getfield 346	org/eclipse/osgi/framework/internal/core/EquinoxLauncher:framework	Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   49: astore_1
    //   50: aload_1
    //   51: ifnull +17 -> 68
    //   54: aload_1
    //   55: invokevirtual 382	org/eclipse/osgi/framework/internal/core/Framework:close	()V
    //   58: aload_0
    //   59: aconst_null
    //   60: putfield 346	org/eclipse/osgi/framework/internal/core/EquinoxLauncher:framework	Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   63: aload_0
    //   64: aconst_null
    //   65: putfield 347	org/eclipse/osgi/framework/internal/core/EquinoxLauncher:systemBundle	Lorg/osgi/framework/Bundle;
    //   68: invokestatic 364	java/lang/Thread:currentThread	()Ljava/lang/Thread;
    //   71: invokevirtual 362	java/lang/Thread:getContextClassLoader	()Ljava/lang/ClassLoader;
    //   74: astore_2
    //   75: aload_0
    //   76: getfield 344	org/eclipse/osgi/framework/internal/core/EquinoxLauncher:configuration	Ljava/util/Map;
    //   79: invokestatic 387	org/eclipse/osgi/framework/internal/core/FrameworkProperties:setProperties	(Ljava/util/Map;)V
    //   82: invokestatic 386	org/eclipse/osgi/framework/internal/core/FrameworkProperties:initializeProperties	()V
    //   85: aload_0
    //   86: aload_0
    //   87: getfield 344	org/eclipse/osgi/framework/internal/core/EquinoxLauncher:configuration	Ljava/util/Map;
    //   90: invokespecial 377	org/eclipse/osgi/framework/internal/core/EquinoxLauncher:setEquinoxProperties	(Ljava/util/Map;)V
    //   93: new 190	org/eclipse/osgi/framework/internal/core/Framework
    //   96: dup
    //   97: new 184	org/eclipse/osgi/baseadaptor/BaseAdaptor
    //   100: dup
    //   101: iconst_0
    //   102: anewarray 176	java/lang/String
    //   105: invokespecial 368	org/eclipse/osgi/baseadaptor/BaseAdaptor:<init>	([Ljava/lang/String;)V
    //   108: invokespecial 384	org/eclipse/osgi/framework/internal/core/Framework:<init>	(Lorg/eclipse/osgi/framework/adaptor/FrameworkAdaptor;)V
    //   111: astore_1
    //   112: aload_0
    //   113: aload_1
    //   114: invokestatic 370	org/eclipse/osgi/framework/internal/core/ConsoleManager:startConsole	(Lorg/eclipse/osgi/framework/internal/core/Framework;)Lorg/eclipse/osgi/framework/internal/core/ConsoleManager;
    //   117: putfield 345	org/eclipse/osgi/framework/internal/core/EquinoxLauncher:consoleMgr	Lorg/eclipse/osgi/framework/internal/core/ConsoleManager;
    //   120: aload_1
    //   121: invokevirtual 383	org/eclipse/osgi/framework/internal/core/Framework:launch	()V
    //   124: aload_0
    //   125: aload_1
    //   126: putfield 346	org/eclipse/osgi/framework/internal/core/EquinoxLauncher:framework	Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   129: aload_0
    //   130: aload_1
    //   131: getfield 348	org/eclipse/osgi/framework/internal/core/Framework:systemBundle	Lorg/eclipse/osgi/framework/internal/core/InternalSystemBundle;
    //   134: putfield 347	org/eclipse/osgi/framework/internal/core/EquinoxLauncher:systemBundle	Lorg/osgi/framework/Bundle;
    //   137: goto +27 -> 164
    //   140: astore_3
    //   141: invokestatic 364	java/lang/Thread:currentThread	()Ljava/lang/Thread;
    //   144: invokevirtual 362	java/lang/Thread:getContextClassLoader	()Ljava/lang/ClassLoader;
    //   147: astore 4
    //   149: aload 4
    //   151: aload_2
    //   152: if_acmpeq +10 -> 162
    //   155: invokestatic 364	java/lang/Thread:currentThread	()Ljava/lang/Thread;
    //   158: aload_2
    //   159: invokevirtual 363	java/lang/Thread:setContextClassLoader	(Ljava/lang/ClassLoader;)V
    //   162: aload_3
    //   163: athrow
    //   164: invokestatic 364	java/lang/Thread:currentThread	()Ljava/lang/Thread;
    //   167: invokevirtual 362	java/lang/Thread:getContextClassLoader	()Ljava/lang/ClassLoader;
    //   170: astore 4
    //   172: aload 4
    //   174: aload_2
    //   175: if_acmpeq +10 -> 185
    //   178: invokestatic 364	java/lang/Thread:currentThread	()Ljava/lang/Thread;
    //   181: aload_2
    //   182: invokevirtual 363	java/lang/Thread:setContextClassLoader	(Ljava/lang/ClassLoader;)V
    //   185: aload_1
    //   186: areturn
    // Line number table:
    //   Java source line #49	-> byte code offset #0
    //   Java source line #50	-> byte code offset #10
    //   Java source line #52	-> byte code offset #15
    //   Java source line #53	-> byte code offset #35
    //   Java source line #55	-> byte code offset #45
    //   Java source line #56	-> byte code offset #50
    //   Java source line #57	-> byte code offset #54
    //   Java source line #58	-> byte code offset #58
    //   Java source line #59	-> byte code offset #63
    //   Java source line #61	-> byte code offset #68
    //   Java source line #63	-> byte code offset #75
    //   Java source line #64	-> byte code offset #82
    //   Java source line #66	-> byte code offset #85
    //   Java source line #67	-> byte code offset #93
    //   Java source line #68	-> byte code offset #112
    //   Java source line #69	-> byte code offset #120
    //   Java source line #70	-> byte code offset #124
    //   Java source line #71	-> byte code offset #129
    //   Java source line #72	-> byte code offset #137
    //   Java source line #73	-> byte code offset #141
    //   Java source line #74	-> byte code offset #149
    //   Java source line #75	-> byte code offset #155
    //   Java source line #76	-> byte code offset #162
    //   Java source line #73	-> byte code offset #164
    //   Java source line #74	-> byte code offset #172
    //   Java source line #75	-> byte code offset #178
    //   Java source line #77	-> byte code offset #185
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	187	0	this	EquinoxLauncher
    //   49	137	1	current	Framework
    //   74	108	2	tccl	ClassLoader
    //   140	23	3	localObject	Object
    //   147	3	4	currentCCL	ClassLoader
    //   170	3	4	currentCCL	ClassLoader
    // Exception table:
    //   from	to	target	type
    //   75	140	140	finally
  }
  
  private void setEquinoxProperties(Map<String, String> configuration)
  {
    Object threadBehavior = configuration == null ? null : (String)configuration.get("osgi.framework.activeThreadType");
    if (threadBehavior == null)
    {
      if (FrameworkProperties.getProperty("osgi.framework.activeThreadType") == null) {
        FrameworkProperties.setProperty("osgi.framework.activeThreadType", "normal");
      }
    }
    else {
      FrameworkProperties.setProperty("osgi.framework.activeThreadType", (String)threadBehavior);
    }
    if (FrameworkProperties.getProperty(Constants.OSGI_COMPATIBILITY_BOOTDELEGATION) == null) {
      FrameworkProperties.setProperty(Constants.OSGI_COMPATIBILITY_BOOTDELEGATION, "false");
    }
    if (FrameworkProperties.getProperty("osgi.support.multipleHosts") == null) {
      FrameworkProperties.setProperty("osgi.support.multipleHosts", "true");
    }
    Object windowSystem = configuration == null ? null : (String)configuration.get("org.osgi.framework.windowsystem");
    if (windowSystem == null)
    {
      windowSystem = FrameworkProperties.getProperty("osgi.ws");
      if (windowSystem != null) {
        FrameworkProperties.setProperty("org.osgi.framework.windowsystem", (String)windowSystem);
      }
    }
    if (configuration == null) {
      return;
    }
    Object clean = configuration.get("org.osgi.framework.storage.clean");
    if ("onFirstInit".equals(clean))
    {
      configuration.remove("org.osgi.framework.storage.clean");
      FrameworkProperties.setProperty("osgi.clean", Boolean.TRUE.toString());
    }
  }
  
  public FrameworkEvent waitForStop(long timeout)
    throws InterruptedException
  {
    Framework current = framework;
    if (current == null) {
      return new FrameworkEvent(64, this, null);
    }
    return current.waitForStop(timeout);
  }
  
  public Enumeration<URL> findEntries(String path, String filePattern, boolean recurse)
  {
    Bundle current = systemBundle;
    if (current == null) {
      return null;
    }
    return current.findEntries(path, filePattern, recurse);
  }
  
  public BundleContext getBundleContext()
  {
    Bundle current = systemBundle;
    if (current == null) {
      return null;
    }
    return current.getBundleContext();
  }
  
  public long getBundleId()
  {
    return 0L;
  }
  
  public URL getEntry(String path)
  {
    Bundle current = systemBundle;
    if (current == null) {
      return null;
    }
    return current.getEntry(path);
  }
  
  public Enumeration<String> getEntryPaths(String path)
  {
    Bundle current = systemBundle;
    if (current == null) {
      return null;
    }
    return current.getEntryPaths(path);
  }
  
  public Dictionary<String, String> getHeaders()
  {
    Bundle current = systemBundle;
    if (current == null) {
      return null;
    }
    return current.getHeaders();
  }
  
  public Dictionary<String, String> getHeaders(String locale)
  {
    Bundle current = systemBundle;
    if (current == null) {
      return null;
    }
    return current.getHeaders(locale);
  }
  
  public long getLastModified()
  {
    Bundle current = systemBundle;
    if (current == null) {
      return System.currentTimeMillis();
    }
    return current.getLastModified();
  }
  
  public String getLocation()
  {
    return "System Bundle";
  }
  
  public ServiceReference<?>[] getRegisteredServices()
  {
    Bundle current = systemBundle;
    if (current == null) {
      return null;
    }
    return current.getRegisteredServices();
  }
  
  public URL getResource(String name)
  {
    Bundle current = systemBundle;
    if (current == null) {
      return null;
    }
    return current.getResource(name);
  }
  
  public Enumeration<URL> getResources(String name)
    throws IOException
  {
    Bundle current = systemBundle;
    if (current == null) {
      return null;
    }
    return current.getResources(name);
  }
  
  public ServiceReference<?>[] getServicesInUse()
  {
    Bundle current = systemBundle;
    if (current == null) {
      return null;
    }
    return current.getServicesInUse();
  }
  
  public int getState()
  {
    Bundle current = systemBundle;
    if (current == null) {
      return 2;
    }
    return current.getState();
  }
  
  public String getSymbolicName()
  {
    return "org.eclipse.osgi";
  }
  
  public boolean hasPermission(Object permission)
  {
    Bundle current = systemBundle;
    if (current == null) {
      return false;
    }
    return current.hasPermission(permission);
  }
  
  public Class<?> loadClass(String name)
    throws ClassNotFoundException
  {
    Bundle current = systemBundle;
    if (current == null) {
      return null;
    }
    return current.loadClass(name);
  }
  
  public void start(int options)
    throws BundleException
  {
    start();
  }
  
  public void start()
    throws BundleException
  {
    checkAdminPermission("execute");
    if (System.getSecurityManager() == null) {
      internalStart();
    } else {
      try
      {
        AccessController.doPrivileged(new PrivilegedExceptionAction()
        {
          public Object run()
          {
            internalStart();
            return null;
          }
        });
      }
      catch (PrivilegedActionException e)
      {
        throw ((BundleException)e.getException());
      }
    }
  }
  
  private void checkAdminPermission(String actions)
  {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
      sm.checkPermission(new AdminPermission(this, actions));
    }
  }
  
  void internalStart()
  {
    if (getState() == 32) {
      return;
    }
    Framework current = internalInit();
    int level = 1;
    try
    {
      level = Integer.parseInt((String)configuration.get("org.osgi.framework.startlevel.beginning"));
    }
    catch (Throwable localThrowable) {}
    startLevelManager.doSetStartLevel(level, new FrameworkListener[0]);
  }
  
  public void stop(int options)
    throws BundleException
  {
    stop();
  }
  
  public void stop()
    throws BundleException
  {
    Bundle current = systemBundle;
    if (current == null) {
      return;
    }
    ConsoleManager currentConsole = consoleMgr;
    if (currentConsole != null)
    {
      currentConsole.stopConsole();
      consoleMgr = null;
    }
    current.stop();
  }
  
  public void uninstall()
    throws BundleException
  {
    throw new BundleException(Msg.BUNDLE_SYSTEMBUNDLE_UNINSTALL_EXCEPTION, 2);
  }
  
  public void update()
    throws BundleException
  {
    Bundle current = systemBundle;
    if (current == null) {
      return;
    }
    current.update();
  }
  
  public void update(InputStream in)
    throws BundleException
  {
    try
    {
      in.close();
    }
    catch (IOException localIOException) {}
    update();
  }
  
  public Map<X509Certificate, List<X509Certificate>> getSignerCertificates(int signersType)
  {
    Bundle current = systemBundle;
    if (current != null) {
      return current.getSignerCertificates(signersType);
    }
    Map<X509Certificate, List<X509Certificate>> empty = Collections.EMPTY_MAP;
    return empty;
  }
  
  public Version getVersion()
  {
    Bundle current = systemBundle;
    if (current != null) {
      return current.getVersion();
    }
    return Version.emptyVersion;
  }
  
  public <A> A adapt(Class<A> adapterType)
  {
    Bundle current = systemBundle;
    if (current != null) {
      return (A)current.adapt(adapterType);
    }
    return null;
  }
  
  public int compareTo(Bundle o)
  {
    Bundle current = systemBundle;
    if (current != null) {
      return current.compareTo(o);
    }
    throw new IllegalStateException();
  }
  
  public File getDataFile(String filename)
  {
    Bundle current = systemBundle;
    if (current != null) {
      return current.getDataFile(filename);
    }
    return null;
  }
}

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

import java.util.ArrayList;
import java.util.List;
import org.eclipse.osgi.internal.loader.BundleLoader;
import org.eclipse.osgi.internal.loader.BundleLoaderProxy;
import org.eclipse.osgi.internal.loader.PackageSource;
import org.eclipse.osgi.service.resolver.BundleDescription;
import org.eclipse.osgi.service.resolver.ExportPackageDescription;
import org.osgi.framework.Bundle;
import org.osgi.framework.Version;
import org.osgi.service.packageadmin.ExportedPackage;

/**
 * @deprecated
 */
public class ExportedPackageImpl
  implements ExportedPackage
{
  private final ExportPackageDescription exportedPackage;
  private final BundleLoaderProxy supplier;
  
  public ExportedPackageImpl(ExportPackageDescription exportedPackage, BundleLoaderProxy supplier)
  {
    this.exportedPackage = exportedPackage;
    this.supplier = supplier;
  }
  
  public String getName()
  {
    return exportedPackage.getName();
  }
  
  public Bundle getExportingBundle()
  {
    if (supplier.isStale()) {
      return null;
    }
    return supplier.getBundleHost();
  }
  
  AbstractBundle getBundle()
  {
    return supplier.getBundleHost();
  }
  
  public Bundle[] getImportingBundles()
  {
    if (supplier.isStale()) {
      return null;
    }
    AbstractBundle bundle = (AbstractBundle)getExportingBundle();
    if (bundle == null) {
      return null;
    }
    AbstractBundle[] bundles = framework.getAllBundles();
    List<Bundle> importers = new ArrayList(10);
    PackageSource supplierSource = supplier.createPackageSource(exportedPackage, false);
    for (int i = 0; i < bundles.length; i++) {
      if ((bundles[i] instanceof BundleHost))
      {
        BundleLoader loader = ((BundleHost)bundles[i]).getBundleLoader();
        if ((loader != null) && (loader.getBundle() != supplier.getBundle()))
        {
          PackageSource importerSource = loader.getPackageSource(getName());
          if ((supplierSource != null) && (supplierSource.hasCommonSource(importerSource))) {
            importers.add(bundles[i]);
          }
        }
      }
    }
    return (Bundle[])importers.toArray(new Bundle[importers.size()]);
  }
  
  /**
   * @deprecated
   */
  public String getSpecificationVersion()
  {
    return exportedPackage.getVersion().toString();
  }
  
  public Version getVersion()
  {
    return exportedPackage.getVersion();
  }
  
  public boolean isRemovalPending()
  {
    BundleDescription exporter = exportedPackage.getExporter();
    if (exporter != null) {
      return exporter.isRemovalPending();
    }
    return true;
  }
  
  public String toString()
  {
    StringBuffer result = new StringBuffer(getName());
    result.append("; ").append("version");
    result.append("=\"").append(exportedPackage.getVersion().toString()).append("\"");
    
    return result.toString();
  }
}

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

import java.util.ArrayList;
import java.util.List;
import org.eclipse.osgi.util.NLS;
import org.osgi.framework.InvalidSyntaxException;

class FilterImpl$Parser
{
  private final String filterstring;
  private final char[] filterChars;
  private int pos;
  
  FilterImpl$Parser(String filterstring)
  {
    this.filterstring = filterstring;
    filterChars = filterstring.toCharArray();
    pos = 0;
  }
  
  FilterImpl parse()
    throws InvalidSyntaxException
  {
    try
    {
      filter = parse_filter();
    }
    catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException)
    {
      FilterImpl filter;
      throw new InvalidSyntaxException(Msg.FILTER_TERMINATED_ABRUBTLY, filterstring);
    }
    FilterImpl filter;
    if (pos != filterChars.length) {
      throw new InvalidSyntaxException(NLS.bind(Msg.FILTER_TRAILING_CHARACTERS, filterstring.substring(pos)), filterstring);
    }
    return filter;
  }
  
  private FilterImpl parse_filter()
    throws InvalidSyntaxException
  {
    skipWhiteSpace();
    if (filterChars[pos] != '(') {
      throw new InvalidSyntaxException(NLS.bind(Msg.FILTER_MISSING_LEFTPAREN, filterstring.substring(pos)), filterstring);
    }
    pos += 1;
    
    FilterImpl filter = parse_filtercomp();
    
    skipWhiteSpace();
    if (filterChars[pos] != ')') {
      throw new InvalidSyntaxException(NLS.bind(Msg.FILTER_MISSING_RIGHTPAREN, filterstring.substring(pos)), filterstring);
    }
    pos += 1;
    
    skipWhiteSpace();
    
    return filter;
  }
  
  private FilterImpl parse_filtercomp()
    throws InvalidSyntaxException
  {
    skipWhiteSpace();
    
    char c = filterChars[pos];
    switch (c)
    {
    case '&': 
      pos += 1;
      return parse_and();
    case '|': 
      pos += 1;
      return parse_or();
    case '!': 
      pos += 1;
      return parse_not();
    }
    return parse_item();
  }
  
  private FilterImpl parse_and()
    throws InvalidSyntaxException
  {
    int lookahead = pos;
    skipWhiteSpace();
    if (filterChars[pos] != '(')
    {
      pos = (lookahead - 1);
      return parse_item();
    }
    List<FilterImpl> operands = new ArrayList(10);
    while (filterChars[pos] == '(')
    {
      FilterImpl child = parse_filter();
      operands.add(child);
    }
    return new FilterImpl(7, null, operands.toArray(new FilterImpl[operands.size()]));
  }
  
  private FilterImpl parse_or()
    throws InvalidSyntaxException
  {
    int lookahead = pos;
    skipWhiteSpace();
    if (filterChars[pos] != '(')
    {
      pos = (lookahead - 1);
      return parse_item();
    }
    List<FilterImpl> operands = new ArrayList(10);
    while (filterChars[pos] == '(')
    {
      FilterImpl child = parse_filter();
      operands.add(child);
    }
    return new FilterImpl(8, null, operands.toArray(new FilterImpl[operands.size()]));
  }
  
  private FilterImpl parse_not()
    throws InvalidSyntaxException
  {
    int lookahead = pos;
    skipWhiteSpace();
    if (filterChars[pos] != '(')
    {
      pos = (lookahead - 1);
      return parse_item();
    }
    FilterImpl child = parse_filter();
    
    return new FilterImpl(9, null, child);
  }
  
  private FilterImpl parse_item()
    throws InvalidSyntaxException
  {
    String attr = parse_attr();
    
    skipWhiteSpace();
    switch (filterChars[pos])
    {
    case '~': 
      if (filterChars[(pos + 1)] == '=')
      {
        pos += 2;
        return new FilterImpl(2, attr, parse_value());
      }
      break;
    case '>': 
      if (filterChars[(pos + 1)] == '=')
      {
        pos += 2;
        return new FilterImpl(3, attr, parse_value());
      }
      break;
    case '<': 
      if (filterChars[(pos + 1)] == '=')
      {
        pos += 2;
        return new FilterImpl(4, attr, parse_value());
      }
      break;
    case '=': 
      if (filterChars[(pos + 1)] == '*')
      {
        int oldpos = pos;
        pos += 2;
        skipWhiteSpace();
        if (filterChars[pos] == ')') {
          return new FilterImpl(5, attr, null);
        }
        pos = oldpos;
      }
      pos += 1;
      Object string = parse_substring();
      if ((string instanceof String)) {
        return new FilterImpl(1, attr, string);
      }
      return new FilterImpl(6, attr, string);
    }
    throw new InvalidSyntaxException(NLS.bind(Msg.FILTER_INVALID_OPERATOR, filterstring.substring(pos)), filterstring);
  }
  
  private String parse_attr()
    throws InvalidSyntaxException
  {
    skipWhiteSpace();
    
    int begin = pos;
    int end = pos;
    
    char c = filterChars[pos];
    while ((c != '~') && (c != '<') && (c != '>') && (c != '=') && (c != '(') && (c != ')'))
    {
      pos += 1;
      if (!Character.isWhitespace(c)) {
        end = pos;
      }
      c = filterChars[pos];
    }
    int length = end - begin;
    if (length == 0) {
      throw new InvalidSyntaxException(NLS.bind(Msg.FILTER_MISSING_ATTR, filterstring.substring(pos)), filterstring);
    }
    return new String(filterChars, begin, length);
  }
  
  private String parse_value()
    throws InvalidSyntaxException
  {
    StringBuffer sb = new StringBuffer(filterChars.length - pos);
    for (;;)
    {
      char c = filterChars[pos];
      switch (c)
      {
      case ')': 
        break;
      case '(': 
        throw new InvalidSyntaxException(NLS.bind(Msg.FILTER_INVALID_VALUE, filterstring.substring(pos)), filterstring);
      case '\\': 
        pos += 1;
        c = filterChars[pos];
      default: 
        sb.append(c);
        pos += 1;
      }
    }
    if (sb.length() == 0) {
      throw new InvalidSyntaxException(NLS.bind(Msg.FILTER_MISSING_VALUE, filterstring.substring(pos)), filterstring);
    }
    return sb.toString();
  }
  
  private Object parse_substring()
    throws InvalidSyntaxException
  {
    StringBuffer sb = new StringBuffer(filterChars.length - pos);
    
    List<String> operands = new ArrayList(10);
    for (;;)
    {
      char c = filterChars[pos];
      switch (c)
      {
      case ')': 
        if (sb.length() <= 0) {
          break label213;
        }
        operands.add(sb.toString());
        
        break;
      case '(': 
        throw new InvalidSyntaxException(NLS.bind(Msg.FILTER_INVALID_VALUE, filterstring.substring(pos)), filterstring);
      case '*': 
        if (sb.length() > 0) {
          operands.add(sb.toString());
        }
        sb.setLength(0);
        
        operands.add(null);
        pos += 1;
        
        break;
      case '\\': 
        pos += 1;
        c = filterChars[pos];
      default: 
        sb.append(c);
        pos += 1;
      }
    }
    label213:
    int size = operands.size();
    if (size == 0) {
      return "";
    }
    if (size == 1)
    {
      Object single = operands.get(0);
      if (single != null) {
        return single;
      }
    }
    return operands.toArray(new String[size]);
  }
  
  private void skipWhiteSpace()
  {
    for (int length = filterChars.length; (pos < length) && (Character.isWhitespace(filterChars[pos]));) {
      pos += 1;
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.framework.internal.core.FilterImpl.Parser
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.framework.internal.core;

import java.util.Dictionary;
import java.util.Enumeration;
import org.osgi.framework.ServiceReference;

class FilterImpl$ServiceReferenceDictionary
  extends Dictionary<String, Object>
{
  private final ServiceReference<?> reference;
  
  FilterImpl$ServiceReferenceDictionary(ServiceReference<?> reference)
  {
    this.reference = reference;
  }
  
  public Object get(Object key)
  {
    if (reference == null) {
      return null;
    }
    return reference.getProperty((String)key);
  }
  
  public boolean isEmpty()
  {
    throw new UnsupportedOperationException();
  }
  
  public Enumeration<String> keys()
  {
    throw new UnsupportedOperationException();
  }
  
  public Enumeration<Object> elements()
  {
    throw new UnsupportedOperationException();
  }
  
  public Object put(String key, Object value)
  {
    throw new UnsupportedOperationException();
  }
  
  public Object remove(Object key)
  {
    throw new UnsupportedOperationException();
  }
  
  public int size()
  {
    throw new UnsupportedOperationException();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.framework.internal.core.FilterImpl.ServiceReferenceDictionary
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.framework.internal.core;

import java.lang.reflect.AccessibleObject;
import java.security.PrivilegedAction;

class FilterImpl$SetAccessibleAction
  implements PrivilegedAction<Object>
{
  private final AccessibleObject accessible;
  
  FilterImpl$SetAccessibleAction(AccessibleObject accessible)
  {
    this.accessible = accessible;
  }
  
  public Object run()
  {
    accessible.setAccessible(true);
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.framework.internal.core.FilterImpl.SetAccessibleAction
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.framework.internal.core;

import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
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 java.util.Map;
import org.eclipse.osgi.framework.debug.Debug;
import org.eclipse.osgi.framework.util.Headers;
import org.eclipse.osgi.internal.serviceregistry.ServiceReferenceImpl;
import org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl;
import org.eclipse.osgi.util.NLS;
import org.osgi.framework.Filter;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceReference;

public class FilterImpl
  implements Filter
{
  private final int op;
  private static final int EQUAL = 1;
  private static final int APPROX = 2;
  private static final int GREATER = 3;
  private static final int LESS = 4;
  private static final int PRESENT = 5;
  private static final int SUBSTRING = 6;
  private static final int AND = 7;
  private static final int OR = 8;
  private static final int NOT = 9;
  private final String attr;
  private final Object value;
  private volatile transient String filterString;
  
  public static FilterImpl newInstance(String filterString)
    throws InvalidSyntaxException
  {
    return new Parser(filterString).parse();
  }
  
  public boolean match(ServiceReference<?> reference)
  {
    if ((reference instanceof ServiceReferenceImpl)) {
      return matchCase(((ServiceReferenceImpl)reference).getRegistration().getProperties());
    }
    return matchCase(new ServiceReferenceDictionary(reference));
  }
  
  public boolean match(Dictionary<String, ?> dictionary)
  {
    if (dictionary != null) {
      dictionary = new Headers(dictionary);
    }
    return matchCase(dictionary);
  }
  
  public boolean matchCase(Dictionary<String, ?> dictionary)
  {
    FilterImpl[] arrayOfFilterImpl1;
    int j;
    int i;
    switch (op)
    {
    case 7: 
      FilterImpl[] filters = (FilterImpl[])value;
      j = (arrayOfFilterImpl1 = filters).length;
      for (i = 0; i < j; i++)
      {
        FilterImpl f = arrayOfFilterImpl1[i];
        if (!f.matchCase(dictionary)) {
          return false;
        }
      }
      return true;
    case 8: 
      FilterImpl[] filters = (FilterImpl[])value;
      j = (arrayOfFilterImpl1 = filters).length;
      for (i = 0; i < j; i++)
      {
        FilterImpl f = arrayOfFilterImpl1[i];
        if (f.matchCase(dictionary)) {
          return true;
        }
      }
      return false;
    case 9: 
      FilterImpl filter = (FilterImpl)value;
      
      return !filter.matchCase(dictionary);
    case 1: 
    case 2: 
    case 3: 
    case 4: 
    case 6: 
      Object prop = dictionary == null ? null : dictionary.get(attr);
      
      return compare(op, prop, value);
    case 5: 
      if (Debug.DEBUG_FILTER) {
        Debug.println("PRESENT(" + attr + ")");
      }
      Object prop = dictionary == null ? null : dictionary.get(attr);
      
      return prop != null;
    }
    return false;
  }
  
  public boolean matches(Map<String, ?> map)
  {
    FilterImpl[] arrayOfFilterImpl1;
    int j;
    int i;
    switch (op)
    {
    case 7: 
      FilterImpl[] filters = (FilterImpl[])value;
      j = (arrayOfFilterImpl1 = filters).length;
      for (i = 0; i < j; i++)
      {
        FilterImpl f = arrayOfFilterImpl1[i];
        if (!f.matches(map)) {
          return false;
        }
      }
      return true;
    case 8: 
      FilterImpl[] filters = (FilterImpl[])value;
      j = (arrayOfFilterImpl1 = filters).length;
      for (i = 0; i < j; i++)
      {
        FilterImpl f = arrayOfFilterImpl1[i];
        if (f.matches(map)) {
          return true;
        }
      }
      return false;
    case 9: 
      FilterImpl filter = (FilterImpl)value;
      
      return !filter.matches(map);
    case 1: 
    case 2: 
    case 3: 
    case 4: 
    case 6: 
      Object prop = map == null ? null : map.get(attr);
      
      return compare(op, prop, value);
    case 5: 
      if (Debug.DEBUG_FILTER) {
        Debug.println("PRESENT(" + attr + ")");
      }
      Object prop = map == null ? null : map.get(attr);
      
      return prop != null;
    }
    return false;
  }
  
  public String toString()
  {
    String result = filterString;
    if (result == null) {
      filterString = (result =
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