# Application Framework

Configuration Overview Programming

# 1 Technical/Implementation Details

Fig. Current startup structure

The super procedures are started in a stack with web-util started first and custom procedures last. The search order when saying “RUN init-request IN web-utilities-hdl.”, would be the last started custom procedure first and then at RUN SUPER continue down the stack.

Fig. Super procedure stack. Init-request appears in all except dbtools.

## 1.1 Startup program “webutil/webstart.p”

“Web-disp.p” will start up “webstart.p” that will be the entry for web-utilities-hdl that again will have multiple super procedures started and added. Additional custom super procedures may be added to add and override any of the functionality in the web-utilities-hdl.

## 1.2 Additional function prototypes “web/method/session.i”.

Session variable functionality set/getSession(), set/getGlobal() and runlogging function logNote() are defined in session.i and this again is included in proto.i which is part of the default Webspeed programs. If these are conflicting with existing application definitions then the last line of proto.i should be commented out.

## 1.1 Session functionality

“web/methods/session.i” which is being included in end of “web/method/proto.i”, contains prototype definitions for following functionality. This is thereby new core Webspeed functionality.

When Dynamics is initialized it will replace the set/getSession. The set/getGlobal on the other hand is useful for system utilities dealing with connections, system status, failover, backup redundancy, so a database free (file-based) method can be more useful then.

Functionality | Description
“gscSessionId” | Global shared variable containing the session id
GetSession(name) | Retrieving a session variable
SetSession(name,value) | Setting a session variable
GetGlobal(name) | Retrieving a cross-agent global variable
SetGlobal(name,value) | Setting a cross-agent global variable
LogNote(messagetype,message) | log a message to the session log

## 1.2 Logging

logNote(messagetype,message) function will log a message to the session log.

The session log is located in by “SessionPath” environment variable, and if not given it goes to the Temp directory. The file name will be the session-id with extension “*.log”. If no session has been initialized it will use SYS.log as filename and if running batch it will use the name “batch.log”.

Message Types set by the “LogTypes” environment variable:

RUN | Messages to inform what is going on.
BATCH | Messages that only apply to BATCH
NOTE | Notes
WARNING | Warning messages such as “trying to run workshop”
ERROR | Error messages
COMPILE | Messages about run-time compilation

The current logs can be viewed from a shortcut in the Data Browser or Application Manager header.

## 1.3 Database reconnect

Databases, DbGroup, DbObject

### 1.3.1 Selective connections

Normally you would just specify the databases to be connected in the “Databases” environment variable, but if certain databases only needs to be connected for certain programs you would have to specify the codebases and databases for each special handling here called DbObject in the diagram. You now also have to specify which databases are considered default in the DbGroup.

Example: You want to connect the customer’s inventory database only when needed.

[Databases] sysdb=-pf c:/app/db/sysdb.pf|invdb=-pf c:/app/db/invdb.pf

[DbObject] inv=c:/app/src/inv

[DbGroup] inv=invdb;default=sysdb

### 1.3.2 Custom connections

It’s possible to specify a program to connect to the databases instead of the connection parameters. By using a program you can connect with data-driven logic if necessary. Say your customers want to have their data separated from other customers databases, then you could connect on the fly using such a routine. For disconnection the specific database you should custom program “end-request” routine to disconnect the customer specific databases after the program has been run.

### 1.3.3 Dynamics

In Dynamics the connection manager will get the parameters that you would otherwise specify in [Databases]. In other words you would not specify the Dynamics configured databases unless you have to override the dynamics configuration for custom connection logic reasons.

Selective connections have to be specified in DbGroup and DbObject as usual even with Dynamics.

## 1.4 Dynamics integration hook

The procedure “afreqsrvrp.p”, Request Manager contains function code for session context functionality using the Dynamics databases and it also does following.

· Automatically detected by “session:icfparameter”

· Looks for XML startup-file

· Starts Dynamics managers

· Configures automatic database reconnection. (Not yet)

· Starts UI Managers and the handle will be switched on the fly by the request.

· Overrides the “run-web-object” to check for Dynamics *.icf extension mappings.