Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: ANN: Cross-Platform Code Generation for mORMot ORM / SOA secure Clients



Permlink Replies: 1 - Last Post: Aug 28, 2014 9:02 AM Last Post By: Kevin Powick
Arnaud BOUCHEZ

Posts: 143
Registered: 2/17/02
ANN: Cross-Platform Code Generation for mORMot ORM / SOA secure Clients
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 25, 2014 1:25 PM
Current version of the main units of our Open Source mORMot framework target only Win32 and Win64 systems.
It allows to make easy self-hosting of mORMot servers for local business applications in any corporation, or pay cheap hosting in the Cloud, since mORMot CPU and RAM expectations are much lower than a regular IIS-WCF-MSSQL-.Net stack.

But in a Service-Oriented Architecture (SOA), you would probably need to create clients for platforms outside the Windows world, especially mobile devices.

A set of cross-platform client units has just been introduced in the CrossPlatform sub-folder of the source code repository.
It allows writing any client in modern object pascal language, for:

- Any version of Delphi, on any platform (with FireMonkey UI, on Mac OSX, or any mobile supported devices);
- FreePascal Compiler 2.7.1;
- Smart Mobile Studio 2.1, to create AJAX or mobile applications (via PhoneGap, if needed).

This series of articles will introduce you to mORMot's Cross-Platform abilities:
- http://blog.synopse.info/post/2014/08/11/CrossPlatform-Clients/Units-Platforms
- http://blog.synopse.info/post/2014/08/11/CrossPlatform-Clients/Generate-Code
- http://blog.synopse.info/post/2014/08/11/CrossPlatform-Clients/Delphi-FreePascal
- http://blog.synopse.info/post/2014/08/11/CrossPlatform-Clients/SmartMobileStudio

In short, you can generate a Delphi unit from any mORmot server, which let any Delphi application, including OSX, iPhone or Android platforms, to connect to this server.

A set of object pascal units will provide a solid and shared ground for the any kind of clients:
- Connection to a mORMot server via HTTP, with full REST support;
- Support of weak or default authentication to secure the transfer - see http://blog.synopse.info/post/2013/06/07/Authentication-and-Authorization
- Definition of the TSQLRecord ORM class, using RTTI when available on Delphi or FreePascal, and generated code for Smart Mobile Studio;
- Remote CRUD operations, via JSON and REST, with a TSQLRestClientURI class, with the same methods as with the mORMot.pas framework unit;
- Optimized TSQLTableJSON class to handle a JSON result table, as returned by +mORMot+'s REST server ORM - see http://blog.synopse.info/post/2010/07/02/JSON-format-of-a-RESTful-application and http://blog.synopse.info/post/json-benchmark-delphi-mormot-superobject-dwsjson-dbxjson for numbers about how our unit is much faster than DBXJSON;
- Batch process - see http://blog.synopse.info/post/2011/06/03/BATCH-sequences-for-adding/updating/deleting-records - for transactional and high-speed writes;
- Client-Server services via methods with parameters marshaling;
- Client-Server services via interfaces with parameters marshaling and instance-life time;
- Mapping of most supported field types, including e.g. ISO 8601 date/time encoding, BLOBs and TModTime/TCreateTime;
- Complex record types are also exported and consumed via JSON, on all platforms (for both ORM and SOA methods);
- Some cross-platform low-level functions and types definitions, to help share as much code as possible between your projects.

You can now write code like this on any Delphi client:

var Client: TSQLRestClientHTTP;
    people: TSQLRecord;
    i: integer;
    calc: ICalculator;
...
  Client := GetClient('localhost','User','synopse'); // connect and create a session on the server
 
  people := TSQLRecordPeople.Create; // create an ORM class
  try
    for i := 1 to 200 do begin
      people.FirstName := 'First'+IntToStr(i);
      people.LastName := 'Last'+IntToStr(i);
      people.YearOfBirth := i+1800;
      people.YearOfDeath := i+1825;
      people.Sexe := TPeopleSexe(i and 1);
      assert(Client.Add(people,true)=i); // add one record
    end;
  finally
    people.Free;
  end;
 
  calc := TServiceCalculator.Create(Client); // access to an ICalculator service
  for i := 1 to 200 do
    assert(calc.Add(i,i+1)=i*2+1); // call a remote interface-based service


Now, your mobile or OSX clients will be able to interact with any SQL database (our ORM supports SQLite3, Oracle, Jet/MSAccess, MS SQL, Firebird, DB2, PostgreSQL, MySQL and NexusDB), or even NoSQL database (it supports MongoDB or an in-memory engine).
And consume remote services defined as interface - just like in WCF, without the installation or configuration hell of this platform, since mORMot relies on the convention over configuration pattern.

Performance is very high, especially for database access, and scaling to thousands of concurrent users.
For Delphi 6 up to XE6, full Open Source project.

See http://synopse.info/fossil/wiki?name=SQLite3+Framework
or download the documentation from http://synopse.info/files/pdf/Synopse%20mORMot%20Framework%20SAD%201.18.pdf

Hope you find it interesting!
Kevin Powick

Posts: 4
Registered: 1/18/01
Re: ANN: Cross-Platform Code Generation for mORMot ORM / SOA secure Clients
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 28, 2014 9:02 AM   in response to: Arnaud BOUCHEZ in response to: Arnaud BOUCHEZ
Amazing, Arnaud. You are a beast!

--
Kevin Powick
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02