(1) Basic architecture of TMTS

Source: Internet
Author: User

1. TMTS is a server similar to the COM + server. There is only one function in the interface region:

Ibizservice = interface (iconnectionservice) <br/> ['{11c672e9-6082-4acd-93ab-3f3a18e44e6f}'] <br/> // clone a interface for multi-thread <br/> function clone: ibizservice; <br/> // call business Mehod in appserver <br/> // clientcontent needs to be defined because soapbroker. DLL transfer requires <br/> function call (const aservicename, amethodname: string; <br/> const aparams: olevariant; const aserviceobjectstub: integer =-1; <br/> const acall Mode: tservicecallmode = cmsynccall; <br/> const aresultisfile: Boolean = false; <br/> const aresultsavedirectory: String = ''; <br/> const aclient: tclientcontent = nil): olevariant; <br/> function callsync (const aservicename, amethodname: string; <br/> const aparams: olevariant; const aserviceobjectstub: integer =-1; <br/> const aresultisfile: Boolean = false; <br/> const aresultsavedirectory: String = ''; <br/> const Client: tclientcontent = nil): olevariant; <br/> // The client parameter must exist because the SOAP/HTTP transit mode exists. <br/> // because the client parameter exists, the email parameter cannot be added because the local information of the IIS computer is changed to the soap file. <br/> function callasync (const aservicename, amethodname: string; <br/> const aparams: olevariant; const aserviceobjectstub: integer =-1; <br/> const aresultsavedirectory: String = ''; <br/> const aresultnotifier: Signature = nil; <br/> const aclient: tclientconten T = nil; <br/> const aisshowmodalprogress: Boolean = false): Upload; overload; <br/> function getasynccallprogress (const progress: tasynccallidentifier; <br/> const aasynccontent: tasynccallcontent; <br/> const aclient: tclientcontent = nil): Boolean; <br/> procedure cancelasynccall (const accept: accept; <br/> const aclient: tclientcontent = nil ); <br/> functio N combineconnectionstring (acomputername, aservername, aserverguid: string; aport: integer): string; <br/> function getdefaultport: integer; <br/> function getdefacompcomputername: string; <br/> function isserverportreadonly: Boolean; <br/> end; </P> <p> function tservicerepository. call (<br/> const ainvokecontent: tinvokecontent): olevariant; <br/> var <br/> index: integer; <br/> I: integer; <br/> vmacs: string; <br /> Vfound: Boolean; <br/> begin <br/> // calls the call function from different sources. The apartment thread of DCOM, TCP peerthread <br/> // create a working thread to control the timeout. <br/> // otherwise, the terminatethread API may cause resource leakage or the client can hold it. <br/> // is it necessary to create a thread pool for a working thread? <Br/> // start an activity. The root element may not need transaction. Therefore, transaction is not suitable here. <br/> result: = NULL; <br/> clientrepository. lock; <br/> try <br/> If (clientrepository. fuseauthorizediplist) and <br/> not clientrepository. fauthorizediplist. find (ainvokecontent. clientcontent. IP, index) Then <br/> raise exception. createfmt (s_clientipnotauthorized, [ainvokecontent. clientcontent. IP]); <br/> If (clientrepository. fuseauthorizedcardlist) and <br/> not clientrepository. fauthorizedcardlist. find (ainvokecontent. clientcontent. dogcardno, index) Then <br/> raise exception. createfmt (s_clientcardnotauthorized, [ainvokecontent. clientcontent. dogcardno]); <br/> If (clientrepository. fuseauthorizedmaclist) Then <br/> begin <br/> vfound: = false; <br/> for I: = 0 to high (ainvokecontent. clientcontent. macs) DO <br/> begin <br/> If clientrepository. fauthorizedmaclist. find (ainvokecontent. clientcontent. macs [I], index) Then <br/> begin <br/> vfound: = true; <br/> break; <br/> end; <br/> if not vfound then <br/> begin <br/> vmacs: = ''; <br/> for I: = 0 to high (ainvokecontent. clientcontent. macs) DO <br/> vmacs: = vmacs + ainvokecontent. clientcontent. macs [I] + '; <br/> If vmacs <> ''then Delete (vmacs, length (vmacs), 1 ); <br/> // record the authorization prohibition error <br/> servicelog. callend (ainvokecontent, ainvokecontent. callmode = cmasynccall, <br/> 0, false, false, wideformat (s_clientmacnotauthorized, [vmacs]); <br/> raise exception. createfmt (s_clientmacnotauthorized, [vmacs]); <br/> end; <br/> finally <br/> clientrepository. unlock; <br/> end; <br/> case ainvokecontent. callmode of <br/> cmsynccall: <br/> result: = synccall (ainvokecontent); <br/> cmasynccall: <br/> result: = asynccall (ainvokecontent ); <br/> cmlockobject: <br/> result: = INTEGER (lockobject (ainvokecontent); <br/> cmunlockobject: <br/> unlockobject (ainvokecontent ); <br/> cmgetasynccallstatus: <br/> result: = getasynccallstatus (ainvokecontent); <br/> cmcancelasynccall: <br/> cancelasynccall (ainvokecontent); <br/> end; <br/> end;

