Download as pdf or txt
Download as pdf or txt
You are on page 1of 30

T24 Co m pon e n tisation

Doc u m e n t Hist o r y

Revi si o
Dat e Ame n d e d Na m e De s c r i p t i o n
n
30 th Octob e r
1 T. Aube r t Initial version
2015
15 th Nove m b e r
2 T. Aube r t Upda t e s
2015

4 th Dece m b e r
3 H. Aube r t Form a t & Review
2015

4 17 th Feb 2015 T. Aube r t Add Par a g r a p h for Interf a c e s

5 15 th Mar 2016 M. Kuma r R16 Review

6 22 nd Marc h 2019 S. Sakt hi R19 AMR Review

7 26 th Marc h 2020 H. Aube r t R20 AMR Review

Bash e e r
8 12 th April 2021 R21 AMR review
Aham e d

9 25 th Marc h 2022 S.Sakt hi R22 AMR Review

10 06 th April 2023 M.kum a r R23 AMR Review

2
T24 Co m pon e n tisation

Copyri g h t

Copyrig h t © Teme n o s Hea d q u a r t e r s SA 2009- 2023.


All right s rese rv e d.
This docu m e n t cont ain s prop rie t a r y inform a tio n that is prote c t e d by copyrig h t. No part of this docu m e n t may
be repro d u c e d , tra ns m i t t e d , or mad e availa ble direc tly or indirec tly to a third party without the expr e s s
writt e n agre e m e n t of TEMENOS UK Limite d. Receipt of this mate ri al direc tly TEMENO S UK Limite d
constit u t e s its expr e s s per mis sion to copy. Per mis sion to use or copy this docu m e n t expr e s sly exclud e s
modifying it for any purpo s e , or using it to cre a t e a derivative the r ef ro m .

Errat a and Com m e n t s


If you have any com m e n t s reg a r di n g this man u al or wish to repor t any error s in the docu m e n t a t i o n ,
plea s e docu m e n t the m and send the m to the add r e s s below:
Technology Depa r t m e n t
Teme no s Hea d q u a r t e r s SA
2 Rue de l’Ecole- de- Chimie,
CH - 1205 Geneva,
Switze rl a n d

Tel SB: +4 1 (0) 22 708 1150


Fax: +4 1 (0) 22 708 1160

Pleas e includ e your na m e , comp a n y, addr e s s, and telep h o n e and fax num b e r s , and email add r e s s if
applica bl e. TAFJdev@t e m e n o s . c o m

3 Teme no s Application Fra m e w o r k Java – (TAFJ)


T24 Co m pon e n tisation
Ta b l e o f C o n t e n t s

4
T24 Co m pon e n tisation

Intro d u c t i o n

A compo n e n t is a logical and tech nic al groupi n g of jBC artef a c t s. By ”jBC art efa c t s” we mea n
subr o u t i n e s, functions, com m o n s and table s. This groupi n g was alre a dy existing, but by nami n g
conve n t ion s only. As an exam pl e, the routi n e EB.ACCOUNTING was part of « EB » by it's nam e. But what
abou t EXCHRATE?
Since version R15, a new type of file has bee n relea s e d: the .com po n e n t .
This file will cont ai n a list of all the artef ac t s mentio n e d earlie r. This file will be compiled as a nor m al jBC
routin e and will be used durin g the develop m e n t .
This .com po n e n t is the façad e to the unde rlying imple m e n t a t i o n s. This acts as a king of « inte rf a c e ».

