quickfix
Class DataDictionary

java.lang.Object
  extended by quickfix.DataDictionary

public class DataDictionary
extends java.lang.Object

Provide the message metadata for various versions of FIX.


Nested Class Summary
static class DataDictionary.Exception
          Data dictionary-related exception.
static class DataDictionary.GroupInfo
          Contains meta-data for FIX repeating groups
 
Field Summary
static java.lang.String ANY_VALUE
           
static java.lang.String HEADER_ID
           
static java.lang.String TRAILER_ID
           
 
Constructor Summary
DataDictionary(DataDictionary source)
          Copy a data dictionary.
DataDictionary(java.io.InputStream in)
          Initialize a data dictionary from an input stream.
DataDictionary(java.lang.String location)
          Initialize a data dictionary from a URL or a file path.
 
Method Summary
 java.lang.String getFieldName(int field)
          Get the field name for a specified tag.
 int getFieldTag(java.lang.String name)
          Get the field tag given a field name.
 int getFieldType(int field)
          Get the field type for a field.
 FieldType getFieldTypeEnum(int field)
          Return the field type for a field.
 DataDictionary.GroupInfo getGroup(java.lang.String msg, int field)
          Get repeating group metadata.
 java.lang.String getMsgType(java.lang.String msgName)
          Return the message type for the specified name.
 int[] getOrderedFields()
           
 java.lang.String getValueName(int field, java.lang.String value)
          Get the value name, if any, for an enumerated field value.
 java.lang.String getVersion()
          Get the FIX version associated with this dictionary.
 boolean hasFieldValue(int field)
          Predicate for determining if a field has enumerated values.
 boolean isAdminMessage(java.lang.String msgType)
          Predicate for determining if a message is in the admin category.
 boolean isAppMessage(java.lang.String msgType)
          Predicate for determining if a message is in the app category.
 boolean isCheckFieldsOutOfOrder()
           
 boolean isDataField(int field)
          Predicate for determining if a field is a FIX raw data field.
 boolean isField(int field)
          Predicate for determining if a tag is a defined field.
 boolean isFieldValue(int field, java.lang.String value)
          Predicate for determining if a field value is valid
 boolean isGroup(java.lang.String msg, int field)
          Predicate for determining if a field is a group count field for a message type.
 boolean isHeaderField(int field)
          Predicate for determining if field is a header field.
 boolean isHeaderGroup(int field)
          Predicate for determining if a field is a header group count field
 boolean isMsgField(java.lang.String msgType, int field)
          Predicate for determining if a field is valid for a given message type.
 boolean isMsgType(java.lang.String msgType)
          Predicate for determining if message type is valid for a specified FIX version.
 boolean isRequiredField(java.lang.String msgType, int field)
          Predicate for determining if a field is required for a message type
 boolean isRequiredHeaderField(int field)
          Predicate for determining if a header field is a required field
 boolean isRequiredTrailerField(int field)
          Predicate for determining if a trailer field is a required field
 boolean isTrailerField(int field)
          Predicate for determining if field is a trailer field.
 void setAllowUnknownMessageFields(boolean allowUnknownFields)
           
 void setCheckFieldsHaveValues(boolean flag)
          Controls whether empty field values are checked.
 void setCheckFieldsOutOfOrder(boolean flag)
          Controls whether out of order fields are checked.
 void setCheckUserDefinedFields(boolean flag)
          Controls whether user defined fields are checked.
 void validate(Message message)
          Validate a mesasge, including the header and trailer fields.
 void validate(Message message, boolean bodyOnly)
          Validate the message body, with header and trailer fields being validated conditionally.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ANY_VALUE

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

HEADER_ID

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

TRAILER_ID

public static final java.lang.String TRAILER_ID
See Also:
Constant Field Values
Constructor Detail

DataDictionary

public DataDictionary(java.lang.String location)
               throws ConfigError
Initialize a data dictionary from a URL or a file path.

Parameters:
location - a URL or file system path
Throws:
ConfigError

DataDictionary

public DataDictionary(java.io.InputStream in)
               throws ConfigError
Initialize a data dictionary from an input stream.

Parameters:
in - the input stream
Throws:
ConfigError

DataDictionary

public DataDictionary(DataDictionary source)
Copy a data dictionary.

Parameters:
source - the source dictionary that will be copied into this dictionary
Method Detail

getVersion

public java.lang.String getVersion()
Get the FIX version associated with this dictionary.

Returns:
the FIX version

getFieldName

public java.lang.String getFieldName(int field)
Get the field name for a specified tag.

Parameters:
field - the tag
Returns:
the field name

getValueName

public java.lang.String getValueName(int field,
                                     java.lang.String value)
Get the value name, if any, for an enumerated field value.

Parameters:
field - the tag
value - the value
Returns:
the value's name

isField

public boolean isField(int field)
Predicate for determining if a tag is a defined field.

Parameters:
field - the tag
Returns:
true if the field is defined, false otherwise

getFieldTypeEnum

public FieldType getFieldTypeEnum(int field)
Return the field type for a field.

Parameters:
field - the tag
Returns:
the field type

getMsgType

public java.lang.String getMsgType(java.lang.String msgName)
Return the message type for the specified name.

