com.latencybusters.lbm.sdm
Class LBMSDMField

java.lang.Object
  extended by com.latencybusters.lbm.sdm.LBMSDM
      extended by com.latencybusters.lbm.sdm.LBMSDMField
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
LBMSDMFieldBlob, LBMSDMFieldBool, LBMSDMFieldDecimal, LBMSDMFieldDouble, LBMSDMFieldFloat, LBMSDMFieldInt16, LBMSDMFieldInt32, LBMSDMFieldInt64, LBMSDMFieldInt8, LBMSDMFieldMessage, LBMSDMFieldString, LBMSDMFieldTimestamp, LBMSDMFieldUint16, LBMSDMFieldUint32, LBMSDMFieldUint64, LBMSDMFieldUint8, LBMSDMFieldUnicode

public class LBMSDMField
extends LBMSDM
implements java.lang.Cloneable

LBMSDMField is the base class for all LBM SDM field types. All base LBM SDM field types use the naming convention LBMSDMField(Type). Field arrays are subclasses of the respective field class and use the naming convention LBMSDMArray(Type). LBMSDMRaw(BaseType) is used as the naming convention for raw data types where needed and support the respective LBMSDMField(Type) classes.


Field Summary
protected  int elements
          Number of elements in array
static int MAX_FIELD_NAME_LENGTH
          Maximum length of a field name.
protected  java.lang.String name
          The name of this field
protected  short type
          The current field type
static short TYPE_ARRAY_BLOB
          SDM field type: Array of Binary Large Objects (BLOB).
static short TYPE_ARRAY_BOOLEAN
          SDM field type: Array of Booleans (non-zero is true; zero is false).
static short TYPE_ARRAY_DECIMAL
          SDM field type: Array of decimal numbers.
static short TYPE_ARRAY_DOUBLE
          SDM field type: Array of double-precision floating points.
static short TYPE_ARRAY_FLOAT
          SDM field type: Array of single-precision floating points.
static short TYPE_ARRAY_INT16
          SDM field type: Array of 16-bit signed integers.
static short TYPE_ARRAY_INT32
          SDM field type: Array of 32-bit signed integers.
static short TYPE_ARRAY_INT64
          SDM field type: Array of 64-bit signed integers.
static short TYPE_ARRAY_INT8
          SDM field type: Array of 8-bit signed integers.
static short TYPE_ARRAY_MESSAGE
          SDM field type: Array of nested SDM messages.
static short TYPE_ARRAY_STRING
          SDM field type: Array of character strings (ASCIZ).
static short TYPE_ARRAY_TIMESTAMP
          SDM field type: Array of timestamps (seconds and microseconds since the epoch (UTC)).
static short TYPE_ARRAY_UINT16
          SDM field type: Array of 16-bit unsigned integers.
static short TYPE_ARRAY_UINT32
          SDM field type: Array of 32-bit unsigned integers.
static short TYPE_ARRAY_UINT64
          SDM field type: Array of 64-bit unsigned integers.
static short TYPE_ARRAY_UINT8
          SDM field type: Array of 8-bit unsigned integers.
static short TYPE_ARRAY_UNICODE
          SDM field type: Array of unicode strings.
static short TYPE_BLOB
          SDM field type: Binary Large Object (BLOB).
static short TYPE_BOOLEAN
          SDM field type: Boolean (non-zero is true; zero is false).
static short TYPE_DECIMAL
          SDM field type: Decimal number.
static short TYPE_DOUBLE
          SDM field type: Double-precision floating point.
static short TYPE_FLOAT
          SDM field type: Single-precision floating point.
static short TYPE_INT16
          SDM field type: 16-bit signed integer.
static short TYPE_INT32
          SDM field type: 32-bit signed integer.
static short TYPE_INT64
          SDM field type: 64-bit signed integer.
static short TYPE_INT8
          SDM field type: 8-bit signed integer.
static short TYPE_INVALID
          SDM field type: Type is invalid.
static short TYPE_MESSAGE
          SDM field type: Nested SDM message.
static short TYPE_STRING
          SDM field type: Character string (ASCIZ).
static short TYPE_TIMESTAMP
          SDM field type: Seconds and microseconds since the epoch (UTC).
static short TYPE_UINT16
          SDM field type: 16-bit unsigned integer.
static short TYPE_UINT32
          SDM field type: 32-bit unsigned integer.
static short TYPE_UINT64
          SDM field type: 64-bit unsigned integer.
static short TYPE_UINT8
          SDM field type: 8-bit unsigned integer.
