com.latencybusters.pdm
Class PDMDefinition

java.lang.Object
  extended by com.latencybusters.pdm.PDMDefinition

public class PDMDefinition
extends java.lang.Object

The message definition class that needs to be populated and finalized before using in a PDMMessage


Constructor Summary
protected PDMDefinition()
          Protected constructor used by PDMMessage when parsing a PDMDefinition included with the PDMMessage
  PDMDefinition(int numFields)
          Creates a new definition with the specified number of fields
  PDMDefinition(int numFields, boolean useIntsForNames)
          Creates a new definition with the specified number of fields and whether or not to use ints or strings as field names
 
Method Summary
 PDMFieldInfo addFieldInfo(int name, PDMFieldType type, boolean required)
          Adds field information to the definition with an int field name
 PDMFieldInfo addFieldInfo(int name, PDMFieldType type, boolean required, int numElements)
          Adds field information to the definition for a fixed-size array field with an int field name
 PDMFieldInfo addFieldInfo(int name, PDMFieldType type, int fixedStrLen, boolean required)
          Adds field information to the definition for a fixed length string field with an int field name
 PDMFieldInfo addFieldInfo(int name, PDMFieldType type, int fixedStrLen, boolean required, int numElements)
          Adds field information to the definition for a fixed-size array field of fixed length strings with an int field name
protected  PDMFieldInfo addFieldInfo(java.lang.String strName, int intName, PDMFieldType type, int fixedStrLen, boolean required, int numElements)
          The main method used internally to add field information to the definition
 PDMFieldInfo addFieldInfo(java.lang.String name, PDMFieldType type, boolean required)
          Adds field information to the definition with a string field name
 PDMFieldInfo addFieldInfo(java.lang.String name, PDMFieldType type, boolean required, int numElements)
          Adds field information to the definition for a fixed-size array field with a string field name
 PDMFieldInfo addFieldInfo(java.lang.String name, PDMFieldType type, int fixedStrLen, boolean required)
          Adds field information to the definition for a fixed length string field with a string field name
 PDMFieldInfo addFieldInfo(java.lang.String name, PDMFieldType type, int fixedStrLen, boolean required, int numElements)
          Adds field information to the definition for a fixed-size array field of fixed length strings with a string field name
protected  int calcLen(PDMSerializer ser)
          Calculates the total length of the definition
 int compareTo(int otherDefnId)
          Used to compare this PDMDefinition to another's id taking into account only the the definition id
 int compareTo(PDMDefinition other)
          Used to compare this PDMDefinition to another taking into account only the the definition id
 int compareToWithVersion(int otherDefnId, int otherMsgVersMajor, int otherMsgVersMinor)
          Used to compare this PDMDefinition to another's properties taking into account the definition id and the major and minor message version
 int compareToWithVersion(PDMDefinition other)
          Used to compare this PDMDefinition to another taking into account the definition id and the major and minor message version
 java.util.Iterator<PDMFieldInfo> createFieldInfoIterator()
          Creates an iterator of PDMFieldInfo to iterate through the field information
 void finalizeDef()
          Finalizes the definition to ready it for use in a message
 PDMFieldInfo getFieldInfo(int name)
          Access the field information by integer name
 PDMFieldInfo getFieldInfo(java.lang.String name)
          Access the field information by String name
protected  PDMFieldInfo getFieldInfoById(int id)
          Gets the PDMFieldInfo object by its id
 java.util.List<PDMFieldInfo> getFieldInfoList()
           
protected  int getFixedRequiredLen()
          Gets or calcs the length of the fixed required fields
 int getId()
           
 byte getMsgVersMajor()
           
 byte getMsgVersMinor()
           
 int getNumFields()
           
 boolean isFinalized()
           
 boolean isIntsForNames()
           
 int parse(PDMDeserializer deser, byte[] ba)
          Parses an existing byte array into this object
 int parse(PDMDeserializer deser, byte[] ba, int pos)
          Parses an existing byte array into this object
 void setId(int id)
           
 void setMsgVersMajor(byte msgVersMajor)
           
 void setMsgVersMinor(byte msgVersMinor)
           
 byte[] toBytes(PDMSerializer ser)
          Serializes the PDMDefinition to a new byte array
 int toBytes(PDMSerializer ser, byte[] ba, int pos)
          Serialize the PDMDefinition to an existing byte array
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PDMDefinition

protected PDMDefinition()
Protected constructor used by PDMMessage when parsing a PDMDefinition included with the PDMMessage


PDMDefinition

public PDMDefinition(int numFields)
Creates a new definition with the specified number of fields

Parameters:
numFields - the number of fields

PDMDefinition

public PDMDefinition(int numFields,
                     boolean useIntsForNames)
Creates a new definition with the specified number of fields and whether or not to use ints or strings as field names

Parameters:
numFields - the number of fields
useIntsForNames - true to use ints as field names or false to use string field names (the default)
Method Detail

getFieldInfoList

public java.util.List<PDMFieldInfo> getFieldInfoList()

getNumFields

public int getNumFields()

isFinalized

public boolean isFinalized()

setMsgVersMajor

public void setMsgVersMajor(byte msgVersMajor)

getMsgVersMajor

public byte getMsgVersMajor()

setMsgVersMinor

public void setMsgVersMinor(byte msgVersMinor)

getMsgVersMinor

public byte getMsgVersMinor()

setId

public void setId(int id)

getId

public int getId()

isIntsForNames

public boolean isIntsForNames()

getFixedRequiredLen

protected int getFixedRequiredLen()
Gets or calcs the length of the fixed required fields

Returns:
the length in bytes

calcLen

protected int calcLen(PDMSerializer ser)
Calculates the total length of the definition

Parameters:
ser -
Returns:
the length in bytes

getFieldInfoById

protected PDMFieldInfo getFieldInfoById(int id)
Gets the PDMFieldInfo object by its id

Parameters:
id - the internal id of the field
Returns:
the PDMFieldInfo object

addFieldInfo

protected PDMFieldInfo addFieldInfo(java.lang.String strName,
                                    int intName,
                                    PDMFieldType type,
                                    int fixedStrLen,
                                    boolean required,
                                    int numElements)
The main method used internally to add field information to the definition

Parameters:
strName - the string name of the field (if using string names)
intName - the int name of the field (if using int names)
type - the type of field
fixedStrLen - the fixed string length (number of characters) and is normally 0 unless the type is fixed string or fixed unicode
required - whether or not the field is required
numElements - a non-zero value is used to define a fixed-size array for array types
Returns:
the added PDMFieldInfo

createFieldInfoIterator

public java.util.Iterator<PDMFieldInfo> createFieldInfoIterator()
Creates an iterator of PDMFieldInfo to iterate through the field information

Returns:
an Iterator used to iterate through the list of PDMFieldInfo

finalizeDef

public void finalizeDef()
Finalizes the definition to ready it for use in a message


getFieldInfo

public PDMFieldInfo getFieldInfo(int name)
Access the field information by integer name

Parameters:
name - the int field name
Returns:
the PDMFieldInfo handle

getFieldInfo

public PDMFieldInfo getFieldInfo(java.lang.String name)
Access the field information by String name

Parameters:
name - the string field name
Returns:
the PDMFieldInfo handle

addFieldInfo

public PDMFieldInfo addFieldInfo(java.lang.String name,
                                 PDMFieldType type,
                                 boolean required)
Adds field information to the definition with a string field name

Parameters:
name - the string name of the field
type - the type of field
required - whether or not the field is required
Returns:
the PDMFieldInfo handle

addFieldInfo

public PDMFieldInfo addFieldInfo(int name,
                                 PDMFieldType type,
                                 boolean required)
Adds field information to the definition with an int field name

Parameters:
name - the int name of the field
type - the type of field
required - whether or not the field is required
Returns:
the PDMFieldInfo handle

addFieldInfo

public PDMFieldInfo addFieldInfo(java.lang.String name,
                                 PDMFieldType type,
                                 int fixedStrLen,
                                 boolean required)
Adds field information to the definition for a fixed length string field with a string field name

Parameters:
name - the string name of the field
type - the type of field
fixedStrLen - the fixed string length (number of characters) and is normally 0 unless the type is fixed string or fixed unicode
required - whether or not the field is required
Returns:
the PDMFieldInfo handle

addFieldInfo

public PDMFieldInfo addFieldInfo(int name,
                                 PDMFieldType type,
                                 int fixedStrLen,
                                 boolean required)
Adds field information to the definition for a fixed length string field with an int field name

Parameters:
name - the int name of the field
type - the type of field
fixedStrLen - the fixed string length (number of characters) and is normally 0 unless the type is fixed string or fixed unicode
required - whether or not the field is required
Returns:
the PDMFieldInfo handle

addFieldInfo

public PDMFieldInfo addFieldInfo(java.lang.String name,
                                 PDMFieldType type,
                                 boolean required,
                                 int numElements)
