Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsliebig2008-02-14 09:14:05 -0500
committersliebig2008-02-14 09:14:05 -0500
commitdce12dd6dd75f4c83fde58c79669b4253e18f1b5 (patch)
tree582521455076185c39ad7f8438bba7041cbb15df /bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing
parenta844bd742c1bb10a5f96a0b1ea24fb65e27a53e4 (diff)
downloadrt.equinox.p2-dce12dd6dd75f4c83fde58c79669b4253e18f1b5.tar.gz
rt.equinox.p2-dce12dd6dd75f4c83fde58c79669b4253e18f1b5.tar.xz
rt.equinox.p2-dce12dd6dd75f4c83fde58c79669b4253e18f1b5.zip
limited access to fields with protected getters and implemented new IStateful contract
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing')
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStep.java32
1 files changed, 24 insertions, 8 deletions
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStep.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStep.java
index a9634f845..d6126e1ad 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStep.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStep.java
@@ -25,13 +25,10 @@ import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IStateful
* about the data (e.g., checksum or hash) or transform the data (e.g., unpack200).
*/
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
- //in a hook method rather than letting the subclass access this state directly.
- protected OutputStream destination;
- protected IProgressMonitor monitor;
- protected IStatus status = Status.OK_STATUS;
+
+ private OutputStream destination;
+ private IProgressMonitor monitor;
+ private IStatus status = Status.OK_STATUS;
protected ProcessingStep() {
super();
@@ -45,6 +42,7 @@ public abstract class ProcessingStep extends OutputStream implements IStateful {
* @param context the context in which the step is being used
*/
public void initialize(ProcessingStepDescriptor descriptor, IArtifactDescriptor context) {
+ // nothing to do here!
}
/**
@@ -63,6 +61,7 @@ public abstract class ProcessingStep extends OutputStream implements IStateful {
* @param b the byte being written
*/
public void write(int b) throws IOException {
+ // nothing to do here!
}
/**
@@ -92,7 +91,24 @@ public abstract class ProcessingStep extends OutputStream implements IStateful {
}
public void setStatus(IStatus status) {
- this.status = status;
+ this.status = status == null ? Status.OK_STATUS : status;
+ }
+
+ /**
+ * Get the progress monitor.
+ * @return the progress monitor; may be null
+ */
+ protected IProgressMonitor getProgressMonitor() {
+ return monitor;
+ }
+
+ /**
+ * Get the stream to write the processed data into.
+ *
+ * @return output stream for processed data
+ */
+ protected OutputStream getDestination() {
+ return destination;
}
/**

Back to the top