org.eclipse.equinox.p2.operations_2.2.0.v20130119-010614

ild(100));
    job.setAdditionalProgressMonitor(mon.newChild(900));
    return job;
  }
  
  protected void prepareToResolve() {}
  
  void makeResolveJob(IProgressMonitor monitor)
  {
    noChangeRequest = PlanAnalyzer.getProfileChangeAlteredStatus();
    if (session.hasScheduledOperationsFor(profileId)) {
      noChangeRequest.add(PlanAnalyzer.getStatus(10052, null));
    } else {
      computeProfileChangeRequest(noChangeRequest, monitor);
    }
    if (request == null)
    {
      if (noChangeRequest.getChildren().length == 0) {
        noChangeRequest = new MultiStatus("org.eclipse.equinox.p2.operations", 10050, new IStatus[] { PlanAnalyzer.getStatus(10050, null) }, Messages.ProfileChangeOperation_NoProfileChangeRequest, null);
      }
      return;
    }
    createPlannerResolutionJob();
  }
  
  protected abstract void computeProfileChangeRequest(MultiStatus paramMultiStatus, IProgressMonitor paramIProgressMonitor);
  
  private void createPlannerResolutionJob()
  {
    job = new PlannerResolutionJob(getResolveJobName(), session, profileId, request, getFirstPassProvisioningContext(), getSecondPassEvaluator(), noChangeRequest);
  }
  
  protected abstract String getResolveJobName();
  
  protected abstract String getProvisioningJobName();
  
  public IStatus getResolutionResult()
  {
    if (request == null)
    {
      if (noChangeRequest != null)
      {
        if (noChangeRequest.getChildren().length == 1) {
          return noChangeRequest.getChildren()[0];
        }
        return noChangeRequest;
      }
      return null;
    }
    if ((job != null) && (job.getResolutionResult() != null)) {
      return job.getResolutionResult().getSummaryStatus();
    }
    return null;
  }
  
  public String getResolutionDetails()
  {
    if ((job != null) && (job.getResolutionResult() != null)) {
      return job.getResolutionResult().getSummaryReport();
    }
    IStatus result = getResolutionResult();
    if (result != null) {
      return result.getMessage();
    }
    return null;
  }
  
  public String getResolutionDetails(IInstallableUnit iu)
  {
    if ((job != null) && (job.getResolutionResult() != null)) {
      return job.getResolutionResult().getDetailedReport(new IInstallableUnit[] { iu });
    }
    return null;
  }
  
  public IProvisioningPlan getProvisioningPlan()
  {
    if (job != null) {
      return job.getProvisioningPlan();
    }
    return null;
  }
  
  public IProfileChangeRequest getProfileChangeRequest()
  {
    if (job != null) {
      return job.getProfileChangeRequest();
    }
    return null;
  }
  
  public ProvisioningJob getProvisioningJob(IProgressMonitor monitor)
  {
    IStatus status = getResolutionResult();
    if ((status.getSeverity() != 8) && (status.getSeverity() != 4) && 
      (job.getProvisioningPlan() != null))
    {
      ProfileModificationJob pJob = new ProfileModificationJob(getProvisioningJobName(), session, profileId, job.getProvisioningPlan(), job.getActualProvisioningContext());
      pJob.setAdditionalProgressMonitor(monitor);
      return pJob;
    }
    return null;
  }
  
  public void setProvisioningContext(ProvisioningContext context)
  {
    this.context = context;
    if (job != null) {
      updateJobProvisioningContexts(job, context);
    }
  }
  
  public ProvisioningContext getProvisioningContext()
  {
    return context;
  }
  
  public String getProfileId()
  {
    return profileId;
  }
  
  public boolean hasResolved()
  {
    return getResolutionResult() != null;
  }
  
  ProvisioningContext getFirstPassProvisioningContext()
  {
    return getProvisioningContext();
  }
  
  IFailedStatusEvaluator getSecondPassEvaluator()
  {
    new IFailedStatusEvaluator()
    {
      public ProvisioningContext getSecondPassProvisioningContext(IProvisioningPlan failedPlan)
      {
        return null;
      }
    };
  }
  
  protected void updateJobProvisioningContexts(PlannerResolutionJob job, ProvisioningContext context)
  {
    job.setFirstPassProvisioningContext(context);
  }
}

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

import org.eclipse.equinox.p2.engine.IPhaseSet;
import org.eclipse.equinox.p2.engine.IProfile;
import org.eclipse.equinox.p2.engine.IProfileRegistry;
import org.eclipse.equinox.p2.engine.IProvisioningPlan;
import org.eclipse.equinox.p2.engine.PhaseSetFactory;
import org.eclipse.equinox.p2.engine.ProvisioningContext;

