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.

IO Factory

All io components to convert object to and from streams can be requested in the IOFactory. The factory is a normal Factory where several io components can be bind.

To way how to get a io component is always the same:

  1. request the io names that are able to handle a given class
  2. request the io component with one of the names

For example, to get an parser for a Model the Java code would be:

        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[0]);
        Model model = (Model);

One factory is available: IOFactory

Helper Classes

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.