org.eclipse.equinox.p2.director_2.1.1.v20111126-0211

16:44:08.142 INFO  jd.cli.Main - Decompiling org.eclipse.equinox.p2.director_2.1.1.v20111126-0211.jar
package org.eclipse.equinox.internal.p2.director;

import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.IInstallableUnitPatch;
import org.eclipse.equinox.p2.metadata.expression.ExpressionUtil;
import org.eclipse.equinox.p2.metadata.expression.IExpression;
import org.eclipse.equinox.p2.query.ExpressionMatchQuery;

public class ApplicablePatchQuery
  extends ExpressionMatchQuery<IInstallableUnit>
{
  private static final IExpression applicablePatches = ExpressionUtil.parse(
    "applicabilityScope.empty || applicabilityScope.exists(rqArr | rqArr.all(rq | $0 ~= rq))");
  
  public ApplicablePatchQuery(IInstallableUnit iu)
  {
    super(tmp4_1, applicablePatches, new Object[] { iu });
  }
}

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

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.IInstallableUnitFragment;
import org.eclipse.equinox.p2.metadata.IProvidedCapability;
import org.eclipse.equinox.p2.metadata.IRequirement;
import org.eclipse.equinox.p2.metadata.MetadataFactory;
import org.eclipse.equinox.p2.query.QueryUtil;

public class AttachmentHelper
{
  private static final IInstallableUnitFragment[] NO_FRAGMENTS = new IInstallableUnitFragment[0];
  
  public static Collection<IInstallableUnit> attachFragments(Iterator<IInstallableUnit> toAttach, Map<IInstallableUnitFragment, List<IInstallableUnit>> fragmentsToIUs)
  {
    Map<IInstallableUnit, IInstallableUnitFragment[]> fragmentBindings = new HashMap();
    
    Map<IInstallableUnit, List<IInstallableUnitFragment>> iusToFragment = new HashMap(fragmentsToIUs.size());
    Iterator localIterator2;
    List<IInstallableUnitFragment> potentialFragments;
    for (Iterator localIterator1 = fragmentsToIUs.entrySet().iterator(); localIterator1.hasNext(); localIterator2.hasNext())
    {
      Map.Entry<IInstallableUnitFragment, List<IInstallableUnit>> mapping = (Map.Entry)localIterator1.next();
      IInstallableUnitFragment fragment = (IInstallableUnitFragment)mapping.getKey();
      List<IInstallableUnit> existingMatches = (List)mapping.getValue();
      
      localIterator2 = existingMatches.iterator(); continue;IInstallableUnit host = (IInstallableUnit)localIterator2.next();
      potentialFragments = (List)iusToFragment.get(host);
      if (potentialFragments == null)
      {
        potentialFragments = new ArrayList();
        iusToFragment.put(host, potentialFragments);
      }
      potentialFragments.add(fragment);
    }
    for (localIterator1 = iusToFragment.entrySet().iterator(); localIterator1.hasNext();)
    {
      Map.Entry<IInstallableUnit, List<IInstallableUnitFragment>> entry = (Map.Entry)localIterator1.next();
      IInstallableUnit hostIU = (IInstallableUnit)entry.getKey();
      List<IInstallableUnitFragment> potentialIUFragments = (List)entry.getValue();
      ArrayList<IInstallableUnitFragment> applicableFragments = new ArrayList();
      for (potentialFragments = potentialIUFragments.iterator(); potentialFragments.hasNext();)
      {
        IInstallableUnitFragment potentialFragment = (IInstallableUnitFragment)potentialFragments.next();
        if (!hostIU.equals(potentialFragment))
        {
          Collection<IRequirement> reqsFromFragment = potentialFragment.getHost();
          boolean match = true;
          requirementMatched = false;
          for (Iterator<IRequirement> iterator = reqsFromFragment.iterator(); (iterator.hasNext()) && (match);)
          {
            IRequirement reqs = (IRequirement)iterator.next();
            requirementMatched = false;
            if (hostIU.satisfies(reqs)) {
              requirementMatched = true;
            }
            if (!requirementMatched)
            {
              match = false;
              break;
            }
          }
          if (match) {
            applicableFragments.add(potentialFragment);
          }
        }
      }
      IInstallableUnitFragment theFragment = null;
      int specificityLevel = 0;
      LinkedList<IInstallableUnitFragment> fragments = new LinkedList();
      for (boolean requirementMatched = applicableFragments.iterator(); requirementMatched.hasNext();)
      {
        IInstallableUnitFragment fragment = (IInstallableUnitFragment)requirementMatched.next();
        if (isTranslation(fragment))
        {
          fragments.add(fragment);
        }
        else if (fragment.getHost().size() > specificityLevel)
        {
          theFragment = fragment;
          specificityLevel = fragment.getHost().size();
        }
      }
      if (theFragment != null) {
        fragments.addFirst(theFragment);
      }
      if (!fragments.isEmpty()) {
        fragmentBindings.put(hostIU, (IInstallableUnitFragment[])fragments.toArray(new IInstallableUnitFragment[fragments.size()]));
      }
    }
    Collection<IInstallableUnit> result = new HashSet();
    while (toAttach.hasNext())
    {
      IInstallableUnit iu = (IInstallableUnit)toAttach.next();
      if (iu != null) {
        if (QueryUtil.isFragment(iu))
        {
          result.add(iu);
        }
        else
        {
          IInstallableUnitFragment[] fragments = (IInstallableUnitFragment[])fragmentBindings.get(iu);
          if (fragments == null) {
            fragments = NO_FRAGMENTS;
          }
          result.add(MetadataFactory.createResolvedInstallableUnit(iu, fragments));
        }
      }
    }
    return result;
  }
  