public class ProfileModificationJob
  extends ProvisioningJob
  implements IProfileChangeJob
{
  IProvisioningPlan plan;
  String profileId;
  IPhaseSet phaseSet = PhaseSetFactory.createDefaultPhaseSet();
  ProvisioningContext provisioningContext;
  int restartPolicy = 2;
  private String taskName;
  
  public ProfileModificationJob(String name, ProvisioningSession session, String profileId, IProvisioningPlan plan, ProvisioningContext context)
  {
    super(name, session);
    this.plan = plan;
    this.profileId = profileId;
    provisioningContext = context;
  }
  
  public void setPhaseSet(IPhaseSet phaseSet)
  {
    this.phaseSet = phaseSet;
  }
  
  public String getProfileId()
  {
    return profileId;
  }
  
  /* Error */
  public org.eclipse.core.runtime.IStatus runModal(org.eclipse.core.runtime.IProgressMonitor monitor)
  {
    // Byte code:
    //   0: aload_1
    //   1: ifnonnull +11 -> 12
    //   4: new 55	org/eclipse/core/runtime/NullProgressMonitor
    //   7: dup
    //   8: invokespecial 116	org/eclipse/core/runtime/NullProgressMonitor:<init>	()V
    //   11: astore_1
    //   12: aload_0
    //   13: getfield 111	org/eclipse/equinox/p2/operations/ProfileModificationJob:taskName	Ljava/lang/String;
    //   16: astore_2
    //   17: getstatic 108	org/eclipse/core/runtime/Status:OK_STATUS	Lorg/eclipse/core/runtime/IStatus;
    //   20: astore_3
    //   21: aload_2
    //   22: ifnonnull +8 -> 30
    //   25: aload_0
    //   26: invokevirtual 119	org/eclipse/equinox/p2/operations/ProfileModificationJob:getName	()Ljava/lang/String;
    //   29: astore_2
    //   30: aload_1
    //   31: aload_2
    //   32: sipush 1000
    //   35: invokeinterface 125 3 0
    //   40: aload_0
    //   41: invokevirtual 120	org/eclipse/equinox/p2/operations/ProfileModificationJob:getSession	()Lorg/eclipse/equinox/p2/operations/ProvisioningSession;
    //   44: aload_0
    //   45: getfield 113	org/eclipse/equinox/p2/operations/ProfileModificationJob:plan	Lorg/eclipse/equinox/p2/engine/IProvisioningPlan;
    //   48: aload_0
    //   49: getfield 112	org/eclipse/equinox/p2/operations/ProfileModificationJob:phaseSet	Lorg/eclipse/equinox/p2/engine/IPhaseSet;
    //   52: aload_0
    //   53: getfield 114	org/eclipse/equinox/p2/operations/ProfileModificationJob:provisioningContext	Lorg/eclipse/equinox/p2/engine/ProvisioningContext;
    //   56: new 57	org/eclipse/core/runtime/SubProgressMonitor
    //   59: dup
    //   60: aload_1
    //   61: sipush 1000
    //   64: invokespecial 117	org/eclipse/core/runtime/SubProgressMonitor:<init>	(Lorg/eclipse/core/runtime/IProgressMonitor;I)V
    //   67: invokevirtual 123	org/eclipse/equinox/p2/operations/ProvisioningSession:performProvisioningPlan	(Lorg/eclipse/equinox/p2/engine/IProvisioningPlan;Lorg/eclipse/equinox/p2/engine/IPhaseSet;Lorg/eclipse/equinox/p2/engine/ProvisioningContext;Lorg/eclipse/core/runtime/IProgressMonitor;)Lorg/eclipse/core/runtime/IStatus;
    //   70: astore_3
    //   71: goto +14 -> 85
    //   74: astore 4
    //   76: aload_1
    //   77: invokeinterface 124 1 0
    //   82: aload 4
    //   84: athrow
    //   85: aload_1
    //   86: invokeinterface 124 1 0
    //   91: aload_3
    //   92: areturn
    // Line number table:
    //   Java source line #71	-> byte code offset #0
    //   Java source line #72	-> byte code offset #4
    //   Java source line #73	-> byte code offset #12
    //   Java source line #74	-> byte code offset #17
    //   Java source line #75	-> byte code offset #21
    //   Java source line #76	-> byte code offset #25
    //   Java source line #77	-> byte code offset #30
    //   Java source line #79	-> byte code offset #40
    //   Java source line #80	-> byte code offset #71
    //   Java source line #81	-> byte code offset #76
    //   Java source line #82	-> byte code offset #82
    //   Java source line #81	-> byte code offset #85
    //   Java source line #83	-> byte code offset #91
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	93	0	this	ProfileModificationJob
    //   0	93	1	monitor	org.eclipse.core.runtime.IProgressMonitor
    //   16	16	2	task	String
    //   20	72	3	status	org.eclipse.core.runtime.IStatus
    //   74	9	4	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   40	74	74	finally
  }
  
  public void setTaskName(String label)
  {
    taskName = label;
  }
  
  public int getRestartPolicy()
  {
    if ("_SELF_".equals(profileId)) {
      return restartPolicy;
    }
    IProfile profile = getSession().getProfileRegistry().getProfile("_SELF_");
    String id = profile == null ? null : profile.getProfileId();
    if ((id != null) && (profileId.equals(id))) {
      return restartPolicy;
    }
    return 1;
  }
  
  public void setRestartPolicy(int policy)
  {
    restartPolicy = policy;
  }
}

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

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