This completes the development process and makes it easy for the client to implement multiple Protocol applications, such as DCOM, socket, TCP, soap, or even RS232. In general, if programmers constantly create new com or COM + components, they will not stop adding new letters to the component interface, and use the statement if they need to be changed, for example, when copying data to soap, you need to redefine these COM components and interface functions in soap, which is very troublesome.

2. The server supports using BPL as the businessobject plug-in.

3. The idbservice interface is defined in the definition of data centers. Different engines such as BDE, ADO, and dbexpress can be found.

4. The definition of businessobject defines ibizservice. The client has the idbserver and ibizserver at the same time, that is to say, the data statistics query can be a direct data statistics query (C/S mode ), you can also use the ibizservice to allow the middleware server TMTS to access the data volume.

5. businessobject can be deployed on the client end. It refers to the process of EXE development on the client end. It is not a com DLL, so it does not need to be installed or installed.

6. Have your own UI to observe the execution of serviceobject. And can insert some UI images of special applications in the form of plug-ins.

Serviceobject methods are defined in the published section. You can use rtti to find the called function during the call.

Tserviceproc1 = function (const aparams: olevariant): olevariant of object; <br/> tserviceproc2 = function (const aparams: olevariant; aasynccallcontent: tasynccallcontent): olevariant of object; <br/> tserviceproc3 = function (const aparams: olevariant; aasynccallcontent: tasynccallcontent; const aclientcontent: tclientcontent): olevariant of object; </P> <p> function tcustomserviceobject. callmethod (<br/> const amethodname: string; const aparams: olevariant; <br/> const aasynccallcontent: tasynccallcontent; <br/> const aclientcontent: tclientcontent): olevariant; <br/> var <br/> amethod: tserviceproc1; <br/> vcount: integer; <br/> begin <br/> tmethod (amethod ). data: = self; <br/> tmethod (amethod ). code: = self. methodaddress (amethodname); <br/> If tmethod (amethod ). code = nil then <br/> raise exception. createfmt (s_methodnotfind, [amethodname, fservicename]); </P> <p> vcount: = getmethodparamcount2 (self, amethodname ); <br/> case vcount of <br/> 2: Result: = tserviceproc1 (amethod) (aparams); <br/> 3: Result: = tserviceproc2 (amethod) (aparams, aasynccallcontent); <br/> 4: Result: = tserviceproc3 (amethod) (aparams, aasynccallcontent, aclientcontent); <br/> else raise exception. createfmt (s_notfoundmethod, [classname + ':' + amethodname, inttostr (vcount)]); <br/> end;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.