public interface DSData extends DSPacket, Iterable<DSField>
This interface should be implemented by a class that needs to send data to DataSource peers (for example, a Caplin Liberator, or another DataSource-enabled application).
Peers identify instances of a class that implements DSData by their subject names. The peer can also determine the type of object (record, page, etc.) and whether it should take any special actions, indicated by the flags.
Modifier and Type | Field and Description |
---|---|
static int |
CONTAINER_TYPE
A Container object type.
|
static int |
F_AUTH_UPDATE
Used to indicate to a Liberator that this update should be checked for client access using the auth module.
|
static int |
F_AUTHGLOBAL
Indicates that this object is a global permission object and that all updates for it should be
passed through to the Auth module.
|
static int |
F_CHANGEDFIELDS
Indicates that this object should be delta compressed before sending on to the clients.
|
static int |
F_CLEAR_PERMISSIONS
Clear all permission entries for this object.
|
static int |
F_CLEAR_TYPE2
Clear all type 2 entries for this object.
|
static int |
F_CLEAR_TYPE3
Clear all type 3 entries for this object.
|
static int |
F_CREATEOBJECT
Creates this object if it does not exist.
|
static int |
F_CREATEPARENT
Creates the parent directory if it does not exist.
|
static int |
F_DELETE_PERMISSION
Delete any permission entries for this object with the same value as the first field
in the update.
|
static int |
F_FILTER_TYPE2
Clear any type 2 entries for this object with the same value as the first field
in the update.
|
static int |
F_FILTER_TYPE3
Clear all type 3 entries for this object with the same value as the first field in the update.
|
static int |
F_IMAGE
Indicates this packet is an image and not an update.
|
static int |
F_NONACTIVE
Indicates that this object should be treated in a non-active (ie broadcast) manner.
|
static int |
GENERIC_TYPE
A Generic Type object type.
|
static int |
NEWS_TYPE
A News Headline object type.
|
static int |
PAGE_TYPE
A Page object type.
|
static int |
PERMISSION_TYPE
A Permission object type.
|
static int |
RECORD_TYPE
A Record object type.
|
static int |
STORY_TYPE
A News Story object type.
|
static int |
TYPE2_RECORD_TYPE
A Type 2 Record object type.
|
static int |
TYPE3_RECORD_TYPE
A Type 3 Record object type.
|
static int |
UNKNOWN_TYPE
An uknown type.
|
Modifier and Type | Method and Description |
---|---|
void |
addBinaryData(int fieldNumber,
byte value)
Adds the byte value for the specified field number.
|
void |
addBinaryData(int fieldNumber,
byte[] value)
Adds the byte array value for the specified field number.
|
void |
addBinaryData(int fieldNumber,
double value)
Adds the double value for the specified field number.
|
void |
addBinaryData(int fieldNumber,
float value)
Adds the float value for the specified field number.
|
void |
addBinaryData(int fieldNumber,
int value)
Adds the integer value for the specified field number.
|
void |
addBinaryData(int fieldNumber,
long value)
Adds the long value for the specified field number.
|
void |
addBinaryData(int fieldNumber,
short value)
Adds the short value for the specified field number.
|
void |
addBinaryData(int fieldNumber,
String value)
Adds the String value for the specified field number.
|
void |
addData(DSField dsField)
Adds the DSField.
|
void |
addData(int fieldNumber,
char value)
Adds the String representation of the character value for the
specified field number.
|
void |
addData(int fieldNumber,
char[] value)
Adds the String representation of the character array for the
specified field number.
|
void |
addData(int fieldNumber,
double value)
Adds the String representation of the double value for the
specified field number.
|
void |
addData(int fieldNumber,
float value)
Adds the String representation of the float value for the
specified field number.
|
void |
addData(int fieldNumber,
int value)
Adds the String representation of the integer value for the
specified field number.
|
void |
addData(int fieldNumber,
long value)
Adds the String representation of the long value for the
specified field number.
|
void |
addData(int fieldNumber,
String value)
Adds the String value for the specified field number.
|
void |
clearFields()
Removes all the fields.
|
int |
count()
Gets the number of fields that are present in this packet.
|
Enumeration |
elements()
Returns an enumeration of the fields for this DSData.
|
DSField |
getFieldByFieldNumber(int fieldNumber)
Gets the first occurrence of the field with the specified field
number.
|
DSField |
getFieldByFieldNumber(int fieldNumber,
int occurrence)
Gets the specified occurrence of the field with the specified
field number.
|
int |
getFlags()
Gets the flags that are going to be sent with this packet.
|
Enumeration |
getKeys()
Deprecated.
use elements() or iterator().
|
String |
getSubject()
Gets this object's subject.
|
int |
getType()
Gets this object's type.
|
Enumeration |
getValues()
Deprecated.
use elements() or iterator().
|
Iterator<DSField> |
iterator()
Returns an iterator of the fields for this DSData.
|
boolean |
removeField(DSField dsField)
Removes the specified field from the DSData.
|
void |
setFlags(int flags)
Sets the flags to be sent with this packet.
|
void |
setSubject(String subject)
Sets this object's subject.
|
void |
setType(int type)
Sets the object type of this DSData to the specified value.
|
boolean |
updateData(int fieldNumber,
String value)
Sets the value of the first occurrence for the specified field
number.
|
boolean |
updateData(int fieldNumber,
String value,
int occurrence)
Sets the value of the specified occurrence for a particular
field number.
|
send, sendDirect, sendToPeer
toBytes
static final int F_CREATEOBJECT
static final int F_CREATEPARENT
static final int F_IMAGE
static final int F_NONACTIVE
static final int F_AUTH_UPDATE
NEWS_TYPE
objects.static final int F_CHANGEDFIELDS
static final int F_FILTER_TYPE2
N.B. In the case of the first field being a type 2 identified (e.g. Market-Maker, Quote ID) it will delete that single entry. If the first field is a standard field then there may be multiple matching entries, all of which will be deleted.
static final int F_FILTER_TYPE3
static final int F_CLEAR_TYPE2
static final int F_CLEAR_TYPE3
static final int F_AUTHGLOBAL
static final int F_DELETE_PERMISSION
static final int F_CLEAR_PERMISSIONS
static final int UNKNOWN_TYPE
static final int PAGE_TYPE
static final int RECORD_TYPE
static final int NEWS_TYPE
static final int STORY_TYPE
static final int TYPE2_RECORD_TYPE
static final int TYPE3_RECORD_TYPE
static final int CONTAINER_TYPE
static final int PERMISSION_TYPE
static final int GENERIC_TYPE
void setFlags(int flags)
Sets the flags to be sent with this packet.
The flags that can be set are:
F_CREATEOBJECT
F_CREATEPARENT
F_IMAGE
F_NONACTIVE
F_AUTH_UPDATE
F_FILTER_TYPE2
F_FILTER_TYPE3
F_CLEAR_TYPE2
F_CLEAR_TYPE3
Multiple flags can be set by bitwise ORing them together (e.g. F_CREATEOBJECT|F_CREATEPARENT|F_IMAGE).
flags
- The flags to be sent with this packet.int getFlags()
Gets the flags that are going to be sent with this packet.
void setType(int type)
Sets the object type of this DSData to the specified value.
Valid object types are:
type
- this object's type.int getType()
Gets this object's type.
void setSubject(String subject)
Sets this object's subject.
subject
- The subject name.String getSubject()
Gets this object's subject.
int count()
Gets the number of fields that are present in this packet.
Enumeration getKeys()
Returns as Enumeration
of Integers
indicating the field number .
Enumeration
.Enumeration getValues()
Returns as Enumeration
of Strings
indicating the field values .
Enumeration
.Enumeration elements()
Returns an enumeration of the fields for this DSData. Each
field is represented by a DSField
.
Iterator<DSField> iterator()
Returns an iterator of the fields for this DSData. Each field
is represented by a DSField
.
DSField getFieldByFieldNumber(int fieldNumber)
Gets the first occurrence of the field with the specified field number.
If there are three occurrences of the field 12, with values "75", "75.5" and "75.25", then calling getFieldByFieldNumber(12) will return the field that contains the value "75".
This is equivalent to calling getFieldByFieldNumber(fieldNumber, 0).
fieldNumber
- The field identifier number.DSField getFieldByFieldNumber(int fieldNumber, int occurrence)
Gets the specified occurrence of the field with the specified field number.
If there are three occurrences of the field 12, with values "75", "75.5" and "75.25", then calling getFieldByFieldNumber(12, 2) will return the field that contains the value "75.25".
fieldNumber
- The field identifier number.occurrence
- The occurrence of the field to be got. The
first field is occurrence 0, the next occurrence
1, and so on.boolean removeField(DSField dsField)
Removes the specified field from the DSData.
dsField
- The field to remove.boolean updateData(int fieldNumber, String value, int occurrence)
Sets the value of the specified occurrence for a particular field number.
If there are three occurrences of the field 12, "75", "75.5" and "75.25", then calling updateData(12, "76", 2) will change occurrences to be "75", "75.5" and "76".
fieldNumber
- The field identifier number.value
- The new value for the field.occurrence
- The occurrence of the field to be updated. The
first field is occurrence 0, the next occurrence
1, and so on.ArrayIndexOutOfBoundsException
- If there are fewer
occurrences of the field than the specified occurrence
to update.boolean updateData(int fieldNumber, String value)
Sets the value of the first occurrence for the specified field number.
If there are three occurrences of the field 12, "75", "75.5" and "75.25", then calling updateData(12, "76") will change occurrences to be "76", "75.5" and "75.25".
This is equivalent to calling updateData(fieldNumber, value, 0).
fieldNumber
- The field identifier number.value
- The new value for the field.void clearFields()
Removes all the fields.
void addData(DSField dsField)
Adds the DSField.
dsField
- the DSField to be added.void addData(int fieldNumber, String value)
Adds the String value for the specified field number.
fieldNumber
- The field identifier number.value
- The value to be stored in the field.void addData(int fieldNumber, char value)
Adds the String representation of the character value for the specified field number.
fieldNumber
- The field identifier number.value
- The value to be stored in the field.void addData(int fieldNumber, char[] value)
Adds the String representation of the character array for the specified field number.
fieldNumber
- The field identifier number.value
- The value to be stored in the field.void addData(int fieldNumber, double value)
Adds the String representation of the double value for the specified field number.
Warning: the underlying implementation will not guarantee any
accuracy beyond 12 decimal places. If greater precision is required,
the value should be formatted separately and added using the
addData(int, String)
method.
fieldNumber
- The field identifier number.value
- The value to be stored in the field.void addData(int fieldNumber, float value)
Adds the String representation of the float value for the specified field number.
Warning: the underlying implementation will not guarantee any
accuracy beyond 6 decimal places. If greater precision is required,
the value should be formatted separately and added using the
addData(int, String)
method.
fieldNumber
- The field identifier number.value
- The value to be stored in the field.void addData(int fieldNumber, int value)
Adds the String representation of the integer value for the specified field number.
fieldNumber
- The field identifier number.value
- The value to be stored in the field.void addData(int fieldNumber, long value)
Adds the String representation of the long value for the specified field number.
fieldNumber
- The field identifier number.value
- The value to be stored in the field.void addBinaryData(int fieldNumber, byte value)
Adds the byte value for the specified field number. This method Base64 encodes the value before storing it.
fieldNumber
- The field identifier number.value
- The byte value to be stored in the field.void addBinaryData(int fieldNumber, short value)
Adds the short value for the specified field number. This method Base64 encodes the value before storing it.
fieldNumber
- The field identifier number.value
- The value to be stored in the field.void addBinaryData(int fieldNumber, int value)
Adds the integer value for the specified field number. This method Base64 encodes the value before storing it.
fieldNumber
- The field identifier number.value
- The value to be stored in the field.void addBinaryData(int fieldNumber, long value)
Adds the long value for the specified field number. This method Base64 encodes the value before storing it.
fieldNumber
- The field identifier number.value
- The value to be stored in the field.void addBinaryData(int fieldNumber, float value)
Adds the float value for the specified field number. This method Base64 encodes the value before storing it.
fieldNumber
- The field identifier number.value
- The value to be stored in the field.void addBinaryData(int fieldNumber, double value)
Adds the double value for the specified field number. This method Base64 encodes the value before storing it.
fieldNumber
- The field identifier number.value
- The value to be stored in the field.void addBinaryData(int fieldNumber, byte[] value)
Adds the byte array value for the specified field number. This method Base64 encodes the value before storing it.
fieldNumber
- The field identifier number.value
- The array of bytes to be stored in the field.void addBinaryData(int fieldNumber, String value)
Adds the String value for the specified field number. This method Base64 encodes the value before storing it.
fieldNumber
- The field identifier number.value
- The value to be stored in the field.Please send bug reports and comments to Caplin support