class ProvisioningJob$DoubleProgressMonitor
  extends ProgressMonitorWrapper
{
  IProgressMonitor additionalMonitor;
  
  protected ProvisioningJob$DoubleProgressMonitor(IProgressMonitor monitor1, IProgressMonitor monitor2)
  {
    super(monitor1);
    additionalMonitor = monitor2;
  }
  
  public void beginTask(String name, int totalWork)
  {
    super.beginTask(name, totalWork);
    additionalMonitor.beginTask(name, totalWork);
  }
  
  public void clearBlocked()
  {
    super.clearBlocked();
    if ((additionalMonitor instanceof IProgressMonitorWithBlocking)) {
      ((IProgressMonitorWithBlocking)additionalMonitor).clearBlocked();
    }
  }
  
  public void done()
  {
    super.done();
    additionalMonitor.done();
  }
  
  public void internalWorked(double work)
  {
    super.internalWorked(work);
    additionalMonitor.internalWorked(work);
  }
  
  public boolean isCanceled()
  {
    if (super.isCanceled()) {
      return true;
    }
    return additionalMonitor.isCanceled();
  }
  
  public void setBlocked(IStatus reason)
  {
    super.setBlocked(reason);
    if ((additionalMonitor instanceof IProgressMonitorWithBlocking)) {
      ((IProgressMonitorWithBlocking)additionalMonitor).setBlocked(reason);
    }
  }
  
  public void setCanceled(boolean b)
  {
    super.setCanceled(b);
    additionalMonitor.setCanceled(b);
  }
  
  public void setTaskName(String name)
  {
    super.setTaskName(name);
    additionalMonitor.setTaskName(name);
  }
  
  public void subTask(String name)
  {
    super.subTask(name);
    additionalMonitor.subTask(name);
  }
  
  public void worked(int work)
  {
    super.worked(work);
    additionalMonitor.worked(work);
  }
}

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

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IProgressMonitorWithBlocking;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.ProgressMonitorWrapper;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.equinox.internal.p2.operations.Messages;
import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.osgi.util.NLS;

public abstract class ProvisioningJob
  extends Job
{
  public static final int RESTART_NONE = 1;
  public static final int RESTART_OR_APPLY = 2;
  public static final int RESTART_ONLY = 3;
  private ProvisioningSession session;
  private IProgressMonitor additionalMonitor;
  
  private static class DoubleProgressMonitor
    extends ProgressMonitorWrapper
  {
    IProgressMonitor additionalMonitor;
    
    protected DoubleProgressMonitor(IProgressMonitor monitor1, IProgressMonitor monitor2)
    {
      super();
      additionalMonitor = monitor2;
    }
    
    public void beginTask(String name, int totalWork)
    {
      super.beginTask(name, totalWork);
      additionalMonitor.beginTask(name, totalWork);
    }
    
    public void clearBlocked()
    {
      super.clearBlocked();
      if ((additionalMonitor instanceof IProgressMonitorWithBlocking)) {
        ((IProgressMonitorWithBlocking)additionalMonitor).clearBlocked();
      }
    }
    
    public void done()
    {
      super.done();
      additionalMonitor.done();
    }
    
    public void internalWorked(double work)
    {
      super.internalWorked(work);
      additionalMonitor.internalWorked(work);
    }
    
    public boolean isCanceled()
    {
      if (super.isCanceled()) {
        return true;
      }
      return additionalMonitor.isCanceled();
    }
    
    public void setBlocked(IStatus reason)
    {
      super.setBlocked(reason);
      if ((additionalMonitor instanceof IProgressMonitorWithBlocking)) {
        ((IProgressMonitorWithBlocking)additionalMonitor).setBlocked(reason);
      }
    }
    
    public void setCanceled(boolean b)
    {
      super.setCanceled(b);
      additionalMonitor.setCanceled(b);
    }
    
    public void setTaskName(String name)
    {
      super.setTaskName(name);
      additionalMonitor.setTaskName(name);
    }
    
    public void subTask(String name)
    {
      super.subTask(name);
      additionalMonitor.subTask(name);
    }
    
    public void worked(int work)
    {
      super.worked(work);
      additionalMonitor.worked(work);
    }
  }
  
  public ProvisioningJob(String name, ProvisioningSession session)
  {
    super(name);
    this.session = session;
  }
  
  protected ProvisioningSession getSession()
  {
    return session;
  }
  
  private IProgressMonitor getCombinedProgressMonitor(IProgressMonitor mon1, IProgressMonitor mon2)
  {
    if (mon1 == null) {
      return mon2;
    }
    if (mon2 == null) {
      return mon1;
    }
    return new DoubleProgressMonitor(mon1, mon2);
  }
  
  public void setAdditionalProgressMonitor(IProgressMonitor monitor)
  {
    additionalMonitor = monitor;
  }
  
  public final IStatus run(IProgressMonitor monitor)
  {
    IProgressMonitor wrappedMonitor = getCombinedProgressMonitor(monitor, additionalMonitor);
    IStatus status = Status.OK_STATUS;
    try
    {
      status = runModal(wrappedMonitor);
    }
    catch (OperationCanceledException localOperationCanceledException)
    {
      status = Status.CANCEL_STATUS;
    }
    return status;
  }
  
  public abstract IStatus runModal(IProgressMonitor paramIProgressMonitor);
  
  public int getRestartPolicy()
  {
    return 1;
  }
  
  protected IStatus getErrorStatus(String message, ProvisionException e)
  {
    if (message == null) {
      if (e == null) {
        message = NLS.bind(Messages.ProvisioningJob_GenericErrorStatusMessage, getName());
      } else {
        message = e.getLocalizedMessage();
      }
    }
    return new Status(4, "org.eclipse.equinox.p2.operations", message, e);
  }
}

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

