org.eclipse.osgi_3.8.2.v20130124-134944

Filter.toString());
      }
    }
    return result;
  }
  
  protected Map<String, Object> getInteralAttributes()
  {
    synchronized (monitor)
    {
      return attributes == null ? Collections.EMPTY_MAP : new HashMap(attributes);
    }
  }
  
  protected String getInternalNameSpace()
  {
    return getType();
  }
}

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

import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import org.eclipse.osgi.service.resolver.BaseDescription;
import org.eclipse.osgi.service.resolver.BundleDescription;
import org.eclipse.osgi.service.resolver.HostSpecification;
import org.eclipse.osgi.service.resolver.VersionRange;

public class HostSpecificationImpl
  extends VersionConstraintImpl
  implements HostSpecification
{
  private BundleDescription[] hosts;
  private boolean multihost = false;
  private Map<String, Object> attributes;
  private Map<String, String> arbitraryDirectives;
  
  /* Error */
  Map<String, Object> getAttributes()
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 183	org/eclipse/osgi/internal/resolver/HostSpecificationImpl:monitor	Ljava/lang/Object;
    //   4: dup
    //   5: astore_1
    //   6: monitorenter
    //   7: aload_0
    //   8: getfield 185	org/eclipse/osgi/internal/resolver/HostSpecificationImpl:attributes	Ljava/util/Map;
    //   11: aload_1
    //   12: monitorexit
    //   13: areturn
    //   14: aload_1
    //   15: monitorexit
    //   16: athrow
    // Line number table:
    //   Java source line #28	-> byte code offset #0
    //   Java source line #29	-> byte code offset #7
    //   Java source line #28	-> byte code offset #14
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	17	0	this	HostSpecificationImpl
    //   5	10	1	Ljava/lang/Object;	Object
    // Exception table:
    //   from	to	target	type
    //   7	13	14	finally
    //   14	16	14	finally
  }
  
  void setAttributes(Map<String, ?> attributes)
  {
    synchronized (monitor)
    {
      this.attributes = attributes;
    }
  }
  
  /* Error */
  Map<String, String> getArbitraryDirectives()
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 183	org/eclipse/osgi/internal/resolver/HostSpecificationImpl:monitor	Ljava/lang/Object;
    //   4: dup
    //   5: astore_1
    //   6: monitorenter
    //   7: aload_0
    //   8: getfield 184	org/eclipse/osgi/internal/resolver/HostSpecificationImpl:arbitraryDirectives	Ljava/util/Map;
    //   11: aload_1
    //   12: monitorexit
    //   13: areturn
    //   14: aload_1
    //   15: monitorexit
    //   16: athrow
    // Line number table:
    //   Java source line #41	-> byte code offset #0
    //   Java source line #42	-> byte code offset #7
    //   Java source line #41	-> byte code offset #14
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	17	0	this	HostSpecificationImpl
    //   5	10	1	Ljava/lang/Object;	Object
    // Exception table:
    //   from	to	target	type
    //   7	13	14	finally
    //   14	16	14	finally
  }
  
  void setArbitraryDirectives(Map<String, ?> directives)
  {
    synchronized (monitor)
    {
      arbitraryDirectives = directives;
    }
  }
  
  public boolean isSatisfiedBy(BaseDescription supplier)
  {
    if (!(supplier instanceof BundleDescriptionImpl)) {
      return false;
    }
    BundleDescriptionImpl candidate = (BundleDescriptionImpl)supplier;
    if (candidate.getHost() != null) {
      return false;
    }
    Map<String, ?> requiredAttrs = getAttributes();
    if (requiredAttrs != null)
    {
      Map<String, ?> prividerAttrs = candidate.getAttributes();
      if (prividerAttrs == null) {
        return false;
      }
      for (Iterator localIterator = requiredAttrs.keySet().iterator(); localIterator.hasNext();)
      {
        String key = (String)localIterator.next();
        Object requiredValue = requiredAttrs.get(key);
        Object prividedValue = prividerAttrs.get(key);
        if ((prividedValue == null) || (!requiredValue.equals(prividedValue))) {
          return false;
        }
      }
    }
    String[] mandatory = (String[])candidate.getDirective("mandatory");
    if (!hasMandatoryAttributes(mandatory)) {
      return false;
    }
    if ((getName() != null) && (getName().equals(candidate.getSymbolicName())) && ((getVersionRange() == null) || (getVersionRange().isIncluded(candidate.getVersion())))) {
      return true;
    }
    return false;
  }
  
  public BundleDescription[] getHosts()
  {
    synchronized (monitor)
    {
      return hosts == null ? BundleDescriptionImpl.EMPTY_BUNDLEDESCS : hosts;
    }
  }
  
  protected boolean hasMandatoryAttributes(String[] mandatory)
  {
    if (mandatory != null)
    {
      Map<String, ?> requiredAttrs = getAttributes();
      String[] arrayOfString;
      int j = (arrayOfString = mandatory).length;
      for (int i = 0; i < j; i++)
      {
        String key = arrayOfString[i];
        if (!"bundle-version".equals(key)) {
          if ((requiredAttrs == null) || (requiredAttrs.get(key) == null)) {
            return false;
          }
        }
      }
    }
    return true;
  }
  
  public boolean isResolved()
  {
    synchronized (monitor)
    {
      return (hosts != null) && (hosts.length > 0);
    }
  }
  
  void setHosts(BundleDescription[] hosts)
  {
    synchronized (monitor)
    {
      this.hosts = hosts;
    }
  }
  
  public String toString()
  {
    return "Fragment-Host: " + getName() + "; bundle-version=\"" + getVersionRange() + "\"";
  }
  
  public BaseDescription getSupplier()
  {
    synchronized (monitor)
    {
      if ((hosts == null) || (hosts.length == 0)) {
        return null;
      }
      return hosts[0];
    }
  }
  
  /* Error */
  public boolean isMultiHost()
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 183	org/eclipse/osgi/internal/resolver/HostSpecificationImpl:monitor	Ljava/lang/Object;
    //   4: dup
    //   5: astore_1
    //   6: monitorenter
    //   7: aload_0
    //   8: getfield 182	org/eclipse/osgi/internal/resolver/HostSpecificationImpl:multihost	Z
    //   11: aload_1
    //   12: monitorexit
    //   13: ireturn
    //   14: aload_1
    //   15: monitorexit
    //   16: athrow
    // Line number table:
    //   Java source line #127	-> byte code offset #0
    //   Java source line #128	-> byte code offset #7
    //   Java source line #127	-> byte code offset #14
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	17	0	this	HostSpecificationImpl
    //   5	10	1	Ljava/lang/Object;	Object
    // Exception table:
    //   from	to	target	type
    //   7	13	14	finally
    //   14	16	14	finally
  }
  
  void setIsMultiHost(boolean multihost)
  {
    synchronized (monitor)
    {
      this.multihost = multihost;
    }
  }
  
  protected Map<String, String> getInternalDirectives()
  {
    Map<String, String> result = new HashMap(2);
    synchronized (monitor)
    {
      if (arbitraryDirectives != null) {
        result.putAll(arbitraryDirectives);
      }
      result.put("filter", createFilterDirective());
      return result;
    }
  }
  
  private String createFilterDirective()
  {
    StringBuffer filter = new StringBuffer();
    filter.append("(&");
    synchronized (monitor)
    {
      addFilterAttribute(filter, "osgi.wiring.host", getName());
      VersionRange range = getVersionRange();
      if ((range != null) && (range != VersionRange.emptyRange)) {
        addFilterAttribute(filter, "bundle-version", range);
      }
      if (attributes != null) {
        addFilterAttributes(filter, attributes);
      }
    }
    filter.append(')');
    return filter.toString();
  }
  
  protected Map<String, Object> getInteralAttributes()
  {
    return Collections.EMPTY_MAP;
  }
  
  protected String getInternalNameSpace()
  {
    return "osgi.wiring.host";
  }
}

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

