CAKE IO Description
CAKE provides a centralized concept for all IO operations. IO operations are for example XML parsers and writers or network protocols. The goal of the concept is to easily replace a XML parser or writer with another one or with another technologie. This should be possible without changing the code.
To way how to get a io component is always the same:
- request the io names that are able to handle a given class
- request the io component with one of the names
For example, to get an parser for a
Model the Java
String names = IOFactory.getReaderNamesFor(Model.class); if (names.length == 0) throw new CakeIOException(IO.COMPONENT, IO.LOG_READER_NOT_FOUND, this, Model.class); Reader reader = (Reader) IOFactory.newIO(names); reader.setFilename("..."); Model model = (Model) reader.read();
One factory is available:
Beside the usage of the io components also some classes are provided that support the developer to write io components.
- Currently, all parser and writers in CAKE are using XML. To simplify the handling this packages provides a simplified parser and writer infrastructure.
Interface Summary Interface Description ContentHandlerThe ContentHandler extends the
ContentHandlerof the SAX parser API with an additional unified method to get the parsed object.
IOThe IO interace summarises constants and methods for all io components. LogComponentIdentifierInterface with constants required for the Logger. ReaderThe Reader interface provides some common constants and methods for all io readers. ResourcePaths WriterThe Writer interface provides some common constants and methods for all io writers.
Class Summary Class Description CakeCSVParserA CSV Parser, that uses the csv package from the Apache group. IOFactory IOUtil