====== Installing a Webapp in OpenBIS STAGE ======
**(1)** Download the simple example ''service-demo.zip'' from https://wiki-bsse.ethz.ch/download/attachments/101197296/service-demo.zip?version=1&modificationDate=1380265520019
**(2)** Unzip it in the core plugins folder:
# ~/stage/openBIS/servers/core-plugins> unzip service-demo.zip
**(3)** Enable the new core plugin by editing the ''core-plugins.propeties'' file:
# ~/stage/openBIS/servers/core-plugins> vi core-plugins.properties
Once edited this file has the following content:
enabled-modules = screening, service-demo
#disabled-core-plugins = screening:
disabled-core-plugins = screening:data-sources, screening:drop-boxes, screening:image-overview-plugins, screening:maintenance-tasks, screening:services, screening:dss-data-sources
**(4)** Restart openBIS:
# ~/stage/openBIS/servers/openBIS-server/jetty/logs> alldown.sh
Stopping Data Store Server (not running - nothing to do)
Shutting openBIS down...
# ~/stage/openBIS/servers/openBIS-server/jetty/logs> allup.sh
Starting openBIS...
.........Done.
Starting Data Store Server (pid 5918)
Info: During openBIS start, two new symlinks are created in the jetty webapp directory pointing to the two new installed wepapps from the "service-demo" example:
# ~/stage/openBIS/servers/openBIS-server/jetty/webapps/openbis/webapp> ls -al
total 16
drwxr-xr-x 2 mx_nas mx-servers 4096 Oct 2 12:28 .
drwxr-xr-x 9 mx_nas mx-servers 4096 Aug 20 17:41 ..
lrwxrwxrwx 1 mx_nas mx-servers 118 Oct 2 12:28 aggregation -> /home/openbis/stage/openBIS/servers/openBIS-server/jetty/../../core-plugins/service-demo/1/as/webapps/aggregation/html
lrwxrwxrwx 1 mx_nas mx-servers 116 Oct 2 12:28 ingestion -> /home/openbis/stage/openBIS/servers/openBIS-server/jetty/../../core-plugins/service-demo/1/as/webapps/ingestion/html
**(5)** Adapt ''webapp.js'':
# ~/stage/openBIS/servers/core-plugins/service-demo/1/as/webapps/aggregation/html> vi webapp.js
# ~/stage/openBIS/servers/core-plugins/service-demo/1/as/webapps/ingestion/html> vi webapp.js
What to adapt:
* The openBIS server we use for our data.\\
In our case the hostname is ''infectx-stage.biozentrum.unibas.ch'':
openbisServer = new openbis('https://infectx-stage.biozentrum.unibas.ch/openbis/openbis', 'https://infectx-stage.biozentrum.unibas.ch/datastore_server');
* The DSS (data source) to contact.
To find out what the code of the data source is, either have a look at the ''service.properties'' of the data store server, (key: ''data-store-server-code = DSS1''), or have a look at the openbis DB calling ''=# select code from data_stores;''\\
In our case tha value is ''dss-screening'':
openbisServer.createReportFromAggregationService("dss-screening", "example-aggregation-service", parameters, displayReturnedTable);
**(6)** For the ingestion service, adapt the ''script.py'' script which registers a new sample into openBIS:
# ~/stage/openBIS/servers/core-plugins/service-demo/1/dss/reporting-plugins/example-ingestion-service> vi script.py
It is necessary to set an existing experiment and sample type.\\
In our case we set as experiment ''/BEE/VACCINIA_TEAM/VACCINIA-DU-K1'' and as sample type ''CONTROL_WELL'':
sampleId = "/BEE/" + sampleCode
sample = tr.createNewSample(sampleId, "CONTROL_WELL")
exp = tr.getExperiment("/BEE/VACCINIA_TEAM/VACCINIA-DU-K1")
sample.setExperiment(exp)
**(7)** The wepapps can be accessed at the URLs:\\
''https://infectx-stage.biozentrum.unibas.ch/openbis/webapp/aggregation/''\\
''https://infectx-stage.biozentrum.unibas.ch/openbis/webapp/ingestion/''
====== Calling external libraries from Jython script ======
**1.** The lib should go into folder where the Jython script resides. Simply create a ''lib'' folder and put all jars inside. \\
Here is an example:
# ~/openbis_example_wepapp/servers/core-plugins/appExample/1/dss/reporting-plugins/apiExample> ll lib/
total 17104
drwxr-xr-x 7 kohleman staff 238 Oct 9 17:23 ./
drwxr-xr-x 6 kohleman staff 204 Oct 9 17:25 ../
-rw-r--r--@ 1 kohleman staff 168586 Sep 27 14:34 cisd-hcscld.jar
-rw-r--r--@ 1 kohleman staff 1252347 Sep 27 14:34 cisd-jhdf5-core.jar
-rw-r--r--@ 1 kohleman staff 2852257 Sep 27 14:34 hdf5-linux-intel.jar
-rw-r--r--@ 1 kohleman staff 2652865 Sep 27 14:34 hdf5-macosx-intel.jar
-rw-r--r--@ 1 kohleman staff 1821318 Sep 27 14:34 hdf5-windows-intel.jar
**2.** Then restart openBIS. This creates links in the ''dss/lib'' folder to those jars. For old version, this doesn't happen and the jars should be copied there directly.
**3.** In the jython script use the import command, for example:
from ch.ethz.sis.hcscld import CellLevelDataset
The * star does not work, you have to import each class separately.
**4.** And that is it! Use Java from Jython as in any other case.