1 Preface
In the practical application, for some large-scale application system, the application business logic is quite complex, if the application system adopts the traditional client/server architecture, the business logic is too centralized and the client, will overload the client. In addition, once some business logic changes, all client applications must be changed, which will lead to the difficulty of application distribution, an effective solution is to apply the logical structure of the rational distribution, using the N-tier architecture. This architecture divides the client application into two parts: Customer application, server application. Customer applications are part of the original customer application, and another part of the original customer application is moved into the server application, the new customer application is responsible for the user interface and simple fixed business logic, the new server application resides in the core variable business logic.
2 Distributed technology in PB
A typical distributed PowerBuilder application system is composed of two parts:
1 server application: Implement transaction logic and provide service to customers.
2 Customer Application: Establish the user interface and interact with the user. You also need to invoke the transaction logic provided by the server.
The server application consists of two parts:
1 remote object: Establishes the application transaction logic.
2) Transport (Transfer object): Used to monitor customer requests.
The customer application is composed of three parts:
1 user interface: Interact with the user.
2 proxy object: The agent that the server applies to the client.
3) CONNECTION (Connection object): Used to establish a connection to the server application.
The structure of the distributed application and the relationship between the parts are shown in the following illustration:
2. 1 server applications
1) Remote Objects
In distributed applications, customer applications use services provided by remote objects in the application server. The remote object resides in the application server, contains the function and method of completing the transaction logic, and is the user object of the custom class in PB. In distributed Application systems, client applications can invoke remote objects as they would with local objects.
A client can invoke a remote object in two ways:
1) Synchronous call
2) Asynchronous call
When synchronous calls are made, the process is synchronized, the client makes a request, the server responds immediately, and processes it. The client does not trigger any events during this period until the server completes processing.
When an asynchronous call is made, the server calls the client and dispatches it to the end of the client request queue, during which the client can continue its task, and the processing of the server does not affect the customer's process. Consider using this call when the real time requirement is not high.
2) Transport (transmission) object
The server accepts the client's connection through the transport object and processes the client's request to the server. The transport object must be instantiated in the server application. A transport object contains a series of properties that define information about the server.
2. 2 Customer Application
1) User interface
Provides a place to interact with the user.
2) Proxy Object
Similar to the image of a remote object on the client in a server application. It has the same name as the server remote object.
3) Connection object
The role is to complete the client-server connection, requesting services. It has a series of properties like a transport object. These properties define information about the client. such as drivers.