import java.util.Set;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;

class ProvisioningSession$1
  extends JobChangeAdapter
{
  final ProvisioningSession this$0;
  
  ProvisioningSession$1(ProvisioningSession paramProvisioningSession) {}
  
  public void done(IJobChangeEvent event)
  {
    this$0.scheduledJobs.remove(event.getJob());
  }
}

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

import java.io.IOException;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
import org.eclipse.equinox.internal.p2.operations.Activator;
import org.eclipse.equinox.internal.p2.operations.Messages;
import org.eclipse.equinox.internal.provisional.configurator.Configurator;
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus;
import org.eclipse.equinox.p2.core.IAgentLocation;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.engine.IEngine;
import org.eclipse.equinox.p2.engine.IPhaseSet;
import org.eclipse.equinox.p2.engine.IProfile;
import org.eclipse.equinox.p2.engine.IProfileRegistry;
import org.eclipse.equinox.p2.engine.IProvisioningPlan;
import org.eclipse.equinox.p2.engine.PhaseSetFactory;
import org.eclipse.equinox.p2.engine.ProvisioningContext;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.planner.IPlanner;
import org.eclipse.equinox.p2.query.IQueryResult;
import org.eclipse.equinox.p2.query.IQueryable;
import org.eclipse.equinox.p2.query.QueryUtil;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;

public class ProvisioningSession
{
  private IProvisioningAgent agent;
  Set<Job> scheduledJobs = Collections.synchronizedSet(new HashSet());
  
  public ProvisioningSession(IProvisioningAgent agent)
  {
    Assert.isNotNull(agent, Messages.ProvisioningSession_AgentNotFound);
    this.agent = agent;
  }
  
  public IProvisioningAgent getProvisioningAgent()
  {
    return agent;
  }
  
  IAgentLocation getAgentLocation()
  {
    return (IAgentLocation)agent.getService(IAgentLocation.SERVICE_NAME);
  }
  
  IArtifactRepositoryManager getArtifactRepositoryManager()
  {
    return (IArtifactRepositoryManager)agent.getService(IArtifactRepositoryManager.SERVICE_NAME);
  }
  
  IMetadataRepositoryManager getMetadataRepositoryManager()
  {
    return (IMetadataRepositoryManager)agent.getService(IMetadataRepositoryManager.SERVICE_NAME);
  }
  
  IProfileRegistry getProfileRegistry()
  {
    return (IProfileRegistry)agent.getService(IProfileRegistry.SERVICE_NAME);
  }
  
  IEngine getEngine()
  {
    return (IEngine)agent.getService(IEngine.SERVICE_NAME);
  }
  
  IProvisioningEventBus getProvisioningEventBus()
  {
    return (IProvisioningEventBus)agent.getService(IProvisioningEventBus.SERVICE_NAME);
  }
  
  IPlanner getPlanner()
  {
    return (IPlanner)agent.getService(IPlanner.SERVICE_NAME);
  }
  
