Building Distributed
Applications
Using the Progress AppServer
AppServer Session Access
You can publish entry points (remote procedure pathnames) that control access to an AppServer session at run time using the EXPORT( ) method on the SESSION handle. Publishing an export list the remote procedures that a client application can execute to those that you specify with this method. Because this is a run-time operation, you can change the list at any time that your application requires, and you can reset the list to empty, allowing access to the entire set of procedures available from the current AppServer PROPATH setting.
However, setting this list applies only to the AppServer session in which you execute the EXPORT( ) method. This means that you might have to manage the list differently in your application depending on the operating mode that you configure for the AppServer.
For more information on setting and resetting entry points in an AppServer session, see Programming the AppServer."
Operating Mode Interactions
Because of how the EXPORT( ) method and AppServer operating modes work together, you must use it differently, depending on your AppServer operating mode. When you invoke the method with a list of procedure names, the method adds this list to any existing list of entry points that you have previously specified for an AppServer session.
If the AppServer is running in state-reset operating mode, each Application Server process automatically resets any export list to empty with each new connection. However, if the AppServer is running in state-aware or stateless operating mode, you must manage all setting and resetting of entry points manually. Otherwise, each time you execute the method with a list of procedure names, they are added to the existing list of entry points. Thus, unless you explicitly reset the list, on a state-aware AppServer, the number of entry points set for an Application Server process can grow with each client connection, and on a stateless AppServer, the number can grow with each client request.
How to Set and Reset an Export List for Each Operating Mode
Each AppServer operating mode requires a different arrangement for setting and resetting the published entry points during an AppServer session:
- State-reset operating mode—You can set an export list any time before a client application uses them; you never need to reset your an export list.
- State-aware operating mode—You can set an export list any time before a client application uses them; if you set them in remote procedures, you probably want to reset them with each connection.
- Stateless operating mode—You can set an export list any time before a client application uses them; you generally set them in the Startup procedure for the entire AppServer session.
State-reset Operating Mode
When the connection terminates on a state-reset AppServer, the export list for the disconnected Application Server process is automatically reset to empty. Thus, you must set any export list on a state-reset AppServer for each new connection and in some procedure that is guaranteed to be executed when you need to have the list set.
You might want to set the export list in the Connect procedure if you know the export list criteria at the start of each connection. The criteria can be based on the user or any other information that you determine at the time of connection. Otherwise, you must set or reset the list in some remote procedure executed by the client.
State-aware Operating Mode
For a state-aware AppServer, you can conveniently set a single export list for all Application Server processes, regardless of the connection, using the Startup procedure. Otherwise, you can set it, like on a state-reset AppServer, in the Connect procedure or some remote procedure executed by the client.
When the connection terminates on a state-aware AppServer, the disconnected Application Server process maintains the last setting of the export list. If you want the export list to be empty at the start of every connection, you must explicitly reset the list at some point between connections. You can guarantee this for every AppServer session by resetting the list in the AppServer Connect or Disconnect procedure:
Stateless Operating Mode
For a stateless AppServer, you can conveniently set a single export list for all Application Server processes (global to the AppServer session), using the Startup procedure. Because export list settings apply only to the Application Server process in which they occur, setting and resetting an export list at any other point on a stateless AppServer requires careful attention.
CAUTION: Setting an export list during remote procedure requests to a stateless AppServer is an error-prone activity. If your application requires this fine degree of control, the rest of this section explains how you can do it. However, you might consider implementing your AppServer using state-aware operating mode, instead.Like a state-aware AppServer, once you set an export list, the list remains set in the AppServer session until you reset it. For an unbound connection, because you cannot guarantee when an Application Server process will execute what procedure, you must manage any export list settings appropriately during each request. If you do not, you can leave an unpredictable set of export list settings across Application Server processes in the AppServer pool.
For an unbound connection, you can maintain consistent export list settings using the Connect, Activate, and Deactivate configuration procedures. This is especially useful to provide user-based access control:
- In the Connect procedure, establish an export list based on the authenticated user.
- Save the export list using stateless context storage, such as the SERVER-CONNECTION-CONTEXT attribute or a context database.
- In the Activate procedure, retrieve the export list from your stateless context storage and set it using the EXPORT( ) method. The list is now set to filter the current remote procedure call and ensure its validity for the user.
- In the Deactivate procedure, reset the export list to empty or to any other global session value using the EXPORT( ) method. This leaves the Application Server process to handle remote procedures calls from all connections, as appropriate.
NOTE: The Disconnect procedure is not effective to reset a user-based export list, especially for an unbound connection, because the Disconnect procedure can run in an Application Server process other than the one where the last export list setting occurred.You can also use the Activate procedure to make application-based settings, where you set the list depending on some application state other than the authenticated user. In this case, you might determine the setting indirectly from stateless context storage or from some other source available to the 4GL. For more information on using stateless context storage, see Programming the AppServer."
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |