Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsliebig2007-12-03 12:46:03 +0000
committersliebig2007-12-03 12:46:03 +0000
commit1d05700fce62ef7d74d42bb0d28a6eeed76c48a3 (patch)
tree76b6a55f0f416a3694c64772bb4778e71071540f /bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox
parenta8eee496f1429cae3011f2049a54d86a0dbf18a8 (diff)
downloadrt.equinox.p2-1d05700fce62ef7d74d42bb0d28a6eeed76c48a3.tar.gz
rt.equinox.p2-1d05700fce62ef7d74d42bb0d28a6eeed76c48a3.tar.xz
rt.equinox.p2-1d05700fce62ef7d74d42bb0d28a6eeed76c48a3.zip
ProcessingStep is now a ´stateful´ output stream (cancelable/abortable)
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox')
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/p2/artifact/repository/processing/ProcessingStep.java21
1 files changed, 15 insertions, 6 deletions
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/p2/artifact/repository/processing/ProcessingStep.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/p2/artifact/repository/processing/ProcessingStep.java
index 3c92a9674..9d255cc0e 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/p2/artifact/repository/processing/ProcessingStep.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/p2/artifact/repository/processing/ProcessingStep.java
@@ -17,13 +17,14 @@ import java.util.ArrayList;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.artifact.repository.Activator;
import org.eclipse.equinox.p2.artifact.repository.IArtifactDescriptor;
+import org.eclipse.equinox.p2.artifact.repository.IStateful;
/**
* ProcessingSteps process the data written to them and pass the resultant data on
* to a configured destination stream. Steps may monitor (e.g., count) the data, compute information
* about the data (e.g., checksum or hash) or transform the data (e.g., unpack200).
*/
-public abstract class ProcessingStep extends OutputStream {
+public abstract class ProcessingStep extends OutputStream implements IStateful {
//TODO It's generally not good to expose fields as API. It raises difficulties about
//when the subclass should be writing the fields, when the fields will have
//meaningful values, etc. It's generally better to pass values as parameters
@@ -86,6 +87,14 @@ public abstract class ProcessingStep extends OutputStream {
monitor = null;
}
+ public IStatus getStatus() {
+ return status;
+ }
+
+ public void setStatus(IStatus status) {
+ this.status = status;
+ }
+
/**
* Return the status of this step. The status will be <code>null</code> if the
* step has not yet executed. If the step has executed the returned status
@@ -95,7 +104,7 @@ public abstract class ProcessingStep extends OutputStream {
*/
public IStatus getStatus(boolean deep) {
if (!deep)
- return status;
+ return getStatus();
ArrayList list = new ArrayList();
int severity = collectStatus(list);
if (severity == IStatus.OK)
@@ -105,14 +114,14 @@ public abstract class ProcessingStep extends OutputStream {
}
private int collectStatus(ArrayList list) {
- list.add(status);
+ list.add(getStatus());
if (!(destination instanceof ProcessingStep))
- return status.getSeverity();
+ return getStatus().getSeverity();
int result = ((ProcessingStep) destination).collectStatus(list);
// TODO greater than test here is a little brittle but it is very unlikely that we will add
// a new status severity.
- if (status.getSeverity() > result)
- return status.getSeverity();
+ if (getStatus().getSeverity() > result)
+ return getStatus().getSeverity();
return result;
}

Back to the top