The be n e f i t s
Befor e going in details into the compo n e n t world, let's talk about the ben efits of it.
- Groupi n g code mea n s that the inter- depe n d e n c i e s bet w e e n the differ e n t grou p s beco m e s visible and
man a g e a b l e .
- COMMO N variabl e acce s s is done thro u g h gett e r s and sett e r s. No more side- effect s of cha n gi n g a
com m o n variabl e without knowi ng it.
- Tables acce ss are rest ric t e d . Canno t writ e in a table in a differe n t compo n e n t
- Const a n t s (EQU) are define d in the com po n e n t and not copied across like a $INSERT does. So Ther e
are no risk to clash with differe n t versions.
- A compo n e n t is self- desc ri bin g. Prot e c t use r to have to know the und e r n e a t h imple m e n t a t i o n s
- Auto- compl e tio n in jBC Editor
- Scopi ng allow met ho d, prope r t i e s, … to be hidde n from the exte r n a l world (an othe r compo n e n t )
- Defining Compo n e n t orien t e d Unit Tests (UnitTe st Fra m e w o r k )

This pictur e pre s e n t s the sam e kind of code, withou t and with a « com po n e n t i s a ti o n ». It clea rly shows
that, once the com po n e n t s are well define d, the inter- actions betw e e n the m beco m e s obvious and
man a g e a b l e .

5 Teme no s Application Fra m e w o r k Java – (TAFJ)


T24 Co m pon e n tisation

6
T24 Co m pon e n tisation

Creat i n g a ne w Com p o n e n t

In EDS, cre a ti n g a new com po n e n t is done the sam e way as crea ti n g a new SUBROUTINE.
In the TAFJ Pers p e c t ive
Right- click on the direc to ry you want the compo n e n t to be, choose New → T24 routin e / compo n e n t /
testc a s e , ent e r a nam e for your compo n e n t and click finish.

Import a n t : A compo n e n t nam e


is compos e d of a
«module».«component»

The noti o n of
« mo d u l e »

A modul e nam e is usu ally a 2


upp e r- case lette r (eg « AA »,
« FT », « EB » ) in the com po n e n t nam e.
A Module is a logical grou p of compo n e n t . This is impor t a n t to consid e r the modul e as it has a real
implica tion in the scopi ng (see « Scoping » chap t e r ).

Crea t i n g a new Com p o n e n t (co n t i n u a t i o n )


Once you have mad e a new → T24 compo n e n t , you will auto m a t i c a lly ent e r the EDS Compo n e n t editor.

7 Teme no s Application Fra m e w o r k Java – (TAFJ)


T24 Co m pon e n tisation

The Design S t u di o/E clips e Compon e n t editor come s with auto- com pl e tion facilities. ¨
TO do so, pres s Ctrl + < S PACE > . You will have som et hi n g like this:

8
T24 Co m pon e n tisation
The last for options are the tem pl a t e . So choosin g, as an exam pl e, “New M e t h o d ” will auto m a t i c a lly add
this code ...

With the focus to the scope. You can naviga t e from one field to anot h e r one with the <t a b > / <S hift > +
<Ta b > .
Befor e going in details on the 4 availabl e options, lets discuss the Scopin g.

9 Teme no s Application Fra m e w o r k Java – (TAFJ)


T24 Co m pon e n tisation

The Sco p i n g

The Scop e is a man d a t o r y infor m a t io n for ALL the compo n e n t art ef a c t s (Const a n t , Met ho d, Prope r t y and
Table). It can have 4 differe n t value s :

publi c
The art efa c t is visible from everyw h e r e (othe r module, othe r com po n e n t )

mo d u l e
The art efa c t is visible only for the compo n e n t being part of the sam e modul e

privat e
Only visible in the sam e < m o d ul e > . < c o m p o n e n t >

ext e r n a l
This option is for futur e relea s e and is usele ss for now.
This is import a n t to consid e r the scoping with car e, and not make everyt hi n g public. By default the
scopin g is « modul e », but redu ci n g it to « privat e » and chan g e it only if nece s s a r y is cert ai nly a good
prac ti c e.

The Met h o d

A met ho d is desc ri bi n g a jBC SUBROUTINE or FUNCTIO N. It is compo s e d of the scope, an alias Na m e