  private static boolean isTranslation(IInstallableUnitFragment fragment)
  {
    for (Iterator localIterator = fragment.getProvidedCapabilities().iterator(); localIterator.hasNext();)
    {
      IProvidedCapability capability = (IProvidedCapability)localIterator.next();
      if ("org.eclipse.equinox.p2.localization".equals(capability.getNamespace())) {
        return true;
      }
    }
    return false;
  }
}

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

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

public class DirectorActivator
  implements BundleActivator
{
  public static final String PI_DIRECTOR = "org.eclipse.equinox.p2.director";
  public static BundleContext context;
  
  public void start(BundleContext ctx)
    throws Exception
  {
    context = ctx;
  }
  
  public void stop(BundleContext ctx)
    throws Exception
  {
    context = null;
  }
}

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

import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.core.spi.IAgentServiceFactory;
import org.eclipse.equinox.p2.engine.IEngine;
import org.eclipse.equinox.p2.planner.IPlanner;

public class DirectorComponent
  implements IAgentServiceFactory
{
  public Object createService(IProvisioningAgent agent)
  {
    IEngine engine = (IEngine)agent.getService(IEngine.SERVICE_NAME);
    IPlanner planner = (IPlanner)agent.getService(IPlanner.SERVICE_NAME);
    return new SimpleDirector(engine, planner);
  }
}

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

class Explanation$1
  extends Explanation
{
  public int orderValue()
  {
    return 6;
  }
  
  public String toString()
  {
    return Messages.Explanation_optionalDependency;
  }
  
  public int shortAnswer()
  {
    return 100;
  }
}

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

import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.IRequirement;
import org.eclipse.osgi.util.NLS;

public class Explanation$HardRequirement
  extends Explanation
{
  public final IInstallableUnit iu;
  public final IRequirement req;
  
  public Explanation$HardRequirement(IInstallableUnit iu, IRequirement req)
  {
    this.iu = iu;
    this.req = req;
  }
  
  public int orderValue()
  {
    return 5;
  }
  
  public IStatus toStatus()
  {
    MultiStatus result = new MultiStatus("org.eclipse.equinox.p2.director", 1, Messages.Explanation_unsatisfied, null);
    result.add(new Status(4, "org.eclipse.equinox.p2.director", NLS.bind(Messages.Explanation_from, getUserReadableName(iu))));
    result.add(new Status(4, "org.eclipse.equinox.p2.director", NLS.bind(Messages.Explanation_to, req)));
    return result;
  }
  
  public String toString()
  {
    return NLS.bind(Messages.Explanation_hardDependency, iu, req);
  }
  
  public int shortAnswer()
  {
    return 5;
  }
}

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

import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.osgi.util.NLS;

public class Explanation$IUInstalled
  extends Explanation
{
  public final IInstallableUnit iu;
  
  public Explanation$IUInstalled(IInstallableUnit iu)
  {
    this.iu = iu;
  }
  
  public int orderValue()
  {
    return 2;
  }
  
  public String toString()
  {
    return NLS.bind(Messages.Explanation_alreadyInstalled, iu);
  }
  
  public IStatus toStatus()
  {
    return new Status(4, "org.eclipse.equinox.p2.director", NLS.bind(Messages.Explanation_alreadyInstalled, getUserReadableName(iu)));
  }
  
  public int shortAnswer()
  {
    return 3;
  }
}

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

