Title: Computer and Software
1Building MOM
Kjell Harald Gjermundrød (harald_at_wsu.edu)
2Topics for today
- MOM System
- Conceptual Model
- Physical Model
- Example
- Building blocks in the MOM system
- Adaptive Communication Environment
- The MOM Library
- Interface Definition Language Compiler
- Mapping a program into a MOM system
- NON OO program
- OO program
- Conclusion and further work
3Conceptual Model ( Tree )
ROOT Bank Of Europe
Bank of Norway
Bank of England
DNB Of Oslo
Sparebanken Vestfold
Lloyd Bank
Royal Bank Of Scotland
VISA ATM Terminal
VISA ATM Terminal
4Physical Model ( Distributed Objects )
ROOT Bank Of Europe
Bank of Norway
Bank of England
DNB Of Oslo
Lloyd Bank
Internet
VISA ATM Terminal
VISA ATM Terminal
Sparebanken Vestfold
Royal Bank Of Scotland
5Want to withdraw money
- From Lloyds ATM using a Royal Bank of Scotland
card. - Need to go up to Bank of England and then down to
Bank of Scotland. - The reply will go the same way.
- Lloyds bank needs authorization to go through
Bank Of England.
Msg (msgId, Src, Dest, TokenList, Channel,
Methodname, ReplyTo, ParamList) Msg1 (1, Lloyd
ATM, RBoS (Key List), 1 , Withdraw, Lloyd
ATM, (Account, Pin, 500))
Msg1c
Bank of England
Lloyd Bank
Royal Bank Of Scotland
VISA ATM Terminal
Msg1a
Msg1b
Msg2a
Msg2c
Msg2b
Msg (msgId, Src, Dest, TokenList, Channel,
Methodname, Reply) Msg2 (1, RBoS, Lloyd ATM
(Key List), 1 , GRANTED)
6Want to withdraw money cont.
- From Lloyds ATM using a DNB Of Oslo card.
- Need to go up to Bank of England, Bank of Europe,
down to Bank Of Norway, DNB Of Oslo.
ROOT Bank Of Europe
Bank of Norway
Bank of England
DNB Of Oslo
VISA ATM Terminal
Lloyd Bank
VISA ATM Terminal
7Pros and cons of the examples
- Pros
- Norway goes to war against UK. Just one place to
cut the banking business. - A hierarchy of trust, one bank is hacked. Only
its parent must be informed to not accept
request. Not all the banks in Europe. - Hiding of the banking structure, you only know
about your parent and direct children. - Cons
- A request must go through many banks before the
desired bank is reached. - Every bank does processing of a msg even though
the msg is not for them. Using a lot of CPU and
bandwidth at each bank.
8Building blocks in the MOM system
Visual MOM development Environment
Application Programming (C Only)
Policy setting/ Initialization MAC, DAC, RBAC,
TBAC
IDL Compiler
Translate to ROC
Compile to Platform binary file
RUN on ROCVM
Same Output
9Adaptive Communication Environment (ACE)
- Library to build platform independent
applications that communicate over a network. - Used as the lowest building block in the Tao
CORBA implementation. - Hides the details and tricky part of
communicating over a net. - Is ported to most platforms and it is not too
hard to port it to a new platform. - Should make it possible to run MOM objects on
different machines running different Operating
Systems.
10ACE in MOM
- Used to set up a two way communication stream
between a parent and a child. - Easy to change between single threaded objects or
thread pr msg. - Makes it easy to send a MOM msg down the stream.
Takes care of packing the msg if it contains
pointers. - Provide synchronization classes to protect data
structures if we use thread pr msg. Like the
OACL.
11The MOM library
- The Methods is a functor, a function object. It
is an object that you can call as a function and
it holds its state. Since it is an object you can
call it by pointers without knowing its name.
12Interface Definition Language Compiler
- We need a way of inserting our methods into the
a MOM object, how? - Method is called
- WithDraw(int nAccount, int nPin, long nAmount)
- But in MOM object we must store this as an entry
in or method table. - So the IDL compiler converts this method into.
- Class CWithDraw public CMomMeth
-
- public
- virtual CMomArg operator() (CMomArg inArg)
- // Unmarshal the arguments
- int nAccount inArg.GetFirst() int nPin
inArg.GetFirst() - int nAmount inArg.GetFirst
-
- int nRet WithDraw(nAccount, nPin,
nAmount) - // Marshal up the return arguments
- return CreateArg(nRet)
-
- private
- WithDraw(int nAccount, int nPin, long
nAmount)
13MOM calls the method
- At the initialization of an object you have
- main()
-
- CWithDraw obj1, objn
- INETADR adrPar(127.0.0.1, 1346)
- INETADR adrChild(127.0.0.1, 1345)
- CMom mObj(adrPar, adrChild,static_cast(CMomMeth)
obj1, objn) - mObj.start() // Should never return
-
- Use polymorphism when calling objects (This is
inside the MOM object) - CMomMeth ptr list.find(msg.methname)
- cMomArg arg msgIn.arg
- cMomArg ret_arg (ptr)(arg)
14Mapping a program into a MOM system
- Write the program using the Visual MOM
environment, editor, compilers, translators. - Two types of programs
- NON OO program
- MOM objects encapsulate one or more functions.
- Initial access has to be set by the policy
setting part. And compiled into the IDL compiler
part. - OO program
- Again here we have two ways to map a program down
to MOM. Class or method as finest granularity.
15- OO with class as finest grain
- MOM object encapsulates all methods in class.
- All the methods will have the same access
policies. - Might be used as a milestone before we implement
the next. - OO with method as finest grain
- Will set up different access policies for the
different objects. - Might even want to move some of the methods into
their own MOM object.
16Conclusion and further work
- Not much is working yet, but have found out how
to do it. - Three weeks without homework and the library
should be up and running? - The IDL compiler and the policy setting will be
someone elses problem? - Should get the translator to ROCVM up and
running. - Same output should be produced on the MOM system
and on ROCVM.