(Oper a t i o n N a m e ), the optional retu r n type (if a function) the list of the para m e t e r s and the jBC
imple m e n t a t i o n nam e (the « real » SUBROUTINE / FUNCTION nam e)

Curr e n t ly (Nov 2015) only “string” is a valid ret u r n type.

10
T24 Co m pon e n tisation
The para m e t e r s

A par a m e t e r is compos e d of an Access, it's na m e it's type and it's multiplicity.


There are coming right afte r the na m e of the met ho d, are sepa r a t e d by com a and wra p p e d in brack e t s
(…)
The acces s is IN, INOUT or OUT.
IN mea n s the para m e t e r is not modified in the routi n e
OUT mea n s it is only for ret u r ni n g a value
INOUT mea n s the para m e t e r value is releva n t and will be modified.
As today, this is an inform a t i o n only. In futur e rele a s e s , this value will be verified at compile time.
The nam e is any valid variable nam e. This is encou r a g e d to use the cam el casing.
The type define the type of par a m e t e r . As per today, only « string » is valid.
The type can be followed by open/clos e brack e t to define a DIMe ntion n e d array.

Exam pl e:

11 Teme n o s Application Fra m e w o r k Java – (TAFJ)


T24 Co m pon e n tisation
The jBC infor m a t i o n

The jBC infor m a t io n define the « real » SUBROUTINE / FUNCTION na m e .


It is wrap p e d in curly brac k e t s { … }
Exam pl e :

A Full Met ho d :

or

12
T24 Co m pon e n tisation

The Con s t a n t

The const a n t is quit e easy to imple m e n t s; it is compo s e d of the scope, a nam e and a value. Optionally, we
can specify a jBC na m e which is only nece s s a r y for auto- incor po r a t i o n (see specific chap t e r )
Exam pl e:

The Tabl e

The table is compos e d of the scope, an alias (the table N a m e ) , the real jBC table nam e (without the prefix)
and a list of fields.
The fields are sepa r a t e d by com a and wrap p e d in a fields:{ } grou p. Not e that the fields can have, for the
sam e rea so n s as const a n t s , the JBC nam e in brack e t s .
Note that ther e is no com a sepa r a t o r betw e e n the fields.
Exam pl e:

13 Teme n o s Application Fra m e w o r k Java – (TAFJ)


T24 Co m pon e n tisation

The prop e r t y

As mention e d earlie r, a prop e r t y is wrap pi n g a COMMO N varia bl e.


A Prope r t y is com pos e d of the scope, the prope r t y nam e , it's acces s, it's type and option ally the
corr e s p o n di n g COMMO N define d by an Inser t file and a variabl e nam e .
The acces s can be rea d, write, rea d w ri t e or rea d o nly(d e p r e c a t e d ) .
If rea d, only a get t e r will be availabl e.
If write, only a sett e r will be availabl e.
You can, by sepa r a t i n g rea d / writ e for the sam e prop e r t y fully man a g e the scopin g. For exam pl e, you can
decid e to have your prope r t y privat e for the write, and public for the rea d.

If the COMMON is a DIMm e d arr ay, the jBC varia bl e nam e must be followe d by the num b e r of
dim e n sio n s in- betw e e n brac k e t . Notice that we are talking about the NUMBER of dime n si on s, not the
size!
R.NEW(50 0) has 1 dime n si on
MY.ARRAY(10,20) has 2 dime n si o n s
Exam pl e:

14
T24 Co m pon e n tisation
A prop e r t y can also not have any JBC: imple m e n t a t i o n. In this case, the unde rlyi ng COMMO N is only
acces si bl e from the prope r t y. This will be the favourit e option for new compo n e n t s .
Exam pl e:

There is no such suppo r t for DIMm e d arr ay for the prop e r t i e s not having a “jBC:” inform a t i o n.

Com p i l i n g a co m p o n e n t

A compo n e n t , like any othe r jBC file must be compile d. In EDS, simply saving it will invoke the jBC
com pile r so you should not have to worry about it. You always can right- click on the file and do a
« com pile Basic file »