import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.osgi.util.NLS;

public class Explanation$IUToInstall
  extends Explanation
{
  public final IInstallableUnit iu;
  
  public Explanation$IUToInstall(IInstallableUnit iu)
  {
    this.iu = iu;
  }
  
  public int orderValue()
  {
    return 1;
  }
  
  public String toString()
  {
    return NLS.bind(Messages.Explanation_toInstall, iu);
  }
  
  public IStatus toStatus()
  {
    return new Status(4, "org.eclipse.equinox.p2.director", NLS.bind(Messages.Explanation_toInstall, getUserReadableName(iu)));
  }
  
  public int shortAnswer()
  {
    return 4;
  }
}

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

import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.osgi.util.NLS;

public class Explanation$MissingGreedyIU
  extends Explanation
{
  public final IInstallableUnit iu;
  
  public Explanation$MissingGreedyIU(IInstallableUnit iu)
  {
    this.iu = iu;
  }
  
  public int orderValue()
  {
    return 3;
  }
  
  public int shortAnswer()
  {
    return 1;
  }
  
  public String toString()
  {
    return NLS.bind(Messages.Explanation_missingNonGreedyRequired, iu);
  }
  
  public IStatus toStatus()
  {
    return new Status(4, "org.eclipse.equinox.p2.director", NLS.bind(Messages.Explanation_missingNonGreedyRequired, getUserReadableName(iu)));
  }
}

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

import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.IRequirement;
import org.eclipse.osgi.util.NLS;

public class Explanation$MissingIU
  extends Explanation
{
  public final IInstallableUnit iu;
  public final IRequirement req;
  public boolean isEntryPoint;
  
  public Explanation$MissingIU(IInstallableUnit iu, IRequirement req, boolean isEntryPoint)
  {
    this.iu = iu;
    this.req = req;
    this.isEntryPoint = isEntryPoint;
  }
  
  public int orderValue()
  {
    return 3;
  }
  
  public int shortAnswer()
  {
    return 1;
  }
  
  public String toString()
  {
    if (isEntryPoint) {
      return NLS.bind(Messages.Explanation_missingRootRequired, req);
    }
    if (req.getFilter() == null) {
      return NLS.bind(Messages.Explanation_missingRequired, iu, req);
    }
    return NLS.bind(Messages.Explanation_missingRequiredFilter, new Object[] { req.getFilter(), iu, req });
  }
  
  public IStatus toStatus()
  {
    if (isEntryPoint) {
      return new Status(4, "org.eclipse.equinox.p2.director", NLS.bind(Messages.Explanation_missingRootRequired, req));
    }
    if (req.getFilter() == null) {
      return new Status(4, "org.eclipse.equinox.p2.director", NLS.bind(Messages.Explanation_missingRequired, getUserReadableName(iu), req));
    }
    return new Status(4, "org.eclipse.equinox.p2.director", NLS.bind(Messages.Explanation_missingRequiredFilter, new Object[] { req.getFilter(), getUserReadableName(iu), req }));
  }
}

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

import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.equinox.p2.metadata.IRequirement;
import org.eclipse.osgi.util.NLS;

public class Explanation$NotInstallableRoot
  extends Explanation
{
  public final IRequirement req;
  
  public Explanation$NotInstallableRoot(IRequirement req)
  {
    this.req = req;
  }
  
  public String toString()
  {
    return NLS.bind(Messages.Explanation_missingRootFilter, req);
  }
  
  public IStatus toStatus()
  {
    return new Status(4, "org.eclipse.equinox.p2.director", NLS.bind(Messages.Explanation_missingRootFilter, req));
  }
  
  protected int orderValue()
  {
    return 2;
  }
  
  public int shortAnswer()
  {
    return 7;
  }
}

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

import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.IInstallableUnitPatch;
import org.eclipse.equinox.p2.metadata.IRequirement;
import org.eclipse.osgi.util.NLS;

