Initialize Model Engine

1. Initialize the model engine

    Initializing the model engine is to initialize org.xmeta.World, where World is a single instance, and generally only needs to be initialized once when the system starts.

import org.xmeta.World;
 
//World is a single instance
World world = World.getInstance();

//World initialization needs to give a directory, this directory should be readable and writable
world.init(".");

2. Directory Rules

    The directory used to initialize the engine should be readable and writable, it can be empty, or it can contain the following subdirectories.

  • config: is generally used to put configuration files, this directory will be loaded into the classpath.
  • databases: Generally used to store database files, such as sqlite database files.
  • lib: The place to put the public class library at runtime.
  • lib_rap: The class library required to run XWorker's web-based model editor.
  • os/lib/xxx: Applicable to class libraries under different operating systems. For example: os/lib/lib_macosx_x86_64 is a class library for macos64-bit system.
  • os/library/xxx: Dynamic libraries for different operating systems. Such as: os/lib/win32_x86_64 distributed dynamic library suitable for windows64-bit system.
  • projects/xxx: Model projects, used to configure the ThingManager. For example, projects/_local means that XWorker will create a model manager named _local by default to store some local models.
  • webroot: The root directory of XWorker's built-in web server.
  • work: The working temporary directory. Used to store various temporary files generated when the model is running.

    If it is used in a Java project, the class library under os/lib/xxx needs to be manually imported into the project, and the os/library/xxx directory needs to be added to the JVM startup item when starting the application , such as:  -Djava.library.path=./xworker/os/library/win32_x86_64/.

 

 

Copyright ©  2007-2019 XWorker.org  版权所有  沪ICP备08000575号