-
Notifications
You must be signed in to change notification settings - Fork 0
Home
-
"Plugin" refers to the python script(s) which are imported into Mapping Service installations
-
"Mapping" (noun) refers to the enabling of the plugin on an instance of the Mapping Service by providing it with the mapfile and a descriptor, title, ID, etc
-
Plugin creation in 3 basic steps:
-
Create a repo containing a python script
-
Create the jar file using the SEMPlugin gradle app
-
Move the resulting jar file into the appropriate folder specified by the mapping service application properties (usually plugins)
-
-
In slightly more detail now:
-
Python script:
a. Should take as a command line argument (in this order):
i. Map file in JSON ii. Data file(s) iii. Path where to save the output file to
b. Should be uploaded to a public repo
i. The SEMPlugin gradle app uses a github library to locally clone the repo such that any changes can be updated automatically when the plugin is reloaded.
-
Creating the JAR File
a. The github repo for the jar compiler: https://github.com/kit-data-manager/SEMplugin (NB: it is unclear who the OG developer of this compiler is. Commit history says
b. The main script which you need to edit is > src/main/java/edu/kit/datamanager/semplugin/SEMplugin.java
c. The way this app is built, the following variable and function names need to be edited when creating a new plugin (otherwise, it will overwrite existing plugins when moved over, because of the way the jar file is compiled (don't ask me the specifics of this, it's probably some gradle compiler issue))
i. Change the class name on Line 11 and 12 (from SEMPlugin to whatever you like) ii. The appropriate git URL and branch name strings on lines 13 and 14 iii. Appropriate name, description, version number (if governance desired), URI to python script, on lines 19, 24, 29, and 34 respectively iv. Need to point the java script to the proper python script which executes the extraction and mapping within the git repo that you specified in lines 13 & 14. We do this in line 61 with a PythonRunnerUtil function which takes as arguments the script's path and then the arguments. It essentially calls python \<path_to_script\> \<path_to_map_file\> \<input_path\> \<output_path\> in a command line, which is why the python script needs to be set up using the sys.argv calls.
-
Renaming and moving the jar file
a. Once this is done, build the .jar file using ./gradlew jar and you should find it in build/libs. Note that the name for this is fixed, no matter what variables you change in the .java file. I never looked into changing this because it was low priority among so many other things, but it's likely in the build.gradle file. This however means you will need to rename the jar file manually to something more meaningful and especially so that it doesn't overwrite any existing jar files when you move it to the plugin dir of the mapping service installation.
-
Creating the mapping
a. While the plugin creation is technically finished, in order to use the plugin, a mapping utilizing it needs to be created
b. For this we use the "backend" of the mapping service. I.e. the old frontend interface which now serves as our backend so that users are not exposed to the mapping creation functions.
c. For this restart the mapping service after having included the newly created jar file, and navigate to the "add mapping scheme" tab. From there, select the plugin which you would like, give it some unique ID, title, description, and provide it with the map file. Then create the mapping (verified by a green checkmark next to the create button)
d. Then the plugin is finally ready to be used!