class FlatFileCustomerCreditDao implements CustomerCreditDao, DisposableBean {

	private ItemWriter<String> itemWriter;

	private String separator = "\t";

	private volatile boolean opened = false;

	@Override
	public void writeCredit(CustomerCredit customerCredit) throws Exception {

		if (!opened) {
			open(new ExecutionContext());
		}

		String line = customerCredit.getName() + separator + customerCredit.getCredit();

		itemWriter.write(Chunk.of(line));
	}

	public void setSeparator(String separator) {
		this.separator = separator;
	}

	public void setItemWriter(ItemWriter<String> itemWriter) {
		this.itemWriter = itemWriter;
	}

	public void open(ExecutionContext executionContext) throws Exception {<FILL_FUNCTION_BODY>}

	public void close() throws Exception {
		if (itemWriter instanceof ItemStream) {
			((ItemStream) itemWriter).close();
		}
	}

	@Override
	public void destroy() throws Exception {
		close();
	}

}

		if (itemWriter instanceof ItemStream) {
			((ItemStream) itemWriter).open(executionContext);
		}
		opened = true;
	
<no_super_class>