Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 212811 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Sizing.java (+16 lines)
Lines 21-26 Link Here
21
import org.eclipse.equinox.internal.provisional.p2.engine.*;
21
import org.eclipse.equinox.internal.provisional.p2.engine.*;
22
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
22
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
23
import org.eclipse.equinox.internal.provisional.p2.metadata.ITouchpointType;
23
import org.eclipse.equinox.internal.provisional.p2.metadata.ITouchpointType;
24
import org.eclipse.osgi.util.NLS;
24
25
25
public class Sizing extends InstallableUnitPhase {
26
public class Sizing extends InstallableUnitPhase {
26
	private static final String PHASE_ID = "sizing"; //$NON-NLS-1$
27
	private static final String PHASE_ID = "sizing"; //$NON-NLS-1$
Lines 29-34 Link Here
29
	private long sizeOnDisk;
30
	private long sizeOnDisk;
30
	private long dlSize;
31
	private long dlSize;
31
32
33
	public static int INCOMPLETE_DISK_SIZE = 1;
34
	public static int INCOMPLETE_DOWNLOAD_SIZE = 2;
35
32
	public Sizing(int weight, String phaseName) {
36
	public Sizing(int weight, String phaseName) {
33
		super(PHASE_ID, weight);
37
		super(PHASE_ID, weight);
34
	}
38
	}
Lines 70-75 Link Here
70
	protected IStatus completePhase(IProgressMonitor monitor, IProfile profile, Map parameters) {
74
	protected IStatus completePhase(IProgressMonitor monitor, IProfile profile, Map parameters) {
71
		List artifactRequests = (List) parameters.get("artifactRequests"); //$NON-NLS-1$
75
		List artifactRequests = (List) parameters.get("artifactRequests"); //$NON-NLS-1$
72
		ProvisioningContext context = (ProvisioningContext) parameters.get(PARM_CONTEXT);
76
		ProvisioningContext context = (ProvisioningContext) parameters.get(PARM_CONTEXT);
77
		int status = 0;
73
78
74
		Set artifactsToObtain = new HashSet(artifactRequests.size());
79
		Set artifactsToObtain = new HashSet(artifactRequests.size());
75
80
Lines 94-99 Link Here
94
99
95
		for (Iterator iterator = artifactsToObtain.iterator(); iterator.hasNext() && !monitor.isCanceled();) {
100
		for (Iterator iterator = artifactsToObtain.iterator(); iterator.hasNext() && !monitor.isCanceled();) {
96
			IArtifactRequest artifactRequest = (IArtifactRequest) iterator.next();
101
			IArtifactRequest artifactRequest = (IArtifactRequest) iterator.next();
102
			boolean found = false;
97
			for (int i = 0; i < repositories.length; i++) {
103
			for (int i = 0; i < repositories.length; i++) {
98
				IArtifactRepository repo;
104
				IArtifactRepository repo;
99
				try {
105
				try {
Lines 107-118 Link Here
107
				if (descriptors.length > 0) {
113
				if (descriptors.length > 0) {
108
					if (descriptors[0].getProperty(IArtifactDescriptor.ARTIFACT_SIZE) != null)
114
					if (descriptors[0].getProperty(IArtifactDescriptor.ARTIFACT_SIZE) != null)
109
						sizeOnDisk += Long.parseLong(descriptors[0].getProperty(IArtifactDescriptor.ARTIFACT_SIZE));
115
						sizeOnDisk += Long.parseLong(descriptors[0].getProperty(IArtifactDescriptor.ARTIFACT_SIZE));
116
					else
117
						status |= INCOMPLETE_DISK_SIZE;
110
					if (descriptors[0].getProperty(IArtifactDescriptor.DOWNLOAD_SIZE) != null)
118
					if (descriptors[0].getProperty(IArtifactDescriptor.DOWNLOAD_SIZE) != null)
111
						dlSize += Long.parseLong(descriptors[0].getProperty(IArtifactDescriptor.DOWNLOAD_SIZE));
119
						dlSize += Long.parseLong(descriptors[0].getProperty(IArtifactDescriptor.DOWNLOAD_SIZE));
120
					else
121
						status |= INCOMPLETE_DOWNLOAD_SIZE;
122
					found = true;
112
					break;
123
					break;
113
				}
124
				}
114
			}
125
			}
126
			if (!found)
127
				// The artifact wasn't present in any repository
128
				return new Status(IStatus.ERROR, phaseId, NLS.bind(Messages.Phase_Sizing_Error, getClass().getName()));
115
		}
129
		}
130
		if (status != 0)
131
			return new Status(IStatus.WARNING, phaseId, status, NLS.bind(Messages.Phase_Sizing_Error, getClass().getName()), null);
116
		return null;
132
		return null;
117
	}
133
	}
118
134

Return to bug 212811