skip to main content
OpenEdge Development: ADM Reference
SmartObjects and Their Methods and Properties : AppServer methods for SmartObjects
 
AppServer methods for SmartObjects
The AppServer methods expend the Container and Query classes. If you define the macro {&APP-SERVER-VARS}, the Container and Query classes inherit from the AppServer class. This section describes the AppServer methods.
bindServer
Procedure that binds the object to the server, as does getASHandle. However, bindServer does not expose the handle, making it a better choice for outside callers.
Location: appserver.p
Parameters: None
Notes: None
destroyObject
Procedure that disconnects the AppServer connection if present before invoking the standard destroy code.
Location: appserver.p
Parameters: None
Notes: None
destroyServerObject
Destroys the server object and retrieves its context.
Location: appserver.p
Parameters: None
Notes:  
*Called from unbindServer when stateless.
*This event is not always called because queryObjects now supports singlet data requests or calls destroyObject directly when BindScope is data.
disconnectObject
Procedure that disables fields in the ENABLED-FIELDS list.
Location: appserver.p
Parameters: None
Note: If Asbound is TRUE, an explicit destroyObject is done on the AppServer to give the object an opportunity to clean up. This procedure is invoked from destroyObject, but can also be run directly to disconnect without exiting.
initializeServerObject
Procedure that initializes the server object after it has been started or restarted.
Location: appserver.p
Parameters: None
Note: This is an internal event that is called from runServerObject after a successful run on server. It silently ignores any calls when not bound.
runServerObject
Procedure that runs the server part of this object and sets AShandle.
Location: appserver.p
Parameters:  
INPUT phAppService AS HANDLE
AppServer Session handle.
Note: Called from startServerObject and restartServerObject.
runServerProcedure
Returns the handle of a procedure after it runs on server.
Location: appserver.p
Parameters:  
INPUT pcServerFileName AS CHARACTER
INPUT phAppService AS HANDLE
Returns: HANDLE
Note: Simplifies an override of the RUN statement, such as to use a bind procedure instead of running the procedure directly.
unbindServer
Procedure that unbinds the AppServer by destroying the server side object started by the client.
Location: appserver.p
Parameters:  
INPUT pcMode AS CHARACTER
Valid values are unconditional, conditional, and the empty string. If conditional, unbinding only takes place if the caller is at the same level as BindSignature. The empty string is recognized, but not currently supported.
Notes:  
*This procedure allows nested calls of procedures that binds and unbinds, but still postpone the unbinding until we are back at the level that did the actual binding.
*The logic in this procedure is dependent of the fact that getAsHandle or bindServer does the actual binding (if AsHandle is the Unknown value (?)) and logs the call level by setBindSignature = program-name(2).
*An external caller uses the following sequence to ensure that all calls are done with one connection:
RUN bindServer in <handle>.
somerequest in handle
somerequest in handle
RUN unbindServer(?).
*Internal calls typically look like the following:
hAsHandle = getAsHandle().
somerequest in hasHandle
RUN unbindServer(?).
*Overrides need to do the following:
 
DEFINE INPUT PARAMETER pcMode AS CHARACTER NO-UNDO.
 
RUN SUPER(IF pcMode = ? THEN PROGRAM-NAME(2) ELSE pcMode).
*Limitations apply as recursive calls and external callers have the same signature, so an unbind might happen too early. (This can probably be fixed by saving the complete stack in BindSignature).