static short TYPE_UNICODE
          SDM field type: Unicode string.
 
Fields inherited from class com.latencybusters.lbm.sdm.LBMSDM
DEBUG_BASIC, debug_level, DEBUG_VERBOSE_PARSING
 
Constructor Summary
  LBMSDMField()
          Create an untyped, unnamed field
protected LBMSDMField(java.lang.String Name, short Type)
          Create a named field with a defined type - used by derived classes
 
Method Summary
 void add_element(LBMSDMField newfield)
          Add an element to an array from a field
protected  void append(LBMSDMField newfield)
          This is overridden by array classes
 LBMSDMField clone()
          Clone this field
 int format_name(byte[] buf, int offset)
          Format into a byte buffer the name of this field.
 int format_type(byte[] buf, int offset)
          Format into a byte buffer the type of this field.
protected  int format(byte[] buf, int offset)
          This is overridden by field and array subclasses
protected  int get_len()
          This is overridden by field and array subclasses
 java.lang.String get_name()
          Get the field name
 short getType()
          Get the type of this field
static short getType(java.lang.String typeName, boolean isarray)
          Get the TYPE_XXX value for a given string.
 java.lang.String getTypeString()
          Get a string representing this field type
 java.lang.String internalString(java.lang.String sname, java.lang.String sval)
          Create a string based on the internal representation (includes the type)
 boolean isNull()
          Test to see if this field is a null field (I.E.
 int length()
          Return the number of elements in an array.
 int name_len()
          Get the length of this fields name in raw form.
protected  int parse(byte[] buf, int offset)
          This is overridden by field and array subclasses
 void remove(int element)
          Remove an element from an array class
 boolean sameBaseType(LBMSDMField f)
          Compare the base type of the field to this field
 boolean sameType(LBMSDMField f)
          Compare the type of the field to this field
 void set_name(java.lang.String new_name)
          Set the name of this field.
protected  void set(LBMSDMField f, int arrayidx)
          This is overridden by array classes
 void setNull()
          Set this field to a null value - discarding current value (if any)
 java.lang.String toDbgString()
          Create a string useful for debugging.
 int type_len()
          Get the length of the type field in raw form.
 
Methods inherited from class com.latencybusters.lbm.sdm.LBMSDM
log, set_debug_level
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_FIELD_NAME_LENGTH

public static final int MAX_FIELD_NAME_LENGTH
Maximum length of a field name.

See Also:
Constant Field Values

TYPE_INVALID

public static final short TYPE_INVALID
SDM field type: Type is invalid.

See Also:
Constant Field Values

TYPE_BOOLEAN

public static final short TYPE_BOOLEAN
SDM field type: Boolean (non-zero is true; zero is false).

See Also:
Constant Field Values

TYPE_INT8

public static final short TYPE_INT8
SDM field type: 8-bit signed integer.

See Also:
Constant Field Values

TYPE_UINT8

public static final short TYPE_UINT8
SDM field type: 8-bit unsigned integer.

See Also:
Constant Field Values

TYPE_INT16

public static final short TYPE_INT16
SDM field type: 16-bit signed integer.

See Also:
Constant Field Values

TYPE_UINT16

public static final short TYPE_UINT16
SDM field type: 16-bit unsigned integer.

See Also:
Constant Field Values

TYPE_INT32

public static final short TYPE_INT32
SDM field type: 32-bit signed integer.

See Also:
Constant Field Values

TYPE_UINT32

public static final short TYPE_UINT32
SDM field type: 32-bit unsigned integer.

See Also:
Constant Field Values

TYPE_INT64

public static final short TYPE_INT64
SDM field type: 64-bit signed integer.

See Also:
Constant Field Values

TYPE_UINT64

public static final short TYPE_UINT64
SDM field type: 64-bit unsigned integer.

See Also:
Constant Field Values

TYPE_FLOAT

public static final short TYPE_FLOAT
SDM field type: Single-precision floating point.

See Also:
Constant Field Values

TYPE_DOUBLE

public static final short TYPE_DOUBLE
SDM field type: Double-precision floating point.

See Also:
Constant Field Values

TYPE_DECIMAL

public static final short TYPE_DECIMAL
SDM field type: Decimal number.

See Also:
Constant Field Values

TYPE_TIMESTAMP

public static final short TYPE_TIMESTAMP
SDM field type: Seconds and microseconds since the epoch (UTC).

See Also:
Constant Field Values

TYPE_MESSAGE

public static final short TYPE_MESSAGE
SDM field type: Nested SDM message.

See Also:
Constant Field Values

TYPE_STRING

public static final short TYPE_STRING
SDM field type: Character string (ASCIZ).

See Also:
Constant Field Values

TYPE_UNICODE

public static final short TYPE_UNICODE
SDM field type: Unicode string.

See Also:
Constant Field Values

TYPE_BLOB

public static final short TYPE_BLOB
SDM field type: Binary Large Object (BLOB).

See Also:
Constant Field Values

TYPE_ARRAY_BOOLEAN

public static final short TYPE_ARRAY_BOOLEAN
SDM field type: Array of Booleans (non-zero is true; zero is false).

See Also:
Constant Field Values

TYPE_ARRAY_INT8

public static final short TYPE_ARRAY_INT8
SDM field type: Array of 8-bit signed integers.

See Also:
Constant Field Values

TYPE_ARRAY_UINT8

public static final short TYPE_ARRAY_UINT8
SDM field type: Array of 8-bit unsigned integers.

See Also:
Constant Field Values

TYPE_ARRAY_INT16

public static final short TYPE_ARRAY_INT16
SDM field type: Array of 16-bit signed integers.

See Also:
Constant Field Values

TYPE_ARRAY_UINT16

public static final short TYPE_ARRAY_UINT16
SDM field type: Array of 16-bit unsigned integers.

See Also:
Constant Field Values

TYPE_ARRAY_INT32

public static final short TYPE_ARRAY_INT32
SDM field type: Array of 32-bit signed integers.

See Also:
Constant Field Values

TYPE_ARRAY_UINT32

public static final short TYPE_ARRAY_UINT32
SDM field type: Array of 32-bit unsigned integers.

See Also:
Constant Field Values

TYPE_ARRAY_INT64

public static final short TYPE_ARRAY_INT64
SDM field type: Array of 64-bit signed integers.

See Also:
Constant Field Values

TYPE_ARRAY_UINT64

public static final short TYPE_ARRAY_UINT64
SDM field type: Array of 64-bit unsigned integers.

See Also:
Constant Field Values

TYPE_ARRAY_FLOAT

public static final short TYPE_ARRAY_FLOAT
SDM field type: Array of single-precision floating points.

See Also:
Constant Field Values

TYPE_ARRAY_DOUBLE

public static final short TYPE_ARRAY_DOUBLE
SDM field type: Array of double-precision floating points.

See Also:
Constant Field Values

TYPE_ARRAY_DECIMAL

public static final short TYPE_ARRAY_DECIMAL
SDM field type: Array of decimal numbers.

See Also:
Constant Field Values

TYPE_ARRAY_TIMESTAMP

public static final short TYPE_ARRAY_TIMESTAMP
SDM field type: Array of timestamps (seconds and microseconds since the epoch (UTC)).

See Also:
Constant Field Values

TYPE_ARRAY_MESSAGE

public static final short TYPE_ARRAY_MESSAGE
SDM field type: Array of nested SDM messages.

See Also:
Constant Field Values

TYPE_ARRAY_STRING

public static final short TYPE_ARRAY_STRING
SDM field type: Array of character strings (ASCIZ).

See Also:
Constant Field Values

TYPE_ARRAY_UNICODE

public static final short TYPE_ARRAY_UNICODE
SDM field type: Array of unicode strings.

See Also:
Constant Field Values

TYPE_ARRAY_BLOB

public static final short TYPE_ARRAY_BLOB
SDM field type: Array of Binary Large Objects (BLOB).

See Also:
Constant Field Values

type

protected short type
The current field type


name

protected java.lang.String name
The name of this field


elements

protected int elements
Number of elements in array

Constructor Detail

LBMSDMField

public LBMSDMField()
Create an untyped, unnamed field


LBMSDMField

protected LBMSDMField(java.lang.String Name,
                      short Type)
               throws java.lang.IllegalArgumentException
Create a named field with a defined type - used by derived classes

Parameters:
Name - Name of the field to be created.
Type - Type of the field to be created.
Throws:
java.lang.IllegalArgumentException
Method Detail

getType

public static short getType(java.lang.String typeName,
                            boolean isarray)
Get the TYPE_XXX value for a given string. Recognised strings are: boolean, int8, uint8, int16, uint16, int32, uint32, int64, uint64, float, double, decimal, timestamp, message, string, unicode, blob

Parameters:
typeName - A string which needs translating to a short form
isarray - A boolean indicating if an array type is required
Returns:
A short representation for the string or TYPE_INVALID

getType

public short getType()
Get the type of this field

Returns:
The TYPE_XXX value of this object

getTypeString

public java.lang.String getTypeString()
Get a string representing this field type

Returns:
A string representing this field type

sameType

public boolean sameType(LBMSDMField f)
Compare the type of the field to this field

Parameters:
f - A field to compare
Returns:
true if the same type, false if not

sameBaseType

public boolean sameBaseType(LBMSDMField f)
Compare the base type of the field to this field

Parameters:
f - A field to compare
Returns:
true if the same type, false if not

get_name

public java.lang.String get_name()
Get the field name

Returns:
A string containing the field name

set_name

public void set_name(java.lang.String new_name)
Set the name of this field. A copy of the name will be made.

Parameters:
new_name - The name this field shall use.

set

protected void set(LBMSDMField f,
                   int arrayidx)
            throws LBMSDMException
This is overridden by array classes

Parameters:
f - The array field to be modified
arrayidx - The array index of the field to be set
Throws:
LBMSDMException

add_element

public void add_element(LBMSDMField newfield)
                 throws LBMSDMException
Add an element to an array from a field

Parameters:
newfield - The new field to be added
Throws:
LBMSDMException

append

protected void append(LBMSDMField newfield)
               throws LBMSDMException
This is overridden by array classes

Parameters:
newfield - The new field to be appended
Throws:
LBMSDMException - when a non array field tries to call append()

toDbgString

public java.lang.String toDbgString()
Create a string useful for debugging.

Returns:
A string that contains the field in a form useful for debugging

internalString

public java.lang.String internalString(java.lang.String sname,
                                       java.lang.String sval)
Create a string based on the internal representation (includes the type)

Parameters:
sname - The field name
sval - The field value in string form
Returns:
A string that contains the field name and value in ascii form

get_len

protected int get_len()
This is overridden by field and array subclasses

Returns:
0

name_len

public int name_len()
Get the length of this fields name in raw form. This is only needed by LBMSDMessage to format a raw message.

Returns:
the number of bytes the name of this field needs plus one for the length

type_len

public int type_len()
Get the length of the type field in raw form. This is only needed by LBMSDMessage to format a raw message.

Returns:
the number of bytes the type field needs

format

protected int format(byte[] buf,
                     int offset)
              throws LBMSDMException
This is overridden by field and array subclasses

Parameters:
buf - The buffer to format the message in to
offset - The offset in to the byte buffer
Returns:
-1
Throws:
LBMSDMException - when an unexpected error occurs within LBMSDM

format_name

public int format_name(byte[] buf,
                       int offset)
                throws LBMSDMException
Format into a byte buffer the name of this field. Only needed by LBMSDMessage to format messages

Parameters:
buf - The buffer to format the message in to
offset - The offset in to the byte buffer where the message should be placed
Returns:
The new offset in the buffer after formatting the message name
Throws:
LBMSDMException - when an unexpected error occurs within LBMSDM

format_type

public int format_type(byte[] buf,
                       int offset)
                throws LBMSDMException
Format into a byte buffer the type of this field. Only needed by LBMSDMessage to format messages

Parameters:
buf - The buffer to format the type in to
offset - The offset in to the byte buffer where the type should be placed
Returns:
The new offset in the buffer after formatting the message type
Throws:
LBMSDMException - when an unexpected error occurs within LBMSDM

parse

protected int parse(byte[] buf,
                    int offset)
             throws LBMSDMException
This is overridden by field and array subclasses

Parameters:
buf - The buffer to format in to
offset - The offset in to the byte buffer
Returns:
nothing - always throws exception
Throws:
LBMSDMException - parse() should be overridden

clone

public LBMSDMField clone()
                  throws java.lang.CloneNotSupportedException
Clone this field

Overrides:
clone in class java.lang.Object
Returns:
A new field that is a copy of this object
Throws:
java.lang.CloneNotSupportedException

length

public int length()
           throws LBMSDMException
Return the number of elements in an array.

Returns:
The number of elements
Throws:
LBMSDMNotArrayException - if called for non array classes
LBMSDMException

remove

public void remove(int element)
            throws LBMSDMException
Remove an element from an array class

Parameters:
element - The array element to be removed
Throws:
LBMSDMException

isNull

public boolean isNull()
Test to see if this field is a null field (I.E. a field with no data)

Returns:
true/false

setNull

public void setNull()
Set this field to a null value - discarding current value (if any)



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.