import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import org.eclipse.osgi.framework.internal.core.Constants;
import org.eclipse.osgi.service.resolver.BaseDescription;
import org.eclipse.osgi.service.resolver.BundleDescription;
import org.eclipse.osgi.service.resolver.ExportPackageDescription;
import org.eclipse.osgi.service.resolver.ImportPackageSpecification;
import org.eclipse.osgi.service.resolver.VersionRange;

public class ImportPackageSpecificationImpl
  extends VersionConstraintImpl
  implements ImportPackageSpecification
{
  private String resolution = "static";
  private String symbolicName;
  private VersionRange bundleVersionRange;
  private Map<String, Object> attributes;
  private Map<String, String> arbitraryDirectives;
  
  public Map<String, Object> getDirectives()
  {
    synchronized (monitor)
    {
      Map<String, Object> result = new HashMap(5);
      if (resolution != null) {
        result.put("resolution", resolution);
      }
      return result;
    }
  }
  
  public Object getDirective(String key)
  {
    synchronized (monitor)
    {
      if (key.equals("resolution")) {
        return resolution;
      }
      return null;
    }
  }
  
  Object setDirective(String key, Object value)
  {
    synchronized (monitor)
    {
      if (key.equals("resolution")) {
        return resolution = (String)value;
      }
      return null;
    }
  }
  
  void setDirectives(Map<String, ?> directives)
  {
    synchronized (monitor)
    {
      if (directives == null) {
        return;
      }
      resolution = ((String)directives.get("resolution"));
    }
  }
  
  void setArbitraryDirectives(Map<String, ?> directives)
  {
    synchronized (monitor)
    {
      arbitraryDirectives = directives;
    }
  }
  
  /* Error */
  Map<String, String> getArbitraryDirectives()
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 267	org/eclipse/osgi/internal/resolver/ImportPackageSpecificationImpl:monitor	Ljava/lang/Object;
    //   4: dup
    //   5: astore_1
    //   6: monitorenter
    //   7: aload_0
    //   8: getfield 270	org/eclipse/osgi/internal/resolver/ImportPackageSpecificationImpl:arbitraryDirectives	Ljava/util/Map;
    //   11: aload_1
    //   12: monitorexit
    //   13: areturn
    //   14: aload_1
    //   15: monitorexit
    //   16: athrow
    // Line number table:
    //   Java source line #68	-> byte code offset #0
    //   Java source line #69	-> byte code offset #7
    //   Java source line #68	-> byte code offset #14
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	17	0	this	ImportPackageSpecificationImpl
    //   5	10	1	Ljava/lang/Object;	Object
    // Exception table:
    //   from	to	target	type
    //   7	13	14	finally
    //   14	16	14	finally
  }
  
  public String getBundleSymbolicName()
  {
    synchronized (monitor)
    {
      if ("system.bundle".equals(symbolicName))
      {
        StateImpl state = (StateImpl)getBundle().getContainingState();
        return state == null ? Constants.getInternalSymbolicName() : state.getSystemBundle();
      }
      return symbolicName;
    }
  }
  
  public VersionRange getBundleVersionRange()
  {
    synchronized (monitor)
    {
      if (bundleVersionRange == null) {
        return VersionRange.emptyRange;
      }
      return bundleVersionRange;
    }
  }
  
  /* Error */
  public Map<String, Object> getAttributes()
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 267	org/eclipse/osgi/internal/resolver/ImportPackageSpecificationImpl:monitor	Ljava/lang/Object;
    //   4: dup
    //   5: astore_1
    //   6: monitorenter
    //   7: aload_0
    //   8: getfield 271	org/eclipse/osgi/internal/resolver/ImportPackageSpecificationImpl:attributes	Ljava/util/Map;
    //   11: aload_1
    //   12: monitorexit
    //   13: areturn
    //   14: aload_1
    //   15: monitorexit
    //   16: athrow
    // Line number table:
    //   Java source line #92	-> byte code offset #0
    //   Java source line #93	-> byte code offset #7
    //   Java source line #92	-> byte code offset #14
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	17	0	this	ImportPackageSpecificationImpl
    //   5	10	1	Ljava/lang/Object;	Object
    // Exception table:
    //   from	to	target	type
    //   7	13	14	finally
    //   14	16	14	finally
  }
  
  public boolean isSatisfiedBy(BaseDescription supplier)
  {
    return isSatisfiedBy(supplier, true);
  }
  
  public boolean isSatisfiedBy(BaseDescription supplier, boolean checkEE)
  {
    if (!(supplier instanceof ExportPackageDescription)) {
      return false;
    }
    ExportPackageDescriptionImpl pkgDes = (ExportPackageDescriptionImpl)supplier;
    
    String[] friends = (String[])pkgDes.getDirective("x-friends");
    Boolean internal = (Boolean)pkgDes.getDirective("x-internal");
    if ((internal.booleanValue()) || (friends != null))
    {
      StateImpl state = (StateImpl)getBundle().getContainingState();
      boolean strict = state == null ? false : state.inStrictMode();
      if (strict)
      {
        if (internal.booleanValue()) {
          return false;
        }
        boolean found = false;
        if ((friends != null) && (getBundle().getSymbolicName() != null)) {
          for (int i = 0; i < friends.length; i++) {
            if (getBundle().getSymbolicName().equals(friends[i])) {
              found = true;
            }
          }
        }
        if (!found) {
          return false;
        }
      }
    }
    String exporterSymbolicName = getBundleSymbolicName();
    if (exporterSymbolicName != null)
    {
      BundleDescription exporter = pkgDes.getExporter();
      if (!exporterSymbolicName.equals(exporter.getSymbolicName())) {
        return false;
      }
      if ((getBundleVersionRange() != null) && (!getBundleVersionRange().isIncluded(exporter.getVersion()))) {
        return false;
      }
    }
    String name = getName();
    if ((!"*".equals(name)) && ((!name.endsWith(".*")) || (!pkgDes.getName().startsWith(name.substring(0, name.length() - 1)))) && (!pkgDes.getName().equals(name))) {
      return false;
    }
    if ((getVersionRange() != null) && (!getVersionRange().isIncluded(pkgDes.getVersion()))) {
      return false;
    }
    Map<String, ?> importAttrs = getAttributes();
    if (importAttrs != null)
    {
      Map<String, ?> exportAttrs = pkgDes.getAttributes();
      if (exportAttrs == null) {
        return false;
      }
      for (Iterator<String> i = importAttrs.keySet().iterator(); i.hasNext();)
      {
        String importKey = (String)i.next();
        Object importValue = importAttrs.get(importKey);
        Object exportValue = exportAttrs.get(importKey);
        if ((exportValue == null) || (!importValue.equals(exportValue))) {
          return false;
        }
      }
    }
    String[] mandatory = (String[])pkgDes.getDirective("mandatory");
    if (!hasMandatoryAttributes(mandatory)) {
      return false;
    }
    if (!checkEE) {
      return true;
    }
    if (((BundleDescriptionImpl)getBundle()).getEquinoxEE() < 0) {
      return true;
    }
    int eeIndex = ((Integer)pkgDes.getDirective("x-equinox-ee")).intValue();
    return (eeIndex < 0) || (eeIndex == ((BundleDescriptionImpl)getBundle()).getEquinoxEE());
  }
  
  protected boolean hasMandatoryAttributes(String[] mandatory)
  {
    if (mandatory != null)
    {
      Map<String, ?> importAttrs = getAttributes();
      for (int i = 0; i < mandatory.length; i++) {
        if ("bundle-symbolic-name".equals(mandatory[i]))
        {
          if (getBundleSymbolicName() == null) {
            return false;
          }
        }
        else if ("bundle-version".equals(mandatory[i]))
        {
          if (bundleVersionRange == null) {
            return false;
          }
        }
        else if (("specification-version".equals(mandatory[i])) || ("version".equals(mandatory[i])))
        {
          if (getVersionRange() == null) {
            return false;
          }
        }
        else
        {
          if (importAttrs == null) {
            return false;
          }
          if (importAttrs.get(mandatory[i]) == null) {
            return false;
          }
        }
      }
    }
    return true;
  }
  
  protected void setBundleSymbolicName(String symbolicName)
  {
    synchronized (monitor)
    {
      this.symbolicName = symbolicName;
    }
  }
  
  protected void setBundleVersionRange(VersionRange bundleVersionRange)
  {
    synchronized (monitor)
    {
      this.bundleVersionRange = bundleVersionRange;
    }
  }
  
  protected void setAttributes(Map<String, ?> attributes)
  {
    synchronized (monitor)
    {
      this.attributes = attributes;
    }
  }
  
  public String toString()
  {
    return "Import-Package: " + getName() + "; version=\"" + getVersionRange() + "\"";
  }
  
  protected Map<String, String> getInternalDirectives()
  {
    synchronized (monitor)
    {
      Map<String, String> result = new HashMap(5);
      if (arbitraryDirectives != null) {
        result.putAll(arbitraryDirectives);
      }
      if (resolution != null) {
        if ("static".equals(resolution)) {
          result.put("resolution", "mandatory");
        } else {
          result.put("resolution", resolution);
        }
      }
      result.put("filter", createFilterDirective());
      return result;
    }
  }
  
  private String createFilterDirective()
  {
    StringBuffer filter = new StringBuffer();
    filter.append("(&");
    synchronized (monitor)
    {
      addFilterAttribute(filter, "osgi.wiring.package", getName(), false);
      VersionRange range = getVersionRange();
      if ((range != null) && (range != VersionRange.emptyRange)) {
        addFilterAttribute(filter, "version", range);
      }
      if (symbolicName != null) {
        addFilterAttribute(filter, "bundle-symbolic-name", symbolicName);
      }
      if (bundleVersionRange != null) {
        addFilterAttribute(filter, "bundle-version", bundleVersionRange);
      }
      if (attributes != null) {
        addFilterAttributes(filter, attributes);
      }
    }
    filter.append(')');
    return filter.toString();
  }
  
  protected Map<String, Object> getInteralAttributes()
  {
    return Collections.EMPTY_MAP;
  }
  
  protected String getInternalNameSpace()
  {
    return "osgi.wiring.package";
  }
}

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

