org.eclipse.osgi_3.8.2.v20130124-134944

Impl
    //   5	10	1	Ljava/lang/Object;	Object
    // Exception table:
    //   from	to	target	type
    //   7	13	14	finally
    //   14	16	14	finally
  }
  
  /* Error */
  public BundleDescription[] getResolvedBundles()
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 1028	org/eclipse/osgi/internal/resolver/StateImpl:monitor	Ljava/lang/Object;
    //   4: dup
    //   5: astore_1
    //   6: monitorenter
    //   7: aload_0
    //   8: getfield 1036	org/eclipse/osgi/internal/resolver/StateImpl:resolvedBundles	Lorg/eclipse/osgi/framework/util/KeyedHashSet;
    //   11: aload_0
    //   12: getfield 1036	org/eclipse/osgi/internal/resolver/StateImpl:resolvedBundles	Lorg/eclipse/osgi/framework/util/KeyedHashSet;
    //   15: invokevirtual 1097	org/eclipse/osgi/framework/util/KeyedHashSet:size	()I
    //   18: anewarray 577	org/eclipse/osgi/service/resolver/BundleDescription
    //   21: invokevirtual 1105	org/eclipse/osgi/framework/util/KeyedHashSet:elements	([Ljava/lang/Object;)[Ljava/lang/Object;
    //   24: checkcast 521	[Lorg/eclipse/osgi/service/resolver/BundleDescription;
    //   27: aload_1
    //   28: monitorexit
    //   29: areturn
    //   30: aload_1
    //   31: monitorexit
    //   32: athrow
    // Line number table:
    //   Java source line #598	-> byte code offset #0
    //   Java source line #599	-> byte code offset #7
    //   Java source line #598	-> byte code offset #30
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	33	0	this	StateImpl
    //   5	26	1	Ljava/lang/Object;	Object
    // Exception table:
    //   from	to	target	type
    //   7	29	30	finally
    //   30	32	30	finally
  }
  
  /* Error */
  public boolean isEmpty()
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 1028	org/eclipse/osgi/internal/resolver/StateImpl:monitor	Ljava/lang/Object;
    //   4: dup
    //   5: astore_1
    //   6: monitorenter
    //   7: aload_0
    //   8: getfield 1035	org/eclipse/osgi/internal/resolver/StateImpl:bundleDescriptions	Lorg/eclipse/osgi/framework/util/KeyedHashSet;
    //   11: invokevirtual 1100	org/eclipse/osgi/framework/util/KeyedHashSet:isEmpty	()Z
    //   14: aload_1
    //   15: monitorexit
    //   16: ireturn
    //   17: aload_1
    //   18: monitorexit
    //   19: athrow
    // Line number table:
    //   Java source line #604	-> byte code offset #0
    //   Java source line #605	-> byte code offset #7
    //   Java source line #604	-> byte code offset #17
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	20	0	this	StateImpl
    //   5	13	1	Ljava/lang/Object;	Object
    // Exception table:
    //   from	to	target	type
    //   7	16	17	finally
    //   17	19	17	finally
  }
  
  void setResolved(boolean resolved)
  {
    synchronized (monitor)
    {
      this.resolved = resolved;
    }
  }
  
  boolean basicAddBundle(BundleDescription description)
  {
    synchronized (monitor)
    {
      StateImpl origState = (StateImpl)description.getContainingState();
      if ((origState != null) && (origState != this))
      {
        if (removalPendings.contains(description)) {
          throw new IllegalStateException(NLS.bind(StateMsg.BUNDLE_PENDING_REMOVE_STATE, description.toString()));
        }
        if (origState.getBundle(description.getBundleId()) == description) {
          throw new IllegalStateException(NLS.bind(StateMsg.BUNDLE_IN_OTHER_STATE, description.toString()));
        }
      }
      ((BundleDescriptionImpl)description).setContainingState(this);
      ((BundleDescriptionImpl)description).setStateBit(4, false);
      if (bundleDescriptions.add((BundleDescriptionImpl)description))
      {
        if (description.getBundleId() > getHighestBundleId()) {
          highestBundleId = description.getBundleId();
        }
        return true;
      }
      return false;
    }
  }
  
  void addResolvedBundle(BundleDescriptionImpl resolvedBundle)
  {
    synchronized (monitor)
    {
      resolvedBundles.add(resolvedBundle);
    }
  }
  
  public ExportPackageDescription[] getExportedPackages()
  {
    fullyLoad();
    synchronized (monitor)
    {
      List<ExportPackageDescription> allExportedPackages = new ArrayList();
      for (Iterator<KeyedElement> iter = resolvedBundles.iterator(); iter.hasNext();)
      {
        BundleDescription bundle = (BundleDescription)iter.next();
        ExportPackageDescription[] bundlePackages = bundle.getSelectedExports();
        if (bundlePackages != null) {
          for (int i = 0; i < bundlePackages.length; i++) {
            allExportedPackages.add(bundlePackages[i]);
          }
        }
      }
      for (Iterator<BundleDescription> iter = removalPendings.iterator(); iter.hasNext();)
      {
        BundleDescription bundle = (BundleDescription)iter.next();
        ExportPackageDescription[] bundlePackages = bundle.getSelectedExports();
        if (bundlePackages != null) {
          for (int i = 0; i < bundlePackages.length; i++) {
            allExportedPackages.add(bundlePackages[i]);
          }
        }
      }
      return (ExportPackageDescription[])allExportedPackages.toArray(new ExportPackageDescription[allExportedPackages.size()]);
    }
  }
  
  BundleDescription[] getFragments(BundleDescription host)
  {
    List<BundleDescription> fragments = new ArrayList();
    synchronized (monitor)
    {
      for (Iterator<KeyedElement> iter = bundleDescriptions.iterator(); iter.hasNext();)
      {
        BundleDescription bundle = (BundleDescription)iter.next();
        HostSpecification hostSpec = bundle.getHost();
        if (hostSpec != null)
        {
          BundleDescription[] hosts = hostSpec.getHosts();
          if (hosts != null) {
            for (int i = 0; i < hosts.length; i++) {
              if (hosts[i] == host)
              {
                fragments.add(bundle);
                break;
              }
            }
          }
        }
      }
    }
    return (BundleDescription[])fragments.toArray(new BundleDescription[fragments.size()]);
  }
  
  public void setTimeStamp(long newTimeStamp)
  {
    synchronized (monitor)
    {
      timeStamp = newTimeStamp;
    }
  }
  
  private void updateTimeStamp()
  {
    synchronized (monitor)
    {
      if (getTimeStamp() == Long.MAX_VALUE) {
        setTimeStamp(0L);
      }
      setTimeStamp(getTimeStamp() + 1L);
    }
  }
  
  public StateObjectFactory getFactory()
  {
    return factory;
  }
  
  void setFactory(StateObjectFactory factory)
  {
    this.factory = factory;
  }
  
  public BundleDescription getBundleByLocation(String location)
  {
    synchronized (monitor)
    {
      for (Iterator<KeyedElement> i = bundleDescriptions.iterator(); i.hasNext();)
      {
        BundleDescription current = (BundleDescription)i.next();
        if (location.equals(current.getLocation())) {
          return current;
        }
      }
      return null;
    }
  }
  
  /* Error */
  public Resolver getResolver()
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 1028	org/eclipse/osgi/internal/resolver/StateImpl:monitor	Ljava/lang/Object;
    //   4: dup
    //   5: astore_1
    //   6: monitorenter
    //   7: aload_0
    //   8: getfield 1040	org/eclipse/osgi/internal/resolver/StateImpl:resolver	Lorg/eclipse/osgi/service/resolver/Resolver;
    //   11: aload_1
    //   12: monitorexit
    //   13: areturn
    //   14: aload_1
    //   15: monitorexit
    //   16: athrow
    // Line number table:
    //   Java source line #720	-> byte code offset #0
    //   Java source line #721	-> byte code offset #7
    //   Java source line #720	-> byte code offset #14
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	17	0	this	StateImpl
    //   5	10	1	Ljava/lang/Object;	Object
    // Exception table:
    //   from	to	target	type
    //   7	13	14	finally
    //   14	16	14	finally
  }
  
  public void setResolver(Resolver newResolver)
  {
    if (resolver == newResolver) {
      return;
    }
    if (resolver != null)
    {
      Resolver oldResolver = resolver;
      resolver = null;
      oldResolver.setState(null);
    }
    synchronized (monitor)
    {
      resolver = newResolver;
    }
    if (resolver == null) {
      return;
    }
    resolver.setState(this);
  }
  
  public boolean setPlatformProperties(Dictionary<?, ?> platformProperties)
  {
    return setPlatformProperties(new Dictionary[] { platformProperties });
  }
  
  public boolean setPlatformProperties(Dictionary<?, ?>[] platformProperties)
  {
    return setPlatformProperties(platformProperties, true);
  }
  
  synchronized boolean setPlatformProperties(Dictionary<?, ?>[] platformProperties, boolean resetSystemExports)
  {
    if (platformProperties.length == 0) {
      throw new IllegalArgumentException();
    }
    Dictionary[] newPlatformProperties = new Dictionary[platformProperties.length];
    for (int i = 0; i < platformProperties.length; i++)
    {
      newPlatformProperties[i] = new Hashtable(platformProperties[i].size());
      synchronized (platformProperties[i])
      {
        for (Enumeration<?> keys = platformProperties[i].keys(); keys.hasMoreElements();)
        {
          Object key = keys.nextElement();
          Object value = platformProperties[i].get(key);
          newPlatformProperties[i].put(key, value);
        }
      }
      if ((newPlatformProperties[i].get("org.osgi.framework.os.name") == null) && (newPlatformProperties[i].get("osgi.os") != null)) {
        newPlatformProperties[i].put("org.osgi.framework.os.name", newPlatformProperties[i].get("osgi.os"));
      }
      if ((newPlatformProperties[i].get("org.osgi.framework.processor") == null) && (newPlatformProperties[i].get("osgi.arch") != null)) {
        newPlatformProperties[i].put("org.osgi.framework.processor", newPlatformProperties[i].get("osgi.arch"));
      }
      if ((newPlatformProperties[i].get("org.osgi.framework.language") == null) && ((newPlatformProperties[i].get("osgi.nl") instanceof String)))
      {
        String osgiNL = (String)newPlatformProperties[i].get("osgi.nl");
        int idx = osgiNL.indexOf('_');
        if (idx >= 0) {
          osgiNL = osgiNL.substring(0, idx);
        }
        newPlatformProperties[i].put("org.osgi.framework.language", osgiNL);
      }
    }
    boolean result = false;
    boolean performResetSystemExports = false;
    boolean performResetSystemCapabilities = false;
    if (this.platformProperties.length != newPlatformProperties.length)
    {
      result = true;
      performResetSystemExports = true;
      performResetSystemCapabilities = true;
    }
    else
    {
      String[] keys = getPlatformPropertyKeys();
      for (int i = 0; (i < newPlatformProperties.length) && (!result); i++)
      {
        result |= changedProps(this.platformProperties[i], newPlatformProperties[i], keys);
        if (resetSystemExports)
        {
          performResetSystemExports |= checkProp(this.platformProperties[i].get("org.osgi.framework.system.packages"), newPlatformProperties[i].get("org.osgi.framework.system.packages"));
          performResetSystemExports |= checkProp(this.platformProperties[i].get("org.osgi.framework.system.packages.extra"), newPlatformProperties[i].get("org.osgi.framework.system.packages.extra"));
          performResetSystemExports |= checkProp(this.platformProperties[i].get("system.bundle"), newPlatformProperties[i].get("system.bundle"));
          performResetSystemCapabilities |= checkProp(this.platformProperties[i].get("org.osgi.framework.system.capabilities"), newPlatformProperties[i].get("org.osgi.framework.system.capabilities"));
          performResetSystemCapabilities |= checkProp(this.platformProperties[i].get("org.osgi.framework.system.capabilities.extra"), newPlatformProperties[i].get("org.osgi.framework.system.capabilities.extra"));
          performResetSystemCapabilities |= checkProp(this.platformProperties[i].get("org.osgi.framework.executionenvironment"), newPlatformProperties[i].get("org.osgi.framework.executionenvironment"));
        }
      }
    }
    this.platformProperties = newPlatformProperties;
    if (performResetSystemExports) {
      resetSystemExports();
    }
    if (performResetSystemCapabilities) {
      resetSystemCapabilities();
    }
    developmentMode = (this.platformProperties.length == 0 ? false : "development".equals(this.platformProperties[0].get("osgi.resolverMode")));
    return result;
  }
  
  private void resetAllSystemCapabilities()
  {
    resetSystemExports();
    resetSystemCapabilities();
  }
  
  private void resetSystemExports()
  {
    BundleDescription[] systemBundles = getBundles("system.bundle");
    for (int idx = 0; idx < systemBundles.length; idx++)
    {
      BundleDescriptionImpl systemBundle = (BundleDescriptionImpl)systemBundles[idx];
      ExportPackageDescription[] exports = systemBundle.getExportPackages();
      List<ExportPackageDescription> newExports = new ArrayList(exports.length);
      for (int i = 0; i < exports.length; i++) {
        if (((Integer)exports[i].getDirective("x-equinox-ee")).intValue() < 0) {
          newExports.add(exports[i]);
        }
      }
      addSystemExports(newExports);
      systemBundle.setExportPackages((ExportPackageDescription[])newExports.toArray(new ExportPackageDescription[newExports.size()]));
    }
  }
  
  private void addSystemExports(List<ExportPackageDescription> exports)
  {
    for (int i = 0; i < platformProperties.length; i++) {
      try
      {
        addSystemExports(exports, ManifestElement.parseHeader("Export-Package", (String)platformProperties[i].get("org.osgi.framework.system.packages")), i);
        addSystemExports(exports, ManifestElement.parseHeader("Export-Package", (String)platformProperties[i].get("org.osgi.framework.system.packages.extra")), i);
      }
      catch (BundleException localBundleException) {}
    }
  }
  
  private void addSystemExports(List<ExportPackageDescription> exports, ManifestElement[] elements, int index)
  {
    if (elements == null) {
      return;
    }
    ExportPackageDescription[] systemExports = StateBuilder.createExportPackages(elements, null, null, false);
    Integer profInx = new Integer(index);
    for (int j = 0; j < systemExports.length; j++)
    {
      ((ExportPackageDescriptionImpl)systemExports[j]).setDirective("x-equinox-ee", profInx);
      exports.add(systemExports[j]);
    }
  }
  
  private void resetSystemCapabilities()
  {
    BundleDescription[] systemBundles = getBundles("system.bundle");
    BundleDescription[] arrayOfBundleDescription1;
    int j = (arrayOfBundleDescription1 = systemBundles).length;
    for (int i = 0; i < j; i++)
    {
      BundleDescription systemBundle = arrayOfBundleDescription1[i];
      GenericDescription[] capabilities = systemBundle.getGenericCapabilities();
      List<GenericDescription> newCapabilities = new ArrayList(capabilities.length);
      GenericDescription[] arrayOfGenericDescription1;
      int m = (arrayOfGenericDescription1 = capabilities).length;
      for (int k = 0; k < m; k++)
      {
        GenericDescription capability = arrayOfGenericDescription1[k];
        Object equinoxEEIndex = capability.getDeclaredAttributes().get("x-equinox-ee");
        if (equinoxEEIndex == null) {
          newCapabilities.add(capability);
        }
      }
      addSystemCapabilities(newCapabilities);
      ((BundleDescriptionImpl)systemBundle).setGenericCapabilities((GenericDescription[])newCapabilities.toArray(new GenericDescription[newCapabilities.size()]));
    }
  }
  
  private void addSystemCapabilities(List<GenericDescription> capabilities)
  {
    for (int i = 0; i < platformProperties.length; i++) {
      try
      {
        addSystemCapabilities(capabilities, ManifestElement.parseHeader("Provide-Capability", (String)platformProperties[i].get("org.osgi.framework.system.capabilities")), new Integer(i));
        addSystemCapabilities(capabilities, ManifestElement.parseHeader("Provide-Capability", (String)platformProperties[i].get("org.osgi.framework.system.capabilities.extra")), new Integer(i));
        checkOSGiEE(capabilities, (String)platformProperties[i].get("org.osgi.framework.executionenvironment"), new Integer(i));
      }
      catch (BundleException localBundleException) {}
    }
  }
  
  private void checkOSGiEE(List<GenericDescription> capabilities, String profileEE, Integer profileIndex)
  {
    if ((profileEE == null) || (profileEE.length() == 0)) {
      return;
    }
    for (Iterator localIterator1 = capabilities.iterator(); localIterator1.hasNext();)
    {
      GenericDescription capability = (GenericDescription)localIterator1.next();
      if (("osgi.ee".equals(capability.getType())) && (profileIndex.equals(capability.getAttributes().get("x-equinox-ee")))) {
        return;
      }
    }
    Map<String, List<String>> eeVersions = new HashMap();
    String[] ees = ManifestElement.getArrayFromList(profileEE);
    String[] arrayOfString1;
    int j = (arrayOfString1 = ees).length;
    for (int i = 0; i < j; i++)
    {
      String ee = arrayOfString1[i];
      String[] eeNameVersion = StateBuilder.getOSGiEENameVersion(ee);
      
      List<String> versions = (List)eeVersions.get(eeNameVersion[0]);
      if (versions == null)
      {
        versions = new ArrayList();
        eeVersions.put(eeNameVersion[0], versions);
      }
      if ((eeNameVersion[1] != null) && (!versions.contains(eeNameVersion[1]))) {
        versions.add(eeNameVersion[1]);
      }
    }
    for (Iterator localIterator2 = eeVersions.entrySet().iterator(); localIterator2.hasNext();)
    {
      Map.Entry<String, List<String>> eeVersion = (Map.Entry)localIterator2.next();
      GenericDescriptionImpl capability = new GenericDescriptionImpl();
      capability.setType("osgi.ee");
      Object attributes = new Hashtable();
      ((Dictionary)attributes).put(capability.getType(), eeVersion.getKey());
      if (((List)eeVersion.getValue()).size() > 0)
      {
        List<Version> versions = new ArrayList(((List)eeVersion.getValue()).size());
        for (Iterator localIterator3 = ((List)eeVersion.getValue()).iterator(); localIterator3.hasNext();)
        {
          String version = (String)localIterator3.next();
          versions.add(new Version(version));
        }
        ((Dictionary)attributes).put("version", versions);
      }
      ((Dictionary)attributes).put("x-equinox-ee", profileIndex);
      capability.setAttributes((Dictionary)attributes);
      capabilities.add(capability);
    }
  }
  
  private void addSystemCapabilities(List<GenericDescription> capabilities, ManifestElement[] elements, Integer profileIndex)
  {
    try
    {
      StateBuilder.createOSGiCapabilities(elements, capabilities, profileIndex);
    }
    catch (BundleException e)
    {
      throw new RuntimeException("Unexpected exception adding system capabilities.", e);
    }
  }
  
  public Dictionary[] getPlatformProperties()
  {
    return platformProperties;
  }
  
  private boolean checkProp(Object origObj, Object newObj)
  {
    if (((origObj == null) && (newObj != null)) || ((origObj != null) && (newObj == null))) {
      return true;
    }
    if (origObj == null) {
      return false;
    }
    if (origObj.getClass() != newObj.getClass()) {
      return true;
    }
    if ((origObj instanceof String[]))
    {
      String[] origProps = (String[])origObj;
      String[] newProps = (String[])newObj;
      if (origProps.length != newProps.length) {
        return true;
      }
      for (int i = 0; i < origProps.length; i++) {
        if (!origProps[i].equals(newProps[i])) {
          return true;
        }
      }
      return false;
    }
    return !origObj.equals(newObj);
  }
  
  private boolean changedProps(Dictionary<Object, Object> origProps, Dictionary<Object, Object> newProps, String[] keys)
  {
    for (int i = 0; i < keys.length; i++)
    {
      Object origProp = origProps.get(keys[i]);
      Object newProp = newProps.get(keys[i]);
      if (checkProp(origProp, newProp)) {
        return true;
      }
    }
    return false;
  }
  
  public String getSystemBundle()
  {
    String symbolicName = null;
    if ((platformProperties != null) && (platformProperties.length > 0)) {
      symbolicName = (String)platformProperties[0].get("osgi.system.bundle");
    }
    return symbolicName != null ? symbolicName : Constants.getInternalSymbolicName();
  }
  
  /* Error */
  public BundleDescription[] getRemovalPending()
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 1028	org/eclipse/osgi/internal/resolver/StateImpl:monitor	Ljava/lang/Object;
    //   4: dup
    //   5: astore_1
    //   6: monitorenter
    //   7: aload_0
    //   8: getfield 1031	org/eclipse/osgi/internal/resolver/StateImpl:removalPendings	Ljava/util/LinkedList;
    //   11: aload_0
    //   12: getfield 1031	org/eclipse/osgi/internal/resolver/StateImpl:removalPendings	Ljava/util/LinkedList;
    //   15: invokevirtual 1082	java/util/LinkedList:size	()I
    //   18: anewarray 577	org/eclipse/osgi/service/resolver/BundleDescription
    //   21: invokevirtual 1088	java/util/LinkedList:toArray	([Ljava/lang/Object;)[Ljava/lang/Object;
    //   24: checkcast 521	[Lorg/eclipse/osgi/service/resolver/BundleDescription;
    //   27: aload_1
    //   28: monitorexit
    //   29: areturn
    //   30: aload_1
    //   31: monitorexit
    //   32: athrow
    // Line number table:
    //   Java source line #968	-> byte code offset #0
    //   Java source line #969	-> byte code offset #7
    //   Java source line #968	-> byte code offset #30
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	33	0	this	StateImpl
    //   5	26	1	Ljava/lang/Object;	Object
    // Exception table:
    //   from	to	target	type
    //   7	29	30	finally
    //   30	32	30	finally
  }
  
  private void addRemovalPending(BundleDescription removed)
  {
    synchronized (monitor)
    {
      if (!removalPendings.contains(removed)) {
        removalPendings.addFirst(removed);
      }
    }
  }
  
  public Collection<BundleDescription> getDependencyClosure(Collection<BundleDescription> bundles)
  {
    BundleDescription[] removals = getRemovalPending();
    Set<BundleDescription> result = new HashSet();
    for (Iterator localIterator = bundles.iterator(); localIterator.hasNext();)
    {
      BundleDescription bundle = (BundleDescription)localIterator.next();
      addDependents(bundle, result, removals);
    }
    return result;
  }
  
  private static void addDependents(BundleDescription bundle, Set<BundleDescription> result, BundleDescription[] removals)
  {
    if (result.contains(bundle)) {
      return;
    }
    result.add(bundle);
    BundleDescription[] dependents = bundle.getDependents();
    BundleDescription[] arrayOfBundleDescription1;
    int j = (arrayOfBundleDescription1 = dependents).length;
    for (int i = 0; i < j; i++)
    {
      BundleDescription dependent = arrayOfBundleDescription1[i];
      addDependents(dependent, result, removals);
    }
    j = (arrayOfBundleDescription1 = removals).length;
    for (i = 0; i < j; i++)
    {
      BundleDescription removed = arrayOfBundleDescription1[i];
      if (removed.getBundleId() == bundle.getBundleId()) {
        addDependents(removed, result, removals);
      }
    }
  }
  
  private BundleDescription[] internalGetRemovalPending()
  {
    synchronized (monitor)
    {
      Iterator<BundleDescription> removed = removalPendings.iterator();
      BundleDescription[] result = new BundleDescription[removalPendings.size()];
      int i = 0;
      while (removed.hasNext()) {
        result[(i++)] = getBundle(((BundleDescription)removed.next()).getBundleId());
      }
      return result;
    }
  }
  
  public ExportPackageDescription linkDynamicImport(BundleDescription importingBundle, String requestedPackage)
  {
    if (resolver == null) {
      throw new IllegalStateException("no resolver set");
    }
    BundleDescriptionImpl importer = (BundleDescriptionImpl)importingBundle;
    if (importer.getDynamicStamp(requestedPackage) == getTimeStamp()) {
      return null;
    }
    fullyLoad();
    synchronized (monitor)
    {
      ResolverHook currentHook = null;
      try
      {
        resolving = true;
        ResolverHookFactory currentFactory = hookFactory;
        if (currentFactory != null)
        {
          Collection<BundleRevision> triggers = new ArrayList(1);
          triggers.add(importingBundle);
          triggers = Collections.unmodifiableCollection(triggers);
          currentHook = begin(triggers);
        }
        ExportPackageDescriptionImpl result = (ExportPackageDescriptionImpl)resolver.resolveDynamicImport(importingBundle, requestedPackage);
        if (result == null)
        {
          importer.setDynamicStamp(requestedPackage, new Long(getTimeStamp()));
        }
        else
        {
          importer.setDynamicStamp(requestedPackage, null);
          
          importer.addDynamicResolvedImport(result);
        }
        setDynamicCacheChanged(true);
        ExportPackageDescriptionImpl localExportPackageDescriptionImpl1 = result;
        
        resolving = false;
        if (currentHook != null) {
          currentHook.end();
        }
        return localExportPackageDescriptionImpl1;
      }
      finally
      {
        localObject1 = finally;
        resolving = false;
        if (currentHook != null) {
          currentHook.end();
        }
        throw ((Throwable)localObject1);
      }
    }
  }
  
  public void addDynamicImportPackages(BundleDescription importingBundle, ImportPackageSpecification[] dynamicImports)
  {
    synchronized (monitor)
    {
      ((BundleDescriptionImpl)importingBundle).addDynamicImportPackages(dynamicImports);
      setDynamicCacheChanged(true);
    }
  }
  
  void setReader(StateReader reader)
  {
    synchronized (monitor)
    {
      this.reader = reader;
    }
  }
  
  /* Error */
  StateReader getReader()
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 1028	org/eclipse/osgi/internal/resolver/StateImpl:monitor	Ljava/lang/Object;
    //   4: dup
    //   5: astore_1
    //   6: monitorenter
    //   7: aload_0
    //   8: getfield 1038	org/eclipse/osgi/internal/resolver/StateImpl:reader	Lorg/eclipse/osgi/internal/resolver/StateReader;
    //   11: aload_1
    //   12: monitorexit
    //   13: areturn
    //   14: aload_1
    //   15: monitorexit
    //   16: athrow
    // Line number table:
    //   Java source line #1071	-> byte code offset #0
    //   Java source line #1072	-> byte code offset #7
    //   Java source line #1071	-> byte code offset #14
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	17	0	this	StateImpl
    //   5	10	1	Ljava/lang/Object;	Object
    // Exception table:
    //   from	to	target	type
    //   7	13	14	finally
    //   14	16	14	finally
  }
  
  public final void fullyLoad()
  {
    synchronized (monitor)
    {
      if (reader == null) {
        return;
      }
      if (fullyLoaded) {
        return;
      }
      if (reader.isLazyLoaded()) {
        reader.fullyLoad();
      }
      fullyLoaded = true;
    }
  }
  
  public final boolean unloadLazyData(long checkStamp)
  {
    synchronized (monitor)
    {
      if ((checkStamp != getTimeStamp()) || (dynamicCacheChanged())) {
        return false;
      }
      if (reader.getAccessedFlag())
      {
        reader.setAccessedFlag(false);
        return true;
      }
      fullyLoaded = false;
      BundleDescription[] bundles = getBundles();
      for (int i = 0; i < bundles.length; i++) {
        ((BundleDescriptionImpl)bundles[i]).unload();
      }
      reader.flushLazyObjectCache();
      resolver.flush();
      return true;
    }
  }
  
  public ExportPackageDescription[] getSystemPackages()
  {
    synchronized (monitor)
    {
      List<ExportPackageDescription> result = new ArrayList();
      BundleDescription[] systemBundles = getBundles("system.bundle");
      if (systemBundles.length > 0)
      {
        BundleDescriptionImpl systemBundle = (BundleDescriptionImpl)systemBundles[0];
        ExportPackageDescription[] exports = systemBundle.getExportPackages();
        for (int i = 0; i < exports.length; i++) {
          if (((Integer)exports[i].getDirective("x-equinox-ee")).intValue() >= 0) {
            result.add(exports[i]);
          }
        }
      }
      return (ExportPackageDescription[])result.toArray(new ExportPackageDescription[result.size()]);
    }
  }
  
  /* Error */
  boolean inStrictMode()
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 1028	org/eclipse/osgi/internal/resolver/StateImpl:monitor	Ljava/lang/Object;
    //   4: dup
    //   5: astore_1
    //   6: monitorenter
    //   7: ldc_w 516
    //   10: aload_0
    //   11: invokevirtual 1175	org/eclipse/osgi/internal/resolver/StateImpl:getPlatformProperties	()[Ljava/util/Dictionary;
    //   14: iconst_0
    //   15: aaload
    //   16: ldc 16
    //   18: invokevirtual 1075	java/util/Dictionary:get	(Ljava/lang/Object;)Ljava/lang/Object;
    //   21: invokevirtual 1062	java/lang/String:equals	(Ljava/lang/Object;)Z
    //   24: aload_1
    //   25: monitorexit
    //   26: ireturn
    //   27: aload_1
    //   28: monitorexit
    //   29: athrow
    // Line number table:
    //   Java source line #1125	-> byte code offset #0
    //   Java source line #1126	-> byte code offset #7
    //   Java source line #1125	-> byte code offset #27
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	30	0	this	StateImpl
    //   5	23	1	Ljava/lang/Object;	Object
    // Exception table:
    //   from	to	target	type
    //   7	26	27	finally
    //   27	29	27	finally
  }
  
  public ResolverError[] getResolverErrors(BundleDescription bundle)
  {
    synchronized (monitor)
    {
      if (bundle.isResolved()) {
        return new ResolverError[0];
      }
      List<ResolverError> result = (List)resolverErrors.get(bundle);
      return result == null ? new ResolverError[0] : (ResolverError[])result.toArray(new ResolverError[result.size()]);
    }
  }
  
  public void addResolverError(BundleDescription bundle, int type, String data, VersionConstraint unsatisfied)
  {
    synchronized (monitor)
    {
      if (!resolving) {
        throw new IllegalStateException();
      }
      List<ResolverError> errors = (List)resolverErrors.get(bundle);
      if (errors == null)
      {
        errors = new ArrayList(1);
        resolverErrors.put(bundle, errors);
      }
      errors.add(new ResolverErrorImpl((BundleDescriptionImpl)bundle, type, data, unsatisfied));
    }
  }
  
  public void removeResolverErrors(BundleDescription bundle)
  {
    synchronized (monitor)
    {
      if (!resolving) {
        throw new IllegalStateException();
      }
      resolverErrors.remove(bundle);
    }
  }
  
  /* Error */
  public boolean dynamicCacheChanged()
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 1028	org/eclipse/osgi/internal/resolver/StateImpl:monitor	Ljava/lang/Object;
    //   4: dup
    //   5: astore_1
    //   6: monitorenter
    //   7: aload_0
    //   8: getfield 1024	org/eclipse/osgi/internal/resolver/StateImpl:dynamicCacheChanged	Z
    //   11: aload_1
    //   12: monitorexit
    //   13: ireturn
    //   14: aload_1
    //   15: monitorexit
    //   16: athrow
    // Line number table:
    //   Java source line #1161	-> byte code offset #0
    //   Java source line #1162	-> byte code offset #7
    //   Java source line #1161	-> byte code offset #14
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	17	0	this	StateImpl
    //   5	10	1	Ljava/lang/Object;	Object
    // Exception table:
    //   from	to	target	type
    //   7	13	14	finally
    //   14	16	14	finally
  }
  
  void setDynamicCacheChanged(boolean dynamicCacheChanged)
  {
    synchronized (monitor)
    {
      this.dynamicCacheChanged = dynamicCacheChanged;
    }
  }
  
  public StateHelper getStateHelper()
  {
    return StateHelperImpl.getInstance();
  }
  
  void addPlatformPropertyKeys(String[] keys)
  {
    synchronized (platformPropertyKeys)
    {
      for (int i = 0; i < keys.length; i++) {
        if (!platformPropertyKeys.contains(keys[i])) {
          platformPropertyKeys.add(keys[i]);
        }
      }
    }
  }
  
  /* Error */
  String[] getPlatformPropertyKeys()
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 1034	org/eclipse/osgi/internal/resolver/StateImpl:platformPropertyKeys	Ljava/util/Set;
    //   4: dup
    //   5: astore_1
    //   6: monitorenter
    //   7: aload_0
    //   8: getfield 1034	org/eclipse/osgi/internal/resolver/StateImpl:platformPropertyKeys	Ljava/util/Set;
    //   11: aload_0
    //   12: getfield 1034	org/eclipse/osgi/internal/resolver/StateImpl:platformPropertyKeys	Ljava/util/Set;
    //   15: invokeinterface 1245 1 0
    //   20: anewarray 532	java/lang/String
    //   23: invokeinterface 1249 2 0
    //   28: checkcast 520	[Ljava/lang/String;
    //   31: aload_1
    //   32: monitorexit
    //   33: areturn
    //   34: aload_1
    //   35: monitorexit
    //   36: athrow
    // Line number table:
    //   Java source line #1185	-> byte code offset #0
    //   Java source line #1186	-> byte code offset #7
    //   Java source line #1185	-> byte code offset #34
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	37	0	this	StateImpl
    //   5	30	1	Ljava/lang/Object;	Object
    // Exception table:
    //   from	to	target	type
    //   7	33	34	finally
    //   34	36	34	finally
  }
  
  /* Error */
  public long getHighestBundleId()
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 1028	org/eclipse/osgi/internal/resolver/StateImpl:monitor	Ljava/lang/Object;
    //   4: dup
    //   5: astore_1
    //   6: monitorenter
    //   7: aload_0
    //   8: getfield 1021	org/eclipse/osgi/internal/resolver/StateImpl:highestBundleId	J
    //   11: aload_1
    //   12: monitorexit
    //   13: lreturn
    //   14: aload_1
    //   15: monitorexit
    //   16: athrow
    // Line number table:
    //   Java source line #1191	-> byte code offset #0
    //   Java source line #1192	-> byte code offset #7
    //   Java source line #1191	-> byte code offset #14
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	17	0	this	StateImpl
    //   5	10	1	Ljava/lang/Object;	Object
    // Exception table:
    //   from	to	target	type
    //   7	13	14	finally
    //   14	16	14	finally
  }
  
  public void setNativePathsInvalid(NativeCodeDescription nativeCodeDescription, boolean hasInvalidNativePaths)
  {
    ((NativeCodeDescriptionImpl)nativeCodeDescription).setInvalidNativePaths(hasInvalidNativePaths);
  }
  
  /* Error */
  public BundleDescription[] getDisabledBundles()
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 1028	org/eclipse/osgi/internal/resolver/StateImpl:monitor	Ljava/lang/Object;
    //   4: dup
    //   5: astore_1
    //   6: monitorenter
    //   7: aload_0
    //   8: getfield 1032	org/eclipse/osgi/internal/resolver/StateImpl:disabledBundles	Ljava/util/Map;
    //   11: invokeinterface 1239 1 0
    //   16: iconst_0
    //   17: anewarray 577	org/eclipse/osgi/service/resolver/BundleDescription
    //   20: invokeinterface 1249 2 0
    //   25: checkcast 521	[Lorg/eclipse/osgi/service/resolver/BundleDescription;
    //   28: aload_1
    //   29: monitorexit
    //   30: areturn
    //   31: aload_1
    //   32: monitorexit
    //   33: athrow
    // Line number table:
    //   Java source line #1201	-> byte code offset #0
    //   Java source line #1202	-> byte code offset #7
    //   Java source line #1201	-> byte code offset #31
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	34	0	this	StateImpl
    //   5	27	1	Ljava/lang/Object;	Object
    // Exception table:
    //   from	to	target	type
    //   7	30	31	finally
    //   31	33	31	finally
  }
  
  public void addDisabledInfo(DisabledInfo disabledInfo)
  {
    synchronized (monitor)
    {
      if (getBundle(disabledInfo.getBundle().getBundleId()) != disabledInfo.getBundle()) {
        throw new IllegalArgumentException(NLS.bind(StateMsg.BUNDLE_NOT_IN_STATE, disabledInfo.getBundle()));
      }
      List<DisabledInfo> currentInfos = (List)disabledBundles.get(disabledInfo.getBundle());
      if (currentInfos == null)
      {
        currentInfos = new ArrayList(1);
        currentInfos.add(disabledInfo);
        disabledBundles.put(disabledInfo.getBundle(), currentInfos);
      }
      else
      {
        Iterator<DisabledInfo> it = currentInfos.iterator();
        while (it.hasNext())
        {
          DisabledInfo currentInfo = (DisabledInfo)it.next();
          if (disabledInfo.getPolicyName().equals(currentInfo.getPolicyName()))
          {
            currentInfos.remove(currentInfo);
            break;
          }
        }
        currentInfos.add(disabledInfo);
      }
      updateTimeStamp();
    }
  }
  
  public void removeDisabledInfo(DisabledInfo disabledInfo)
  {
    synchronized (monitor)
    {
      List<DisabledInfo> currentInfos = (List)disabledBundles.get(disabledInfo.getBundle());
      if ((currentInfos != null) && (currentInfos.contains(disabledInfo)))
      {
        currentInfos.remove(disabledInfo);
        if (currentInfos.isEmpty()) {
          disabledBundles.remove(disabledInfo.getBundle());
        }
      }
      updateTimeStamp();
    }
  }
  
  public DisabledInfo getDisabledInfo(BundleDescription bundle, String policyName)
  {
    synchronized (monitor)
    {
      List<DisabledInfo> currentInfos = (List)disabledBundles.get(bundle);
      if (currentInfos == null) {
        return null;
      }
      Iterator<DisabledInfo> it = currentInfos.iterator();
      while (it.hasNext())
      {
        DisabledInfo currentInfo = (DisabledInfo)it.next();
        if (currentInfo.getPolicyName().equals(policyName)) {
          return currentInfo;
        }
      }
      return null;
    }
  }
  
  public DisabledInfo[] getDisabledInfos(BundleDescription bundle)
  {
    synchronized (monitor)
    {
      List<DisabledInfo> currentInfos = (List)disabledBundles.get(bundle);
      return currentInfos == null ? EMPTY_DISABLEDINFOS : (DisabledInfo[])currentInfos.toArray(new DisabledInfo[currentInfos.size()]);
    }
  }
  
  DisabledInfo[] getDisabledInfos()
  {
    List<DisabledInfo> results = new ArrayList();
    synchronized (monitor)
    {
      for (Iterator<List<DisabledInfo>> allDisabledInfos = disabledBundles.values().iterator(); allDisabledInfos.hasNext();) {
        results.addAll((Collection)allDisabledInfos.next());
      }
    }
    return (DisabledInfo[])results.toArray(new DisabledInfo[results.size()]);
  }
}

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

import org.eclipse.osgi.util.NLS;

public class StateMsg
  extends NLS
{
  private static final String BUNDLE_NAME = "org.eclipse.osgi.internal.resolver.StateMessages";
  public static String BUNDLE_NOT_IN_STATE;
  public static String BUNDLE_IN_OTHER_STATE;
  public static String BUNDLE_PENDING_REMOVE_STATE;
  public static String HEADER_REQUIRED;
  public static String HEADER_PACKAGE_DUPLICATES;
  public static String HEADER_PACKAGE_JAVA;
  public static String HEADER_VERSION_ERROR;
  public static String HEADER_EXPORT_ATTR_ERROR;
  public static String HEADER_DIRECTIVE_DUPLICATES;
  public static String HEADER_ATTRIBUTE_DUPLICATES;
  public static String HEADER_EXTENSION_ERROR;
  public static String RES_ERROR_DISABLEDBUNDLE;
  public static String RES_ERROR_MISSING_PERMISSION;
  public static String RES_ERROR_MISSING_CONSTRAINT;
  public static String RES_ERROR_FRAGMENT_CONFLICT;
  public static String RES_ERROR_USES_CONFLICT;
  public static String RES_
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-2017. Infinite Loop Ltd