The Net.Data Web registry provides persistent storage for application-related data. A Web registry can be used to store configuration information and other data that can be accessed dynamically at run time by Web-based applications. You can access Web registries only through Net.Data macros using Net.Data and the Web registry built-in support and from CGI programs written for this purpose. The Web registry is available on a subset of operating systems. See Net.Data Reference for description and syntax of the Web registry built-in function, as well as list of operating systems that support the language environment.
Standard Web page development requires that URLs be placed directly in the HTML source for the page. This makes changing links difficult. The static nature also limits the type of links that can be easily placed on a Web page. Using a Web registry to store application-related data, for example URLs, can help in the creation of HTML pages with dynamically set links.
Information can be stored and maintained in a registry by application developers and Web administrators who have write access to the registry. Applications retrieve the information from their associated registries at run time. This facilitates the design of flexible applications and also allows movement of applications and servers. You can use Net.Data macros to create HTML pages using dynamically set links.
Information is stored in a Web registry in the form of registry entries. Each registry entry consists of a pair of character strings: a RegistryVariable string and a corresponding RegistryData string. Any information that can be represented by a pair of strings can be stored as a registry entry. Net.Data uses the variable string as a search key to locate and retrieve specific entries from a registry.
Table 10 displays a sample Web registry:
CompanyName | WorldConnect |
---|---|
Server | ftp.einet.net |
JohnDoe/foreground | Green |
CompanyURL/IBM Corp. | http://www.ibm.com |
CompanyURL/Sun Microsystems Corp. | http://www.sun.com |
CompanyURL/Digital Equipment Corp. | http://www.dec.com |
JaneDoe/Home_page | http://jane.info.net |
Reasons to consider using a Web registry:
Indexed entries in the Web Registry are entries whose RegistryVariable strings have an additional Index string appended to them, using the following syntax:
RegistryVariable/Index
The user provides the value of the index string in a separate parameter to a built-in function designed to work with indexed entries. Multiple indexed registry entries can have the same RegistryVariable string value, but they can maintain their uniqueness by having different Index string values.
Table 11. Sample Indexed Web Registry
Smith/Company_URL | http://www.ibmlink.ibm.com |
Smith/Home_page | http://www.advantis.com |
Even though the above two indexed entries have the same RegistryVariable string value Smith, the index string is different in each case. They are treated as two distinct entries by the Web registry functions.
Verify that the following configuration statement is in the initialization file, on one line:
ENVIRONMENT (DTW_WEBREG) DTWWEB ( OUT RETURN_CODE )
See Environment Configuration Statements to learn more about the Net.Data initialization file and language environment ENVIRONMENT statements.
Call an Web Registry function as you would any other function. Use a DEFINE statement to define as variables any of the parameters that you want to pass. For example:
%DEFINE { name = "smith" %}
Then use a function call statement to invoke the function; for example:
@DTWR_ADDENTRY("URLLIST", name, "http://www.ibm.com/software/", "WORK_URL"
The following example creates a Web registry and adds entries. It then displays a report containing the entries.
%DEFINE { RegTable = %TABLE(ALL) %} %MESSAGE { default:"<p>Function Error: Return code: $(RETURN_CODE)." :continue %} %FUNCTION(DTW_WEBREG) ListTable(INOUT RegTable) { %} %HTML(report) { @DTWR_CREATEREG("MYREG") @DTWR_ADDENTRY("MYREG", "Dept. 1", "Payroll") @DTWR_ADDENTRY("MYREG", "Dept. 2", "Technical Support") @DTWR_ADDENTRY("MYREG", "Dept. 3", "Research") @DTWR_LISTREG("MYREG", RegTable) <p>Report:<br /> @ListTable(RegTable) %}