quickfix.mina.acceptor
Class DynamicAcceptorSessionProvider

java.lang.Object
  extended by quickfix.mina.acceptor.DynamicAcceptorSessionProvider
All Implemented Interfaces:
AcceptorSessionProvider

public class DynamicAcceptorSessionProvider
extends java.lang.Object
implements AcceptorSessionProvider

Dynamically defines sessions for an acceptor. This can be useful for applications like simulators that want to accept any connection and dynamically create an associated session. For more complex situations, you can use this class as a starting point for implementing your own AcceptorSessionProvider.


Nested Class Summary
static class DynamicAcceptorSessionProvider.TemplateMapping
          Mapping from a sessionID pattern to a session template ID.
 
Field Summary
protected  SessionFactory sessionFactory
           
protected  SessionSettings settings
           
static java.lang.String WILDCARD
           
 
Constructor Summary
DynamicAcceptorSessionProvider(SessionSettings settings, java.util.List<DynamicAcceptorSessionProvider.TemplateMapping> templateMappings, Application application, MessageStoreFactory messageStoreFactory, LogFactory logFactory, MessageFactory messageFactory)
           
DynamicAcceptorSessionProvider(SessionSettings settings, SessionID templateID, Application application, MessageStoreFactory messageStoreFactory, LogFactory logFactory, MessageFactory messageFactory)
           
 
Method Summary
protected  void copySettings(SessionSettings settings, java.util.Properties properties)
           
 Session getSession(SessionID sessionID, SessionConnector sessionConnector)
          Return a session for this sessionID.
protected  SessionID lookupTemplateID(SessionID sessionID)
           
protected  void optionallySetValue(SessionSettings dynamicSettings, java.lang.String key, java.lang.String value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WILDCARD

public static final java.lang.String WILDCARD
See Also:
Constant Field Values

settings

protected final SessionSettings settings

sessionFactory

protected final SessionFactory sessionFactory
Constructor Detail

DynamicAcceptorSessionProvider

public DynamicAcceptorSessionProvider(SessionSettings settings,
                                      SessionID templateID,
                                      Application application,
                                      MessageStoreFactory messageStoreFactory,
                                      LogFactory logFactory,
                                      MessageFactory messageFactory)
Parameters:
settings - session settings
templateID - this is a session ID for a session definition in the session settings that will be used for default dynamic session values. The BeginString, SenderCompID, and TargetCompID settings will be replaced with those in the received logon message.
application - application for the dynamic sessions
messageStoreFactory - message store factory for the dynamic sessions
logFactory - log factory for the dynamic sessions
messageFactory - message factory for the dynamic sessions

DynamicAcceptorSessionProvider

public DynamicAcceptorSessionProvider(SessionSettings settings,
                                      java.util.List<DynamicAcceptorSessionProvider.TemplateMapping> templateMappings,
                                      Application application,
                                      MessageStoreFactory messageStoreFactory,
                                      LogFactory logFactory,
                                      MessageFactory messageFactory)
Parameters:
settings - session settings
templateMappings - this is a list of session ID patterns mapped to session IDs in the settings file. The session IDs represent the template for a specified session ID pattern. The template is used to dynamically create acceptor sessions. Use "*" to represent a wildcard for a pattern element. For example, new SessionID("FIX.4.2", "*", "*") would match for any FIX 4.2 session ID. This allows separate template session configurations for FIX versions (or CompIDs) being accepted dynamically on a single TCP port.
application - application for the dynamic sessions
messageStoreFactory - message store factory for the dynamic sessions
logFactory - log factory for the dynamic sessions
messageFactory - message factory for the dynamic sessions
See Also:
DynamicAcceptorSessionProvider.TemplateMapping
Method Detail

getSession

public Session getSession(SessionID sessionID,
                          SessionConnector sessionConnector)
Description copied from interface: AcceptorSessionProvider
Return a session for this sessionID. The session might be created dynamically.

Specified by:
getSession in interface AcceptorSessionProvider
Returns:
the associated session or null if no session can be associated with the given ID.

optionallySetValue

protected void optionallySetValue(SessionSettings dynamicSettings,
                                  java.lang.String key,
                                  java.lang.String value)

lookupTemplateID

protected SessionID lookupTemplateID(SessionID sessionID)

copySettings

protected void copySettings(SessionSettings settings,
                            java.util.Properties properties)