01: /*
02: *
03: * The DbUnit Database Testing Framework
04: * Copyright (C)2002-2004, DbUnit.org
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * version 2.1 of the License, or (at your option) any later version.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: * You should have received a copy of the GNU Lesser General Public
17: * License along with this library; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19: *
20: */
21:
22: package org.dbunit.dataset.csv.handlers;
23:
24: import org.slf4j.Logger;
25: import org.slf4j.LoggerFactory;
26:
27: import org.dbunit.dataset.csv.IllegalInputCharacterException;
28:
29: import java.util.LinkedList;
30:
31: public class UnquotedFieldAssembler extends AbstractPipelineComponent {
32:
33: /**
34: * Logger for this class
35: */
36: private static final Logger logger = LoggerFactory
37: .getLogger(UnquotedFieldAssembler.class);
38:
39: LinkedList addedComponents;
40:
41: public UnquotedFieldAssembler() {
42: setAddedComponents(new LinkedList());
43: getPipeline().putFront(SeparatorHandler.ENDPIECE());
44: getPipeline().putFront(IsAlnumHandler.QUOTE());
45: getPipeline().putFront(WhitespacesHandler.IGNORE());
46: }
47:
48: private LinkedList getAddedComponents() {
49: logger.debug("getAddedComponents() - start");
50:
51: return addedComponents;
52: }
53:
54: private void setAddedComponents(LinkedList addedComponents) {
55: logger.debug("setAddedComponents(addedComponents="
56: + addedComponents + ") - start");
57:
58: this .addedComponents = addedComponents;
59: }
60:
61: public boolean canHandle(char c)
62: throws IllegalInputCharacterException {
63: logger.debug("canHandle(c=" + c + ") - start");
64:
65: return true;
66: }
67:
68: static protected class ASSEMBLE extends Helper {
69:
70: /**
71: * Logger for this class
72: */
73: private static final Logger logger = LoggerFactory
74: .getLogger(ASSEMBLE.class);
75:
76: void helpWith(char c) {
77: logger.debug("helpWith(c=" + c + ") - start");
78:
79: getHandler().getPipeline().thePieceIsDone();
80: }
81: }
82:
83: }
|