import org.eclipse.osgi.service.resolver.BundleDescription;
import org.eclipse.osgi.service.resolver.ExportPackageDescription;
import org.eclipse.osgi.service.resolver.ImportPackageSpecification;

class ImportsHolder
{
  private final ImportPackageSpecification[] importedPackages;
  private final ExportPackageDescription[] resolvedImports;
  private final boolean isUsingResolved;
  
  ImportsHolder(BundleDescription bundle, int options)
  {
    isUsingResolved = ((options & 0x2) != 0);
    if (isUsingResolved)
    {
      importedPackages = null;
      resolvedImports = bundle.getResolvedImports();
    }
    else
    {
      importedPackages = bundle.getImportPackages();
      resolvedImports = null;
    }
  }
  
  ExportPackageDescription getSupplier(int index)
  {
    if (isUsingResolved) {
      return resolvedImports[index];
    }
    return (ExportPackageDescription)importedPackages[index].getSupplier();
  }
  
  String getName(int index)
  {
    if (isUsingResolved) {
      return resolvedImports[index].getName();
    }
    return importedPackages[index].getName();
  }
  
  int getSize()
  {
    if (isUsingResolved) {
      return resolvedImports.length;
    }
    return importedPackages.length;
  }
}

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

import java.util.Collections;
import java.util.Dictionary;
import java.util.Map;
import org.eclipse.osgi.framework.internal.core.FilterImpl;
import org.eclipse.osgi.service.resolver.BundleDescription;
import org.eclipse.osgi.service.resolver.NativeCodeDescription;
import org.eclipse.osgi.service.resolver.State;
import org.eclipse.osgi.service.resolver.VersionRange;
import org.osgi.framework.Filter;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.Version;