public class Explanation$PatchedHardRequirement
  extends Explanation
{
  public final IInstallableUnit iu;
  public final IInstallableUnitPatch patch;
  public final IRequirement req;
  
  public Explanation$PatchedHardRequirement(IInstallableUnit iu, IInstallableUnitPatch patch)
  {
    this.iu = iu;
    req = null;
    this.patch = patch;
  }
  
  public Explanation$PatchedHardRequirement(IInstallableUnit iu, IRequirement req, IInstallableUnitPatch patch)
  {
    this.iu = iu;
    this.req = req;
    this.patch = patch;
  }
  
  public int orderValue()
  {
    return 6;
  }
  
  public IStatus toStatus()
  {
    MultiStatus result = new MultiStatus("org.eclipse.equinox.p2.director", 1, Messages.Explanation_unsatisfied, null);
    String fromString = patch.toString() + ' ' + getUserReadableName(iu);
    result.add(new Status(4, "org.eclipse.equinox.p2.director", NLS.bind(Messages.Explanation_fromPatch, fromString)));
    result.add(new Status(4, "org.eclipse.equinox.p2.director", NLS.bind(Messages.Explanation_to, req)));
    return result;
  }
  
  public String toString()
  {
    return NLS.bind(Messages.Explanation_patchedHardDependency, new Object[] { patch, iu, req });
  }
  
  public int shortAnswer()
  {
    return 6;
  }
}

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

import java.util.Arrays;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.osgi.util.NLS;

public class Explanation$Singleton
  extends Explanation
{
  public final IInstallableUnit[] ius;
  
  public Explanation$Singleton(IInstallableUnit[] ius)
  {
    this.ius = ius;
  }
  
  public int orderValue()
  {
    return 4;
  }
  
  public int shortAnswer()
  {
    return 2;
  }
  
  public IStatus toStatus()
  {
    MultiStatus result = new MultiStatus("org.eclipse.equinox.p2.director", 1, NLS.bind(Messages.Explanation_singleton, ""), null);
    for (int i = 0; i < ius.length; i++) {
      result.add(new Status(4, "org.eclipse.equinox.p2.director", getUserReadableName(ius[i])));
    }
    return result;
  }
  
  public String toString()
  {
    return NLS.bind(Messages.Explanation_singleton, Arrays.asList(ius));
  }
}

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

import java.util.Arrays;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.IInstallableUnitPatch;
import org.eclipse.equinox.p2.metadata.IRequirement;
import org.eclipse.osgi.util.NLS;

