This repository has been archived by the owner on Sep 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Loading modules
rjrudin edited this page Mar 25, 2019
·
1 revision
One of the main features of ml-javaclient-util is its support for loading modules into a MarkLogic modules database.
Starting in version 3.0.0, all modules are loaded via the REST API, as shown below. For more information, please see Loading files.
DatabaseClient client = DatabaseClientFactory.newClient(...); // Use the ML Java Client API
AssetFileLoader assetFileLoader = new AssetFileLoader(client); // Uses the REST API to load asset modules
DefaultModulesLoader modulesLoader = new DefaultModulesLoader(assetLoader);
File modulesDir = new File("src/main/ml-modules");
ModulesFinder modulesFinder = new DefaultModulesFinder(); // Allows for adjusting where modules are stored on a filesystem
modulesLoader.loadModules(modulesDir, modulesFinder, client);
Prior to version 3.0.0, loading modules was accomplished via a combination of XCC and the REST API:
DatabaseClient client = DatabaseClientFactory.newClient(...); // Use the ML Java Client API
XccAssetLoader assetLoader = new XccAssetLoader(client); // Can use XCC or the REST API to load asset modules
DefaultModulesLoader modulesLoader = new DefaultModulesLoader(assetLoader);
File modulesDir = new File("src/main/ml-modules");
ModulesFinder modulesFinder = new DefaultModulesFinder(); // Allows for adjusting where modules are stored on a filesystem
modulesLoader.loadModules(modulesDir, modulesFinder, client);
See this ml-gradle Wiki page for information on the expected directory structure for modules, including REST API modules and non-REST API modules.