JWS-114 Fixed what the default for local and cluster should (also considering people...
[jabaws.git] / website / docs / v_2_2_0 / _sources / man / develop.rst.txt
1 For Developers
2 ==============
3
4 .. _jabaws_source:
5
6 Source Code
7 -----------
8
9 .. note:: This is an open source project. If you want to contribute or report an issue have a look at our  `Git-tracker`_.
10
11 Publicly available Git repository: http://source.jalview.org/gitweb/?p=jabaws.git
12
13 .. code:: bash
14
15     git clone http://source.jalview.org/git/jabaws.git
16
17
18 ------------
19
20 .. _jabaws_api:
21
22 The API
23 -------
24
25 `Data Model JavaDoc`_ - read this if your are coding against JABA Web Services
26
27 `Complete JavaDoc`_ - for developers who want to use JABAWS framework and use Engines and Executables directly
28
29
30 -------------
31
32 .. _jabaws_structure:
33
34 Structure of the project
35 ------------------------
36
37 | |folder| *binaries* contains native executables e.g. clustalw
38 |     |folder| *src* contains sources of native executables
39 |     |folder| *windows* contains pre-compiled Windows binaries
40 |     |folder| *compilebin.sh* the script to complile binaries
41 |     |folder| *setexecflag.sh* the script to set executable flag for the binaries
42 | |folder| *conf*       contains JABAWS configuration files
43 | |folder| *ExecutionStatistics*        the database for storing collected execution statistics
44 | |folder| *jobsout* a default folder for temporary job directories
45 | |folder| *statpages* the web pages for execution statistics display
46 | |folder| *WEB-INF* default
47 | |folder| *website* contains the JABAWS web pages
48 |     |folder| *archive* contains JABAWS packages, the WAR and JAR files
49 | |folder| *datamodel* contains the JABAWS datamodel
50 | |folder| *engine* contains the JABAWS engine - the code that abstract the execution environment and executes native binaries
51 | |folder| *runner* contains the JABAWS runners - thin wrappers for native binaries
52 | |folder| *webservices* contains the JABAWS SOAP web services
53 | |folder| *testsrc* contains the JABAWS unit tests
54
55
56 ------------
57
58 .. _jabaws_code:
59
60 The code structure
61 ------------------
62
63 .. image:: ../../website/static/img/ws-structure.png
64   :height: 414
65   :width: 282
66   :scale: 95 %
67   :align: left
68
69
70 Each source folder depends on the upper folders for compilation. For example, the datamodel is the top level folder so it has no other dependencies on other JABAWS code. The Engine level depends on the datamodel to compile etc. The web services folder is the bottom layer and depends on all the other source code.
71
72 So the JABAWS project is split into 4 layers. From bottom-up the first layer consists from the value classes used by all other layers of the hierarchy, in particular web services. So, to be able to use JABAWS one needs to have these classes. At the same time classes on this layer does not have any dependencies on the layers above.
73
74 The second layer contains code for execution of the wrappers, which are the abstraction describing native executables. JABAWS can execute tasks locally that is on the same machine as JVM and on the cluster. Thus currently code on this layer contain two engines. This layer depends on the layer underneath, the data model layer, but is completely independent from the code above.
75
76 The third layer consists of the wrappers for the native executables and classes to handle their configuration. It depends on the engines and the data model, but know nothing about the web services.
77
78 Finally, the upper layer contains the web services, that depend on all the layers below.
79
80 The layer isolation is archived though specially designed compilation task which is executed sequentially in several stages so that the first layer compiles before any other layers, second layer compiles after that and process continies before all the code is compiled. Any violation of the layer boundaries results in the compilation failure. Use Ant "Compile" or "Complile_with_debug" tasks to perform the staged compilation.
81
82 A client package contains only classes from data model layer and a simple web services client. Framework package is for anyone who want to use JABAWS framework for controlling native executables in local or cluster environments. Framework exclude the web services layer. Server package contains all the code.
83
84
85 ------------
86
87 .. _jabaws_tests:
88
89 Running tests
90 -------------
91
92 JABAWS uses TestNG [test] framework for testing. The test results for the JABAWS package offered for download can be found at: Test Results [link]
93 JABAWS uses TestNG for testing. There is a TestNG plugin available for Eclipse which has functionality similar to JUnit. However, no plugins are necessary to run the test cases, as testng jar is supplied with JABAWS together with an ant tasks to run the test cases.
94
95
96 Several testing groups are supported:
97
98 * All tests ('Test')
99 * Cluster tests ('Run_cluster_dependent_test')
100 * Cluster independent tests ('All_cluster_independent_tests')
101 * Windows only tests ('All_cluster_independent_windows_only_tests')
102 * Performance and stability tests ('Long_tests')
103 * Re-run failed tests ('Rerun_failed_tests')
104 * Run custom test ('CustomTest')
105
106 To run the tests you need to download all sources from repository [link]. Once you have done that, enter into the command line mode, change directory to the project directory and type:
107
108 .. code:: bash
109
110     ant -f build.xml <test group name>
111
112
113 Make sure you have Apache Ant [link] installed and path to ant executable is defined in your path environmental variable. Replace test group name with the one of the names given in the list above to run required group of tests e.g for running cluster only tests use the following command:
114
115 .. code:: bash
116
117     ant -f build.xml Run_cluster_dependent_test
118
119
120 If you work under Linux you could use a simple script from the root folder of repository called ``runtests.sh``. This script simply contains a collection of the test commands described above and paths to java home directory and an ant executable, which you can define once for your system and then reuse.
121
122 A handy feature of TestNG is its ability to re-run failed tests. Failed test ant file is stored in ``test-output/testng-failed.xml``. and is used in the ant task called ``Rerun_failed_tests``. So re-running failed tests requires no more work than running any other test group and could be accomplished with the command:
123
124 .. code:: bash
125
126     ant -f build.xml Rerun_failed_tests
127
128
129 CustomTest runs the test defined in the project root directory file called ``temp-testng-customsuite.xml``. This file is generated by TestNG plugin every time you run the test from Eclipse. Thus an easy way to run a test in a different environment is to run it from Eclipse first and then from ant using a custom test procedure.
130
131 For cluster execution make sure that the property ``LD_LIBRARY_PATH`` defined in build.xml points to cluster engine LD libraries directory in your local system.
132
133
134 ------------
135
136 .. _jabaws_conn_services:
137
138 Accessing JABAWS from your program
139 ----------------------------------
140
141 .. _jabaws_conn_functions:
142
143 Web services functions overview
144 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
145
146
147 All JABAWS multiple sequence alignment web services comply to the same interface, thus the function described below are available from all the services.
148
149 Functions for initiating the alignment
150
151 .. code:: bash
152
153     String id = align(List<FastaSequence> list)
154     String id = customAlign(List<FastaSequence> sequenceList, List<Option> optionList)
155     String id = presetAlign(List<FastaSequence> sequenceList, Preset preset)
156
157 Functions pertaining to job monitoring and control
158
159 .. code:: bash
160
161     JobStatus status = getJobStatus(String id)
162     Alignment al = getResult(String id)
163     boolean cancelled = cancelJob(String id)
164     ChunkHolder chunk = pullExecStatistics(String id, long marker)
165
166 Functions relating to service features discovery
167
168 .. code:: bash
169
170     RunnerConfig rc = getRunnerOptions()
171     Limit limit = getLimit(String name)
172     LimitsManager lm = getLimits()
173     PresetManager pm = getPresets()
174
175 Please refer to a Data Model JavaDoc for a detailed description of each methods.
176
177
178 ------------
179
180 .. _jabaws_conn_functions2:
181
182 Structure of the template command line client
183 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
184
185 +------------------------+------------------------------------------------------------------------+
186 | Packages               |  Classes and Interfaces                                                |
187 +========================+========================================================================+
188 | compbio.data.msa       |  MsaWS the interface for all multiple sequence alignment web services  |
189 +------------------------+------------------------------------------------------------------------+
190 | compbio.data.sequence  |  JABAWS data types                                                     |
191 +------------------------+------------------------------------------------------------------------+
192 | compbio.metadata       |  JABAWS meta data types                                                |
193 +------------------------+------------------------------------------------------------------------+
194 | compbio.ws.client      |  JABAWS command line client                                            |
195 +------------------------+------------------------------------------------------------------------+
196
197 Additional utility libraries that this client depend upon is the compbio-util-1.3.jar and compbio-annotation-1.0.jar.
198
199 Please refer to a Data Model JavaDoc [link] for a detailed description of each class and its methods.
200
201
202 ------------
203
204 .. _jabaws_conn_conn:
205
206 Connecting to JABAWS
207 ~~~~~~~~~~~~~~~~~~~~
208
209 For a complete working example of JABAWS command line client please see compbio.ws.client.Jws2Client class. JABAWS command line client source code is available from the download page [link]. Please note that for now all the examples are in Java, other languages will follow if there is sufficient demand.
210
211 Download a binary JABAWS client. Add the client to the class path. The following code excerpt will connect your program to Clustal web service deployed in the University of Dundee.
212
213 .. code-block:: java
214
215     import java.net.URL;
216     import javax.xml.namespace.QName;
217     import javax.xml.ws.Service;
218     // (...)
219     String qualifiedName = "http://msa.data.compbio/01/01/2010/";
220     URL url = new URL("http://www.compbio.dundee.ac.uk/jabaws/ClustalWS?wsdl");
221     QName qname = new QName(, "ClustalWS");
222     Service serv = Service.create(url, qname);
223     MsaWS msaws = serv.getPort(new QName(qualifiedName, "ClustalWSPort"),
224     MsaWS.class);
225
226 Line 1 makes a qualified name for JABA web services.
227
228 Line 2 constructs the URL to the web services WSDL.
229
230 Line 3 makes a qualified name instance for Clustal JABA web service.
231
232 Line 4 creates a service instance.
233
234 Line 5 makes a connection to the server.
235
236 A more generic connection method would look like this
237
238 .. code-block:: java
239
240     import java.net.URL;
241     import javax.xml.namespace.QName;
242     import javax.xml.ws.Service;
243     import compbio.ws.client.Services
244     // (...)
245     String qualifiedServiceName = "http://msa.data.compbio/01/01/2010/";
246     String host = "http://www.compbio.dundee.ac.uk/jabaws";
247     // In real life the service name can come from args
248     Services clustal = Services.ClustalWS;
249     URL url = new URL(host + "/" + clustal.toString() + "?wsdl");
250     QName qname = new QName(qualifiedServiceName, clustal.toString());
251     Service serv = Service.create(url, qname);
252     MsaWS msaws = serv.getPort(new QName(qualifiedServiceName, clustal + "Port"), MsaWS.class);
253
254
255 Where Services is enumeration of JABAWS web services. All JABAWS multiple sequence alignment methods confirm to MsaWS specification, thus from the caller point of view all JABAWS web services can be represented by MsaWS interface. The full documentation of MsaWS functions is available from the JavaDoc [link].
256
257
258 ------------
259
260 .. _jabaws_conn_aln:
261
262 Aligning Sequences
263 ~~~~~~~~~~~~~~~~~~
264
265 Given that *msaws* is web service proxy, created as described in "Connecting to JABAWS" section, the actual alignment can be obtained as follows:
266
267 .. code:: bash
268
269     List<FastaSequence> fastalist = SequenceUtil.readFasta(new FileInputStream(file));
270     String jobId = msaws.align(fastalist);
271     Alignment alignment = msaws.getResult(jobId);
272     Line one loads FASTA sequence from the file.
273
274 Line two submits them to web service represented by msaws proxy.
275
276 Line three retrieves the alignment from a web service. This line will block the execution until the result is available. Use this with caution. In general, you should make sure that the calculation has been completed before attempting retrieving results. This is to avoid keeping the connection to the server on hold for a prolonged periods of time. While this may be ok with your local server, our public server (www.compbio.dundee.ac.uk/jabaws) will not let you hold the connection for longer than 10 minutes. This is done to prevent excessive load on the server. The next section describes how to check the status of the calculation.
277 Methods and classes mentioned in the excerpt are available from the JABAWS client library.
278
279
280 ------------
281
282 .. _jabaws_conn_status:
283
284 Checking the status of the calculation
285 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
286
287 You may have noticed that there was no pause between submitting the job and retrieving of the results. This is because getResult(jobId) method block the processing until the calculation is completed. However, taking into account that the connection holds server resources, our public server (www.compbio.dundee.ac.uk/jabaws) is configured to reset the connection after 10 minutes of waiting. To work around the connection reset you are encouraged to check whether the calculation has been completed before accessing the results. You can do it like this:
288
289 .. code-block:: java
290
291     while (msaws.getJobStatus(jobId) != JobStatus.FINISHED) {
292         Thread.sleep(2000); // wait two  seconds, then recheck the status
293     }
294
295
296 ------------
297
298 .. _jabaws_conn_aln_presets:
299
300 Aligning with presets
301 ~~~~~~~~~~~~~~~~~~~~~
302
303 .. code:: bash
304
305     PresetManager presetman = msaws.getPresets();
306     Preset preset = presetman.getPresetByName(presetName);
307     List<FastaSequence> fastalist = SequenceUtil.readFasta(new FileInputStream(file));
308     String jobId = msaws.presetAlign(fastalist, preset);
309     Alignment alignment = msaws.getResult(jobId);
310
311 Line one obtains the lists of presets supported by a web service.
312
313 Line two return a particular Preset by its name.
314
315 Lines three to five are doing the same job as in the first aligning sequences example [link].
316
317
318 ------------
319
320 .. _jabaws_conn_aln_params:
321
322 Aligning with custom parameters
323 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
324
325 .. code:: bash
326
327     RunnerConfig options = msaws.getRunnerOptions();
328     Argument matrix = options.getArgument("MATRIX");
329     matrix.setValue("PAM300");
330     Argument gapopenpenalty = options.getArgument("GAPOPEN");
331     gapopenpenalty.setValue("20");
332     List<Argument> arguments = new ArrayList<Argument>();
333     arguments.add(matrix); arguments.add(gapopenpenalty);
334     List<FastaSequence> fastalist = SequenceUtil.readFasta(new FileInputStream(file));
335     String jobId = msaws.customAlign(fastalist, arguments);
336     Alignment alignment = msaws.getResult(jobId);
337
338 Line one obtains the ``RunnerConfig`` object that holds information on supported parameters and their values
339
340 Line two retrieve a particular parameter from the holder by its name.
341
342 Lines three sets a value to this parameter which will be used in the calculation.
343
344 Line four and five do the same but for another parameter.
345
346 Line six makes a List to hold the parameters.
347
348 Line seven puts the parameters into that list.
349
350 Line eight and ten is the same as in previous examples.
351
352 Line nine submit an alignment request with the sequences and the parameters.
353
354 The names of all the parameters supported by a web service e.g. "PAM300" can be obtained using ``options.getArguments()`` method. Further details on the methods available from ``RunnerConfig`` object are available from the JavaDoc.
355
356
357 ------------
358
359 .. _jabaws_conn_aln_file:
360
361 Writing alignments to a file
362 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
363
364 There is a utility method in the client library that does exactly that.
365
366 .. code-block:: java
367
368     Alignment alignment = align(...)
369     FileOutputStream outStream = new FileOutputStream(file);
370     ClustalAlignmentUtil.writeClustalAlignment(outStream, align);
371
372
373 ------------
374
375 .. _jabaws_conn_aln_example:
376
377 A complete client example
378 ~~~~~~~~~~~~~~~~~~~~~~~~~
379
380 Finally, a complete example of the program that connects to JABAWS Clustal service and aligns sequences using one of the Clustal web service presets. All you need for this to work is a JABAWS binary client [link]. Please make sure that the client is in the Java class path before running this example.
381
382 .. code-block:: java
383
384     import java.io.ByteArrayInputStream;
385     import java.io.FileNotFoundException;
386     import java.io.IOException;
387     import java.net.URL;
388     import java.util.List;
389
390     import javax.xml.namespace.QName;
391     import javax.xml.ws.Service;
392
393     import compbio.data.msa.MsaWS;
394     import compbio.data.sequence.Alignment;
395     import compbio.data.sequence.FastaSequence;
396     import compbio.data.sequence.SequenceUtil;
397     import compbio.metadata.JobSubmissionException;
398     import compbio.metadata.LimitExceededException;
399     import compbio.metadata.Preset;
400     import compbio.metadata.PresetManager;
401     import compbio.metadata.ResultNotAvailableException;
402     import compbio.metadata.UnsupportedRuntimeException;
403     import compbio.metadata.WrongParameterException;
404
405     public class Example {
406
407       /*
408        * Input sequences for alignment
409        */
410       static final String input = ">Foo\r\n"
411                 + "MTADGPRELLQLRAAVRHRPQDFVAWLMLADAELGMGDTTAGEMAVQRGLALHPGHPEAVARLGR"
412                 + "VRWTQQRHAEAAVLLQQASDAAPEHPGIALWLGHALEDAGQAEAAAAAYTRAHQLLPEEPYITAQ"
413                 + "LLNWRRRLCDWRALDVLSAQVRAAVAQGVGAVEPFAFLSEDASAAEQLACARTRAQAIAASVRPL"
414                 + "APTRVRSKGPLRVGFVSNGFGAHPTGLLTVALFEALQRRQPDLQMHLFATSGDDGSTLRTRLAQA"
415                 + "STLHDVTALGHLATAKHIRHHGIDLLFDLRGWGGGGRPEVFALRPAPVQVNWLAYPGTSGAPWMD"
416                 + "YVLGDAFALPPALEPFYSEHVLRLQGAFQPSDTSRVVAEPPSRTQCGLPEQGVVLCCFNNSYKLN"
417                 + "PQSMARMLAVLREVPDSVLWLLSGPGEADARLRAFAHAQGVDAQRLVFMPKLPHPQYLARYRHAD"
418                 + "LFLDTHPYNAHTTASDALWTGCPVLTTPGETFAARVAGSLNHHLGLDEMNVADDAAFVAKAVALAS"
419                 + "DPAALTALHARVDVLRRESGVFEMDGFADDFGALLQALARRHGWLGI\r\n"
420                 + "\r\n"
421                 + ">Bar\r\n"
422                 + "MGDTTAGEMAVQRGLALHQQRHAEAAVLLQQASDAAPEHPGIALWLHALEDAGQAEAAAAYTRAH"
423                 + "QLLPEEPYITAQLLNAVAQGVGAVEPFAFLSEDASAAESVRPLAPTRVRSKGPLRVGFVSNGFGA"
424                 + "HPTGLLTVALFEALQRRQPDLQMHLFATSGDDGSTLRTRLAQASTLHDVTALGHLATAKHIRHHG"
425                 + "IDLLFDLRGWGGGGRPEVFALRPAPVQVNWLAYPGTSGAPWMDYVLGDAFALPPALEPFYSEHVL"
426                 + "RLQGAFQPSDTSRVVAEPPSRTQCGLPEQGVVLCCFNNSYKLNPQSMARMLAVLREVPDSVLWLL"
427                 + "SGPGEADARLRAFAHAQGVDAQRLVFMPKLPHPQYLARYRHADLFLDTHPYNAHTTASDALWTGC"
428                 + "PVLTTPGETFAARVAGSLNHHLGLDEMNVADDAAFVAKAVALASDPAALTALHARVDVLRRESGV"
429                 + "FEMDGFADDFGALLQALARRHGWLGI\r\n"
430                 + "\r\n"
431                 + ">Friends\r\n"
432                 + "MTADGPRELLQLRAAVRHRPQDVAWLMLADAELGMGDTTAGEMAVQRGLALHPGHPEAVARLGRV"
433                 + "RWTQQRHAEAAVLLQQASDAAPEHPGIALWLGHALEDHQLLPEEPYITAQLDVLSAQVRAAVAQG"
434                 + "VGAVEPFAFLSEDASAAEQLACARTRAQAIAASVRPLAPTRVRSKGPLRVGFVSNGFGAHPTGLL"
435                 + "TVALFEALQRRQPDLQMHLFATSGDDGSTLRTRLAQASTLHDVTALGHLATAKHIRHHGIDLLFD"
436                 + "LRGWGGGGRPEVFALRPAPVQVNWLAYPGTSGAPWMDYVLGDAFALPPALEPFYSEHVLRLQGAF"
437                 + "QPSDTSRVVAEPPSRTQCGLPEQGVVLCCFNNSYKLNPQSMARMLAVLREVPDSVLWLLSGPGEA"
438                 + "DARLRAFAHAQGVDAQRLVFMPKLPHPQYLARYRHADLFLDTHPYNAHTTASDALWTGCPVLTTP"
439                 + "GETFAARVAGSLNHHLGLDEMNVADDAAFVAKAVALASDPAALTALHARVDVLRRESI";
440
441       public static void main(String[] args) throws UnsupportedRuntimeException,
442                 LimitExceededException, JobSubmissionException,
443                 WrongParameterException, FileNotFoundException, IOException,
444                 ResultNotAvailableException, InterruptedException {
445
446                 String qualifiedServiceName = "http://msa.data.compbio/01/01/2010/";
447
448                 /* Make a URL pointing to web service WSDL */
449                 URL url = new URL("http://www.compbio.dundee.ac.uk/jabaws/ClustalWS?wsdl");
450
451                 /*
452                  * If you are making a client that connects to different web services
453                  * you can use something like this:
454                  */
455                 // URL url = new URL(host + "/" + Services.ClustalWS.toString() +
456                 // "?wsdl");
457
458         QName qname = new QName(qualifiedServiceName, "ClustalWS");
459         Service serv = Service.create(url, qname);
460         /*
461          * Multiple sequence alignment interface for Clustal web service
462          * instance
463          */
464         MsaWS msaws = serv.getPort(new QName(qualifiedServiceName, "ClustalWS"
465                         + "Port"), MsaWS.class);
466
467         /* Get the list of available presets */
468         PresetManager presetman = msaws.getPresets();
469
470         /* Get the Preset object by preset name */
471         Preset preset = presetman
472                         .getPresetByName("Disable gap weighting (Speed-oriented)");
473
474         /*
475          * Load sequences in FASTA format from the file You can use something
476          * like new FileInputStream(<filename>) to load sequence from the file
477          */
478         List<FastaSequence> fastalist = SequenceUtil
479                         .readFasta(new ByteArrayInputStream(input.getBytes()));
480
481         /*
482          * Submit loaded sequences for an alignment using preset. The job
483          * identifier is returned by this method, you can retrieve the results
484          * with it sometime later.
485          */
486         String jobId = msaws.presetAlign(fastalist, preset);
487
488         /* This method will block for the duration of the calculation */
489         Alignment alignment = msaws.getResult(jobId);
490
491         /*
492          * This is a better way of obtaining results, it does not involve
493          * holding the connection open for the duration of the calculation,
494          * Besides, as the University of Dundee public server will reset the
495          * connection after 10 minutes of idling, this is the only way to obtain
496          * the results of long running task from our public server.
497          */
498         // while (msaws.getJobStatus(jobId) != JobStatus.FINISHED) {
499         // Thread.sleep(1000); // wait a second, then recheck the status
500         // }
501
502         /* Output the alignment to standard out */
503         System.out.println(alignment);
504
505         // Alternatively, you can record retrieved alignment into the file in
506         // ClustalW format
507
508         // ClustalAlignmentUtil.writeClustalAlignment(new FileOutputStream(
509         // "output.al"), alignment);
510
511       }
512     }
513
514 For a more detailed description of all available types and their functions please refer to the Data Model JavaDoc [link].
515
516
517 ------------
518
519 .. _jabaws_new_services:
520
521 Adding new web-services
522 -----------------------
523
524 .. _jabaws_new_guide:
525
526 Brief Guide
527 ~~~~~~~~~~~
528
529
530 1. Add a new executable which you'd like to wrap as a JABAWS web service to the binaries folder. If it has the source code and can be recompiled for different platforms include it under ``binaries/src``. Edit ``setexecutableflag.sh`` and ``compilebin.sh`` scripts in ``binaries/src`` accordingly.
531
532 2. Make sure that all the dependencies of the software being installed are satisfied. If there are other binaries they should be included as well. Keep the dependent binaries in a subfolder for the main executable. Update ``compilebin.sh`` and ``setexecflag.sh`` scripts accordingly.
533
534 3. Make sure that the new executable does not have any hard links to its dependencies, e.g. is able to run from any installation folder and does not contain any hard coded paths.
535
536 4. Describe executable in ``conf/Exectuable.properties`` file. The lowercase name of the wrapper should be included in the name of the property for example Clustal properties all include clustal as a part of the name e.g. ``local.clustalw.bin``. The same property for MAFFT will be called ``local.mafft.bin``. For more help please refer to the Executable.properties file.
537
538 5. Describe the executable supported parameters in the ``<ExecutableName>Parameters.xml``, presets in the ``<ExecutableName>Presets.xml`` and the execution limits in the ``<ExecutableName>Limit.xml``. By convention these files are stored in ``conf/settings``. All of these are optional. If the executable does not support parameters you do not have to mention the ``XXXParameter.xml`` file in the ``Executable.properties`` file at all. The same is true for Presets and Limits.
539
540 6. Create a Java wrapper class for your executable. Create it within runner source directory. Examples of other wrappers can be found in ``compbio.runner.msa`` or in other ``compbio.runner.*`` packages. Wrapper should extend ``SkeletalExecutable<T>`` and implement ``PipedExecutable<T>`` if you need to pass the input or collect the results from the standard in/out. Please see Mafft code as example. Wrapper should expend ``SkeletalExecutable<T>`` if input/output can be set as a parameter for an executable. Please see the ClustalW code as example.
541
542 7. Create a testcase suit for your wrapper in ``testsrc`` and run the test cases.
543
544 8. Create parser for the output files of your executable. Suggested location ``compbio.data.sequence.SequenceUtil``.
545
546 9. Test the parser.
547
548 10. Decide which web services interfaces your executable is going to match. For example if the executable output can be represented as SequenceAnnotation then SequenceAnnotation interface might be appropriate. For multiple sequence alignment an Msa interface should be used.
549
550 11. If you find a web interface that matches your returning data type, then implement a web service which confirms to it within a webservices source folder.
551
552 12. Register web service in ``WEB-INF/web.xml`` and ``WEB-INF/sun-jaxws.xml``.
553
554 13. Add generated wsdl to wsbuild.xml ant script to generate the stubs.
555
556 14. Run build-server task in wsbuild file. Watch for errors. If the task fails that means that JAXB cannot serialize some of your new data structures. Add appropriate annotations to your data types. Also check that:
557
558         * you do not have interfaces to serialize, since JAXB cannot serialize them
559         * you have a default no args constructor (can be private if you do not need it)
560         * JAXB cannot serialize Java Map class, use a custom data structure instead
561         * Enum cannot be serialized as its abstract class (do not confuse with enum which is fine)
562         * Fields serialization leaves a little more space for manoeuvre. If you do this then you may accept and return interfaces, e.g. List, Map; abstract classes etc, from your methods
563
564     If you have the data on the server side, but nothing is coming through to the client, this is a JAXB serialization problem. They tend to be very silent and thus hard to debug. Check your data structure can be serialized!
565
566 15. Modify the client to work with your new web service. Update Services enumeration to include new service and ensure that all the methods of this enumeration take into account the new service. Update the client help text (``client_help.txt``) and insert it into the Constraints class.
567
568 16. Test the web service with the client.
569
570 17. Test on the cluster.
571
572
573 ------------
574
575 .. _jabaws_artifacts:
576
577 Building web services artifacts
578 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
579
580 JABAWS are the standard JAX-WS [link] SOAP web services, which are WS-I [link] basic profile compatible. This means that you could use whatever tool your language has to work with web services. Below is how you can generate portable artifacts to work with JABAWS from Java. However if programming in Java, we recommend using our client library as it provides a handful of useful methods in addition to plain data types.
581
582 .. code:: bash
583
584     wsimport -keep http://www.compbio.dundee.ac.uk/jabaws/ClustalWS?wsdl
585
586
587 Server side artifacts should be rebuild whenever the data model, meta model or MSA interface were changed. To do that run build-server task from wsbuild.xml ant build file. WSDL files will be generated in ``webservices/compbio/ws/server/resource`` directory. It is not necessary to edit them if any of the JABAWS clients are used. JABAWS are the standard JAX-WS web services, which are WS-I basic profile compatible.
588
589
590 ------------
591
592 .. _jabaws_distributives:
593
594 Preparing Distributives
595 ~~~~~~~~~~~~~~~~~~~~~~~
596
597 There are a number of ant tasks aimed for preparing distributives for download. Currently a few types of JABAWS packages are offered:
598
599 1. Client only (contains classes required to access JABA Web Services)
600 2. Platform specific JABAWS (windows and other)
601 3. JABAWS without binaries
602 4. JABAWS framework
603
604 Corresponding build task names are:
605
606 1. min-jaba-client
607 2. jaba-windows, jaba-complete
608 3. jaba-no-binaries
609 4. full-jaba-client
610
611 The easiest way to build all distributives is to call ``build-all`` ant task. There are more tasks defined in build.xml than described here. They are mostly self explanatory.
612
613 If you made any changes to the data model and would like to generate a complete JABAWS distro make sure you have rebuilt jaxws artifact as described below.
614
615
616
617 .. _Git-tracker: https://source.jalview.org/crucible/changelog/jabaws
618 .. _Data Model JavaDoc: http://www.compbio.dundee.ac.uk/jabaws/dm_javadoc/index.html
619 .. _Complete JavaDoc: http://www.compbio.dundee.ac.uk/jabaws/full_javadoc/index.html
620
621
622
623 .. |folder| image:: ../../website/static/img/folder-small.png
624    :align: middle
625    :width: 15