Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| tutorial:plugins [2020/06/06 19:58] – [Develop custom plugin] admin | tutorial:plugins [2024/01/03 19:56] (current) – removed admin | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Tutorial: Plugins ====== | ||
| - | |||
| - | Learning Objectives: | ||
| - | * What does a plugin do? | ||
| - | * System plugins | ||
| - | * Develop custom plugin | ||
| - | * Deploy custom plugin | ||
| - | * Sharing custom plugin | ||
| - | |||
| - | ===== Develop custom plugin ===== | ||
| - | |||
| - | Set plugin development environment using Eclipse IDE: | ||
| - | * create a java project | ||
| - | * add toplugin.jar to build path (project properties) | ||
| - | |||
| - | Create plugin package | ||
| - | Create plugin class inheriting from PluginAncestor class | ||
| - | Add @TO_PLUGIN annotation to the class | ||
| - | Implement required methods | ||
| - | Add your plugin functions, declare as public functions | ||
| - | Compile and fix errors | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | |||
| - | @Override | ||
| - | public String getPluginID() { | ||
| - | | ||
| - | } | ||
| - | |||
| - | @Override | ||
| - | public String getPluginDesc() { | ||
| - | | ||
| - | } | ||
| - | |||
| - | @NOT_MSCRIPT_METHOD | ||
| - | @Override | ||
| - | | ||
| - | System.out.println(" | ||
| - | |||
| - | } | ||
| - | |||
| - | @NOT_MSCRIPT_METHOD | ||
| - | @Override | ||
| - | public void close() { | ||
| - | | ||
| - | } | ||
| - | |||
| - | public String doSomething (String something_p) { | ||
| - | | ||
| - | | ||
| - | } | ||
| - | } | ||
| - | |||
| - | By default, all public methods declared as well as inherited are exposed as MScript function. | ||
| - | |||
| - | |||
| - | Write your junit test to test the plugin functions. | ||
| - | |||
| - | |||
| - | Deploy Custom Plugin: | ||
| - | Export project as jar file | ||
| - | Copy plugin jar file to /lib folder | ||
| - | Register your plugin package in config.properties | ||
| - | | ||
| - | Restart TestOptimal server | ||
| - | |||
| - | Use Custom Plugin: | ||
| - | Open an existing model or create a new model | ||
| - | Select SCRIPT tab | ||
| - | Click on " | ||
| - | Check the checbox for your custom plugin | ||
| - | Your plugin should show up on CodeAssist list as " | ||
| - | CodeAssist on your custom plugin should automatically be added. | ||
| - | |||
| - | |||