Writes one or more defined server contexts to a file on the local file system.
Related functions: edmiDefineServerContext, edmiDefineServerContextsFromFile, edmiDeleteAllServerContexts, edmiDeleteServerContext, edmiDeleteServerContextBN, edmiGetAllServerContexts, edmiGetServerContextId, edmiGetServerContextProperties, edmiResetServerContext.
Use edmiDefineServerContextsFromFile to reload the server contexts from the file.
Header:
#include "sdai.h"
Prototype:
EdmiError edmiWriteServerContextsToFile(SdaiString serverContextName,
SdaiString serverContextFile,
SdaiOptions options);
Arguments:
serverContextName |
The name or name pattern of the server context(s) to write to file. |
serverContextFile |
The name and full path to the server context file on the local file system. |
options |
The options to be used when invoking the function. The legal options are listed below. The options are mutaly exclusive. |
Options: Descriptions:
PARTIAL_MATCH |
Load and define all server contexts with names that match the name pattern given in parameter <serverContextName>. Use the asterisk character as wildchard character. |
EXACT_MATCH |
Do only load and define the server context with exactly the same name as given by the parameter <serverContextName> |
Returns:
A completion code of datatype EdmiError is the returned function value. The completion code has the following values:
Completion code = 0 : Operation successfully performed.
Completion code != 0: Error in operation. Completion code is an EDMinterface error code. Use edmiGetErrorText to get the error text corresponding to the error code.
Example:
EdmiError rstat;
SdaiString contextFile = "c:/data/myServerContexts";
SdaiUnsignedInt contextId, contextIds[2], *pContextId = &contextIds[0];
SdaiInteger nContext;
. . .
/* define four contexts */
rstat = edmiDefineServerContext("LOCAL_DB_ServerContext",
"Johnny", NULL, "4cg67w", "LOCAL_DB", NULL,
NULL, NULL, NULL, NULL, NULL, NULL, &contextId);
rstat = edmiDefineServerContext("LOCAL_CONTEXT_ServerContext",
"Johnny", NULL, "4cg67w", "LOCAL_CONTEXT", NULL,
NULL, NULL, NULL, NULL, NULL, NULL, &contextId);
rstat = edmiDefineServerContext("HTTP_ServerContext",
"Johnny", "Supervisor", "4cg67w",
"HTTP", "9090", "MyEdmServer",
"c:/HttpServlet", "7408", "MyHttpServer",
"1412", "192.136.64.13", &contextId);
rstat = edmiDefineServerContext("TCP_ServerContext",
"Johnny", "Supervisor", "4cg67w",
"TCP", "9090", "MyEdmServer",
NULL, NULL, NULL, NULL, NULL, &contextId);
/* Write all contexts to file */
rstat = edmiWriteServerContextsToFile("*",
contextFile, PARTIAL_MATCH);
/* Delete all contexts */
rstat = edmiDeleteAllServerContexts();
/* Redefine two contexts from file */
rstat = edmiDefineServerContextsFromFile("LOCAL_*",
contextFile, PARTIAL_MATCH);
/* Get all context ids */
rstat = edmiGetAllServerContexts(&pContextId, &nContext);
. . .