public abstract class Explanation
  implements Comparable<Explanation>
{
  public static class PatchedHardRequirement
    extends Explanation
  {
    public final IInstallableUnit iu;
    public final IInstallableUnitPatch patch;
    public final IRequirement req;
    
    public PatchedHardRequirement(IInstallableUnit iu, IInstallableUnitPatch patch)
    {
      this.iu = iu;
      req = null;
      this.patch = patch;
    }
    
    public PatchedHardRequirement(IInstallableUnit iu, IRequirement req, IInstallableUnitPatch patch)
    {
      this.iu = iu;
      this.req = req;
      this.patch = patch;
    }
    
    public int orderValue()
    {
      return 6;
    }
    
    public IStatus toStatus()
    {
      MultiStatus result = new MultiStatus("org.eclipse.equinox.p2.director", 1, Messages.Explanation_unsatisfied, null);
      String fromString = patch.toString() + ' ' + getUserReadableName(iu);
      result.add(new Status(4, "org.eclipse.equinox.p2.director", NLS.bind(Messages.Explanation_fromPatch, fromString)));
      result.add(new Status(4, "org.eclipse.equinox.p2.director", NLS.bind(Messages.Explanation_to, req)));
      return result;
    }
    
    public String toString()
    {
      return NLS.bind(Messages.Explanation_patchedHardDependency, new Object[] { patch, iu, req });
    }
    
    public int shortAnswer()
    {
      return 6;
    }
  }
  
  public static class HardRequirement
    extends Explanation
  {
    public final IInstallableUnit iu;
    public final IRequirement req;
    
    public HardRequirement(IInstallableUnit iu, IRequirement req)
    {
      this.iu = iu;
      this.req = req;
    }
    
    public int orderValue()
    {
      return 5;
    }
    
    public IStatus toStatus()
    {
      MultiStatus result = new MultiStatus("org.eclipse.equinox.p2.director", 1, Messages.Explanation_unsatisfied, null);
      result.add(new Status(4, "org.eclipse.equinox.p2.director", NLS.bind(Messages.Explanation_from, getUserReadableName(iu))));
      result.add(new Status(4, "org.eclipse.equinox.p2.director", NLS.bind(Messages.Explanation_to, req)));
      return result;
    }
    
    public String toString()
    {
      return NLS.bind(Messages.Explanation_hardDependency, iu, req);
    }
    
    public int shortAnswer()
    {
      return 5;
    }
  }
  
  public static class IUInstalled
    extends Explanation
  {
    public final IInstallableUnit iu;
    
    public IUInstalled(IInstallableUnit iu)
    {
      this.iu = iu;
    }
    
    public int orderValue()
    {
      return 2;
    }
    
    public String toString()
    {
      return NLS.bind(Messages.Explanation_alreadyInstalled, iu);
    }
    
    public IStatus toStatus()
    {
      return new Status(4, "org.eclipse.equinox.p2.director", NLS.bind(Messages.Explanation_alreadyInstalled, getUserReadableName(iu)));
    }
    
    public int shortAnswer()
    {
      return 3;
    }
  }
  
  public static class IUToInstall
    extends Explanation
  {
    public final IInstallableUnit iu;
    
    public IUToInstall(IInstallableUnit iu)
    {
      this.iu = iu;
    }
    
    public int orderValue()
    {
      return 1;
    }
    
    public String toString()
    {
      return NLS.bind(Messages.Explanation_toInstall, iu);
    }
    
    public IStatus toStatus()
    {
      return new Status(4, "org.eclipse.equinox.p2.director", NLS.bind(Messages.Explanation_toInstall, getUserReadableName(iu)));
    }
    
    public int shortAnswer()
    {
      return 4;
    }
  }
  
  public static class NotInstallableRoot
    extends Explanation
  {
    public final IRequirement req;
    
    public NotInstallableRoot(IRequirement req)
    {
      this.req = req;
    }
    
    public String toString()
    {
      return NLS.bind(Messages.Explanation_missingRootFilter, req);
    }
    
    public IStatus toStatus()
    {
      return new Status(4, "org.eclipse.equinox.p2.director", NLS.bind(Messages.Explanation_missingRootFilter, req));
    }
    
    protected int orderValue()
    {
      return 2;
    }
    
    public int shortAnswer()
    {
      return 7;
    }
  }
  
  public static class MissingIU
    extends Explanation
  {
    public final IInstallableUnit iu;
    public final IRequirement req;
    public boolean isEntryPoint;
    
    public MissingIU(IInstallableUnit iu, IRequirement req, boolean isEntryPoint)
    {
      this.iu = iu;
      this.req = req;
      this.isEntryPoint = isEntryPoint;
    }
    
    public int orderValue()
    {
      return 3;
    }
    
    public int shortAnswer()
    {
      return 1;
    }
    
    public String toString()
    {
      if (isEntryPoint) {
        return NLS.bind(Messages.Explanation_missingRootRequired, req);
      }
      if (req.getFilter() == null) {
        return NLS.bind(Messages.Explanation_missingRequired, iu, req);
      }
      return NLS.bind(Messages.Explanation_missingRequiredFilter, new Object[] { req.getFilter(), iu, req });
    }
    
    public IStatus toStatus()
    {
      if (isEntryPoint) {
        return new Status(4, "org.eclipse.equinox.p2.director", NLS.bind(Messages.Explanation_missingRootRequired, req));
      }
      if (req.getFilter() == null) {
        return new Status(4, "org.eclipse.equinox.p2.director", NLS.bind(Messages.Explanation_missingRequired, getUserReadableName(iu), req));
      }
      return new Status(4, "org.eclipse.equinox.p2.director", NLS.bind(Messages.Explanation_missingRequiredFilter, new Object[] { req.getFilter(), getUserReadableName(iu), req }));
    }
  }
  
  public static class MissingGreedyIU
    extends Explanation
  {
    public final IInstallableUnit iu;
    
    public MissingGreedyIU(IInstallableUnit iu)
    {
      this.iu = iu;
    }
    
    public int orderValue()
    {
      return 3;
    }
    
    public int shortAnswer()
    {
      return 1;
    }
    
    public String toString()
    {
      return NLS.bind(Messages.Explanation_missingNonGreedyRequired, iu);
    }
    
    public IStatus toStatus()
    {
      return new Status(4, "org.eclipse.equinox.p2.director", NLS.bind(Messages.Explanation_missingNonGreedyRequired, getUserReadableName(iu)));
    }
  }
  
  public static class Singleton
    extends Explanation
  {
    public final IInstallableUnit[] ius;
    
    public Singleton(IInstallableUnit[] ius)
    {
      this.ius = ius;
    }
    
    public int orderValue()
    {
      return 4;
    }
    
    public int shortAnswer()
    {
      return 2;
    }
    
    public IStatus toStatus()
    {
      MultiStatus result = new MultiStatus("org.eclipse.equinox.p2.director", 1, NLS.bind(Messages.Explanation_singleton, ""), null);
      for (int i = 0; i < ius.length; i++) {
        result.add(new Status(4, "org.eclipse.equinox.p2.director", getUserReadableName(ius[i])));
      }
      return result;
    }
    
    public String toString()
    {
      return NLS.bind(Messages.Explanation_singleton, Arrays.asList(ius));
    }
  }
  
  public static final Explanation OPTIONAL_REQUIREMENT = new Explanation()
  {
    public int orderValue()
    {
      return 6;
    }
    
    public String toString()
    {
      return Messages.Explanation_optionalDependency;
    }
    
    public int shortAnswer()
    {
      return 100;
    }
  };
  public static final int MISSING_REQUIREMENT = 1;
  public static final int VIOLATED_SINGLETON_CONSTRAINT = 2;
  public static final int IU_INSTALLED = 3;
  public static final int IU_TO_INSTALL = 4;
  public static final int VIOLATED_HARD_REQUIREMENT = 5;
  public static final int VIOLATED_PATCHED_HARD_REQUIREMENT = 6;
  public static final int NON_INSTALLABLE_ROOT = 7;
  public static final int OTHER_REASON = 100;
  
  public int compareTo(Explanation exp)
  {
    if (orderValue() == exp.orderValue()) {
      return toString().compareTo(exp.toString());
    }
    return orderValue() - exp.orderValue();
  }
  
  protected abstract int orderValue();
  
  public abstract int shortAnswer();
  
  public IStatus toStatus()
  {
    return new Status(4, "org.eclipse.equinox.p2.director", toString());
  }
  
  protected String getUserReadableName(IInstallableUnit iu)
  {
    if (iu == null) {
      return "";
    }
    String result = getLocalized(iu);
    if (result == null) {
      return iu.toString();
    }
    return result + ' ' + iu.getVersion() + " (" + iu.toString() + ')';
  }
  
  private String getLocalized(IInstallableUnit iu)
  {
    String value = iu.getProperty("org.eclipse.equinox.p2.name");
    if ((value == null) || (value.length() <= 1) || (value.charAt(0) != '%')) {
      return value;
    }
    String actualKey = value.substring(1);
    return iu.getProperty("df_LT." + actualKey);
  }
}

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

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.ProgressMonitorWrapper;