Adds field information to the definition for a fixed-size array field with a string field name

Parameters:
name - the string name of the field
type - the type of field
required - whether or not the field is required
numElements - a non-zero value is used to define a fixed-size array for array types
Returns:
the PDMFieldInfo handle

addFieldInfo

public PDMFieldInfo addFieldInfo(int name,
                                 PDMFieldType type,
                                 boolean required,
                                 int numElements)
Adds field information to the definition for a fixed-size array field with an int field name

Parameters:
name - the int name of the field
type - the type of field
required - whether or not the field is required
numElements - a non-zero value is used to define a fixed-size array for array types
Returns:
the PDMFieldInfo handle

addFieldInfo

public PDMFieldInfo addFieldInfo(java.lang.String name,
                                 PDMFieldType type,
                                 int fixedStrLen,
                                 boolean required,
                                 int numElements)
Adds field information to the definition for a fixed-size array field of fixed length strings with a string field name

Parameters:
name - the string name of the field
type - the type of field
fixedStrLen - the fixed string length (number of characters) and is normally 0 unless the type is fixed string or fixed unicode
required - whether or not the field is required
numElements - a non-zero value is used to define a fixed-size array for array types
Returns:
the PDMFieldInfo handle

addFieldInfo

public PDMFieldInfo addFieldInfo(int name,
                                 PDMFieldType type,
                                 int fixedStrLen,
                                 boolean required,
                                 int numElements)
Adds field information to the definition for a fixed-size array field of fixed length strings with an int field name

Parameters:
name - the int name of the field
type - the type of field
fixedStrLen - the fixed string length (number of characters) and is normally 0 unless the type is fixed string or fixed unicode
required - whether or not the field is required
numElements - a non-zero value is used to define a fixed-size array for array types
Returns:
the PDMFieldInfo handle

compareToWithVersion

public int compareToWithVersion(int otherDefnId,
                                int otherMsgVersMajor,
                                int otherMsgVersMinor)
Used to compare this PDMDefinition to another's properties taking into account the definition id and the major and minor message version

Parameters:
otherDefnId - the other definition id to compare against
otherMsgVersMajor - the other definition major version to compare against
otherMsgVersMinor - the other definition minor version to compare against
Returns:
0 if the two are equal, 1 if this PDMDefinition is greater, -1 if this PDMDefinition is less

compareToWithVersion

public int compareToWithVersion(PDMDefinition other)
Used to compare this PDMDefinition to another taking into account the definition id and the major and minor message version

Parameters:
other - the other PDMDefinition to compare against
Returns:
0 if the two are equal, 1 if this PDMDefinition is greater, -1 if this PDMDefinition is less

compareTo

public int compareTo(int otherDefnId)
Used to compare this PDMDefinition to another's id taking into account only the the definition id

Parameters:
otherDefnId - the other definition id to compare against
Returns:
0 if the two are equal, 1 if this PDMDefinition is greater, -1 if this PDMDefinition is less

compareTo

public int compareTo(PDMDefinition other)
Used to compare this PDMDefinition to another taking into account only the the definition id

Parameters:
other - the other PDMDefinition to compare against
Returns:
0 if the two are equal, 1 if this PDMDefinition is greater, -1 if this PDMDefinition is less

toBytes

public byte[] toBytes(PDMSerializer ser)
Serializes the PDMDefinition to a new byte array

Parameters:
ser - the PDMSerializer to use
Returns:
the new byte array

toBytes

public int toBytes(PDMSerializer ser,
                   byte[] ba,
                   int pos)
Serialize the PDMDefinition to an existing byte array

Parameters:
ser - the PDMSerializer to use
ba - the byte array to serialize into
pos - the position to start at in the byte array
Returns:
the updated position after serializing this object

parse

public int parse(PDMDeserializer deser,
                 byte[] ba)
Parses an existing byte array into this object

Parameters:
deser - the PDMDeserializer to use
ba - the byte array to parse
Returns:
the updated position after parsing this object

parse

public int parse(PDMDeserializer deser,
                 byte[] ba,
                 int pos)
Parses an existing byte array into this object

Parameters:
deser - the PDMDeserializer to use
ba - the byte array to parse
pos - the position to start parsing in the byte array
Returns:
the updated position after parsing this object


All of the documentation and software included in this and any other Informatica Inc "Ultra Messaging" Release is Copyright (C) 2004-2014, Informatica Corporation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted only as covered by the terms of a valid software license agreement with 29West Inc. Copyright © 2004-2014, Informatica, Inc. All Rights Reserved.