com.sun.pkg.client
Class Image.ImagePlan

java.lang.Object
  extended by com.sun.pkg.client.Image.ImagePlan
Enclosing class:
Image

public class Image.ImagePlan
extends java.lang.Object

An ImagePlan takes a list of requested packages, an Image (and its policy restrictions), and returns the set of package operations needed to transform the Image to the list of requested packages.

Use of an ImagePlan involves the identification of the Image, the Catalogs (implicitly), and a set of complete or partial package FMRIs. The Image's policy, which is derived from its type and configuration will cause the formulation of the plan or an exception state.

XXX In the current formulation, an ImagePlan can handle [null -> PkgFmri] and [PkgFmri@Version1 -> PkgFmri@Version2], for a set of PkgFmri objects. With a correct Action object definition, deletion should be able to be represented as [PkgFmri@V1 -> null].

XXX Should we allow downgrades? There's an "arrow of time" associated with the smf(5) configuration method, so it's better to direct manipulators to snapshot-based rollback, but if people are going to do "pkg delete fmri; pkg install fmri@v(n - 1)", then we'd better have a plan to identify when this operation is safe or unsafe.


Method Summary
 int computeTransferFiles()
          Computes the total number of files that will be downloaded during execute().
 long computeTransferSize()
          Computes the total number of bytes that will be downloaded during execute().
 void execute()
          Executes the plan with the empty callback.
 void execute(boolean download, boolean apply)
          Executes the plan with the empty callback.
 void execute(ImagePlanProgressTracker tracker)
          Execute the actions required to bring about the plan.
 void execute(ImagePlanProgressTracker tracker, boolean download, boolean apply)
          Execute the actions required to bring about the plan.
 Fmri[] getProposedFmris()
          Return the Fmris that are proposed for installation as part of this plan.
 java.lang.String toString()
          Generate a string representation for the ImagePlan.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

toString

public java.lang.String toString()
Generate a string representation for the ImagePlan.

Overrides:
toString in class java.lang.Object
Returns:
a String representing the ImagePlan

getProposedFmris

public Fmri[] getProposedFmris()
Return the Fmris that are proposed for installation as part of this plan.

Returns:
the list of proposed Fmris

computeTransferSize

public long computeTransferSize()
Computes the total number of bytes that will be downloaded during execute().


computeTransferFiles

public int computeTransferFiles()
Computes the total number of files that will be downloaded during execute().


execute

public void execute()
             throws java.io.IOException
Executes the plan with the empty callback.

See execute(ImagePlanProgressTracker) for the exact semantics of the method.

Throws:
java.io.IOException

execute

public void execute(boolean download,
                    boolean apply)
             throws java.io.IOException
Executes the plan with the empty callback.

See execute(ImagePlanProgressTracker) for the exact semantics of the method.

Parameters:
download - boolean variable to trigger download
apply - boolean variable to trigger installtion for downloaded packages
Throws:
java.io.IOException

execute

public void execute(ImagePlanProgressTracker tracker)
             throws java.io.IOException
Execute the actions required to bring about the plan.

This results in the installation or uninstallation as specified by the plan.

Parameters:
tracker - The object that receives the progress of the execution. Must not be null.
Throws:
java.io.IOException

execute

public void execute(ImagePlanProgressTracker tracker,
                    boolean download,
                    boolean apply)
             throws java.io.IOException
Execute the actions required to bring about the plan.

This results in the installation or uninstallation as specified by the plan.

Parameters:
tracker - The object that receives the progress of the execution. Must not be null.
download - boolean variable to trigger download
apply - boolean variable to trigger installtion for downloaded packages
Throws:
java.io.IOException