Plugin Development
Plugin Initializer
There is an initializer for plugin projects.
https://github.com/normalizedsystems/nsx-mr-plugin-initializer
You will need to configure the ns-initializer, adding the plugin-initializer. The process is described here.
Setup
Plugins projects are expanded.
The expansionSettings file uses editor-model-expanders
expansion-resource to expand.
It uses the editorElements::EditorPlugin
programType. The target will always be plugin
There are 3 profile to choose from:
Standard Plugin
(basic setup)NSX Plugin
(adds nsx-parent and other nsx related configuration)NSX RnD Plugin
(adds fontawesome pro icons, for which a license is needed)
The plugin model is found under the model/
directory.
Plugin Model
There are XSDs, which can help you to correctly edit the plugin XML files. They are included in the editor-core jar. You can access them by adding the following dependency to your pom.xml.
<dependency>
<groupId>net.democritus.editor</groupId>
<artifactId>editor-core</artifactId>
<version>${editor-core.version}</version>
</dependency>
<editorPlugin xmlns="https://schemas.normalizedsystems.org/xsd/editorElements/3/0/0">
<!-- Name is used to identify the plugin. Also used in artifact id. -->
<name>build</name>
<version>0.1.2-SNAPSHOT</version>
<!-- Plugin id is used to register the plugin in the prime radiant.
Should not be changed after release. -->
<pluginId>net-democritus-build-plugin</pluginId>
<!-- Group id for maven artifacts. -->
<groupId>net.democritus.editor</groupId>
<description>Provides build page</description>
<pluginDependencies>
<!-- Add references to other plugin artifacts to include them during local development. -->
<pluginDependency>
<pluginName>prime</pluginName>
<artifact>net.democritus.editor:mrp-prime-plugin:0.4.0</artifact>
</pluginDependency>
</pluginDependencies>
<metamodels>
<editorMetamodel>
<!-- Under dependency, add metamodel ontologies that are needed,
but which will be provided by other plugins. -->
<type>dependency</type>
<ontologies>
<ontology>elements</ontology>
<ontology>expansionControl</ontology>
</ontologies>
</editorMetamodel>
<editorMetamodel>
<!-- Under source, add metamodel ontologies that you intend to support with this plugin. (if any) -->
<type>source</type>
<ontologies>
<ontology>build</ontology>
</ontologies>
</editorMetamodel>
</metamodels>
</editorPlugin>
Generate plugin model
To initialize the plugin model, run the GeneratePluginSkeleton
transmuter.
This will generate extension models, which describe the Components of the plugin.
After the first time, the transmuter can be run with every update of the metamodel. The transmuter will create generator logs to keep track of what it has created, so it doesn't revert changes made by the developer. However, if the metamodel changes in a significant way, such as removing or renaming elements, you will need to fix the plugin model manually.
Local development
After expanding the plugin, you can deploy it locally and start customizing.
- The plugin is an angular application. Run
npm install
and thennpm start
to start the plugin. - The plugin will need a backend to load a model. Use the
scripts/start-model-server.nss
script to start a model server. It takes an expansionSettings.xml location as argument. (Works best with absolute paths.)