com.devexperts.qd.qtp.file
Class FileConnector

java.lang.Object
  extended by com.devexperts.qd.qtp.AbstractMessageConnector
      extended by com.devexperts.qd.qtp.file.FileConnector
All Implemented Interfaces:
FileConnectorMBean, MessageConnector

@MessageConnectorSummary(info="Connects to a file.",
                         addressFormat="file:",
                         properties={"format -- file format (one of \"binary\", \"text\" or \"blob::\")","ignoretime -- ignore \".time\" files even if they present","start -- time to start playing from (if \".time\" file exists)","delayed -- delay relatively to current time (same as \"start=-\"), DEPRECATED","readAs -- overrides the type of read messages (one of \"ticker_data\", \"stream_data\", \"history_data\", or \"raw_data\", works for binary tape files only)"})
public class FileConnector
extends AbstractMessageConnector
implements FileConnectorMBean

Reads messages from a specified URL or file. By default when reading from some file ".time" file with corresponding name is also read and the messages times are taken from it to mimick delays of original messages. If there is no ".time" file found then all messages are given out at once. It is possible to ignore ".time" files by using boolean option "ignoretime".


Field Summary
 
Fields inherited from class com.devexperts.qd.qtp.AbstractMessageConnector
DEFAULT_READ_AGGREGATION_SIZE, DEFAULT_RECONNECT_DELAY, log
 
Constructor Summary
FileConnector(com.devexperts.connector.proto.ApplicationConnectionFactory factory, java.lang.String address)
          Creates new file connector.
FileConnector(MessageAdapter.Factory factory, java.lang.String address)
          Deprecated. use FileConnector(com.devexperts.connector.proto.ApplicationConnectionFactory , String)
 
Method Summary
 java.lang.String getAddress()
          Returns address string of this connector.
 int getConnectionCount()
          Returns number of established connections.
 com.devexperts.transport.stats.EndpointStats getEndpointStats()
          Returns statistics for this message connector.
 FileFormat getFormat()
           
 boolean getIgnoretime()
           
 MessageConnectorState getState()
          Returns description of connectior's state as a string.
 boolean isActive()
          Returns true if connector is started (not stopped).
 void setAddress(java.lang.String address)
           
 void setDelayed(TimePeriod delay)
           
 void setFormat(FileFormat format)
           
 void setIgnoretime(boolean ignore)
           
 void setReadAs(MessageType readAs)
           
 void setStart(java.util.Date time)
           
 void start()
          Starts connector (connection is immediately established).
 void stop()
          Stops connector (connection is immediately dropped).
 
Methods inherited from class com.devexperts.qd.qtp.AbstractMessageConnector
addClosedConnectionStats, addMessageConnectorListener, getFactory, getLogging, getName, getReconnectDelay, getStats, getThreadPriority, notifyMessageConnectorListeners, reconfigure, removeMessageConnectorListener, restart, setName, setReconnectDelay, setStats, setThreadPriority, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.devexperts.qd.qtp.MessageConnector
addMessageConnectorListener, getName, getReconnectDelay, getStats, getThreadPriority, removeMessageConnectorListener, restart, setName, setReconnectDelay, setStats, setThreadPriority
 

Constructor Detail

FileConnector

@Deprecated
public FileConnector(MessageAdapter.Factory factory,
                                java.lang.String address)
Deprecated. use FileConnector(com.devexperts.connector.proto.ApplicationConnectionFactory , String)

Creates new file connector.

Parameters:
factory - message adapter factory to use
address - address of file to use
Throws:
java.lang.NullPointerException - if factory or address is null

FileConnector

public FileConnector(com.devexperts.connector.proto.ApplicationConnectionFactory factory,
                     java.lang.String address)
Creates new file connector.

Parameters:
factory - application connection factory to use
address - address of file to use
Throws:
java.lang.NullPointerException - if factory or address is null
Method Detail

start

public void start()
Description copied from interface: MessageConnector
Starts connector (connection is immediately established). Does nothing if connector is already started.

Specified by:
start in interface MessageConnector
Specified by:
start in class AbstractMessageConnector

stop

public void stop()
Description copied from interface: MessageConnector
Stops connector (connection is immediately dropped). Does nothing if connector is stopped.

Specified by:
stop in interface MessageConnector
Specified by:
stop in class AbstractMessageConnector

getAddress

public java.lang.String getAddress()
Description copied from interface: MessageConnector
Returns address string of this connector. It is "[host1[:port1],host2[:port2],...]:port" for client socket connector and ":port" for server socket connector.

Specified by:
getAddress in interface MessageConnector
Returns:
address string of this connector

setAddress

public void setAddress(java.lang.String address)
Specified by:
setAddress in interface FileConnectorMBean

getFormat

public FileFormat getFormat()
Specified by:
getFormat in interface FileConnectorMBean

setFormat

public void setFormat(FileFormat format)
Specified by:
setFormat in interface FileConnectorMBean

isActive

public boolean isActive()
Description copied from interface: MessageConnector
Returns true if connector is started (not stopped).

Specified by:
isActive in interface MessageConnector
Returns:
true if connector is started (not stopped)

getState

public MessageConnectorState getState()
Description copied from interface: MessageConnector
Returns description of connectior's state as a string.

Specified by:
getState in interface MessageConnector
Returns:
description of connectior's state as a string

getConnectionCount

public int getConnectionCount()
Description copied from interface: MessageConnector
Returns number of established connections.

Specified by:
getConnectionCount in interface MessageConnector
Returns:
number of established connections

getEndpointStats

public com.devexperts.transport.stats.EndpointStats getEndpointStats()
Description copied from interface: MessageConnector
Returns statistics for this message connector.

Specified by:
getEndpointStats in interface MessageConnector
Overrides:
getEndpointStats in class AbstractMessageConnector
Returns:
statistics for this message connector

setStart

public void setStart(java.util.Date time)

setDelayed

public void setDelayed(TimePeriod delay)

setIgnoretime

public void setIgnoretime(boolean ignore)
Specified by:
setIgnoretime in interface FileConnectorMBean

setReadAs

public void setReadAs(MessageType readAs)

getIgnoretime

public boolean getIgnoretime()
Specified by:
getIgnoretime in interface FileConnectorMBean