Valentina Class: Initialization Methods

Before you start working with a Valentina ADK component, you should initialize it. Initializing the component with a full license removes any limitations placed on functionality during the time in which you are evaluating the Valentina ADK.

A Valentina ADK contains three major components:

  • Valentina Local DB Engine - to create and use local Valentina DB files;
  • Valentina Local Report Engine - to use Valentina Project files and generate reports designed in Valentina Studio;
  • Valentina Client - to talk with a [remote] Valentina DB/Report Server;

There is a single archive for each platform of ADK that incorporates the database (local db and client) and reports engines. If you are working with Valentina ADK for Xojo on the Windows platform, then the archive for it contains Valentina Local DB Engine, Valentina Local Report Engine and Valentina Client system, all of which Windows components.

For each component there is its own Init function (as well as shutdown one):

  • Valentina.Init( inCacheSize, inMacSerial, inWinSerial, inLinSerial )
  • Valentina.InitReports( inMacRepSerial, inWinRepSerial, inLinRepSerial )
  • Valentina.InitClient( inCacheSize )

Valentina Client doesn't use a serial number because any serialization occurs on the Server itself. It doesn't matter to Valentina Server what platform of ADK is attempting to connect to it. For this reason, you can use any Valentina Client with Valentina Server, provided you have a valid license for Valentina Server.

Order of Calls

Your application may use only one of components or few of them. In the last case, please note, that orders of calls of Init methods should be as

  • Valentina.Init() – init vkernel.dll and ICU strings.
  • Valentina.InitReports() – init vreport.dll. IF vkernel was not inited before, then init it also for own usage.
  • Valentina.InitClient() – init vclient.dll. IF vkernel was inited before then uses UTF16 encoding for strings. Otherwise uses IOEncoding as specified.

Shutdown methods call in the reverse order.

Serials

Note, that InitClient() does not have serials. This underlines the fact that each and any Valentina Client is free. In other words, if you have some Valentina Server running, you can use any existing Valentina ADK to connect to it.

For local DB and Report engines you should have a serial for each OS, where you want to run your application.

IMPORTANT: If you do not have serial for some platform, the position should be empty, or nil. For example, if you are only developing on the Windows platform, then the inMacSerial and inLinuxSerial will both appear as ”” (empty). This would look as an example below.

Example

Valentina.Init( 10*1024*1024, "", "WinSerial", "" )

TIP: You may want to split your serial to few small strings or even encrypt to better hide from easy hacking from your application binary.

TIP: If you are upgrading from a previous version of Valentina, it is a good idea that you upgrade all of our components at the same time, and that all serial codes are for the same version. Otherwise, if you update your components and one of them becomes out of date, it can interfere with initialization.

Valentina.Init()

Declaration:

Init(	
    inCacheSize as Integer = 10 * 1024 * 1024, 
    inMacSerialNumber as String = "", 
    inWinSerialNumber as String = "",
    inLinSerialNumber as String = "" )

Parameters:

  • inCacheSize The size of the cache in bytes.
  • inMacSerialNumber The serial for Mac OS.
  • inWinSerialNumber The serial for Windows.
  • inLinSerialNumber The serial for Linux.

Description:

To improve disk access, Valentina uses a cache mechanism. Using the Valentina.Init() method, you should define the size of the cache. It should be 1MB if the database is tiny, or it can be several megabytes if the database is large.

TIP: By default, it is a good idea to allocate not more than a half of available computer memory to the cache. Usually 10-50Mb is enough.

Only registered users are allowed to build and deploy Valentina-based applications, except for testing purposes. If you are a registered user, you can specify either the MacOS or the Windows OS serial number, or both. If Valentina receives an empty string, it will work in the time limited, demonstration mode. After ten minutes in demonstration mode, any request to the database will be ignored and Valentina will respond with three beeps.

Note: You should not call this method second time before Valentina.ShutDown(). Otherwise you will get an error. This is like with file.open() file.close() methods. You can use Valentina.CacheSize property to check if Valentina is initialized already.

Note: You should use your own security methods to ensure that you do not expose your serial numbers in your built applications.

Example:

err = Valentina.Init( 10 * 1024 * 1024  )  // demo

Valentina.InitClient()

Declaration:

InitClient( inCacheSize as Integer = 10 * 1024 * 1024 )

Parameters:

  • inCacheSize The size of the cache in bytes.

Description:

Initializes the Valentina Client for work.

  • VClient uses this cache only for server-side cursors.
  • Each server-side cursor keeps the list of cached records. When cursors dies it destroy cache buffers also.
  • Also exists list of usage history. If cache limit reached then older buffers are released.

Example:

Valentina.InitClient()
 
or 
 
Valentina.InitClient( 15 * 1024 * 1024 )  // 15 Mb max to cache data on cliet side

Valentina.InitReports()

[NEW in 4.0] Valentina ADKs added the Valentina Reports Engine from Valentina technology release 4.

Declaration:

InitReports( inMacSerial as String, inWinSerial as String, inLinSerial as String )

Parameters:

  • inMacSerial - The serial for MAC OS.
  • inWinSerial - The serial for Windows OS.
  • inLinSerial - The serial for Linux OS.

Description:

Initializes Valentina Reports for use by your application.

If you do not specify a serial for Valentina Reports, then generated reports will have DEMO watermark.

Example:

Valentina.InitReports( "MySerial", "", "" )