  public IStatus performProvisioningPlan(IProvisioningPlan plan, IPhaseSet phaseSet, ProvisioningContext context, IProgressMonitor monitor)
  {
    IPhaseSet set;
    IPhaseSet set;
    if (phaseSet == null) {
      set = PhaseSetFactory.createDefaultPhaseSet();
    } else {
      set = phaseSet;
    }
    SubMonitor mon = SubMonitor.convert(monitor, 600);
    int ticksUsed = 0;
    
    IProfile profile = plan.getProfile();
    if (plan.getInstallerPlan() != null)
    {
      if (doesPhaseSetIncludeDownload(set))
      {
        IProvisioningPlan downloadPlan = getEngine().createPlan(profile, context);
        Iterator<IInstallableUnit> it = QueryUtil.compoundQueryable(plan.getAdditions(), plan.getInstallerPlan().getAdditions()).query(QueryUtil.createIUAnyQuery(), null).iterator();
        while (it.hasNext()) {
          downloadPlan.addInstallableUnit((IInstallableUnit)it.next());
        }
        IPhaseSet download = PhaseSetFactory.createPhaseSetIncluding(new String[] { PhaseSetFactory.PHASE_COLLECT });
        IStatus downloadStatus = getEngine().perform(downloadPlan, download, mon.newChild(300));
        if (!downloadStatus.isOK())
        {
          mon.done();
          return downloadStatus;
        }
        ticksUsed = 300;
      }
      IStatus installerPlanStatus = getEngine().perform(plan.getInstallerPlan(), set, mon.newChild(100));
      if (!installerPlanStatus.isOK())
      {
        mon.done();
        return installerPlanStatus;
      }
      ticksUsed += 100;
      
      Configurator configChanger = (Configurator)ServiceHelper.getService(Activator.getContext(), Configurator.class.getName());
      try
      {
        configChanger.applyConfiguration();
      }
      catch (IOException e)
      {
        mon.done();
        return new Status(4, "org.eclipse.equinox.p2.operations", Messages.ProvisioningSession_InstallPlanConfigurationError, e);
      }
    }
    return getEngine().perform(plan, set, mon.newChild(500 - ticksUsed));
  }
  
  private boolean doesPhaseSetIncludeDownload(IPhaseSet set)
  {
    String[] phaseIds = set.getPhaseIds();
    for (int i = 0; i < phaseIds.length; i++) {
      if (phaseIds[i].equals(PhaseSetFactory.PHASE_COLLECT)) {
        return true;
      }
    }
    return false;
  }
  
  public boolean hasScheduledOperationsFor(String profileId)
  {
    Job[] jobs = getScheduledJobs();
    for (int i = 0; i < jobs.length; i++) {
      if ((jobs[i] instanceof IProfileChangeJob))
      {
        String id = ((IProfileChangeJob)jobs[i]).getProfileId();
        if (profileId.equals(id)) {
          return true;
        }
      }
    }
    return false;
  }
  
  /* Error */
  private Job[] getScheduledJobs()
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 282	org/eclipse/equinox/p2/operations/ProvisioningSession:scheduledJobs	Ljava/util/Set;
    //   4: dup
    //   5: astore_1
    //   6: monitorenter
    //   7: aload_0
    //   8: getfield 282	org/eclipse/equinox/p2/operations/ProvisioningSession:scheduledJobs	Ljava/util/Set;
    //   11: aload_0
    //   12: getfield 282	org/eclipse/equinox/p2/operations/ProvisioningSession:scheduledJobs	Ljava/util/Set;
    //   15: invokeinterface 313 1 0
    //   20: anewarray 141	org/eclipse/core/runtime/jobs/Job
    //   23: invokeinterface 315 2 0
    //   28: checkcast 125	[Lorg/eclipse/core/runtime/jobs/Job;
    //   31: aload_1
    //   32: monitorexit
    //   33: areturn
    //   34: aload_1
    //   35: monitorexit
    //   36: athrow
    // Line number table:
    //   Java source line #207	-> byte code offset #0
    //   Java source line #208	-> byte code offset #7
    //   Java source line #207	-> byte code offset #34
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	37	0	this	ProvisioningSession
    //   5	30	1	Ljava/lang/Object;	Object
    // Exception table:
    //   from	to	target	type
    //   7	33	34	finally
    //   34	36	34	finally
  }
  
  public void rememberJob(Job job)
  {
    scheduledJobs.add(job);
    job.addJobChangeListener(new JobChangeAdapter()
    {
      public void done(IJobChangeEvent event)
      {
        scheduledJobs.remove(event.getJob());
      }
    });
  }
}

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

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest;
import org.eclipse.equinox.internal.p2.metadata.query.UpdateQuery;
import org.eclipse.equinox.internal.p2.operations.Messages;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.engine.IProfile;
import org.eclipse.equinox.p2.engine.IProfileRegistry;
import org.eclipse.equinox.p2.engine.IProvisioningPlan;
import org.eclipse.equinox.p2.engine.query.IUProfilePropertyQuery;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.IRequirement;
import org.eclipse.equinox.p2.metadata.MetadataFactory;
import org.eclipse.equinox.p2.metadata.Version;
import org.eclipse.equinox.p2.metadata.VersionRange;
import org.eclipse.equinox.p2.planner.IPlanner;
import org.eclipse.equinox.p2.planner.IProfileChangeRequest;
import org.eclipse.equinox.p2.planner.ProfileInclusionRules;
import org.eclipse.equinox.p2.query.CollectionResult;
import org.eclipse.equinox.p2.query.IQueryResult;
import org.eclipse.equinox.p2.query.IQueryable;
import org.eclipse.equinox.p2.query.QueryUtil;

