The Fixopaedia is a high-level mechanism for FixMessage manipulation. It is responsible for:
The FixDictionary is a storage of meta-data which describes different versions and dialects of the FIX protocol. The format of FixDictionary structure description is XML. The FixDictionary allows to load protocol descriptions dynamically. It provides the following information about the FIX Protocol elements:
The FixDictionary object can be created in a common way.
For example:
final Unmapshaler<Fixdic> saxUnmapshaler = new SAXUnmapshaler<Fixdic>(); final XMLEngine<Fixdic> engine = new XMLEngineImpl<Fixdic>(saxUnmapshaler); //dictName - path to dictionary (XML file) final InputStream xml = Thread.currentThread().getContextClassLoader().getResourceAsStream(dictName); if (xml == null) { throw new RuntimeException("Unable to locate requested dictionary '" + dictName + "' in the application classpath"); } Fixdic fixdic = engine.unmarshal(Fixdic.class, SAXReader.createReader(xml, saxUnmapshaler), true);
You can get lists of messages
List<Msgdef> messages = fixdic.getMsgdic().getMsgdef();
, blocks
List<Blockdef> blocks = fixdic.getMsgdic().getBlockdef();
, fields
List<Fielddef> fields = fixdic.getFielddic().getFielddef();
from Fixdic.
If you need a particular message you have to iterate through the list to find it.
You can get fields, blocks and groups from the message by calling the message.getFieldOrDescrOrAlias()method. It returns a list containing all children, so you need to iterate through it and check element types.
For example, to process all groups in message:
for (Object obj : message.getFieldOrDescrOrAlias()) { if (obj instanceof Group){ Group gr = (Group) obj; doSomethingWithGroup(gr); } }
1.6.3