public class NativeCodeDescriptionImpl
  extends BaseDescriptionImpl
  implements NativeCodeDescription
{
  private static final VersionRange[] EMPTY_VERSIONRANGES = new VersionRange[0];
  private volatile Filter filter;
  private String[] languages;
  private String[] nativePaths;
  private String[] osNames;
  private VersionRange[] osVersions;
  private String[] processors;
  private BundleDescription supplier;
  private volatile boolean invalidNativePaths = false;
  
  public Filter getFilter()
  {
    return filter;
  }
  
  public String[] getLanguages()
  {
    synchronized (monitor)
    {
      if (languages == null) {
        return BundleDescriptionImpl.EMPTY_STRING;
      }
      return languages;
    }
  }
  
  public String[] getNativePaths()
  {
    synchronized (monitor)
    {
      if (nativePaths == null) {
        return BundleDescriptionImpl.EMPTY_STRING;
      }
      return nativePaths;
    }
  }
  
  public String[] getOSNames()
  {
    synchronized (monitor)
    {
      if (osNames == null) {
        return BundleDescriptionImpl.EMPTY_STRING;
      }
      return osNames;
    }
  }
  
  public VersionRange[] getOSVersions()
  {
    synchronized (monitor)
    {
      if (osVersions == null) {
        return EMPTY_VERSIONRANGES;
      }
      return osVersions;
    }
  }
  
  public String[] getProcessors()
  {
    synchronized (monitor)
    {
      if (processors == null) {
        return BundleDescriptionImpl.EMPTY_STRING;
      }
      return processors;
    }
  }
  
  public BundleDescription getSupplier()
  {
    return supplier;
  }
  
  public int compareTo(NativeCodeDescription otherDesc)
  {
    State containingState = getSupplier().getContainingState();
    if (containingState == null) {
      return 0;
    }
    Dictionary[] platformProps = containingState.getPlatformProperties();
    Version osversion;
    try
    {
      osversion = Version.parseVersion((String)platformProps[0].get("org.osgi.framework.os.version"));
    }
    catch (Exception localException)
    {
      Version osversion;
      osversion = Version.emptyVersion;
    }
    VersionRange[] thisRanges = getOSVersions();
    VersionRange[] otherRanges = otherDesc.getOSVersions();
    Version thisHighest = getHighestVersionMatch(osversion, thisRanges);
    Version otherHighest = getHighestVersionMatch(osversion, otherRanges);
    if (thisHighest.compareTo(otherHighest) < 0) {
      return -1;
    }
    return (getLanguages().length == 0 ? 0 : 1) - (otherDesc.getLanguages().length == 0 ? 0 : 1);
  }
  
  public boolean hasInvalidNativePaths()
  {
    return invalidNativePaths;
  }
  
  private Version getHighestVersionMatch(Version version, VersionRange[] ranges)
  {
    Version highest = Version.emptyVersion;
    for (int i = 0; i < ranges.length; i++) {
      if ((ranges[i].isIncluded(version)) && (highest.compareTo(ranges[i].getMinimum()) < 0)) {
        highest = ranges[i].getMinimum();
      }
    }
    return highest;
  }
  
  public String toString()
  {
    StringBuffer sb = new StringBuffer();
    
    String[] paths = getNativePaths();
    for (int i = 0; i < paths.length; i++)
    {
      if (i > 0) {
        sb.append("; ");
      }
      sb.append(paths[i]);
    }
    String[] procs = getProcessors();
    for (int i = 0; i < procs.length; i++)
    {
      sb.append("; ");
      sb.append("processor");
      sb.append('=');
      sb.append(procs[i]);
    }
    String[] oses = getOSNames();
    for (int i = 0; i < oses.length; i++)
    {
      sb.append("; ");
      sb.append("osname");
      sb.append('=');
      sb.append(oses[i]);
    }
    VersionRange[] osRanges = getOSVersions();
    for (int i = 0; i < osRanges.length; i++)
    {
      sb.append("; ");
      sb.append("osversion");
      sb.append("=\"");
      sb.append(osRanges[i].toString());
      sb.append('"');
    }
    String[] langs = getLanguages();
    for (int i = 0; i < langs.length; i++)
    {
      sb.append("; ");
      sb.append("language");
      sb.append('=');
      sb.append(langs[i]);
    }
    Filter f = getFilter();
    if (f != null)
    {
      sb.append("; ");
      sb.append("selection-filter");
      sb.append("=\"");
      sb.append(f.toString());
      sb.append('"');
    }
    return sb.toString();
  }
  
  void setInvalidNativePaths(boolean invalidNativePaths)
  {
    this.invalidNativePaths = invalidNativePaths;
  }
  
  void setOSNames(String[] osNames)
  {
    synchronized (monitor)
    {
      this.osNames = osNames;
    }
  }
  
  void setOSVersions(VersionRange[] osVersions)
  {
    synchronized (monitor)
    {
      this.osVersions = osVersions;
    }
  }
  
  void setFilter(String filter)
    throws InvalidSyntaxException
  {
    this.filter = (filter == null ? null : FilterImpl.newInstance(filter));
  }
  
  void setLanguages(String[] languages)
  {
    synchronized (monitor)
    {
      this.languages = languages;
    }
  }
  
  void setNativePaths(String[] nativePaths)
  {
    synchronized (monitor)
    {
      this.nativePaths = nativePaths;
    }
  }
  
  void setProcessors(String[] processors)
  {
    synchronized (monitor)
    {
      this.processors = processors;
    }
  }
  
  void setSupplier(BundleDescription supplier)
  {
    this.supplier = supplier;
  }
  
  public Map<String, String> getDeclaredDirectives()
  {
    return Collections.EMPTY_MAP;
  }
  
  public Map<String, Object> getDeclaredAttributes()
  {
    return Collections.EMPTY_MAP;
  }
}

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

