Modeling Services > Rogue Wave Script Integration > Rogue Wave Server API Available to Scripts
 
Rogue Wave Server API Available to Scripts
Only a limited part of the Rogue Wave® Server API is available to Rogue Wave Script functions. This API allows you to build simple applications. If you need to access a more powerful API, you have to switch to a standard C++ implementation.
Rogue Wave Script can access the entire Server model through the API defined in the server model interpreter. Moreover, dynamic objects call certain callbacks that can be implemented in an Rogue Wave Script function. See the API of the Rogue Wave Script class IlsDynObject.
Example
function Node_beginEdition(node, status)
{
if (node.locked && (MvServer.interactor != node.locker)) {
MvServer.ReplyMessage("Cannot edit node " + node.name + ": you don’t have the lock");
return false;
}
return true;
}
The running dynamic view server is represented by a global Rogue Wave Script variable, named MvServer, which allows you to:
*declare some objects to the dynamic view server;
*open a dynamic view;
*access the current interacting user;
*access instances stored in dictionaries.
Example
var network = new Network("TheNetwork");
MvServer.DeclObjectLabel(network, network.identifier);
Through the MvServer object, you can also call global functions declared in the application. Such functions are automatically declared as member functions of the Rogue Wave Script class IlsMvServer.
Example
*C++ code
ILS_GLOBAL_FUNCTION1(IlsBoolean,PrintWelcomeMessage,IlsString)
*Script code
MvServer.PrintWelcomeMessage("Welcome");
Through the MvServer object, you can also declare new global functions (accessible from the client and the dynamic views) that are given an Rogue Wave Script implementation. In the following example, we declare a new global function, named MyGlobalCallback, which is given an Rogue Wave Script implementation.
Example
function MyGlobalCallback() {
...
}
 
 
function OnLoad(args)
{
MvServer.DeclGlobalCallback("MyGlobalCallback", "boolean", 0);
}
The scripts used in the context of the Rogue Wave Script integration of Rogue Wave Server can also access the timers API. See Chapter 3, "Rogue Wave Script for the Server Side" of the Reference Manual and, more specifically, the Rogue Wave Script class IlsTimer.

Version 5.8
Copyright © 2014, Rogue Wave Software, Inc. All Rights Reserved.