Package quickfix

Examples of quickfix.DataDictionary


        return new SessionID(sessionID);
    }

    @Converter
    public static Message toMessage(String value, Exchange exchange) throws InvalidMessage, ConfigError {
        DataDictionary dataDictionary = getDataDictionary(exchange);
        return new Message(value, dataDictionary);
    }
View Full Code Here


        return new Message(value, dataDictionary);
    }

    @Converter
    public static Message toMessage(byte[] value, Exchange exchange) throws InvalidMessage, ConfigError, UnsupportedEncodingException {
        DataDictionary dataDictionary = getDataDictionary(exchange);
        String charsetName = IOHelper.getCharsetName(exchange);

        String message;
        if (charsetName != null) {
            message = new String(value, charsetName);
View Full Code Here

    }

    private static DataDictionary getDataDictionary(Exchange exchange) throws ConfigError {
        Object dictionaryValue = exchange.getProperties().get(QuickfixjEndpoint.DATA_DICTIONARY_KEY);

        DataDictionary dataDictionary;
        if (dictionaryValue instanceof DataDictionary) {
            dataDictionary = (DataDictionary) dictionaryValue;
        } else if (dictionaryValue instanceof String) {
            dataDictionary = new DataDictionary((String) dictionaryValue);
        } else {
            SessionID sessionID = (SessionID) exchange.getIn().getHeader(QuickfixjEndpoint.SESSION_ID_KEY);
            Session session = Session.lookupSession(sessionID);
            dataDictionary = session != null ? session.getDataDictionary() : null;
        }
View Full Code Here

           
            DataDictionaryProvider provider = session.getDataDictionaryProvider();
            if (provider != null) {
                try {
                    ApplVerID applVerID = getApplVerID(session, message);
                    DataDictionary appDataDictionary = provider.getApplicationDataDictionary(applVerID);
                    appDataDictionary.validate(message, true);
                } catch (Exception e) {
                    LogUtil.logThrowable(sessionID, "Outgoing message failed validation: "
                            + e.getMessage(), e);
                    return;
                }
View Full Code Here

            String data = "8=FIX.4.4\0019=40\00135=A\001"
                    + "627=2\001628=FOO\001628=BAR\001"
                    + "98=0\001384=2\001372=D\001385=R\001372=8\001385=S\00110=230\001";

            Exchange exchange = new DefaultExchange(camelContext);
            exchange.setProperty(QuickfixjEndpoint.DATA_DICTIONARY_KEY, new DataDictionary("FIX44.xml"));
            exchange.getIn().setBody(data);
           
            Message message = exchange.getIn().getBody(Message.class);
           
            NoHops hop = new NoHops();
View Full Code Here

    return QuickFIXUtils.getDictionary(beginString);
  }

  public static DataDictionary getDictionary(String beginString) throws FIXException {
    DataDictionary dictionary = dictionaryCache.get(beginString);
    if (dictionary == null) {
      if (!BEGIN_STRINGS.contains(beginString)) {
        throw new HermesRuntimeException("Invalid FIX BeginString: '" + beginString + "'.");
      }
      String dictionaryFileName = null ;
     
      if (beginString.equals(FixVersions.BEGINSTRING_FIXT11)) {
        dictionaryFileName = "quickfix/" + FixVersions.FIX50.replaceAll("\\.", "") + ".xml";
      } else {
        dictionaryFileName = "quickfix/" + beginString.replaceAll("\\.", "") + ".xml";
      }

      
      // the dictionary is loaded from the quickfix.jar file.
      InputStream ddis = Thread.currentThread().getContextClassLoader().getResourceAsStream(dictionaryFileName);
      if (ddis == null) {
        throw new NullPointerException("Data Dictionary file '" + dictionaryFileName + "' not found at root of CLASSPATH.");
      }

      try {
        dictionary = new DataDictionary(ddis);
        dictionaryCache.put(beginString, dictionary);
      } catch (ConfigError configError) {
        throw new HermesRuntimeException("Error loading data dictionary file.", configError);
      }
View Full Code Here

        return new SessionID(sessionID);
    }
   
    @Converter
    public static Message toMessage(String value, Exchange exchange) throws InvalidMessage, ConfigError {
        DataDictionary dataDictionary = getDataDictionary(exchange);
        return new Message(value, dataDictionary);
    }
View Full Code Here

    }

    private static DataDictionary getDataDictionary(Exchange exchange) throws ConfigError {
        Object dictionaryValue = exchange.getProperties().get(QuickfixjEndpoint.DATA_DICTIONARY_KEY);
       
        DataDictionary dataDictionary;
        if (dictionaryValue instanceof DataDictionary) {
            dataDictionary = (DataDictionary)dictionaryValue;
        } else if (dictionaryValue instanceof String) {
            dataDictionary = new DataDictionary((String) dictionaryValue);
        } else {
            SessionID sessionID = (SessionID) exchange.getIn().getHeader(QuickfixjEndpoint.SESSION_ID_KEY);
            Session session = Session.lookupSession(sessionID);
            dataDictionary = session != null ? session.getDataDictionary() : null;
        }
View Full Code Here

            String data = "8=FIX.4.4\0019=40\00135=A\001"
                    + "627=2\001628=FOO\001628=BAR\001"
                    + "98=0\001384=2\001372=D\001385=R\001372=8\001385=S\00110=230\001";

            Exchange exchange = new DefaultExchange(camelContext);
            exchange.setProperty(QuickfixjEndpoint.DATA_DICTIONARY_KEY, new DataDictionary("FIX44.xml"));
            exchange.getIn().setBody(data);
           
            Message message = exchange.getIn().getBody(Message.class);
           
            NoHops hop = new NoHops();
View Full Code Here

public class QuickfixjMessageJsonTransformer {
  
    public String transform(Message message) throws FieldNotFound, ConfigError {
        SessionID sessionID = MessageUtils.getSessionID(message);
        Session session = Session.lookupSession(sessionID);
        DataDictionary dataDictionary = session.getDataDictionary();
       
        if (dataDictionary == null) {
            throw new IllegalStateException("No Data Dictionary. Exchange must reference an existing session");
        }
       
View Full Code Here

TOP

Related Classes of quickfix.DataDictionary

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.