import java.util.Collection;
import java.util.Collections;
import java.util.Dictionary;
import java.util.Iterator;
import java.util.Map;
import org.eclipse.osgi.framework.internal.core.AliasMapper;
import org.eclipse.osgi.service.resolver.BaseDescription;
import org.eclipse.osgi.service.resolver.BundleDescription;
import org.eclipse.osgi.service.resolver.NativeCodeDescription;
import org.eclipse.osgi.service.resolver.NativeCodeSpecification;
import org.eclipse.osgi.service.resolver.State;
import org.eclipse.osgi.service.resolver.VersionRange;
import org.osgi.framework.Filter;
import org.osgi.framework.Version;

public class NativeCodeSpecificationImpl
  extends VersionConstraintImpl
  implements NativeCodeSpecification
{
  private static final NativeCodeDescription[] EMPTY_NATIVECODEDESCRIPTIONS = new NativeCodeDescription[0];
  private static AliasMapper aliasMapper = new AliasMapper();
  private NativeCodeDescription[] possibleSuppliers;
  private boolean optional;
  
  public NativeCodeDescription[] getPossibleSuppliers()
  {
    synchronized (monitor)
    {
      if (possibleSuppliers == null) {
        return EMPTY_NATIVECODEDESCRIPTIONS;
      }
      return possibleSuppliers;
    }
  }
  
  void setPossibleSuppliers(NativeCodeDescription[] possibleSuppliers)
  {
    synchronized (monitor)
    {
      this.possibleSuppliers = possibleSuppliers;
    }
  }
  
  /* Error */
  public boolean isOptional()
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 198	org/eclipse/osgi/internal/resolver/NativeCodeSpecificationImpl:monitor	Ljava/lang/Object;
    //   4: dup
    //   5: astore_1
    //   6: monitorenter
    //   7: aload_0
    //   8: getfield 197	org/eclipse/osgi/internal/resolver/NativeCodeSpecificationImpl:optional	Z
    //   11: aload_1
    //   12: monitorexit
    //   13: ireturn
    //   14: aload_1
    //   15: monitorexit
    //   16: athrow
    // Line number table:
    //   Java source line #42	-> byte code offset #0
    //   Java source line #43	-> byte code offset #7
    //   Java source line #42	-> byte code offset #14
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	17	0	this	NativeCodeSpecificationImpl
    //   5	10	1	Ljava/lang/Object;	Object
    // Exception table:
    //   from	to	target	type
    //   7	13	14	finally
    //   14	16	14	finally
  }
  
  void setOptional(boolean optional)
  {
    synchronized (monitor)
    {
      this.optional = optional;
    }
  }
  
  public boolean isSatisfiedBy(BaseDescription supplier)
  {
    if (!(supplier instanceof NativeCodeDescription)) {
      return false;
    }
    State containingState = getBundle().getContainingState();
    if (containingState == null) {
      return false;
    }
    Dictionary[] platformProps = containingState.getPlatformProperties();
    NativeCodeDescription nativeSupplier = (NativeCodeDescription)supplier;
    Filter filter = nativeSupplier.getFilter();
    boolean match = false;
    for (int i = 0; (i < platformProps.length) && (!match); i++)
    {
      Dictionary props = platformProps[i];
      if ((filter == null) || (filter.matchCase(props)))
      {
        String[] osNames = nativeSupplier.getOSNames();
        if (osNames.length == 0)
        {
          match = true;
        }
        else
        {
          Object platformOS = platformProps[i].get("org.osgi.framework.os.name");
          Object aliasedPlatformOS = (platformOS == null) || (!(platformOS instanceof String)) ? platformOS : aliasMapper.aliasOSName((String)platformOS);
          Object[] platformOSes;
          Object[] platformOSes;
          if ((aliasedPlatformOS instanceof Collection)) {
            platformOSes = ((Collection)aliasedPlatformOS).toArray();
          } else {
            platformOSes = new Object[] { aliasedPlatformOS == null ? new Object[0] : aliasedPlatformOS };
          }
          for (int j = 0; (j < osNames.length) && (!match); j++)
          {
            Object aliasedName = aliasMapper.aliasOSName(osNames[j]);
            for (int k = 0; k < platformOSes.length; k++) {
              if ((aliasedName instanceof String))
              {
                if (platformOSes[k].equals(aliasedName)) {
                  match = true;
                }
              }
              else {
                for (Iterator<?> iAliases = ((Collection)aliasedName).iterator(); (iAliases.hasNext()) && (!match);) {
                  if (platformOSes[k].equals(iAliases.next())) {
                    match = true;
                  }
                }
              }
            }
          }
        }
        if (match)
        {
          match = false;
          
          String[] processors = nativeSupplier.getProcessors();
          if (processors.length == 0)
          {
            match = true;
          }
          else
          {
            Object platformProcessor = platformProps[i].get("org.osgi.framework.processor");
            Object aliasedPlatformProcessor = (platformProcessor == null) || (!(platformProcessor instanceof String)) ? platformProcessor : aliasMapper.aliasProcessor((String)platformProcessor);
            if (aliasedPlatformProcessor != null) {
              for (int j = 0; (j < processors.length) && (!match); j++)
              {
                String aliasedProcessor = aliasMapper.aliasProcessor(processors[j]);
                if (aliasedPlatformProcessor.equals(aliasedProcessor)) {
                  match = true;
                }
              }
            }
          }
          if (!match) {
            return false;
          }
          match = false;
          
          String[] languages = nativeSupplier.getLanguages();
          if (languages.length == 0)
          {
            match = true;
          }
          else
          {
            Object platformLanguage = platformProps[i].get("org.osgi.framework.language");
            if (platformLanguage != null) {
              for (int j = 0; (j < languages.length) && (!match); j++) {
                if ((platformLanguage instanceof String) ? ((String)platformLanguage).equalsIgnoreCase(languages[j]) : platformLanguage.equals(languages[j])) {
                  match = true;
                }
              }
            }
          }
          if (!match) {
            return false;
          }
          match = false;
          
          VersionRange[] osVersions = nativeSupplier.getOSVersions();
          if ((osVersions.length == 0) || (platformProps[i].get("org.osgi.framework.os.version") == null))
          {
            match = true;
          }
          else
          {
            Version osversion;
            try
            {
              osversion = Version.parseVersion((String)platformProps[i].get("org.osgi.framework.os.version"));
            }
            catch (Exception localException)
            {
              Version osversion;
              osversion = Version.emptyVersion;
            }
            for (int j = 0; (j < osVersions.length) && (!match); j++) {
              if (osVersions[j].isIncluded(osversion)) {
                match = true;
              }
            }
          }
        }
      }
    }
    return match;
  }
  
  protected boolean hasMandatoryAttributes(String[] mandatory)
  {
    return true;
  }
  
  public String toString()
  {
    StringBuffer sb = new StringBuffer();
    NativeCodeDescription[] suppliers = getPossibleSuppliers();
    for (int i = 0; i < suppliers.length; i++)
    {
      if (i > 0) {
        sb.append(", ");
      }
      sb.append(suppliers[i].toString());
    }
    return sb.toString();
  }
  
  protected Map<String, String> getInternalDirectives()
  {
    return Collections.EMPTY_MAP;
  }
  
  protected Map<String, Object> getInteralAttributes()
  {
    return Collections.EMPTY_MAP;
  }
  
  protected String getInternalNameSpace()
  {
    return null;
  }
}

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

