Figure 9: Adding the input parameter.
Figure 10: The Algorithm Parameters page with the input parameter specified.
Click Next >.
The example algorithm in this tutorial expects one item off of the Data Manager, so click the Add button under the Input Data section to add a new input data item. For the Mime Type, input text/nwb.
Figure 11: Adding the input data item.
The example algorithm in this tutorial also outputs one item on to the Data Manager, so click the Add button under the Output Data section to add a new output data item. Give the output data item the following values: File Name: output.txt Label: Example Non-Java Algorithm Output File Data Type: Text Mime Type: text/plain
Figure 12: Adding the output data item.
Figure 13: The Input and Output Data page with the input and output data items specified.
The seventh page is the Template String page. The template string tells CIShell what command-line string to use when invoking your compiled program. It can contain placeholders that correspond to either values specified by the end-user (as input parameters) or the files chosen from the Data Manager by the end-user (as input data items). A placeholder is specified in the template string by the text _$
_, where placeholder is either the \ _ID_ of an input parameter or _inFile\[input file number\]_. If you recall from earlier in this tutorial, we specified that our algorithm will accept one input parameter, which has the id of _user_file_, so the corresponding placeholder in a template string would be \ _$ Wiki Markup
. In the previous page, we specified an input data item of type _text/nwb and an output data item with the name output.txt. Our input data item has the corresponding template string placeholder _$
(quotes included) should appear in the Template String field.
Figure 14: The first template string placeholder has been inserted.
Repeat this process again, except this time select the second item in the Template String Placeholders table (which should be the text/nwb File entry). After that, append the text "platform.txt" and "output.txt" (quotes included) to the template string.
Figure 15: The final template string, containing the input parameter placeholder; the input data item placeholder; the platform file; and the fourth argument the example program expects, which the name of the file to output to.
You should now have a new project in your Eclipse workspace.
Figure 17: The new project in the Eclipse workspace.
Now that you have an Eclipse project for your algorithm, the next step is to build the project. Fortunately, it is just a matter of running the build.xml Ant script that was created with your project. Right-click on the build.xml file and select Run As->Ant Build to build the project.
Figure 18: Building the Eclipse project.
Now that your project has been built, it can be exported as a plugin for Network Workbench. Refresh your workspace. (You can do this by right-clicking on your project in the Package Explorer and selecting Refresh.) You should see a new build directory. Expand it. Inside of it should be an out directory and a file called projectName_bundleVersion.jar, where projectName and bundleVersion were specified in the wizard. (For this tutorial, the file would be called example.nonjava.algorithm_0.0.1.jar.) Right-click on this file, and select Export...
Figure 19: Exporting the built Network Workbench plugin.
The Export window should open. Select General->File System, and click Next >.
Figure 20: Exporting the built Network Workbench plugin.
Select the plugins directory inside your Network Workbench installation (e.g. C:\Program Files\NWB\plugins), and then click Finish. (Note: If this plugin already exists in your Network Workbench installation, you will be prompted to overwrite the already-existing file. Just click Yes.)
Figure 21: Exporting the built Network Workbench plugin.
, even though we did not specify that in the wizard. That is replaced by the _executable property. The template string is actually a command-line string that gets executed, which is why the executable is specified first (to invoke your program). That is also why everything is wrapped in sets of quotes (in case spaces are involved).
Notice that no input data is specified here, but output data is (the _outFile_ properties). The input (and output) data must be files for non-Java algorithms, and as such the only metadata relevant to it is the expected mime-type of each input data item. The mime types for all of your input data items are specified in the _service.properties_ file, which we will get to. _outFile_ can be thought of as an array of output data items, indexed into via C-style bracket notation (i.e. _outFile\[0\]_). Setting an _outFile_ to a file name declares the output data item. The label of each _outFile_ is what is displayed for the output data item in the Data Manager (in Network Workbench), and the _type_ tells the Data Manager what icon to use. The mime-type must also be specified for each _outFile_, but like the input data, that is done in _service.properties_. Wiki Markup
Finally, open up service.properties. The service.pid property here must match the one specified in the Designate section in your gui.xml file. The in_data and out_data properties are the mime-types of the input and output data items mentioned above. They are merely comma-separated lists. The menu_path defines where your algorithm should be placed in the menu in Network Workbench, and the label property corresponds to the label in the menu. All of the other properties are metadata.