We needed to adjust the DataAbstract.js for further implementation in Delphi web-applications.
Maybe this is necessary in an update of DA for JavaScript.
// RemoteDataAdapter : function RemoteDataAdapter(aDataService, aLoginService, aStreamerClass) { //old api
RemoteDataAdapter: function RemoteDataAdapter(aURL, aDataServiceName, aLoginServiceName, aStreamerClass) {
var that = this;
/*****************************************************************************
* modified this file on Aug 28, 2024.
*
* the old API allowed for the user to pass a DataService and a LoginService
* by *reference* (not a DataService and a LoginService by *name*).
*
* unfortunately, this RemoteDataAdapter implemention needed both services to
* derive from RemObjects.SDK.RemoteService.
*
* in practice, you might want to pass a DataService that derives from
* RemObjects.DataAbstract.Server.DataAbstractService and/or a LoginService
* that derives from RemObjects.DataAbstract.Server.BaseLoginService.
*
* starting with Aug 28, 2024 this RemoteDataAdapter implementation allows for...
* 1. DataService to derive from...
* 1.1 RemObjects.SDK.RemoteService, or
* 1.2 RemObjects.DataAbstract.Server.DataAbstractService
* 2. LoginService to derive from...
* 2.1 RemObjects.SDK.RemoteService, or
* 2.2 RemObjects.DataAbstract.Server.BaseLoginService
*****************************************************************************/
if (arguments[0] instanceof RemObjects.DataAbstract.Server.DataAbstractService) {
this.fService = arguments[0];
} else {
this.fService = new RemObjects.DataAbstract.Server.DataAbstractService(arguments[0]);
}
this.fLoginService = new RemObjects.SDK.RemoteService(
this.fService.fChannel,
this.fService.fMessage,
'LoginService'
);
We modified the old API included with DataAbstract.js, not the new API.
Both APIs included with DataAbstract.js are documented here: RemoteDataAdapter.
The new API allows for the user to pass a DataServer and LoginService by name. But the old API allowed for the user to pass a DataService and LoginService by reference.
We have legacy projects that consume the old API.
Unfortunately, the old API included with DataAbstract.js wanted both services to derive from RemObjects.SDK.RemoteService. It would not accept any other services.
However, in practice you might want to pass a DataService that derives from RemObjects.DataAbstract.Server.DataAbstractService and/or a LoginService that derives from RemObjects.DataAbstract.Server.BaseLoginService. I know we do.
We modifed DataAbstract.js so that it allows for a DataService to derive from…
You haven’t answered to my question:
why you can’t use a new api with url, like
var rda = new RemObjects.DataAbstract.RemoteDataAdapter("http://localhost:8099/json");
//Defaults are:
//data service name = "DataService"
//login service name = "LoginService"
//streamer class = Bin2DataStreamer
and need to pass services by reference?
can you give examples when new api does not cover your needs?