class InfiniteProgress
  extends ProgressMonitorWrapper
{
  private int totalWork;
  private int currentIncrement = 4;
  private int halfWay;
  private int nextProgress = currentIncrement;
  private int worked = 0;
  
  protected InfiniteProgress(IProgressMonitor monitor)
  {
    super(monitor);
  }
  
  public void beginTask(String name, int work)
  {
    super.beginTask(name, work);
    totalWork = work;
    halfWay = (totalWork / 2);
  }
  
  public void worked(int work)
  {
    if (--nextProgress <= 0)
    {
      super.worked(1);
      worked += 1;
      if (worked >= halfWay)
      {
        currentIncrement *= 2;
        halfWay += (totalWork - halfWay) / 2;
      }
      nextProgress = currentIncrement;
    }
  }
}

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

import org.eclipse.osgi.util.NLS;

public class Messages
  extends NLS
{
  private static final String BUNDLE_NAME = "org.eclipse.equinox.internal.p2.director.messages";
  public static String Director_Task_installer_plan;
  public static String Director_Task_Installing;
  public static String Director_Task_Updating;
  public static String Director_Task_Resolving_Dependencies;
  public static String Director_Unsatisfied_Dependencies;
  public static String Director_error_applying_configuration;
  public static String Director_For_Target;
  public static String Director_For_Target_Unselect_Required;
  public static String Explanation_alreadyInstalled;
  public static String Explanation_from;
  public static String Explanation_fromPatch;
  public static String Explanation_hardDependency;
  public static String Explanation_patchedHardDependency;
  public static String Explanation_missingRequired;
  public static String Explanation_missingRootRequired;
  public static String Explanation_missingNonGreedyRequired;
  public static String Explanation_missingRequiredFilter;
  public static String Explanation_missingRootFilter;
  public static String Explanation_optionalDependency;
  public static String Explanation_rootMissing;
  public static String Explanation_rootSingleton;
  public static String Explanation_singleton;
  public static String Explanation_to;
  public static String Explanation_toInstall;
  public static String Explanation_unsatisfied;
  public static String Planner_Timeout;
  public static String Planner_Problems_resolving_plan;
  public static String Planner_Unsatisfiable_problem;
  public static String Planner_Unsatisfied_dependency;
  public static String Planner_NoSolution;
  public static String Planner_Unexpected_problem;
  public static String Planner_actions_and_software_incompatible;
  public static String Planner_can_not_install_preq;
  public static String Planner_no_profile_registry;
  public static String Planner_profile_out_of_sync;
  public static String RequestStatus_message;
  public static String Planner_no_installer_agent;
  
  static
  {
    NLS.initializeMessages("org.eclipse.equinox.internal.p2.director.messages", Messages.class);
  }
}

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

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
import org.eclipse.equinox.p2.engine.IProvisioningPlan;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.IInstallableUnitFragment;
import org.eclipse.equinox.p2.metadata.IUpdateDescriptor;
import org.eclipse.equinox.p2.metadata.MetadataFactory;
import org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription;
import org.eclipse.equinox.p2.metadata.expression.IExpression;
import org.eclipse.equinox.p2.query.IQuery;
import org.eclipse.equinox.p2.query.IQueryResult;
import org.eclipse.equinox.p2.query.QueryUtil;

