This function has two areas of application;
- Opens a model within a locally connected database. This feature has implemented to provide all EDMInterface functionality through the remote EDMInterface calls. Only applicaple for the LOCAL_CONTEXT communication type. See example 1.
- Opens a model within one or optionally all the EDMapplicationServer processes used by the EDMserver. This is a password protected feature ment for system administrators only. See example 2.
The application server processes of an EDMserver needs to load and maintain local copies of the database files that belongs to its open models. If these models are big, the handling of their files may be time consuming. Therefore, the superuser may use this function to open models from one or more application server processes, thereby reducing the delay for the first user that need to access the model.
An EDMapplicationServer is a process that implements the remote EDMInterface operations invoked by the EDMclients. An EDMserver may have from one to any number of EDMapplicationServer processes. In most cases the EDMdatabaseServer and the EDMapplicationServers constitute the EDMserver. This is denoted an EDMserverRoom.
Except for the communication type LOCAL_CONTEXT, all remote EDMInterface operations are stateless. However, this particular operation will not implicitely open the models parent repository. The repository must be opened by a separate call to edmiRemoteOpenRepository.
Note that dictionary models and STEP Identifier models will only be opened for read access by this operation.
Related function: edmiRemoteCloseModel
Header:
#include "sdai.h"
Prototype:
EdmiError edmiRemoteOpenModel(SdaiServerContext serverContextId,
SdaiString remoteRepositoryName,
SdaiString remoteModelName,
SdaiAccessMode openMode,
SdaiString superUserPassword,
SdaiClientId clientId,
SdaiOptions options,
SdaiModel *modelId,
SdaiInvocationId *edmiInvocationId);
Arguments:
serverContextId |
Context identification, from edmiDefineServerContext |
remoteRepositoryName |
The name of the repository in the remote _EDMdatabase_ that contains the model to open. Repository names are case sensitive. |
remoteModelName |
The name of the model to open. Model names are case sensitive. |
openMode |
Legal access modes are sdaiRO and sdaiRW. |
superUserPassword |
The password for the superuser within the remote database. This argument is not required when the server context specifies communication type LOCAL_CONTEXT. |
clientId |
The client Id of the Main Client connection of the EDMapplicationServer for which the model shall be opened. See the example. |
options |
See description of available options below. |
modelId |
A variable that will receive the modelID that uniquely identifies the opened model. |
edmiInvocationId |
Currently not used. |
Options: Descriptions:
ALL_SERVERS |
Open the model from all the EDMapplicationServer processes in the EDMserverRoom. |
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:
/* Open selected repositories and models
to initialize a remote database */
int i;
EdmiError rstat;
SdaiServerContext suContext;
SdaiRepository repositoryId;
SdaiModel modelId;
SdaiQueryResult qexRes;
SdaiInteger nRepository, nModel;
SdaiInteger index;
/* Define Remote Server Context
for the superuser */
rstat = edmiDefineServerContext("SuperUserContext",
"superuser", NULL, "xfx56kl9",
"TCP", "9090", "MyServerHost",
NULL, NULL, NULL, NULL, NULL, &suContext);
/* Find and open all repositories in the
database that is not the 'SystemRepository',
'DictionaryRepository' or
'EDMvisualExpress' repository */
index = 0;
rstat = edmiRemoteSelectInstances(suContext, "SystemRepository",
"ExpressDataManager", "EDM_REPOSITORY",
"(NAME <> 'SystemRepository') AND \
(NAME <> 'DictionaryRepository') AND \
(NAME <> 'EDMvisualExpress')", 0, "NAME", NULL,
NULL, &index, &nRepository, &qexRes,
NULL, NULL, NULL, NULL);
for (i=0;i<nRepository;i++) {
rstat = edmiRemoteOpenRepository(suContext,
((SdaiString *) qexRes->columnDescr[0]->pvalue)[i],
sdaiRW, "xfx56kl9", 0, ALL_SERVERS,
&repositoryId, NULL);
}
edmiFreeQueryResult(qexRes);
/* Find and open all models in the database
that is not in the 'SystemRepository',
'DictionaryRepository' or
'EDMvisualExpress' repository */
index = 0;
rstat = edmiRemoteSelectInstances(suContext, "SystemRepository",
"ExpressDataManager", "EDM_MODEL",
"(REPOSITORY.NAME <> 'SystemRepository') AND \
(REPOSITORY.NAME <> 'DictionaryRepository') AND \
(REPOSITORY.NAME <> 'EDMvisualExpress')", 0,
"REPOSITORY.NAME NAME", NULL,
NULL, &index, &nModel, &qexRes,
NULL, NULL, NULL, NULL);
for (i=0;i<nModel;i++) {
rstat = edmiRemoteOpenModel(suContext,
((SdaiString *) qexRes->columnDescr[0]->pvalue)[i],
((SdaiString *) qexRes->columnDescr[1]->pvalue)[i],
sdaiRW, "xfx56kl9", 0, 0, &modelId, NULL);
}
edmiFreeQueryResult(qexRes);
. . .