public ProcessingStep create( IProvisioningAgent agent, IProcessingStepDescriptor descriptor, IArtifactDescriptor context) { IExtensionRegistry registry = RegistryFactory.getRegistry(); IExtension extension = registry.getExtension(PROCESSING_STEPS_EXTENSION_ID, descriptor.getProcessorId()); Exception error; if (extension != null) { IConfigurationElement[] config = extension.getConfigurationElements(); try { Object object = config[0].createExecutableExtension("class"); // $NON-NLS-1$ ProcessingStep step = (ProcessingStep) object; step.initialize(agent, descriptor, context); return step; } catch (Exception e) { error = e; } } else error = new ProcessingStepHandlerException( NLS.bind( Messages.cannot_get_extension, PROCESSING_STEPS_EXTENSION_ID, descriptor.getProcessorId())); int severity = descriptor.isRequired() ? IStatus.ERROR : IStatus.INFO; ProcessingStep result = new EmptyProcessingStep(); result.setStatus( new Status( severity, Activator.ID, Messages.cannot_instantiate_step + descriptor.getProcessorId(), error)); return result; }
public OutputStream link(ProcessingStep[] steps, OutputStream output, IProgressMonitor monitor) { OutputStream previous = output; for (int i = steps.length - 1; i >= 0; i--) { ProcessingStep step = steps[i]; step.link(previous, monitor); previous = step; } if (steps.length == 0) return previous; // now link the artifact stream to the first stream in the new chain ArtifactOutputStream lastLink = getArtifactStream(previous); if (lastLink != null) lastLink.setFirstLink(previous); return previous; }