Search in sources :

Example 1 with ScreenLogFactory

use of quickfix.ScreenLogFactory in project camel by apache.

the class QuickfixjComponentTest method setUpComponent.

private void setUpComponent(boolean injectQfjPlugins) throws IOException, MalformedURLException, NoSuchMethodException {
    camelContext = new DefaultCamelContext();
    component = new QuickfixjComponent();
    component.setCamelContext(camelContext);
    camelContext.addComponent("quickfix", component);
    if (injectQfjPlugins) {
        engineMessageFactory = new DefaultMessageFactory();
        engineMessageStoreFactory = new MemoryStoreFactory();
        engineLogFactory = new ScreenLogFactory();
        component.setMessageFactory(engineMessageFactory);
        component.setMessageStoreFactory(engineMessageStoreFactory);
        component.setLogFactory(engineLogFactory);
    }
    assertThat(component.getEngines().size(), is(0));
    Method converterMethod = QuickfixjConverters.class.getMethod("toSessionID", new Class<?>[] { String.class });
    camelContext.getTypeConverterRegistry().addTypeConverter(SessionID.class, String.class, new StaticMethodTypeConverter(converterMethod, false));
}
Also used : DefaultMessageFactory(quickfix.DefaultMessageFactory) MemoryStoreFactory(quickfix.MemoryStoreFactory) ScreenLogFactory(quickfix.ScreenLogFactory) Method(java.lang.reflect.Method) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) StaticMethodTypeConverter(org.apache.camel.impl.converter.StaticMethodTypeConverter)

Example 2 with ScreenLogFactory

use of quickfix.ScreenLogFactory in project camel by apache.

the class QuickfixjEngine method inferLogFactory.

private LogFactory inferLogFactory(SessionSettings settings) throws ConfigError {
    Set<LogFactory> impliedLogFactories = new HashSet<LogFactory>();
    isFileLog(settings, impliedLogFactories);
    isScreenLog(settings, impliedLogFactories);
    isSL4JLog(settings, impliedLogFactories);
    isJdbcLog(settings, impliedLogFactories);
    if (impliedLogFactories.size() > 1) {
        throw new ConfigError("Ambiguous log factory implied in configuration");
    }
    LogFactory sessionLogFactory;
    if (impliedLogFactories.size() == 1) {
        sessionLogFactory = impliedLogFactories.iterator().next();
    } else {
        // Default
        sessionLogFactory = new ScreenLogFactory(settings);
    }
    LOG.info("Inferring log factory: {}", sessionLogFactory.getClass().getName());
    return sessionLogFactory;
}
Also used : SLF4JLogFactory(quickfix.SLF4JLogFactory) ScreenLogFactory(quickfix.ScreenLogFactory) JdbcLogFactory(quickfix.JdbcLogFactory) FileLogFactory(quickfix.FileLogFactory) LogFactory(quickfix.LogFactory) ConfigError(quickfix.ConfigError) ScreenLogFactory(quickfix.ScreenLogFactory) HashSet(java.util.HashSet)

Aggregations

ScreenLogFactory (quickfix.ScreenLogFactory)2 Method (java.lang.reflect.Method)1 HashSet (java.util.HashSet)1 DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)1 StaticMethodTypeConverter (org.apache.camel.impl.converter.StaticMethodTypeConverter)1 ConfigError (quickfix.ConfigError)1 DefaultMessageFactory (quickfix.DefaultMessageFactory)1 FileLogFactory (quickfix.FileLogFactory)1 JdbcLogFactory (quickfix.JdbcLogFactory)1 LogFactory (quickfix.LogFactory)1 MemoryStoreFactory (quickfix.MemoryStoreFactory)1 SLF4JLogFactory (quickfix.SLF4JLogFactory)1