import java.util.Collection;
import java.util.Dictionary;
import java.util.List;
import java.util.Map;
import org.eclipse.osgi.service.resolver.BaseDescription;
import org.eclipse.osgi.service.resolver.BundleDescription;
import org.eclipse.osgi.service.resolver.DisabledInfo;
import org.eclipse.osgi.service.resolver.ExportPackageDescription;
import org.eclipse.osgi.service.resolver.GenericDescription;
import org.eclipse.osgi.service.resolver.ImportPackageSpecification;
import org.eclipse.osgi.service.resolver.NativeCodeDescription;
import org.eclipse.osgi.service.resolver.Resolver;
import org.eclipse.osgi.service.resolver.ResolverError;
import org.eclipse.osgi.service.resolver.State;
import org.eclipse.osgi.service.resolver.StateDelta;
import org.eclipse.osgi.service.resolver.StateHelper;
import org.eclipse.osgi.service.resolver.StateObjectFactory;
import org.eclipse.osgi.service.resolver.StateWire;
import org.eclipse.osgi.service.resolver.VersionConstraint;
import org.osgi.framework.BundleException;
import org.osgi.framework.Version;
import org.osgi.framework.hooks.resolver.ResolverHookFactory;

public final class ReadOnlyState
  implements State
{
  private final State target;
  
  public ReadOnlyState(State target)
  {
    this.target = target;
  }
  
  public boolean addBundle(BundleDescription description)
  {
    throw new UnsupportedOperationException();
  }
  
  public StateDelta compare(State state)
    throws BundleException
  {
    return target.compare(state);
  }
  
  public BundleDescription getBundle(long id)
  {
    return target.getBundle(id);
  }
  
  public BundleDescription getBundle(String symbolicName, Version version)
  {
    return target.getBundle(symbolicName, version);
  }
  
  public BundleDescription getBundleByLocation(String location)
  {
    return target.getBundleByLocation(location);
  }
  
  public BundleDescription[] getBundles()
  {
    return target.getBundles();
  }
  
  public BundleDescription[] getBundles(String symbolicName)
  {
    return target.getBundles(symbolicName);
  }
  
  public StateDelta getChanges()
  {
    return target.getChanges();
  }
  
  public ExportPackageDescription[] getExportedPackages()
  {
    return target.getExportedPackages();
  }
  
  public StateObjectFactory getFactory()
  {
    return target.getFactory();
  }
  
  public BundleDescription[] getResolvedBundles()
  {
    return target.getResolvedBundles();
  }
  
  public long getTimeStamp()
  {
    return target.getTimeStamp();
  }
  
  public boolean isEmpty()
  {
    return target.isEmpty();
  }
  
  public boolean isResolved()
  {
    return target.isResolved();
  }
  
  public boolean removeBundle(BundleDescription bundle)
  {
    throw new UnsupportedOperationException();
  }
  
  public BundleDescription removeBundle(long bundleId)
  {
    throw new UnsupportedOperationException();
  }
  
  public StateDelta resolve()
  {
    throw new UnsupportedOperationException();
  }
  
  public StateDelta resolve(boolean incremental)
  {
    throw new UnsupportedOperationException();
  }
  
  public StateDelta resolve(BundleDescription[] discard)
  {
    throw new UnsupportedOperationException();
  }
  
  public StateDelta resolve(BundleDescription[] resolve, boolean discard)
  {
    throw new UnsupportedOperationException();
  }
  
  public void setOverrides(Object value)
  {
    throw new UnsupportedOperationException();
  }
  
  public boolean updateBundle(BundleDescription newDescription)
  {
    throw new UnsupportedOperationException();
  }
  
  public void resolveConstraint(VersionConstraint constraint, BaseDescription supplier)
  {
    throw new UnsupportedOperationException();
  }
  
  /**
   * @deprecated
   */
  public void resolveBundle(BundleDescription bundle, boolean status, BundleDescription[] hosts, ExportPackageDescription[] selectedExports, BundleDescription[] resolvedRequires, ExportPackageDescription[] resolvedImports)
  {
    throw new UnsupportedOperationException();
  }
  
  /**
   * @deprecated
   */
  public void resolveBundle(BundleDescription bundle, boolean status, BundleDescription[] host, ExportPackageDescription[] selectedExports, ExportPackageDescription[] substitutedExports, BundleDescription[] resolvedRequires, ExportPackageDescription[] resolveImports)
  {
    throw new UnsupportedOperationException();
  }
  
  public void resolveBundle(BundleDescription bundle, boolean status, BundleDescription[] hosts, ExportPackageDescription[] selectedExports, ExportPackageDescription[] substitutedExports, GenericDescription[] selectedCapabilities, BundleDescription[] resolvedRequires, ExportPackageDescription[] resolvedImports, GenericDescription[] resolvedCapabilities, Map<String, List<StateWire>> resolvedRequirements)
  {
    throw new UnsupportedOperationException();
  }
  
  public void removeBundleComplete(BundleDescription bundle)
  {
    throw new UnsupportedOperationException();
  }
  
  public Resolver getResolver()
  {
    return null;
  }
  
  public void setResolver(Resolver value)
  {
    throw new UnsupportedOperationException();
  }
  
  public boolean setPlatformProperties(Dictionary<?, ?> platformProperties)
  {
    throw new UnsupportedOperationException();
  }
  
  public boolean setPlatformProperties(Dictionary<?, ?>[] platformProperties)
  {
    throw new UnsupportedOperationException();
  }
  
  public Di
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