@Override
	public void afterPropertiesSet() throws Exception {
		if (this.evaluationContext == null) {
			this.evaluationContext = IntegrationContextUtils.getEvaluationContext(this.beanFactory);
		}
		if (StringUtils.hasText(partitionExpression)) {
			if (!(evaluationContext instanceof StandardEvaluationContext)) {
				throw new RuntimeException("Expecting evaluationContext of type StandardEvaluationContext but was "
						+ evaluationContext);
			}
			MessagePartitionStrategy<String> partitionStrategy = new MessagePartitionStrategy<String>(
					partitionExpression, (StandardEvaluationContext) evaluationContext);
			PartitionTextFileWriter<Message<?>> writer = new PartitionTextFileWriter<Message<?>>(configuration,
					basePath,
					codec,
					partitionStrategy);
			writer.setIdleTimeout(idleTimeout);
			writer.setCloseTimeout(closeTimeout);
			writer.setFlushTimeout(flushTimeout);
			writer.setSyncable(enableSync);
			writer.setInWritingPrefix(inUsePrefix);
			writer.setInWritingSuffix(inUseSuffix);
			writer.setOverwrite(overwrite);
			writer.setFileNamingStrategyFactory(fileNamingStrategy);
			writer.setRolloverStrategyFactory(rolloverStrategy);
			if (beanFactory != null) {
				writer.setBeanFactory(beanFactory);
			}
			if (fileOpenAttempts > 0) {
				writer.setMaxOpenAttempts(fileOpenAttempts);
			}
			storeWriter = writer;
		}
		else {
			TextFileWriter writer = new TextFileWriter(configuration, basePath, codec);
			writer.setIdleTimeout(idleTimeout);
			writer.setCloseTimeout(closeTimeout);
			writer.setInWritingPrefix(inUsePrefix);
			writer.setInWritingSuffix(inUseSuffix);
			writer.setOverwrite(overwrite);
			writer.setFlushTimeout(flushTimeout);
			writer.setSyncable(enableSync);
			writer.setFileNamingStrategy(fileNamingStrategy);
			writer.setRolloverStrategy(rolloverStrategy);
			if (beanFactory != null) {
				writer.setBeanFactory(beanFactory);
			}
			if (fileOpenAttempts > 0) {
				writer.setMaxOpenAttempts(fileOpenAttempts);
			}
			storeWriter = writer;
		}
		if (storeWriter instanceof InitializingBean) {
			((InitializingBean) storeWriter).afterPropertiesSet();
		}
	}
A {@link FactoryBean} creating a {@link DataStoreWriter}. Created writer will be either
{@link PartitionTextFileWriter} or {@link TextFileWriter} depending whether partition
path expression is set.

@author Janne Valkealahti
@author Gary Russell
spring-xd-hadoop/src/main/java/org/springframework/xd/integration/hadoop/config/StoreWriterFactoryBean.java