diff options
author | Mykola Nikishov | 2018-06-26 09:24:37 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2018-10-12 14:35:24 +0000 |
commit | 7f2938951c1f39a7707a06259116aee3d9339f58 (patch) | |
tree | 59a26f795c8cf3520bb1d725effe057ec1f79cee /bundles | |
parent | 8264452199d882c61ccbe30beb035208db379679 (diff) | |
download | rt.equinox.p2-7f2938951c1f39a7707a06259116aee3d9339f58.tar.gz rt.equinox.p2-7f2938951c1f39a7707a06259116aee3d9339f58.tar.xz rt.equinox.p2-7f2938951c1f39a7707a06259116aee3d9339f58.zip |
[RFC] Bug 536282 - Check whether processing step is availableI20181012-1800
Change-Id: I6a625d3fe89ca63a4b176f4fef18f07f9ba4d103
Signed-off-by: Mykola Nikishov <mn@mn.com.ua>
Diffstat (limited to 'bundles')
3 files changed, 22 insertions, 3 deletions
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/pack200/Pack200ProcessorStep.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/pack200/Pack200ProcessorStep.java index 7eb071752..3a1c0d647 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/pack200/Pack200ProcessorStep.java +++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/pack200/Pack200ProcessorStep.java @@ -47,7 +47,7 @@ public class Pack200ProcessorStep extends AbstractBufferingStep { @Override public void initialize(IProvisioningAgent agent, IProcessingStepDescriptor descriptor, IArtifactDescriptor context) { super.initialize(agent, descriptor, context); - if (!UnpackStep.canUnpack()) { + if (!isEnabled()) { IStatus status = null; if (detailedResult) { status = new Status(IStatus.ERROR, Activator.ID, MirrorRequest.ARTIFACT_PROCESSING_ERROR, "Unpack facility not configured.", null); //$NON-NLS-1$ @@ -103,4 +103,9 @@ public class Pack200ProcessorStep extends AbstractBufferingStep { new JarProcessorExecutor().runJarProcessor(options); return new File(getWorkDir(), incoming.getName().substring(0, incoming.getName().length() - PACKED_SUFFIX.length())); } + + @Override + public boolean isEnabled() { + return UnpackStep.canUnpack(); + } } 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 734a5482a..22e407b13 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 @@ -133,4 +133,8 @@ public abstract class ProcessingStep extends OutputStream implements IStateful { public IStatus getStatus(boolean deep) { return ProcessingStepHandler.getStatus(this, deep); } + + public boolean isEnabled() { + return true; + } } diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStepHandler.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStepHandler.java index 25a099eb6..cee06314a 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStepHandler.java +++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStepHandler.java @@ -48,9 +48,19 @@ public class ProcessingStepHandler { if (point == null) return false; IProcessingStepDescriptor[] steps = descriptor.getProcessingSteps(); - for (int i = 0; i < steps.length; i++) { - if (point.getExtension(steps[i].getProcessorId()) == null) + for (IProcessingStepDescriptor stepDescriptor : steps) { + String processorId = stepDescriptor.getProcessorId(); + IExtension extension = point.getExtension(processorId); + if (extension == null) return false; + + IConfigurationElement[] config = extension.getConfigurationElements(); + try { + Object object = config[0].createExecutableExtension("class"); //$NON-NLS-1$ + return ((ProcessingStep) object).isEnabled(); + } catch (CoreException e) { + // noop + } } return true; } |