public class RelaxedUpdateInstallOperation
  extends ProfileChangeOperation
{
  public RelaxedUpdateInstallOperation(ProvisioningSession session)
  {
    super(session);
  }
  
  protected void computeProfileChangeRequest(MultiStatus status, IProgressMonitor monitor)
  {
    IProfileRegistry profileRegistry = (IProfileRegistry)session.getProvisioningAgent().getService(IProfileRegistry.SERVICE_NAME);
    IPlanner plan = (IPlanner)session.getProvisioningAgent().getService(IPlanner.SERVICE_NAME);
    IProfile prof = profileRegistry.getProfile(getProfileId());
    
    IQueryResult<IInstallableUnit> strictRoots = prof.query(new IUProfilePropertyQuery("org.eclipse.equinox.p2.internal.inclusion.rules", "STRICT"), null);
    IQueryResult<IInstallableUnit> optionalRoots = prof.query(new IUProfilePropertyQuery("org.eclipse.equinox.p2.internal.inclusion.rules", "OPTIONAL"), null);
    Set<IInstallableUnit> tmpRoots = new HashSet(strictRoots.toUnmodifiableSet());
    tmpRoots.addAll(optionalRoots.toUnmodifiableSet());
    CollectionResult<IInstallableUnit> allRoots = new CollectionResult(tmpRoots);
    
    request = ((ProfileChangeRequest)plan.createChangeRequest(prof));
    Collection<IRequirement> limitingRequirements = new ArrayList();
    for (Iterator<IInstallableUnit> iterator = allRoots.query(QueryUtil.ALL_UNITS, null).iterator(); iterator.hasNext();)
    {
      IInstallableUnit currentlyInstalled = (IInstallableUnit)iterator.next();
      
      IQueryResult<IInstallableUnit> updatesAvailable = plan.updatesFor(currentlyInstalled, context, null);
      for (Iterator<IInstallableUnit> iterator2 = updatesAvailable.iterator(); iterator2.hasNext();)
      {
        IInstallableUnit update = (IInstallableUnit)iterator2.next();
        request.add(update);
        request.setInstallableUnitInclusionRules(update, ProfileInclusionRules.createOptionalInclusionRule(update));
      }
      if (!updatesAvailable.isEmpty())
      {
        request.setInstallableUnitInclusionRules(currentlyInstalled, ProfileInclusionRules.createOptionalInclusionRule(currentlyInstalled));
        limitingRequirements.add(MetadataFactory.createRequirement("org.eclipse.equinox.p2.iu", currentlyInstalled.getId(), new VersionRange(currentlyInstalled.getVersion(), true, Version.MAX_VERSION, true), null, false, false));
      }
    }
    IProvisioningPlan updateFinderPlan = plan.getProvisioningPlan(request, context, null);
    if (updateFinderPlan.getAdditions().query(QueryUtil.ALL_UNITS, null).isEmpty()) {
      return;
    }
    IProfileChangeRequest finalChangeRequest = plan.createChangeRequest(prof);
    IQueryResult<IInstallableUnit> removals = updateFinderPlan.getRemovals().query(QueryUtil.ALL_UNITS, null);
    for (Iterator<IInstallableUnit> iterator = removals.iterator(); iterator.hasNext();)
    {
      IInstallableUnit iu = (IInstallableUnit)iterator.next();
      if (!allRoots.query(QueryUtil.createIUQuery(iu), null).isEmpty()) {
        finalChangeRequest.remove(iu);
      }
    }
    for (Iterator<IInstallableUnit> iterator = strictRoots.iterator(); iterator.hasNext();)
    {
      IInstallableUnit formerRoot = (IInstallableUnit)iterator.next();
      IQueryResult<IInstallableUnit> update = updateFinderPlan.getAdditions().query(new UpdateQuery(formerRoot), null);
      if (!update.isEmpty()) {
        finalChangeRequest.addAll(update.toUnmodifiableSet());
      }
    }
    for (Iterator<IInstallableUnit> iterator = optionalRoots.iterator(); iterator.hasNext();)
    {
      IInstallableUnit formerRoot = (IInstallableUnit)iterator.next();
      IQueryResult<IInstallableUnit> update = updateFinderPlan.getAdditions().query(new UpdateQuery(formerRoot), null);
      if (!update.isEmpty()) {
        for (Iterator<IInstallableUnit> it = update.iterator(); it.hasNext();)
        {
          IInstallableUnit updatedOptionalIU = (IInstallableUnit)it.next();
          finalChangeRequest.add(updatedOptionalIU);
          finalChangeRequest.setInstallableUnitInclusionRules(updatedOptionalIU, ProfileInclusionRules.createOptionalInclusionRule(updatedOptionalIU));
        }
      }
    }
    request = ((ProfileChangeRequest)finalChangeRequest);
  }
  
  protected String getResolveJobName()
  {
    return Messages.RelaxedUpdateOperation_ResolveJobName;
  }
  
  protected String getProvisioningJobName()
  {
    return Messages.RelaxedUpdateOperation_UpdateJobName;
  }
}

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

