Differences

This shows you the differences between two versions of the page.

Link to this comparison view

muster:8.0:java_net_perl_php [2018/01/11 08:21] (current)
Line 1: Line 1:
 +======= Muster Java .Net Perl and Php API =======
 +
 +The APIs for the scripting languages behaves in the same way as the Python and C++ ones. Please refer to the Python documentation and examples to learn how to use the API that will be find under the same MClientAPI and MTemplateAPI namespace/​packages.
 +
 +When using the Muster API you must configure your PATH environmental variables on Windows, and the LD_LIBRARY_PATH and DYLD_LIBRARY_PATH on posix platforms to let the API find the Muster .DLL/so files . You'll also need to set the MUSTER environmental variable to the Muster 8 root installation path, this allows the .LIB to find the python installation related to Muster. Don't forget to configure the environmental variables, because, you may end up loading another python installation laying somewhere on your filesystem and this could lead to module import errors very hard to sort out.
 +
 +A typical example configuration for Window is:
 +
 +MUSTER=C:​\program files\virtual vertex\muster8
 +PATH=%MUSTER%;​%PATH%
 +A typical example configuration on Linux is:
 +
 +MUSTER=/​usr/​local/​muster8
 +LD_LIBRARY_PATH=/​usr/​local/​muster8:​$LD_LIBRARY_PATH
 +export MUSTER
 +export LD_LIBRARY_PATH
 +A typical example configuration on Mac is:
 +
 +MUSTER=/​usr/​local/​muster8
 +DYLD_LIBRARY_PATH=/​usr/​local/​muster8:​$DYLD_LIBRARY_PATH
 +export MUSTER
 +export DYLD_LIBRARY_PATH
 +
 +Due to namespaces differences,​ the API exposed under the scripting languages is inside the MClientAPI namespace (instead of MClientLib).
 +
 +After configuring your environment,​ you can simply copy the files inside the SDK/Libs inside your scripting language extension folder. ​
 +
 +===== .Net =====
 +
 +The .NET Api requires you to import all the .cs files distributed with the SDK (sdk/​libs/​platform) inside your project.
 +The .NET API does not require any additional configuration.
 +
 +You do not need to import any module from a .NET project, you just need to make sure the following files are available into your compiled program directory:
 +
 +  * MBase.dll
 +  * MClientAPI.dll
 +  * MClientLib.dll
 +  * MFramework.dll
 +  * MTemplate.dll
 +  * MTemplateAPI.dll
 +
 +If you're working with Mono on a Unix platform, just use the .so or .dylib files
 +
 +This is a typical example that pauses JOB ID 1:
 +
 +<code .net>
 +using System;
 +using System.Text;​
 +
 +namespace ConsoleApplication
 +{
 +    class Program
 +    {
 +        static void Main(string[] args)
 +        {
 +          ​
 +            MClientAPI.InitializeLibrary(string.Empty);​
 +            var session = MClientAPI.InitializeSession();​
 +            var err = MClientAPI.Connect(session,​ "​127.0.0.1",​ 9780);
 +            if (err.getErrorCode() != 0)
 +            {
 +                Console.WriteLine("​Failed to connect to the Dispatcher service!"​);​
 +                MClientAPI.ShutdownLibrary();​
 +                return;
 +            }
 +
 +            MClientAPI.JobActionPause(session,​ 1);
 +            MClientAPI.Disconnect(session);​
 +            MClientAPI.ShutdownLibrary();​
 +             
 +        }
 +    }
 +}
 +
 +</​code>​
 +===== Java =====
 +
 +The .NET Api requires you to import all the relevant .java files inside your project. You may also need to distribute the MClientAPI.dll and MTemplateAPI.dll with your project. The java API does not require any additional configuration.
 +
 +You can then import the module with:
 +
 +<code java>
 +import MClientAPI.*;​
 +import MTemplateAPI.*;​
 +</​code>​
 +
 +===== Perl =====
 +
 +The Perl Api requires you to copy the Perl modules inside the Perl/lib folder.
 +
 +You can import the modules in Perl using:
 +
 +<code perl>
 +using MClientAPI;
 +using MTemplateAPI;​
 +</​code>​
 +
 +===== PHP =====
 +
 +The PHP Api requires you to copy the .so files inside your PHP modules directory. You also need to copy the .php files distributed with the installers within your application. Also be sure to enable the modules in your php.ini configuration file.
 +
 +You can then import the modules using:
 +
 +<code php>
 +include "​MClientAPI.php";​
 +include "​MTemplateAPI.php";​
 +</​code>​