Versions Compared

Key

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

...

Due to the various formats of incoming data, the system does not provide any hardcoded formatting rules. Instead, it provides the Ultra subsystem where nearly any format may be defined and handled using the Ultra Format Definition Language (UFDL). Such definitions will automatically compile into classes, implementing the DRUDR interface. In addition, the DTK provides the possibility of coding such classes directly in Java.Image Removed

...

DRUDR

UDR related classes are located in the package com.digitalroute.devkit.drudr.

...

By implementing method names prefixed with the get_ and/or set_ keywords, the UDR subsystem uses Java reflection mechanisms to obtain information about available fields, such as their access type and data type. DRUDRs contain a list of possible error codes that may be useful if UDRs are routed to ECS. Error codes may be added using addErrorCode, examined via getErrorCodes and removed by clearErrors. Finally, a description of the UDR Type and its fields may be obtained using getDRUDRDesc.

Info
title

Example - Creating a UDR

A UDR is created to contain the three fields: name, age and isChild. Note, it is not the variable names but the method names that determine the field names. The isChild field will not be possible to populate since it does not have a set_ method.

Code Block
public class MyUDR extends DRAbstractUDR {

              private String _name;

                private int _age;
   public void set_name(String newName) {
      _name = newName;
   } 
   public String get_name() { 
      return _name; 
   } 
   public void set_age(int newAge) { 
   _age = newAge; 
   } 
   public int get_age() { 
      return _age; 
   } 
   public boolean get_isChild() { // Read only field 
      return _age < 18; 
   } 
   // writeTo and readFrom methods are omitted 
}

The above UDR class can be instantiated and used as follows from DTK code:

Code Block
MyUDR udr = new MyUDR(); 
udr.setValue("name", "Karen"); 
udr.setValue("age", 10); 
udr.setValue("isChild", true); // Will cause exception 
System.out.println( 
  "Name: " + udr.getValue("name") + 
  "Age: " + udr.getValue("age") +
  "Child: " + udr.getValue("isChild"));

or used as follows in APL code:

Code Block
MyUDR udr = udrCreate(MyUDR); 
udr.name = "Karen"; 
udr.age = 10; 
udr.isChild = true; // Will cause APL compilation error 
debug( 
  "Name: " + udr.name + 
  "Age: " + udr.age + 
  "Child: " + udr.isChild);

...

To be able to support type validation and automatic code generation, Image Removed MediationZone implements a type description system that is separate from standard Java class handling. The base class for all type descriptions is DRUDRType, and various UDR types are described by subclasses of DRUDRDesc.

The following table lists the available types, their type descriptions and the runtime implementation classes.

Image Removed Type

MediationZone Type

Type Description

Java Object Type

any

DRUDRType.PT_ANY()

Object

bigint

DRUDRType.PT_BIGINT()

BigInteger

bitset

DRUDRType.PT_BIT_SET()

DRBitSet

boolean

DRUDRType.PT_BOOLEAN()

Boolean

byte

DRUDRType.PT_BYTE()

byte

bytearray

DRUDRRawDataDesc

byte[]

char

DRUDRType.PT_CHAR()

char

date

DRUDRType.PT_DATE()

DRDate

float

DRUDRType.PT_FLOAT()

float

double

DRUDRType.PT_DOUBLE()

double

int

DRUDRType.PT_INT()

int

ipaddress

DRUDRType.PT_IPADDRESS()

DRIPAddress

long

DRUDRType.PT_LONG()

long

short

DRUDRType.PT_SHORT()

short

string

DRUDRType.PT_STRING()

String

table

DRUDRTableType

DRTable

list type

DRUDRListDesc

DRList

map type

DRUDRMapDesc

Map

General UDR type

DRUDRDesc

DRUDR subtype

DevKit UDR type

DRUDRClassDesc

DRAbstractUDR subclass

Scroll pagebreak