Transparent Replication Using Metaprogramming in Cyan


This page has examples for the use of Cyan metaobjects with treplica. Note that the example that are in the article itself are not here. Currently, the Cyan compiler only works on Windows (sorry about that).

In order to run the example, download and uncompress file from the Cyan site, Download the project from File is a previous version of the compiler used by the files of The only difference from the current version is that some classes and files are renamed.

Suppose and were uncompressed into directories


This last directory has subdirectories


In which treplica is subdirectory of meta that is subdirectory of cyanMetaobjects. The Java code of the metaobjects treplicaInit, treplicaAction, loadNonDeterministicFiles, and nonDeterministic are inside directory treplica. To change these metaobjects or to compile them, read the primer on how to build metaobjects.

To test the examples, open a DOS command prompt and make D:\ the current drive. Create a directory D:\treplica\tmpDirs and subdirectories


Go to directory D:\treplica\projeto\app

Now there are four examples, calculator, rogue, treplica, verify. To call them, copy each the following commands to the DOS prompt:

  1. start /wait call-exem calculator "D:\treplica\projeto" "D:\treplica\lib" "\treplica\tmpDirs"
  2. start /wait call-exem rogue "D:\treplica\projeto" "D:\treplica\lib" "\treplica\tmpDirs"
  3. start /wait call-exem treplica "D:\treplica\projeto" "D:\treplica\lib" "\treplica\tmpDirs"
  4. start /wait call-exem verify "D:\treplica\projeto" "D:\treplica\lib" "\treplica\tmpDirs"

Do not put the drive letter in the last directory. That is, do not use this: D:\treplica\tmpDirs.