edmiRemoteCloseModel

EdmiError edmiRemoteCloseModel(SdaiServerContext  serverContextId,
                                SdaiString         remoteRepositoryName,
                                SdaiString         remoteModelName,
                                SdaiString         superUserPassword,
                                SdaiClientId       clientId,
                                SdaiOptions        options,
                                SdaiInvocationId   *edmiInvocationId);
 

 

This function has two areas of application;

  1. Closes a model within a locally connected database. This feature has implemented to provide all EDMInterface functionality through the remote EDMInterface calls. Only applicable for the LOCAL_CONTEXT communication type.  see example 1

  2. Closes a model within one or optionally all the EDMapplicationServer processes used by the EDMserver. This is a password protected feature meant for system administrators only.  see example 2

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 implicitly open the models parent repository. The repository must be opened by a separate call to edmiRemoteOpenRepository.

 

Arguments


  

Error rendering macro 'excerpt-include' : User 'null' does not have permission to view the page 'US:_a_serverContextId'.
Error rendering macro 'excerpt-include' : User 'null' does not have permission to view the page 'US:_a_remoteRepositoryName_EDMI'.
Error rendering macro 'excerpt-include' : User 'null' does not have permission to view the page 'US:_a_remoteModelName_EDMI'.
Error rendering macro 'excerpt-include' : User 'null' does not have permission to view the page 'US:_a_superuserPassword_EDMI'.
Error rendering macro 'excerpt-include' : User 'null' does not have permission to view the page 'US:_a_clientId_EDMI'.
Error rendering macro 'excerpt-include' : User 'null' does not have permission to view the page 'US:_a_options_EDMI'.
Error rendering macro 'excerpt-include' : User 'null' does not have permission to view the page 'US:_a_edmiInvocationId'.

        

Return Value


Error rendering macro 'excerpt-include' : User 'null' does not have permission to view the page 'US:_r_EDMInterface'.

Options


 

Error rendering macro 'excerpt-include' : User 'null' does not have permission to view the page 'US:_o_ALL_SERVERS'.
     
           

 

Example


 

Example 1
/* Demonstrates the use of LOCAL_CONTEXT
to take control over the transaction 
handling in a local database */ 
EdmiError rstat;
SdaiSession sessionId;
SdaiServerContext myLocalContext;
SdaiRepository repId;
SdaiModel modId;
SdaiAggr aggrId;
SdaiInteger nInst;
SdaiString unavailMsg;
 
/* Define Remote Server Context */
rstat = edmiDefineServerContext("MyLocalContext",
NULL, NULL, NULL, "LOCAL_CONTEXT", NULL, NULL, 
NULL, NULL, NULL, NULL, NULL, &myLocalContext); 
 
/* Connect to a local database. This operation will
connect the EDMthick client to the EDMserver. It 
will fail if the server has no more available 
named users. After the connect, the client may 
be identified on the server by edmiRemoteWhoIsOn() */ 
rstat = edmiRemoteConnect(myLocalContext, "Johnny",
"Supervisor", "cf37ftr", &unavailMsg, NULL); 
 
/* Open a session in the local database */
rstat = edmiRemoteOpenSession(myLocalContext, &sessionId, NULL);
 
/* Open the 'MyRepository' repository */
rstat = edmiRemoteOpenRepository(myLocalContext,
"MyRepository", sdaiRW, NULL, 0, 0, &repId, NULL);  
 
/* Open the 'MyModel' model. This loads a
copy of the model to the local file system. */ 
rstat = edmiRemoteOpenModel(myLocalContext, "MyRepository",
"MyModel", sdaiRW, NULL, 0, 0, &modId, NULL); 
 
. . .
 
/* The local copy of 'MyModel' is loaded when
the model is opened. It remains unchanged 
until a transaction is started. Then the local 
copy will be syncronized with the EDMserver to 
include any changes made by other users in the 
meantime */ 
rstat = edmiStartTransaction();
 
/* Count the current number of instances
of type MyEntity in MyModel */ 
rstat = edmiRemoteGetEntityExtentBN(myLocalContext,
"MyRepository", "MyModel", "MyEntity", 0,  
&aggrId, &nInst, NULL, NULL); 
printf("\n%d instances of MyEntity in MyModel.", nInst);
 
/* Terminate the transaction */
rstat = edmiAbortTransaction();
 
/* Close the model. Some operations may not be
performed on the model by other users for  
as long as it is opened by this client. */ 
rstat = edmiRemoteCloseModel(myLocalContext,
"MyRepository", "MyModel", NULL, 0, 0, NULL); 
. . .
 
/* Close the repository. This would implicitely have
closed the model as well. Some operations may not be 
performed on the repository by other users for  
as long as it is opened by this client. */ 
rstat = edmiRemoteCloseRepository(myLocalContext,
"MyRepository", NULL, 0, 0, NULL); 
 
. . .
 
/* Close the session. This will implicitely
close all open models and repositories. */ 
rstat = edmiRemoteCloseSession(myLocalContext, NULL);
 
/* Disconnect. The occupied named user on the
EDMserver will be released. */ 
rstat = edmiRemoteDisconnect(myLocalContext, NULL);
. . .
 
Example 2
/* As Superuser:
Close the model 'MyModel' in all  
the application server processes 
running on the host 'tellus' */ 
int i;
EdmiError rstat;
SdaiServerContext suContext;
tEdmiWhoIsOnServer *pWhoIsOn;
tEdmiConnection *connect;
SdaiClientId appServer[128], *pAppServer = &appServer[0];
SdaiInteger nConnect, nAppServer;
SdaiString hostName, clientName;
/* Define Remote Server Context
for the superuser */ 
rstat = edmiDefineServerContext("SuperUserContext",
"superuser", NULL, "xfx56kl9",
"TCP", "9090", "MyServerHost",
NULL, NULL, NULL, NULL, NULL, &suContext); 
 
/* Find the client ids of all application
servers running on host tellus */ 
rstat = edmiRemoteWhoIsOn(suContext, &nConnect, &pWhoIsOn, NULL);
connect = pWhoIsOn->connections;
nAppServer = 0;
for (i=0;i<nConnect;i++) {
rstat = edmiRemoteGetClientNames(suContext, connect->clientId,
&hostName, &clientName, NULL); 
if (strstr(clientName, "EDMapplicationServer-") && 
strstr(clientName, " Main Client") && 
! strcmp(hostName, "tellus") ) { 
/* Fails if not open */ 
rstat = edmiRemoteCloseModel(suContext, "MyRepository", "MyModel", 
"xfx56kl9", connect->clientId, 0, NULL); 
} 
edmiFree(hostName); 
edmiFree(clientName); 
}
. . .
 

See also

Filter by label

There are no items with the selected labels at this time.