Doi n g tes t s bef or e impl e m e n t i n g

Once your com po n e n t has bee n saved and com pile, you can direc tly sta rt using it. Of cours e, if the jBC
imple m e n t a t i o n has not been done, this will fail at runti m e , but not at compile time, and most import a n t ,
not for Unitt e s t s.
This m e a n that you can defi n e a co m p o n e n t , cre a t e tes t s for it, an d impl e m e n t
afte r havi n g cre a t e d th e tes t !
This is a very impor t a n t point, and we will quickly make a step- by- step proc e d u r e to illust r a t e it.
1) Cre a t e a new com po n e n t , call it MY.Compo n e n t
2) Ctrl + <S p a c e > add a new met ho d, keep the defaul t value s, save
Here you have crea t e d a met ho d MY.Compo n e n t . O p e r a t i o n N a m e (…) with one par a m e t e r . This met ho d is
suppo s e d to invoke the jBC routin e « Routin e N a m e »

3) Cre a t e a

UnitTe st , call it TestO p e r a t i o n N a m e , and edit it like this :

15 Teme n o s Application Fra m e w o r k Java – (TAFJ)


T24 Co m pon e n tisation

4) Save right- click on TestOp e r a t i o n N a m e . t u t (the test file) and run as … Basic UnitTes t

Obviously, the test is failing. Now chan g e hat, take the develop e r one, and imple m e n t the met ho d
« Routin e N a m e »

16
T24 Co m pon e n tisation
5) Cre a t e a new SUBROUTINE, call it Rou ti n e N a m e , and edit it like this :

. . . and re- run your test. You

don't have to reco m pile anyt hin g, just re- run it.

17 Teme n o s Application Fra m e w o r k Java – (TAFJ)


T24 Co m pon e n tisation

Usi n g a Com p o n e n t

The Met h o d s

In orde r to use a compo n e n t , you have to define it with the $USING keywor d
As an exam pl e to use the compo n e n t we cre a t e d in the previou s chap t e r , cre a t e a new PROGRAM, call it
MAIN, and star t editing it like this :

First you will notice the auto- compl e tion right after you typed $USING ….
Then, you can type MY. …. and the auto.co m pl e t io n is proposi n g you « Compon e n t », and then . ….. and
nothi ng any- more !!!!
Why?
Look car efully at the compo n e n t . It has only one met ho d, and its scope is « modul e ». This mea n s that
only piece s of code in the sam e module can acce s s the met ho d.
So 3 solution s in our exam pl e:
1) Make your met h o d public (edit the .com po n e n t , save, com e back on your code, type MY.Com po n e n t .
…. and you will see

18
T24 Co m pon e n tisation
2) Put back « modul e » and use the 2nd option : make your prog r a m being part of the « MY » Module.
To do so, add the $PACKAGE at the top of your prog r a m , and specify a nam e having « at least » the sam e
modul e then your com po n e n t . You can rem ove the $USING claus e.

I mention e d a 3rd option …. well, not exactly. You can try to type Oper a ti o n N a m e yours elf, finally, this is
just auto- com pl e tion, right ? Wrong ! The com pile r will refus e it, and this small exercis e is descri bin g
how we are enforci n g the scopin g and why this is so impor t a n t to define a prope r scope. This feat u r e is
not only in Eclipse (EDS) but also for console compila tion. No way to bypas s it.
This me a n s that for futur e rele a s e s, you only have to car e abou t back- comp a ti bility of public (evt modul e)
met ho d s.

But say you won't aba n d o n so easily, and decide to call the unde r n e a t h routin e direc tly …. no no !

The only way is to remov e the $USING, but in that case you are back in the « old world » and the r e is no
com po n e n t involved any- mor e.
Now that you unde r s t o o d how the compo n e n t is invoke d, and how the Editor is helpin g you to auto-
com pl e t e , let’s explor e the 3 rem ai ni n g artef a c t s:
1. Const a n t s