public class OperationGenerator
{
  private static final IInstallableUnit NULL_IU = MetadataFactory.createResolvedInstallableUnit(MetadataFactory.createInstallableUnit(new MetadataFactory.InstallableUnitDescription()), new IInstallableUnitFragment[0]);
  private final IProvisioningPlan plan;
  
  public OperationGenerator(IProvisioningPlan plan)
  {
    this.plan = plan;
  }
  
  public void generateOperation(Collection<IInstallableUnit> from_, Collection<IInstallableUnit> to_)
  {
    Collection<IInstallableUnit> intersection = new HashSet(from_);
    intersection.retainAll(to_);
    
    HashSet<IInstallableUnit> tmpFrom = new HashSet(from_);
    HashSet<IInstallableUnit> tmpTo = new HashSet(to_);
    tmpFrom.removeAll(intersection);
    tmpTo.removeAll(intersection);
    
    List<IInstallableUnit> from = new ArrayList(tmpFrom);
    Collections.sort(from);
    
    List<IInstallableUnit> to = new ArrayList(tmpTo);
    Collections.sort(to);
    
    generateUpdates(from, to);
    generateInstallUninstall(from, to);
    generateConfigurationChanges(to_, intersection);
  }
  
  private void generateConfigurationChanges(Collection<IInstallableUnit> to_, Collection<IInstallableUnit> intersection)
  {
    if (intersection.size() == 0) {
      return;
    }
    TreeSet<IInstallableUnit> to = new TreeSet(to_);
    for (Iterator localIterator = intersection.iterator(); localIterator.hasNext();)
    {
      IInstallableUnit fromIU = (IInstallableUnit)localIterator.next();
      IInstallableUnit toIU = (IInstallableUnit)to.tailSet(fromIU).first();
      generateConfigurationOperation(fromIU, toIU);
    }
  }
  
  private void generateConfigurationOperation(IInstallableUnit fromIU, IInstallableUnit toIU)
  {
    Collection<IInstallableUnitFragment> fromFragments = fromIU.getFragments();
    Collection<IInstallableUnitFragment> toFragments = toIU.getFragments();
    if (fromFragments == toFragments) {
      return;
    }
    if ((fromFragments.size() == toFragments.size()) && (fromFragments.containsAll(toFragments))) {
      return;
    }
    plan.updateInstallableUnit(fromIU, toIU);
  }
  
  private void generateInstallUninstall(List<IInstallableUnit> from, List<IInstallableUnit> to)
  {
    int toIdx = 0;
    int fromIdx = 0;
    while ((fromIdx != from.size()) && (toIdx != to.size()))
    {
      IInstallableUnit fromIU = (IInstallableUnit)from.get(fromIdx);
      IInstallableUnit toIU = (IInstallableUnit)to.get(toIdx);
      int comparison = toIU.compareTo(fromIU);
      if (comparison < 0)
      {
        plan.addInstallableUnit(toIU);
        toIdx++;
      }
      else if (comparison == 0)
      {
        toIdx++;
        fromIdx++;
      }
      else
      {
        plan.removeInstallableUnit(fromIU);
        fromIdx++;
      }
    }
    if (fromIdx != from.size()) {
      for (int i = fromIdx; i < from.size(); i++) {
        plan.removeInstallableUnit((IInstallableUnit)from.get(i));
      }
    }
    if (toIdx != to.size()) {
      for (int i = toIdx; i < to.size(); i++) {
        plan.addInstallableUnit((IInstallableUnit)to.get(i));
      }
    }
  }
  