import java.io.File;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.URIUtil;
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
import org.eclipse.equinox.internal.p2.operations.Messages;
import org.eclipse.equinox.internal.p2.repository.helpers.RepositoryHelper;
import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.osgi.util.NLS;

public abstract class RepositoryTracker
{
  public static final int STATUS_INVALID_REPOSITORY_LOCATION = 10100;
  private int artifactRepositoryFlags = 2;
  private int metadataRepositoryFlags = 2;
  private final List<URI> reposNotFound = Collections.synchronizedList(new ArrayList());
  
  public abstract URI[] getKnownRepositories(ProvisioningSession paramProvisioningSession);
  
  public IStatus getInvalidLocationStatus(String locationText)
  {
    return new Status(4, "org.eclipse.equinox.p2.operations", 10100, NLS.bind(Messages.RepositoryTracker_InvalidLocation, locationText), null);
  }
  
  public URI locationFromString(String locationString)
  {
    try
    {
      userLocation = URIUtil.fromString(locationString);
    }
    catch (URISyntaxException localURISyntaxException)
    {
      URI userLocation;
      return null;
    }
    URI userLocation;
    String uriString = URIUtil.toUnencodedString(userLocation);
    if ((uriString.length() > 0) && ((uriString.charAt(0) == '/') || (uriString.charAt(0) == File.separatorChar))) {
      return RepositoryHelper.localRepoURIHelper(userLocation);
    }
    return userLocation;
  }
  
  public IStatus validateRepositoryLocation(ProvisioningSession session, URI location, boolean contactRepositories, IProgressMonitor monitor)
  {
    IStatus localValidationStatus = RepositoryHelper.checkRepositoryLocationSyntax(location);
    if (!localValidationStatus.isOK())
    {
      String locationString = URIUtil.toUnencodedString(location);
      if ((locationString.length() > 0) && ((locationString.charAt(0) == '/') || (locationString.charAt(0) == File.separatorChar)))
      {
        location = RepositoryHelper.localRepoURIHelper(location);
        localValidationStatus = RepositoryHelper.checkRepositoryLocationSyntax(location);
      }
    }
    if (!localValidationStatus.isOK()) {
      return localValidationStatus;
    }
    return Status.OK_STATUS;
  }
  
  protected boolean contains(URI location, ProvisioningSession session)
  {
    URI[] knownRepositories = getKnownRepositories(session);
    for (int i = 0; i < knownRepositories.length; i++) {
      if (URIUtil.sameURI(knownRepositories[i], location)) {
        return true;
      }
    }
    return false;
  }
  
  public void addNotFound(URI location)
  {
    reposNotFound.add(location);
  }
  
  public boolean hasNotFoundStatusBeenReported(URI location)
  {
    return reposNotFound.contains(location);
  }
  
  public void clearRepositoriesNotFound()
  {
    reposNotFound.clear();
  }
  
  public void clearRepositoryNotFound(URI location)
  {
    reposNotFound.remove(location);
  }
  
  public int getArtifactRepositoryFlags()
  {
    return artifactRepositoryFlags;
  }
  
  public void setArtifactRepositoryFlags(int flags)
  {
    artifactRepositoryFlags = flags;
  }
  
  public int getMetadataRepositoryFlags()
  {
    return metadataRepositoryFlags;
  }
  
  public void setMetadataRepositoryFlags(int flags)
  {
    metadataRepositoryFlags = flags;
  }
  
  public void reportLoadFailure(URI location, ProvisionException exception)
  {
    int code = exception.getStatus().getCode();
    if ((code == 10100) || (code == 1006) || (code == 1000))
    {
      if (hasNotFoundStatusBeenReported(location)) {
        return;
      }
      addNotFound(location);
    }
    LogHelper.log(exception.getStatus());
  }
  
  public abstract void addRepository(URI paramURI, String paramString, ProvisioningSession paramProvisioningSession);
  
  public abstract void removeRepositories(URI[] paramArrayOfURI, ProvisioningSession paramProvisioningSession);
  
  public abstract void refreshRepositories(URI[] paramArrayOfURI, ProvisioningSession paramProvisioningSession, IProgressMonitor paramIProgressMonitor);
}

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

