"Use of Visibroker for Delphi"

zhaozj2021-02-16  55

"Use of Visibroker for Delphi"

-CORBA technology practice (1)

Yichang City Center People's Hospital Zhao Pu

Email: 3boy@sohu.com

First, how to create server objects

Using the IDL2PAS wizard in Delphi, change the way to create a CORBA application server, can no longer write interface with TypeLibrary, now we only create a CORBA object by manually writing, and we created CORBA does not have to distribute DLLs The form of CORBA supports this simplified us.

Release CORBA process.

Let's take a brief look at how to use the IDL2PAS wizard and create a simple CORBA program.

1. If your program contains TDATAMOUDLE objects, you can put on the data components you want to use like you have developed C / S mode, and of course there is a data provider component. Note Multi_Layer is not C / S, your application server handle your customer segment call can not declare in this DATAMOUDLE, but you can write the code you handled by the server, and then declare your interface method, of course this interface declaration To write in the IDL file, for example

File Name: crb.idl

Module CRB {

Interface crbdbserver {

Void getData ();

}

}

The method in this declared interface is a non-type method. Then you will turn the IDL file into the PAS file. If you have created a project, then you can choose in the Delphi6.0 menu bar.

Regenerate IDL file (ready again), if you have not yet, please go to File-> Other, select the CORBA page (Note: Do not select the MUTILER's CORBA object, click CORBA Server Appliction, then a dialog will appear Will prompt you to create a console program or create a window application, and you will join your interface declaration file, I add crb.idl to go in, create 4 basic files by the wizard, respectively, respectively, respectively. Create CRB_S.PAS, CRB_I.PAS, CRB_IMPL, CRB_C

Document, the meaning representative of these files is:

CRB_S.PAS: (xxx_s) Create server trunk unit {server skeleton unit}

CRB_I.PAS: (xxx_i) Create a PASCAL interface unit

CRB_IMPL: (XXX_IMPL) Creating a Server Execution Unit State

CRB_C.PAS: (XXX_C) Create a skeleton unit of the customer segment {Client Stub unit}

Where _s, _c, _i we can do not look at it, _Impl is where we have to add code, this unit is written

TCRBDBSERVER = Class;

TCRBDBSERVER = Class (TinterFaceDObject, CRB_I.CRBDBServer)

protected

{****************************}

{*** Add to user custom variables here ***}

{****************************}

public

Constructor crete;

Procedure getData;

END;

IMPLEMENTATION

Constructor tcrbdbserver.create;

Begin

inherited;

{***************************}

{*** Add to initialize code ***}

{***************************}

END;

Procedure tcrbdbserver.getdata;

Begin

{***************************}

{*** Add to process processing code here ***}

{***************************}

END;

INITIALIZATION

End.

Then, write the following code in your main control unit:

1), add CRB_C, CRB_I, CRB_IMPL, CRB_S in Uses;

2), protected

// Add a custom variable

CRB_SERVER: CRBDBSERVER;

Create an instance for the customer segment

3) Fill in Procedure Initcorba;

CRB_SERVER: = TCRBDBSERVERSKELETON.CREATE ('CRB Server', TCRBDBServer.create);

Boa.objisready (CRB_SERVER AS _OBJECT);

Ok, you can activate the Smart Agent, so a simple server is initially completed. Although it is not dry, it is a CRB server. In the next section, we will continue to discuss and how to create a more complex CRB server.

You have tried it, the next time you have to start again.

** or more is a personal opinion, if there is a place, please, please, please

转载请注明原文地址:https://www.9cbs.com/read-27065.html

New Post(0)