@Override public List<AnalyzerJob> getAnalyzerJobs() { // create a single analyzer for picking up records final AnalyzerDescriptor<?> descriptor = Descriptors.ofAnalyzer(PreviewTransformedDataAnalyzer.class); final Map<ConfiguredPropertyDescriptor, Object> properties = new HashMap<ConfiguredPropertyDescriptor, Object>(); final List<InputColumn<?>> columns = new ArrayList<InputColumn<?>>(); final Collection<TransformerJob> transformerJobs = getTransformerJobs(); for (TransformerJob transformerJob : transformerJobs) { InputColumn<?>[] outputColumns = transformerJob.getOutput(); for (InputColumn<?> outputColumn : outputColumns) { columns.add(outputColumn); } } properties.put(descriptor.getConfiguredPropertiesForInput().iterator().next(), columns.toArray(new InputColumn[columns.size()])); final ComponentConfiguration componentConfiguration = new ImmutableComponentConfiguration(properties); final AnalyzerJob analyzerJob = new ImmutableAnalyzerJob("Record gatherer", descriptor, componentConfiguration, null, null, null); return Arrays.asList(analyzerJob); }
return new ImmutableAnalyzerJob(getName(), getDescriptor(), new ImmutableComponentConfiguration(jobProperties), componentRequirement, metadataProperties, outputDataStreamJobs);
new ImmutableComponentConfiguration(configuredProperties), componentRequirement, getMetadataProperties(), outputDataStreamJobs); return new AnalyzerJob[] { job };
public TransformerJob toTransformerJob(final boolean validate, final AnalysisJobImmutabilizer immutabilizer) { if (validate && !isConfigured(true)) { throw new IllegalStateException("Transformer job is not correctly configured"); } final ComponentRequirement componentRequirement = immutabilizer.load(getComponentRequirement()); final OutputDataStreamJob[] outputDataStreamJobs = immutabilizer.load(getOutputDataStreamJobs(), validate); return new ImmutableTransformerJob(getName(), getDescriptor(), new ImmutableComponentConfiguration(getConfiguredProperties()), getOutputColumns(), componentRequirement, getMetadataProperties(), outputDataStreamJobs); }
public FilterJob toFilterJob(final boolean validate, final AnalysisJobImmutabilizer immutabilizer) { if (validate && !isConfigured(true)) { throw new IllegalStateException("Filter job is not correctly configured"); } final ComponentRequirement componentRequirement = immutabilizer.load(getComponentRequirement()); final OutputDataStreamJob[] outputDataStreamJobs = immutabilizer.load(getOutputDataStreamJobs(), validate); if (_cachedJob == null) { _cachedJob = new ImmutableFilterJob(getName(), getDescriptor(), new ImmutableComponentConfiguration(getConfiguredProperties()), componentRequirement, getMetadataProperties(), outputDataStreamJobs); } else { final ImmutableFilterJob newFilterJob = new ImmutableFilterJob(getName(), getDescriptor(), new ImmutableComponentConfiguration(getConfiguredProperties()), componentRequirement, getMetadataProperties(), outputDataStreamJobs); if (!newFilterJob.equals(_cachedJob)) { _cachedJob = newFilterJob; } } return _cachedJob; }
config = new ImmutableComponentConfiguration(configuredProperties);
public ComponentConfiguration getComponentConfiguration(CustomJob customJavaJob) { final ComponentDescriptor<?> descriptor = getDescriptor(); final Map<ConfiguredPropertyDescriptor, Object> propertyMap = new HashMap<ConfiguredPropertyDescriptor, Object>(); final PropertiesType propertiesType = getCustomJavaComponentJob().getProperties(); final StringConverter stringConverter = new StringConverter(_injectionManager); // build initial map based on default values from the customJob instance if (customJavaJob != null) { final Set<ConfiguredPropertyDescriptor> configuredProperties = descriptor.getConfiguredProperties(); for (ConfiguredPropertyDescriptor property : configuredProperties) { Object value = property.getValue(customJavaJob); propertyMap.put(property, value); } } // then build/override map based upon specified <property> elements in the XML file if (propertiesType != null) { final List<Property> propertyTypes = propertiesType.getProperty(); for (Property propertyType : propertyTypes) { final String name = propertyType.getName(); final String value = propertyType.getValue(); setProperty(descriptor, propertyMap, name, value, stringConverter); } } return new ImmutableComponentConfiguration(propertyMap); }
@Override public FilterJob getFilterJob() { if (_filterJobBuilder.isConfigured()) { return _filterJobBuilder.toFilterJob(); } else { // Create an incomplete job. This representation is typically used // for comparison, not execution. final ComponentConfiguration beanConfiguration = new ImmutableComponentConfiguration(_filterJobBuilder.getConfiguredProperties()); return new ImmutableFilterJob(_filterJobBuilder.getName(), _filterJobBuilder.getDescriptor(), beanConfiguration, _filterJobBuilder.getComponentRequirement(), _filterJobBuilder.getMetadataProperties(), _filterJobBuilder.getOutputDataStreamJobs()); } }
protected Component getComponentInstanceForQuestioning() { if (!isConfigured()) { // as long as the component is not configured we cannot proceed return null; } final Component component = getComponentInstance(); final D descriptor = getDescriptor(); final DataCleanerConfiguration configuration = getAnalysisJobBuilder().getConfiguration(); final InjectionManager injectionManager = configuration.getEnvironment().getInjectionManagerFactory().getInjectionManager(configuration); final LifeCycleHelper lifeCycleHelper = new LifeCycleHelper(injectionManager, false); // mimic the configuration of a real component instance final ComponentConfiguration beanConfiguration = new ImmutableComponentConfiguration(getConfiguredPropertiesForQuestioning()); lifeCycleHelper.assignConfiguredProperties(descriptor, component, beanConfiguration); lifeCycleHelper.assignProvidedProperties(descriptor, component); try { // only validate, don't initialize lifeCycleHelper.validate(descriptor, component); } catch (final RuntimeException e) { return null; } return component; }