Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Image Added uses internal formats to represent data entities that it can process. All processing agents (for instance, Analysis and Aggregation) work with these internal formats.

A syntax for the internal format is declared as follows:

Code Block
internal <name> [: (<class specifications> | <format inheritance>) ] {
  <field_type> <field_name> [:optional] ;
  ...
}; 

The field types may be any of the following:

Field TypeDescription

any

Any type.

bigint

Big integer.

bigdec
Big decimal.

boolean

Boolean.

bytearray

Byte array.

byte

Integer type (8-bit signed).

char

Integer type (16-bit unsigned).

short

Integer type (16-bit signed).

int

Integer type (32-bit signed).

long

Integer type (64-bit signed).

float

Float type (32-bit).

double

Float type (64-bit).

date

Date type, with capability to hold date parts, time parts, or both.

bitset

A set of bits.

ipaddress

An IP address.

drudr

An instance of any other internal (all internal are drudr instances).

string

String.

The field_type can also be any other internal or list type that is defined in either the same ultra file or in another. See the example below.

Info
titleExample - Internal formats

Case 1:

Code Block
internal I1 {
  I2 f1;
};
internal I2 {
  list<int> f1;
};

Case 2:

Code Block
In file A
internal I1 {
  <foldername>.<filename>.I2 f1;
  //When referring an internal from another file
  that is in the same folder, the folder name can be omitted.
};
In file B
internal I2 {
  list<int> f1;
};



List types are declared as follows:

Code Block
list< ElementType >


Where ElementType can be any of the previous, including an internal format identifier, or another list type.

Info
titleExample - List type


Code Block
internal I1 {
  list<list<I2> > f1;
};


It is also possible to specify a field as optional:

Info
titleExample - Specifying a field as optional


Code Block
internal I1 {
  drudr f1: optional;
};


Similarly, you declare a map field type this way:

Code Block
map< ElementType, ElementType >


Info
titleExample - Declaring a map field


Code Block
internal I1 {
  map<string, int> f1;
};


Internal formats can also be automatically generated from in_map definitions. For further information, see target_internal specification in In-maps.

Class Specifications

All internal formats are compiled into Java classes. It is possible to specify additional interfaces for the class to implement:

Info
titleExample - Class specifications


Code Block
internal I1 : 
    implements("Interface1"), implements("Interface2") {
    ...
}; 


However, this requires that Interface1 and Interface2 only declare methods that are later generated by Ultra when it creates the Java class. For further information about methods and types for UDR type methods, see the /wiki/spaces/MD82/pages/3779155.

Format Inheritance

It is possible to use alternative base UDR definitions for the generated Ultra classes by use of the extends_class or extends option.

extends_class is used by some agents (for instance, the HTTP agent) for better processing support.

Info
titleExample - extends_class


Code Block
internal I1 : 
    extends_class( com.mysite.myDTKUltraFormat ) {
    ...
};


The extends option lets a format inherit fields defined in an ancestor.

Info
titleExample - extends


Code Block
internal A {
    int a;
    ...
};
internal B : extends ( A ) {
    int b;
    ...
};


Multiple inheritances is not supported. That is, you can only use the extends or extends_class option once in the definition of an internal format. 

Event Types

It is possible to declare user-defined event types in Ultra by using the event keyword instead of internal. Such an event is a special type of internal format with added event processing support.