Parameters:
msgName - The message name.
Returns:
the message type

isMsgType

public boolean isMsgType(java.lang.String msgType)
Predicate for determining if message type is valid for a specified FIX version.

Parameters:
msgType - the message type value
Returns:
true if the message type if defined, false otherwise

isAdminMessage

public boolean isAdminMessage(java.lang.String msgType)
Predicate for determining if a message is in the admin category.

Parameters:
msgType - the messageType
Returns:
true, if the msgType is a AdminMessage false, if the msgType is a ApplicationMessage

isAppMessage

public boolean isAppMessage(java.lang.String msgType)
Predicate for determining if a message is in the app category.

Parameters:
msgType - the messageType
Returns:
true, if the msgType is a ApplicationMessage false, if the msgType is a AdminMessage

isMsgField

public boolean isMsgField(java.lang.String msgType,
                          int field)
Predicate for determining if a field is valid for a given message type.

Parameters:
msgType - the message type
field - the tag
Returns:
true if field is defined for message, false otherwise.

isHeaderField

public boolean isHeaderField(int field)
Predicate for determining if field is a header field.

Parameters:
field - the tag
Returns:
true if field is a header field, false otherwise.

isTrailerField

public boolean isTrailerField(int field)
Predicate for determining if field is a trailer field.

Parameters:
field - the tag
Returns:
true if field is a trailer field, false otherwise.

getFieldType

public int getFieldType(int field)
Get the field type for a field.

Parameters:
field - a tag
Returns:
the field type
See Also:
getFieldTypeEnum(int)

getFieldTag

public int getFieldTag(java.lang.String name)
Get the field tag given a field name.

Parameters:
name - the field name
Returns:
the tag

isRequiredField

public boolean isRequiredField(java.lang.String msgType,
                               int field)
Predicate for determining if a field is required for a message type

Parameters:
msgType - the message type
field - the tag
Returns:
true if field is required, false otherwise

isRequiredHeaderField

public boolean isRequiredHeaderField(int field)
Predicate for determining if a header field is a required field

Parameters:
field - the tag
Returns:
true if field s required, false otherwise

isRequiredTrailerField

public boolean isRequiredTrailerField(int field)
Predicate for determining if a trailer field is a required field

Parameters:
field - the tag
Returns:
true if field s required, false otherwise

hasFieldValue

public boolean hasFieldValue(int field)
Predicate for determining if a field has enumerated values.

Parameters:
field - the tag
Returns:
true if field is enumerated, false otherwise

isFieldValue

public boolean isFieldValue(int field,
                            java.lang.String value)
Predicate for determining if a field value is valid

Parameters:
field - the tag
value - a possible field value
Returns:
true if field value is valid, false otherwise

isGroup

public boolean isGroup(java.lang.String msg,
                       int field)
Predicate for determining if a field is a group count field for a message type.

Parameters:
msg - the message type
field - the tag
Returns:
true if field starts a repeating group, false otherwise

isHeaderGroup

public boolean isHeaderGroup(int field)
Predicate for determining if a field is a header group count field

Parameters:
field - the tag
Returns:
true if field starts a repeating group, false otherwise

getGroup

public DataDictionary.GroupInfo getGroup(java.lang.String msg,
                                         int field)
Get repeating group metadata.

Parameters:
msg - the message type
field - the tag
Returns:
an object containing group-related metadata

isDataField

public boolean isDataField(int field)
Predicate for determining if a field is a FIX raw data field.

Parameters:
field - the tag
Returns:
true if field is a raw data field, false otherwise

setCheckFieldsOutOfOrder

public void setCheckFieldsOutOfOrder(boolean flag)
Controls whether out of order fields are checked.

Parameters:
flag - true = checked, false = not checked

isCheckFieldsOutOfOrder

public boolean isCheckFieldsOutOfOrder()

setCheckFieldsHaveValues

public void setCheckFieldsHaveValues(boolean flag)
Controls whether empty field values are checked.

Parameters:
flag - true = checked, false = not checked

setCheckUserDefinedFields

public void setCheckUserDefinedFields(boolean flag)
Controls whether user defined fields are checked.

Parameters:
flag - true = checked, false = not checked

validate

public void validate(Message message)
              throws IncorrectTagValue,
                     FieldNotFound,
                     IncorrectDataFormat
Validate a mesasge, including the header and trailer fields.

Parameters:
message - the message
Throws:
IncorrectTagValue - if a field value is not valid
FieldNotFound - if a field cannot be found
IncorrectDataFormat

validate

public void validate(Message message,
                     boolean bodyOnly)
              throws IncorrectTagValue,
                     FieldNotFound,
                     IncorrectDataFormat
Validate the message body, with header and trailer fields being validated conditionally.

Parameters:
message - the message
bodyOnly - whether to validate just the message body, or to validate the header and trailer sections as well.
Throws:
IncorrectTagValue - if a field value is not valid
FieldNotFound - if a field cannot be found
IncorrectDataFormat

getOrderedFields

public int[] getOrderedFields()

setAllowUnknownMessageFields

public void setAllowUnknownMessageFields(boolean allowUnknownFields)