4D v14.3Configuring the Wakanda Application |
||||||||||||||||||||||||||||||||
|
4D v14.3
Configuring the Wakanda Application
|
Parameter | Type | Description |
localName | String | Local name of remote catalog |
ipAddress | String | Address of remote data server (use HTTPS for added security) |
userName | String | User name for opening of session |
password | String | Password for opening of session |
jsFile | String | (optional) Relative pathname of JavaScript file located in the same folder as the model (see Modifying the external file) |
timeout | Num | (optional) Timeout for client connection to 4D database in minutes (60 by default) |
For a more detailed description, refer to the documentation of the mergeOutsideCatalog() method in the Wakanda Server-Side API manual.
The model object indicates the current "model" of the Wakanda application, in other words, the set of its "datastore classes" (tables) and methods. In the context of a 4D Mobile architecture, the Wakanda model can be empty. If the Wakanda application already contains objects, the classes and methods referenced from the remote 4D application are merged with the local model when you use the mergeOutsideCatalog() method.
When the connection is established successfully, the "exposed" 4D tables are added to the classes of the model on the Wakanda side. In Wakanda Enterprise Studio, you can see the remote tables among the list of classes for the local model. External elements are indicated by a red arrow. The external catalog is also represented in Wakanda Studio by a specific catalog (named localName.waRemoteCatalog) that is also indicated by a red arrow:
Note: File extensions can be hidden in Wakanda Studio.
You can double-click on this file to view the external catalog in the model editor of Wakanda Enterprise Studio:
model.mergeOutsideCatalog("base4D","localhost:80", "admin", "123456");
model.mergeOutsideCatalog("base4D", { hostname: "http://localhost:8050", user: "wak", password: "123456", jsFile: "Model2.js" timeout: 15 });
The openRemoteStore() and addRemoteStore() methods are alternative ways of establishing dynamic links between a Wakanda application and a 4D application.
Like mergeOutsideCatalog(), these methods provide dynamic access to the data of 4D databases but they work in a different way:
openRemoteStore() only returns a valid reference in the current JavaScript context, whereas addRemoteStore() maintains the reference throughout the session.
For more information, refer to the description of the openRemoteStore() and addRemoteStore() methods in the Wakanda documentation.
Whichever way you connect with the remote 4D datastore (using the "Connect to Remote Datastore" dialog box of Wakanda Studio or executing a JavaScript method), you have to choose whether the remote classes (tables) must be merged with the active model, or placed in a dedicated model.
This choice is summarized in the following table:
For... | merging with active model | using a dedicated model |
"Connect to Remote Datastore" dialog box | Check Merge with active Model | Uncheck Merge with active Model |
JavaScript method | mergeOutsideCatalog() | openRemoteStore() or addRemoteStore() |
When you merge remote 4D tables with the active model, they are integrated into the default model of the application (whose datastore is the ds object), as local classes. The data access principles are:
var invoiceList = ds.INVOICES.all(); //access to the INVOICES table of the catalog by default
These principles facilitate the development of 4D Mobile applications but may lead to naming conflicts between tables, in particular when the Web application calls on several datastores. In this case, it may be useful to place the remote elements in a dedicated model.
When remote 4D tables are not merged with the active model, they use a "dedicated" model. Remote classes then use a namespace that is specific to the datastore to which the application is connected and they cannot be accessed in the ds object. This way it is possible to use several tables with the same name in several different datastores:
var invoiceList = my4Dstore.INVOICES.all(); //access to the INVOICES table of the my4Dstore datastore
However, this principle has certain limitations in the current version of Wakanda Enterprise:
So it is usually recommended to choose the merged mode for remote datastores when your client application must access the data of the 4D remote tables directly.
Wakanda Enterprise lets you modify certain characteristics of the local version of the external model, for the purpose of customizing, security or optimization.
To do this, you just need to add the appropriate JavaScript code in a .js file that has the same local name as the catalog plus the suffix ".js" and put this file in the same folder as the model. For example, if the name of the local catalog is Emp4D.waRemoteModel, you need to create a file named Emp4D.js in the folder of the model.
Note: When you establish the connection using a JavaScript method, it is possible to use another name by means of the jsFile parameter.
Wakanda executes this file when the external catalog is initialized. Using this file, you can:
model.className.attributeName.scope ="publicOnServer"
model.className.calcAtt = new Attribute("calculated", "string"); model.className.calcAtt.onGet = function(); model.className.calcAtt.onSet = function();
model.className.newAlias = new Attribute("alias", "number", "Link_15.cinteger");
model.DerivedClass = new DataClass("Emps", "public", "My4DTable")
model.DerivedClass = new DataClass("Emps", "public", "My4DTable") model.DerivedClass.removeAttribute("salary"); model.DerivedClass.removeAttribute("comments"); model.DerivedClass.removeAttribute("...");
For more information about JavaScript code for working with models, refer to the Model API section in the Wakanda documentation.
You can set specific permissions to Wakanda Server overall for the remote model and/or individually for each class. For more information about this point, refer to the Assigning Group Permissions section of the Wakanda documentation.
Product: 4D
Theme: Configuring the Wakanda Application
4D Mobile ( 4D v14 R3)
4D Mobile ( 4D v14.3)
4D Mobile ( 4D v14 R4)
Inherited from : Configuring the Wakanda Application ( 4D v14 R2)