  private void generateUpdates(List<IInstallableUnit> from, List<IInstallableUnit> to)
  {
    if ((to.isEmpty()) || (from.isEmpty())) {
      return;
    }
    Set<IInstallableUnit> processed = new HashSet();
    Set<IInstallableUnit> removedFromTo = new HashSet();
    
    QueryableArray indexedFromElements = new QueryableArray((IInstallableUnit[])from.toArray(new IInstallableUnit[from.size()]));
    for (int toIdx = 0; toIdx < to.size(); toIdx++)
    {
      IInstallableUnit iuTo = (IInstallableUnit)to.get(toIdx);
      if (iuTo.getId().equals(next(to, toIdx).getId()))
      {
        toIdx = skip(to, iuTo, toIdx) - 1;
      }
      else if (iuTo.getUpdateDescriptor() != null)
      {
        IQuery<IInstallableUnit> updateQuery = QueryUtil.createMatchQuery((IExpression)iuTo.getUpdateDescriptor().getIUsBeingUpdated().iterator().next(), new Object[0]);
        iuTo.getUpdateDescriptor().getIUsBeingUpdated();
        IQueryResult<IInstallableUnit> updates = indexedFromElements.query(updateQuery, null);
        if (!updates.isEmpty())
        {
          Iterator<IInstallableUnit> updatesIterator = updates.iterator();
          IInstallableUnit iuFrom = (IInstallableUnit)updatesIterator.next();
          if (!updatesIterator.hasNext()) {
            if (iuTo.equals(iuFrom))
            {
              from.remove(iuFrom);
              
              removedFromTo.add(iuTo);
            }
            else
            {
              plan.updateInstallableUnit(iuFrom, iuTo);
              from.remove(iuFrom);
              
              processed.add(iuTo);
            }
          }
        }
      }
    }
    to.removeAll(processed);
    to.removeAll(removedFromTo);
  }
  
  private IInstallableUnit next(List<IInstallableUnit> l, int i)
  {
    
    if (i >= l.size()) {
      return NULL_IU;
    }
    return (IInstallableUnit)l.get(i);
  }
  
  private int skip(List<IInstallableUnit> c, IInstallableUnit id, int idx)
  {
    for (int i = idx; i < c.size(); i++) {
      if (!id.getId().equals(((IInstallableUnit)c.get(i)).getId())) {
        return i;
      }
    }
    return i;
  }
}

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

import java.util.Map;
import org.eclipse.equinox.internal.p2.metadata.RequiredCapability;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.IRequirement;
import org.eclipse.equinox.p2.query.IQueryable;

public class PermissiveSlicer
  extends Slicer
{
  private boolean includeOptionalDependencies;
  private boolean everythingGreedy;
  private boolean considerFilter;
  private boolean considerOnlyStrictDependency;
  private boolean evalFilterTo;
  private boolean onlyFilteredRequirements;
  
  public PermissiveSlicer(IQueryable<IInstallableUnit> input, Map<String, String> context, boolean includeOptionalDependencies, boolean everythingGreedy, boolean evalFilterTo, boolean considerOnlyStrictDependency, boolean onlyFilteredRequirements)
  {
    super(input, context, true);
    considerFilter = ((context != null) && (context.size() > 1));
    this.includeOptionalDependencies = includeOptionalDependencies;
    this.everythingGreedy = everythingGreedy;
    this.evalFilterTo = evalFilterTo;
    this.considerOnlyStrictDependency = considerOnlyStrictDependency;
    this.onlyFilteredRequirements = onlyFilteredRequirements;
  }
  
  protected boolean isApplicable(IInstallableUnit iu)
  {
    if (considerFilter) {
      return super.isApplicable(iu);
    }
    if (iu.getFilter() == null) {
      return true;
    }
    return evalFilterTo;
  }
  
  protected boolean isApplicable(IRequirement req)
  {
    if ((!includeOptionalDependencies) && 
      (req.getMin() == 0)) {
      return false;
    }
    if ((considerOnlyStrictDependency) && 
      (!RequiredCapability.isVersionStrict(req.getMatches()))) {
      return false;
    }
    if (considerFilter)
    {
      if ((onlyFilteredRequirements) && (req.getFilter() == null)) {
        return false;
      }
      return super.isApplicable(req);
    }
    if (req.getFilter() == null)
    {
      if (onlyFilteredRequirements) {
        return false;
      }
      return true;
    }
    return evalFilterTo;
  }
  
  protected boolean isGreedy(IRequirement req)
  {
    if (everythingGreedy) {
      return true;
    }
    return super.isGreedy(req);
  }
}

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

import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.core.spi.IAgentServiceFactory;

public class Planne
1 2 3 4 5

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