import java.util.Collection;
import java.util.Iterator;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest;
import org.eclipse.equinox.internal.p2.operations.Messages;
import org.eclipse.equinox.p2.engine.IProfile;
import org.eclipse.equinox.p2.engine.IProfileRegistry;
import org.eclipse.equinox.p2.engine.query.UserVisibleRootQuery;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.planner.ProfileInclusionRules;
import org.eclipse.equinox.p2.query.IQueryResult;
import org.eclipse.equinox.p2.query.QueryUtil;

public class SynchronizeOperation
  extends InstallOperation
{
  public SynchronizeOperation(ProvisioningSession session, Collection<IInstallableUnit> toInstall)
  {
    super(session, toInstall);
  }
  
  protected void computeProfileChangeRequest(MultiStatus status, IProgressMonitor monitor)
  {
    request = ProfileChangeRequest.createByProfileId(session.getProvisioningAgent(), profileId);
    
    SubMonitor sub = SubMonitor.convert(monitor, Messages.InstallOperation_ComputeProfileChangeProgress, toInstall.size());
    IProfile profile = session.getProfileRegistry().getProfile(profileId);
    request.removeAll(profile.query(new UserVisibleRootQuery(), sub).toUnmodifiableSet());
    request.addAll(toInstall);
    for (Iterator localIterator = toInstall.iterator(); localIterator.hasNext();)
    {
      IInstallableUnit entryToInstall = (IInstallableUnit)localIterator.next();
      if (QueryUtil.isPatch(entryToInstall)) {
        request.setInstallableUnitInclusionRules(entryToInstall, ProfileInclusionRules.createOptionalInclusionRule(entryToInstall));
      } else {
        request.setInstallableUnitProfileProperty(entryToInstall, "org.eclipse.equinox.p2.type.root", Boolean.toString(true));
      }
      sub.worked(1);
    }
    sub.done();
  }
}

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

import org.eclipse.equinox.internal.p2.operations.IFailedStatusEvaluator;
import org.eclipse.equinox.p2.engine.IProvisioningPlan;
import org.eclipse.equinox.p2.engine.ProvisioningContext;

class UninstallOperation$1
  implements IFailedStatusEvaluator
{
  final UninstallOperation this$0;
  
  UninstallOperation$1(UninstallOperation paramUninstallOperation) {}
  
  public ProvisioningContext getSecondPassProvisioningContext(IProvisioningPlan failedPlan)
  {
    return this$0.context;
  }
}

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

import java.net.URI;
import java.util.Collection;
import java.util.Iterator;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest;
import org.eclipse.equinox.internal.p2.operations.IFailedStatusEvaluator;
import org.eclipse.equinox.internal.p2.operations.Messages;
import org.eclipse.equinox.p2.engine.IProvisioningPlan;
import org.eclipse.equinox.p2.engine.ProvisioningContext;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;

public class UninstallOperation
  extends ProfileChangeOperation
{
  private Collection<IInstallableUnit> toUninstall;
  
  public UninstallOperation(ProvisioningSession session, Collection<IInstallableUnit> toUninstall)
  {
    super(session);
    this.toUninstall = toUninstall;
  }
  
  protected void computeProfileChangeRequest(MultiStatus status, IProgressMonitor monitor)
  {
    request = ProfileChangeRequest.createByProfileId(session.getProvisioningAgent(), profileId);
    request.removeAll(toUninstall);
    for (Iterator localIterator = toUninstall.iterator(); localIterator.hasNext();)
    {
      IInstallableUnit iuToUninstall = (IInstallableUnit)localIterator.next();
      request.removeInstallableUnitProfileProperty(iuToUninstall, "org.eclipse.equinox.p2.type.root");
    }
  }
  
  protected String getProvisioningJobName()
  {
    return Messages.UninstallOperation_ProvisioningJobName;
  }
  
  protected String getResolveJobName()
  {
    return Messages.UninstallOperation_ResolveJobName;
  }
  
  ProvisioningContext getFirstPassProvisioningContext()
  {
    ProvisioningContext pc = new ProvisioningContext(session.getProvisioningAgent());
    pc.setMetadataRepositories(new URI[0]);
    pc.setArtifactRepositories(new URI[0]);
    return pc;
  }
  
  IFailedStatusEvaluator getSecondPassEvaluator()
  {
    new IFailedStatusEvaluator()
    {
      public ProvisioningContext getSecondPassProvisioningContext(IProvisioningPlan failedPlan)
      {
        return context;
      }
    };
  }
}

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

import org.eclipse.equinox.p2.metadata.IInstallableUnit;

public class Update
{
  public IInstallableUnit toUpdate;
  public IInstallableUnit replacement;
  
  public Update(IInstallableUnit toUpdate, IInstallableUnit replacement)
  {
    this.toUpdate = toUpdate;
    this.replacement =
1 2 3

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