2. Prop e r ti e s

3. Tables.

19 Teme n o s Application Fra m e w o r k Java – (TAFJ)


T24 Co m pon e n tisation
The Con s t a n t s

This is quite obvious, and in orde r to illust r a t e it, just add a const a n t decla r a t i o n in MY.Com po n e n t , make
it public !, get back to your MAIN progr a m , and type
MY.Com po n e n t . ... And you will see your const a n t !

Nothin g else to add, apa r t maybe that if you chan g e the value of your const a n t , you do not need to
reco m pil e your progr a m to have the new value. This is a big differe n c e comp a ri n g to the EQU in jBC.

20
T24 Co m pon e n tisation
The Prop e r t i e s

As mention e d previously, a prop e r t y is map pi n g a com m o n varia bl e. The small differe n c e is that you do
not have a « point e r » to the variabl e, but the value itself.
Let's crea t e a prope r t y.
First, crea t e a I_ File (new File) (let's call it I_TEST.INS ERT) and edit it like this:

Then, edit your com po n e n t , and add a prop e r t y :

B ack to you main prog r a m :

21 Teme n o s Application Fra m e w o r k Java – (TAFJ)


T24 Co m pon e n tisation
There is no way to cha n g e the prop e r t y, and the reaso n for it is bec a u s e the prop e r t y is rea do nly. Chan g e
it in the compo n e n t to read w ri t e (doubl e- click on rea d o nly, Ctrl + <s p a c e > will show the list of possible
values) or simply repla c e « rea do nly » by « rea d w ri t e », then back to your progr a m :

If a prope r t y is define d with arr ay size, the get t e r s and sett e r s will act accor di n gly and new helpe r
met ho d s will be made availabl e. To desc ri b e it, first, crea t e a I_ File (new File) (let's call it
I_TEST.INS ERT) and edit it like this :

We have to do it beca u s e , as specified in the “The Prope r t y” chap t e r , a prop e r t y withou t the “jBC:” block
canno t be a DIMm e d arr ay. Then cha n g e your com po n e n t to some t hi n g like this:

22
T24 Co m pon e n tisation
If you get back to your MAIN progr a m :

We can find our get t e r and sett e r , but also 3 new met h o d s :
cl e a r < p r o p e r t y_ n a m e > is the JBC Equivale n t to MAT MY.COMMO N = ''
ge t Dy n Arr ayFr o m < p r o p e r t y_ n a m e > is ret u r ni n g « ret » after some t hi n g like this : MATBUILD ret
FROM MY.COMMO N
se t D y n Arr ayT o < p r o p e r t y_ n a m e > is the JBC Equivale n t to MATPARSE MY.COMMO N FROM dynArr ay

!! WARNI NG !!

This is not possible to mix the sam e prop e r t y with and withou t the “jBC:” settin g.
This code is INVALID . The rea so n for it is that the gett e r (prop e r t y rea d) points to som e t hi n g else than
the sett e r (prop e r t y writ e)

The Tabl e s

Let's crea t e a table definition in our compo n e n t to illust r a t e it :

23 Teme n o s Application Fra m e w o r k Java – (TAFJ)


T24 Co m pon e n tisation

Back to MAIN prog r a m . You will notice your table nam e. Also, a met ho d called « tabl e » + your table
nam e. Ignor e this last one, it is her e just for back- com p a ti bility. Select your table nam e:

All the nece s s a r y (self


desc ri bi n g) met h o d s are
her e…. All ? Wher e are the
writ e facilities ? In fact,
the r e are « privat e » only.
No one apa r t my
com po n e n t is allowe d to
writ e to my table s. If I
want to provide some
upd a t e facilities, I will
have to make public
met ho d s.
Neve r t h e l e s s , let's che a t
and make our MAIN
prog r a m par t of
MY.Com po n e n t to see thes e met ho d s. Rem e m b e r how to do it ? Add $PACKAGE MY.Com po n e n t and
rem ove the $USING.
Try again to Ctrl + <s p a c e > afte r TblCur r e n c yR a t e :
Delet e, ReadU and Write are now availabl e.

24
T24 Co m pon e n tisation

Note that the fields (define d as const a n t ) are always public. This mea n s that you can make a table
privat e, cre a t e a met ho d which ret u r n a part of the recor d only, and the use r of your met ho d will still be
able to acce s s the fields using the <MOD > . < C o m p o n e n t > . < T a b l e N a m e > . < F i e l d N a m e > met h o d olo gy.

25 Teme n o s Application Fra m e w o r k Java – (TAFJ)


T24 Co m pon e n tisation
The int e rf a c e s

The comon e n t s have a last type of definition, the interfa c e s .


You define an inte rf a c e like this :

Interfa c e s are use d to invoke met h o d s « by nam e » (sam e as the old « CALL @ »)
Basically, and interfa c e is nothi ng else than a met ho d, but withou t the { … jBC : … } body.
Once an interf ac e is define d, you can invoke it the sam e way as a met ho d with one major differ e n c e : You
specify the nam e of the met ho d you want to invoke.
Do descri b e it, let's imagin e this full exam pl e :

You then can onvoke « doSomething » by name like this :

26
T24 Co m pon e n tisation

Doc u m e n t a t i o n

This is import a n t to docu m e n t your com po n e n t . The use r of it won't have it. All the auto- compl e tio n
featu r e s are coming from the compile d com po n e n t , not from the sourc e .
Docu m e n t i n g is not only impor t a n t for the public artef a c t s, but also for the privat e, the module, etc …
Here is a fully docu m e n t e d compo n e n t :
component MY.Component
metamodelVersion 1.6
/*
* This is a very important method
* doubing the value passed
*/
module method OperationName
(
/*
* This argument is quite important
* This should be a number.
*/
IN ArgumentName string [0..1]
)
{
jBC: RoutineName
}
/*
* The value of this constant is 10
*/
public constant ConstantName = 10

/*
* This property is just here for fun.
* This is a double dimentioned array
* absolutely useless.
*/
public property readwrite PropertyName : string
{
jBC: I_TEST.INSERT -> MY.COMMON(2)
}

/*
* This table is a 2 column table

27 Teme n o s Application Fra m e w o r k Java – (TAFJ)


T24 Co m pon e n tisation
*/
public table TblCurrencyRate
{
t24: CURRENCY.RATE
fields: {
Currency = 1
Rate = 2
}
}

Impl e m e n t i n g me t h o d s

The com po n e n t editor has a speci al cont ext u al menu to help develop e r s to imple m e n t a met h o d.
This men u is only availa bl e whe n the curso r is locat e d in a met ho d.
To illust r a t e it, position your curso r in a met ho d, and right- click.
The following men u will offer you the possibility to imple m e n t the met ho d:

And clicking on “Imple m e n t met ho d ...” have 3 possible action :


1. everyt hi n g is fine, a new met ho d will be imple m e n t e d , and the focus given on it like this:

28
T24 Co m pon e n tisation

2. The secon d possibility is that the met ho d alre a dy exists in the sourc e. In that case, if the sourc e is
locat e d som e w h e r e else than the place whe r e the compo n e n t is, a warni n g will be given, the
sour c e file will be open e d. If the sour c e is locat e d at the sam e place, the file is simply open e d .

3. The last possibility is that the compile d file is locat e d in your class e s / jars, but no sour c e can be
found. In that case, and error is shown like this:

Once a met h o d has been imple m e n t e d using this facility. The code of the met ho d is highlight e d . You can
un- highlight it with the “R

29 Teme n o s Application Fra m e w o r k Java – (TAFJ)


T24 Co m pon e n tisation
s

30

You might also like