[MOBY-guts] biomoby commit

Martin Senger senger at dev.open-bio.org
Sat Oct 14 20:46:55 UTC 2006


senger
Sat Oct 14 16:46:55 EDT 2006
Update of /home/repository/moby/moby-live/Java/docs
In directory dev.open-bio.org:/tmp/cvs-serv21934

Modified Files:
	Dashboard-NOTES.txt Perl-ChangeLog PerlMoses.html 
Log Message:

moby-live/Java/docs Dashboard-NOTES.txt,1.13,1.14 Perl-ChangeLog,1.1,1.2 PerlMoses.html,1.8,1.9
===================================================================
RCS file: /home/repository/moby/moby-live/Java/docs/Dashboard-NOTES.txt,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- /home/repository/moby/moby-live/Java/docs/Dashboard-NOTES.txt	2006/07/28 10:41:43	1.13
+++ /home/repository/moby/moby-live/Java/docs/Dashboard-NOTES.txt	2006/10/14 20:46:55	1.14
@@ -43,12 +43,6 @@
 * ParemetersTable:
   - Float field is not verified for non-numeric chars
 
-* to share preferences for contact-email and authority across all
-  biomoby entities
-
-* DataTypeTreeTable
-   - should check for cyclic definition in data types?
-
 * Service Input Data
    - should deal also with input Collections
    - and (perhaps?) to allow entering a more specific data type

===================================================================
RCS file: /home/repository/moby/moby-live/Java/docs/Perl-ChangeLog,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/docs/Perl-ChangeLog	2006/08/01 08:44:32	1.1
+++ /home/repository/moby/moby-live/Java/docs/Perl-ChangeLog	2006/10/14 20:46:55	1.2
@@ -1,5 +1,9 @@
+2006-10-13  Martin Senger  <martin.senger at gmail.com>
+
+	* BIG change: All modules were renamed from MOBY::* to
+	MOSES::MOBY::* (in order not to conflict with the old BioMoby Perl
+	implementtaion (that uses modules named MOBY::*)
+
 2006-08-01  Martin Senger  <martin.senger at gmail.com>
 
 	* Released
-	
-

===================================================================
RCS file: /home/repository/moby/moby-live/Java/docs/PerlMoses.html,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- /home/repository/moby/moby-live/Java/docs/PerlMoses.html	2006/08/01 14:58:51	1.8
+++ /home/repository/moby/moby-live/Java/docs/PerlMoses.html	2006/10/14 20:46:55	1.9
@@ -181,6 +181,7 @@
      data/my-input.xml
 </pre>
 
+<a name="first5"></a>
    An output (the same with any input data) is nothing really
 exciting:
 
@@ -607,22 +608,22 @@
 
   <dd> Each BioMoby data type, as registerd in a BioMoby registry, is
 represented by a Perl object
-<tt>MOBY::Data::&lt;moby-data-type-name&gt;</tt>. For example, a
+<tt>MOSES::MOBY::Data::&lt;moby-data-type-name&gt;</tt>. For example, a
 <tt>GenericSequence</tt> object looks like this:
 
        <pre class="sscript">
 #-----------------------------------------------------------------
-# MOBY::Data::GenericSequence
+# MOSES::MOBY::Data::GenericSequence
 # Generated: 30-Jul-2006 14:55:09 BST
 # Contact: Martin Senger &lt;martin.senger at gmail.com&gt; or
 #          Edward Kawas &lt;edward.kawas at gmail.com&gt;
 #-----------------------------------------------------------------
-package MOBY::Data::GenericSequence;
+package MOSES::MOBY::Data::GenericSequence;
 no strict;
 use vars qw( @ISA );
- at ISA = qw( MOBY::Data::VirtualSequence );
+ at ISA = qw( MOSES::MOBY::Data::VirtualSequence );
 use strict;
-use MOBY::Data::Object;
+use MOSES::MOBY::Data::Object;
 
 #-----------------------------------------------------------------
 # accessible attributes
@@ -630,7 +631,7 @@
 {
     my %_allowed =
         (
-         'SequenceString' =&gt; {type =&gt; 'MOBY::Data::String'},
+         'SequenceString' =&gt; {type =&gt; 'MOSES::MOBY::Data::String'},
          );
 
     sub _accessible {
@@ -721,11 +722,11 @@
 # This is a mandatory section - but you can still choose one of
 # the two options (keep one and commented out the other):
 #-----------------------------------------------------------------
-use MOBY::Base;
+use MOSES::MOBY::Base;
 # --- (1) this option loads dynamically everything
 BEGIN {
-    use MOBY::Generators::GenServices;
-    new MOBY::Generators::GenServices->load
+    use MOSES::MOBY::Generators::GenServices;
+    new MOSES::MOBY::Generators::GenServices->load
 	(authority     => 'samples.jmoby.net',
 	 service_names => ['Mabuhay']);
 }
@@ -741,8 +742,8 @@
 # (this to stay here with any of the options above)
 use vars qw( @ISA );
 @ISA = qw( net::jmoby::samples::MabuhayBase );
-use MOBY::Package;
-use MOBY::ServiceException;
+use MOSES::MOBY::Package;
+use MOSES::MOBY::ServiceException;
 use strict;
 </pre>
        
@@ -771,7 +772,7 @@
 # EDIT: PUT REAL VALUES INTO THE RESPONSE
 # fill the response
 foreach my $elem (0..2) {
-    my $hello = new MOBY::Data::simple_key_value_pair
+    my $hello = new MOSES::MOBY::Data::simple_key_value_pair
         (
          value => "this is a 'value $elem'",   # TO BE EDITED
          key => "this is a 'key $elem'",   # TO BE EDITED
@@ -867,7 +868,7 @@
   <dt class="subtitle">config-status.pl
   <dd> This script does not do much but gives you overview of your
 configuration and installation. You can run it to find how
-<em>will</em> Perl Moses behaves when used. For example:
+Perl Moses <em>will</em> behave when used. For example:
 
        <pre class="sscript">
 Perl-MoSeS VERSION: 0.8
@@ -950,13 +951,13 @@
        <pre class="sscript">
 2006/07/30 23:00:33 (492) INFO> [[undef]] GenTypes.pm:125 - Data types will be generated into:
        '/home/senger/moby-live/Java/src/scripts/../Perl/generated'
-2006/07/30 23:00:33 (493) DEBUG> [[undef]] GenTypes.pm:149 - MOBY::Data::BasicGFFSequenceFeature will be generated
-2006/07/30 23:00:33 (665) DEBUG> [[undef]] GenTypes.pm:149 - MOBY::Data::DNASequence will be generated
-2006/07/30 23:00:33 (669) DEBUG> [[undef]] GenTypes.pm:149 - MOBY::Data::DNASequenceWithGFFFeatures will be generated
-2006/07/30 23:00:33 (673) DEBUG> [[undef]] GenTypes.pm:149 - MOBY::Data::GenericSequence will be generated
-2006/07/30 23:00:33 (676) DEBUG> [[undef]] GenTypes.pm:149 - MOBY::Data::NucleotideSequence will be generated
-2006/07/30 23:00:33 (680) DEBUG> [[undef]] GenTypes.pm:149 - MOBY::Data::VirtualSequence will be generated
-2006/07/30 23:00:33 (684) DEBUG> [[undef]] GenTypes.pm:149 - MOBY::Data::multi_key_value_pair will be generated</pre>
+2006/07/30 23:00:33 (493) DEBUG> [[undef]] GenTypes.pm:149 - MOSES::MOBY::Data::BasicGFFSequenceFeature will be generated
+2006/07/30 23:00:33 (665) DEBUG> [[undef]] GenTypes.pm:149 - MOSES::MOBY::Data::DNASequence will be generated
+2006/07/30 23:00:33 (669) DEBUG> [[undef]] GenTypes.pm:149 - MOSES::MOBY::Data::DNASequenceWithGFFFeatures will be generated
+2006/07/30 23:00:33 (673) DEBUG> [[undef]] GenTypes.pm:149 - MOSES::MOBY::Data::GenericSequence will be generated
+2006/07/30 23:00:33 (676) DEBUG> [[undef]] GenTypes.pm:149 - MOSES::MOBY::Data::NucleotideSequence will be generated
+2006/07/30 23:00:33 (680) DEBUG> [[undef]] GenTypes.pm:149 - MOSES::MOBY::Data::VirtualSequence will be generated
+2006/07/30 23:00:33 (684) DEBUG> [[undef]] GenTypes.pm:149 - MOSES::MOBY::Data::multi_key_value_pair will be generated</pre>
 
    An obvious question is "where are the data types generated to"? <p>
 
@@ -997,14 +998,14 @@
 senger at sherekhan:~/jMoby/src/Perl$ ../scripts/generate-datatypes.pl
 Generating all data types.
 Done.
-senger at sherekhan:~/jMoby/src/Perl$ for n in generated/MOBY/Data/*.pm ; do perl -c $n ; done
-generated/MOBY/Data/ABI_Encoded.pm syntax OK
-generated/MOBY/Data/Ace_Text.pm syntax OK
-generated/MOBY/Data/Alignment.pm syntax OK
+senger at sherekhan:~/jMoby/src/Perl$ <b>for n in generated/MOSES/MOBY/Data/*.pm ; do perl -c $n ; done</b>
+generated/MOSES/MOBY/Data/ABI_Encoded.pm syntax OK
+generated/MOSES/MOBY/Data/Ace_Text.pm syntax OK
+generated/MOSES/MOBY/Data/Alignment.pm syntax OK
 ...
-generated/MOBY/Data/WU_BLAST_Text.pm syntax OK
-generated/MOBY/Data/xdom_flatfile.pm syntax OK
-generated/MOBY/Data/zPDB.pm syntax OK
+generated/MOSES/MOBY/Data/WU_BLAST_Text.pm syntax OK
+generated/MOSES/MOBY/Data/xdom_flatfile.pm syntax OK
+generated/MOSES/MOBY/Data/zPDB.pm syntax OK
 senger at sherekhan:~/jMoby/src/Perl$
 </pre>
        
@@ -1016,7 +1017,7 @@
 script). <p>
 
        Usually, you generate code for one or only several
-services. And because all services belong to some authority you need
+services. And because each service belongs to an authority you need
 to tell both:
 
        <pre class="script">
@@ -1111,7 +1112,7 @@
   <dt class="subtitle">known-registries.pl
   <dd> The Perl Moses has a hard-coded list of known BioMoby
 registries. New entries can be added - check the comments in
-<tt>MOBY::Cache::Registries</tt>. Each registry has an abbreviation (a
+<tt>MOSES::MOBY::Cache::Registries</tt>. Each registry has an abbreviation (a
 synonym) that can be used in Perl Moses configuration - it is easier
 and less error-prone than using the long registry's endpoint. This
 script can tell you which registry has which synonym (and few other
@@ -1121,7 +1122,7 @@
 ../scripts/known-registries.pl</pre>
 
        In the time of writing this documentation, the response was
-(note hat one of the registry is labelled as the "default" one):
+(note that one of the registries is labeled as the "default" one):
 
        <pre class="ssscript">
 IRRI, MIPS, default, iCAPTURE, testing
@@ -1161,7 +1162,7 @@
        }
 };</pre>
        <p>
-    This script does not have any options.
+    This script does not have any options (nor the help).
        <p>
 
   <dt class="subtitle">local-cache.pl
@@ -1176,15 +1177,15 @@
        <pre class="script">../scripts/local-cache.pl -t DNASequence</pre>
 
        <pre class="sscript">
--> MOBY::Def::DataType=HASH(0x86026b8)
+-> MOSES::MOBY::Def::DataType=HASH(0x86026b8)
    'authority' => 'www.illuminae.com'
    'children' => ARRAY(0x86028b0)
         empty array
    'description' => 'Lightweight representation a DNA sequence'
    'email' => 'markw at illuminae.com'
    'lsid' => 'urn:lsid:biomoby.org:objectclass:DNASequence:2001-09-21T16-00-00Z'
-   'module_name' => 'MOBY::Data::DNASequence'
-   'module_parent' => 'MOBY::Data::NucleotideSequence'
+   'module_name' => 'MOSES::MOBY::Data::DNASequence'
+   'module_parent' => 'MOSES::MOBY::Data::NucleotideSequence'
    'name' => 'DNASequence'
    'parent' => 'NucleotideSequence'
 </pre>
@@ -1196,16 +1197,16 @@
 
        <pre class="sscript">
 All children of 'DNASequence':
--> MOBY::Def::Relationship=HASH(0x860e608)
+-> MOSES::MOBY::Def::Relationship=HASH(0x860e608)
    'datatype' => 'String'
    'memberName' => 'SequenceString'
-   'module_datatype' => 'MOBY::Data::String'
+   'module_datatype' => 'MOSES::MOBY::Data::String'
    'original_memberName' => 'SequenceString'
    'relationship' => 'HASA'
--> MOBY::Def::Relationship=HASH(0x863a3bc)
+-> MOSES::MOBY::Def::Relationship=HASH(0x863a3bc)
    'datatype' => 'Integer'
    'memberName' => 'Length'
-   'module_datatype' => 'MOBY::Data::Integer'
+   'module_datatype' => 'MOSES::MOBY::Data::Integer'
    'original_memberName' => 'Length'
    'relationship' => 'HASA'
 </pre>
@@ -1299,8 +1300,8 @@
 XML. It always takes an XML file name as a parameter:
 
        <pre class="script">
-../scripts/testing-parser.pl jMoby/data/parser-test-input2.xml
-../scripts/testing-parser.pl -r jMoby/data/parser-test-input2.xml</pre>
+../scripts/testing-parser.pl ~/jMoby/data/parser-test-input2.xml
+../scripts/testing-parser.pl -r ~/jMoby/data/parser-test-input2.xml</pre>
 
        An interesting is the <tt>-b</tt> parameter. It has the form:
        <pre class="script">
@@ -1347,9 +1348,9 @@
 
        <ul>
 	 <li class="tiny"> A mandatory package name - a full package
-name of a called service.
+name of the called service.
 	 <li class="tiny"> Option <tt>-l location</tt> can be used to
-specify a directory where is called service stored. Default is
+specify a directory where is the called service stored. Default is
 <tt>src/Perl/services</tt>.
 	 <li class="tiny"> Options <tt>-v</tt> and <tt>-d</tt> make
 also sense in this mode (but not in the other one).
@@ -1358,10 +1359,9 @@
 
        <pre class="script">../scripts/testing-service.pl -d Service::HelloBiomobyWorld</pre>
 
-       The output of this call <a href="#first">was already shown</a>
-in the documentation (even though it was an example of the full,
-SOAP-based call). Therefore, just look what debug messages were logged
-(notice the <tt>-d</tt> option used):
+       The output of this call <a href="#first5">was already shown</a>
+in this documentation. Therefore, just look what debug messages were
+logged (notice the <tt>-d</tt> option used):
 
        <pre class="sscript">
 2006/07/31 02:19:37 (561) INFO> [23856] HelloBiomobyWorldBase.pm:92 - *** REQUEST START ***
@@ -1379,7 +1379,7 @@
 
        <ul>
 	 <li class="tiny"> A mandatory service name (not a package
-name) of a called service.
+name) of the called service.
 	 <li class="tiny"> A mandatory endpoint <tt>-e endpoint</tt>
 defining where is the service located. Actually, presence of this
 parameter decides which mode is used.
@@ -1389,6 +1389,16 @@
        <pre class="script">
 ../scripts/testing-service.pl \
        -e http://localhost/cgi-bin/MobyServer.cgi HelloBiomobyWorld</pre>
+<p>
+
+       There are also few other behavioral differences between these
+two modes: If an input parsing error occurs (e.g. when an input has an
+unknown article name), it is reported directly to the standard error
+in the testing mode, but in a real mode it is properly included in the
+response as an exception. Or (and only if the logging is set to record
+debug messages), in testing mode the full input raw (not yet parsed)
+are logged, whereas in the real mode only the first 1000 characters
+are logged. <p>
        
        
   <dt class="subtitle">universal-testing.pl
@@ -1525,7 +1535,7 @@
 
 Perl Moses stores configuration in a file named
 <u><tt>moby-services.cfg</tt></u>. The file name is hard-coded (and
-cannot be changed without changing the <tt>MOBY::Config</tt> module),
+cannot be changed without changing the <tt>MOSES::MOBY::Config</tt> module),
 but its location can be set using an environment variable
 <tt>BIOMOBY_CFG_DIR</tt>. Perl Moses looks for its
 configuration place in the following places, in this order:
@@ -1547,7 +1557,7 @@
 it anyway. <p>
 
 The Perl Moses internally uses <tt>Config::Simple</tt> CPAN module,
-but wraps it into its own <tt>MOBY::Config</tt>. This allows expansion
+but wraps it into its own <tt>MOSES::MOBY::Config</tt>. This allows expansion
 later, or even changing the underlying configuration system. The
 <tt>Config::Simple</tt> is simple (thus the name, and thus we selected
 it) but has few drawbacks that may be worth to work on later. <p>
@@ -1720,16 +1730,16 @@
 You can also change or add parameters during the run-time. For
 example, the script <tt>universal-testing.pl</tt> needs to overwrite
 existing parameters because it wants to create everything in a
-separate space, in temporary directory, and within a 'Testing'
+separate space, in a temporary directory, and within the 'Testing'
 package. Because the generators read from the configuration files, it
 is necessary to change it there:
 
 <pre class="sscript">
 my $outdir = File::Spec->catfile ($tmpdir, 'generated-services');
-MOBY::Config->param ('generators.impl.outdir', $outdir);
-MOBY::Config->param ('generators.impl.package.prefix', 'Testing');
+MOSES::MOBY::Config->param ('generators.impl.outdir', $outdir);
+MOSES::MOBY::Config->param ('generators.impl.package.prefix', 'Testing');
 unshift (@INC, $MOBYCFG::GENERATORS_IMPL_OUTDIR);
-my $generator = new MOBY::Generators::GenServices;
+my $generator = new MOSES::MOBY::Generators::GenServices;
 </pre>
 
 More about how to communicate pragmatically with the configuration can
@@ -1752,10 +1762,10 @@
 How does it work in Perl Moses? <p>
 
 The logging is available from the moment when Perl Moses knows about
-the <tt>MOBY::Base</tt> module. All generated service implementations
-inherit from this class, so all of them has immediate access to the
-logging system. By default, the <tt>MOBY::Base</tt> creates a
-<em>logger</em> named <tt>$LOG</tt>. Which means that in your service
+the <tt>MOSES::MOBY::Base</tt> module. All generated service implementations
+inherit from this class, so all of them have immediate access to the
+logging system. By default, the <tt>MOSES::MOBY::Base</tt> creates a
+<em>logger</em> in a variable <tt>$LOG</tt>. Which means that in your service
 implementation you can log events in five different log levels:
 
 <pre class="sscript">
@@ -1772,7 +1782,7 @@
 You can create your own logger. Which may be good if you wish to have,
 for example, a different logging level for a particular service, or
 for a part of it (an example of such situation is in
-<tt>MOBY::Parser.pm</tt> where the parser creates its own
+<tt>MOSES::MOBY::Parser.pm</tt> where the parser creates its own
 <tt>$PLOG</tt> logger). Here is what you need to do:
 
 <pre class="sscript">
@@ -1794,14 +1804,14 @@
 
   If Perl Moses cannot find a <tt>log4perl.properties</tt> file, and
 if there are no logging options in <tt>moby-services.cfg</tt>, it
-assumes some defaults (check them in <tt>MOBY::Base</tt>, in its BEGIN
+assumes some defaults (check them in <tt>MOSES::MOBY::Base</tt>, in its BEGIN
 section, if you need-to-know). <p>
 
     The better way is to use <tt>log4perl.properties</tt> file. The
 file name can be actually different - it is specified by an option
 <tt>log.config</tt> in the <tt>moby-services.cfg</tt> configuration
 file. This is what PerlMoses installation creates there (of course,
-with your own path):
+using your own path):
 
 <pre class="sscript">
 [log]
@@ -1844,7 +1854,7 @@
 To change the log level to DEBUG, replace INFo by DEBUG in the first
 line. <p>
 
-The message format (in Perl Moses default way) means:
+The message format (unless you change the Perl Moses default way) means:
 
 <pre class="sscript">
 %d                  (%r ) %p   > [%x   ] %F{1}               :%L - %m      %n
@@ -2037,11 +2047,11 @@
 # This is a mandatory section - but you can still choose one of
 # the two options (keep one and commented out the other):
 #-----------------------------------------------------------------
-use MOBY::Base;
+use MOSES::MOBY::Base;
 # --- (1) this option loads dynamically everything
 BEGIN {
-    use MOBY::Generators::GenServices;
-    new MOBY::Generators::GenServices->load
+    use MOSES::MOBY::Generators::GenServices;
+    new MOSES::MOBY::Generators::GenServices->load
         (authority     => 'samples.jmoby.net',
          service_names => ['Mabuhay']);
 }
@@ -2062,13 +2072,13 @@
 called <em>jobs</em>). Your service implementation has to implement
 method <b>process_it</b> that is called for every individual job
 contained within every incoming request. The <!-- <a
-href="MOBY/Service/ServiceBase.html"> -->MOBY/Service/ServiceBase</a>
+href="MOSES/MOBY/Service/ServiceBase.html"> -->MOSES/MOBY/Service/ServiceBase</a>
 has details about this method (what parameters it gets, how to deal
 with exceptions, etc.). <p>
 
-In the beginning of the generated <tt>process_it</tt> method is code
-that tells you what methods are available for reading inputs, and at
-the end of the same method is the code showing how to fill the
+In the beginning of the generated <tt>process_it</tt> method is the
+code that tells you what methods are available for reading inputs, and
+at the end of the same method is the code showing how to fill the
 response. Feel free to remove the code, extend it, fill it, turn it
 upside-down, whatever. This is, after all, your implementation. And
 Perl Moses generator is clever enough not to overwrite the code once
@@ -2077,21 +2087,32 @@
 <p>
 
 Perhaps the best way how to close this section is to show a <EM>full
-implementation</EM> of (so often mentioned) service Mabuhay:
+implementation</EM> of (so often mentioned) service Mabuhay (the code
+is also available in <tt>jMoby/src/Perl/samples</tt>):
 
 <pre class="sscript">
 sub process_it {
     my ($self, $request, $response, $context) = @_;
 
+    # read (some) input data
+    # (use eval to protect against missing data)
+    my $language = eval { $request->language };
+    my $regex = eval { $language->regex->value };
+    my $ignore_cases = eval { $language->case_insensitive->value };
+
+    # set an exception if data are not complete
+    unless ($language and $regex) {
+	$response->record_error ( { code => INPUTS_INVALID,
+				    msg  => 'Input regular expression is missing.' } );
+	return;
+    }
 
-    my $regex = $request->language->regex->value;
-    my $ignore_cases = $request->language->case_insensitive->value;
-
+    # creating an answer (this is the "business logic" of this service)
     my @result_hellos = ();
     my @result_langs = ();
     open HELLO, $MOBYCFG::MABUHAY_RESOURCE_FILE
-	or $self->throw ('Mabuhay resource file not found.');
-    while (<HELLO>) {
+        or $self->throw ('Mabuhay resource file not found.');
+    while (&lt;HELLO&gt;) {
 	chomp;
 	my ($lang, $hello) = split (/\t+/, $_, 2);
 	if ( $ignore_cases ? 
@@ -2104,7 +2125,7 @@
     close HELLO;
 
     foreach my $idx (0 .. $#result_hellos) {
-	$response->add_hello (new MOBY::Data::simple_key_value_pair
+	$response->add_hello (new MOSES::MOBY::Data::simple_key_value_pair
 			      ( key   => $self->as_uni_string ($result_langs[$idx]),
 				value => $self->as_uni_string ($result_hellos[$idx])
 				));
@@ -2112,6 +2133,119 @@
 }
 </pre>
 
+When you go through the code above you notice how to do basic things
+that almost every service has to do. Which are:
+
+<dl>
+  <dt class="sb"> Reading input data:
+  <dd> The possible methods were already pre-generated for you so you
+know what methods to use. But you should always check if the data are
+really there (the clients can send you rubbish, of course). <p>
+
+       What was not pre-generated are the methods accessing
+<em>ID</em> and <em>NAMESPACE</em>. Their names are, not surprisingly,
+<tt>id</tt> and <tt>namespace</tt>. For example, the Mabuhay input is
+named <tt>language</tt> (as seen in the code above), so you can call:
+
+       <pre class="sscript">
+$language->id;
+$language->namespace;</pre>
+       
+       The question is what to do if input (or anything else) is not
+complete or valid. This brings us to... <p>
+
+  <dt class="sb"> Reporting exceptions:
+  <dd> One option is to <em>throw an exception</em>:
+
+       <pre class="sscript">
+open HELLO, $MOBYCFG::MABUHAY_RESOURCE_FILE
+     or $self->throw ('Mabuhay resource file not found.');</pre>
+
+       This immediately stops the processing of the input request
+(ignoring all remaining jobs if they are some still there), the text
+of the error message is put into the response as an exception with the
+code 600 ("INTERNAL_PROCESSING_ERROR"), the same message is logged as
+an error, and the response is sent back to the client. <p>
+
+       Note, however, that the response may already contain some
+outputs from the previously processed jobs. If you do not like it, you
+can remove it (find them in the <tt>$context</tt> parameter). <p>
+
+       Another, less drastic, option is to <em>record an
+exception</em> (and, usually, return):
+
+       <pre class="sscript">
+$response->record_error ( { code => INPUTS_INVALID,
+			    msg  => 'Input regular expression is missing.' } );</pre>
+
+       This creates an exception in the response - you choose what
+code to use -, and it does not prevent processing of the remaining (if
+any) jobs. <p>
+
+       In addition to using an <tt>eval{}</tt> block to handle
+exceptions (as shown above), you can also use a
+<em>try-catch-finally</em> block structure if <tt>Error.pm</tt> has
+been installed in your system. See documentation of
+<tt>MOSES::MOBY::Base</tt> for details and examples. <p>
+
+
+  <dt class="sb"> Creating output data:
+  <dd> Again, methods for creating response were pre-generated, so you
+have hints how to use them (they slightly differ for simple and
+collection outputs; but hopefully in a logical way). <p>
+
+       Again here you can also set the <em>ID</em> and
+<em>NAMESPACE</em>. For example, the code above can be extended so the
+<tt>MOSES::MOBY::Data::simple_key_value_pair</tt> data type will have
+also an ID and NAMESPACE:
+
+       <pre class="sscript">
+$response->add_hello (new MOSES::MOBY::Data::simple_key_value_pair
+                      ( key   => $self->as_uni_string ($result_langs[$idx]),
+			value => $self->as_uni_string ($result_hellos[$idx]),
+			<b>id    => 'this is an ID',
+                        namespace => 'this is a NAMESPACE'</b>
+	              ));</pre>
+
+  <dt class="sb"> Creating and adding cross-references:
+  <dd> Each output object can have attached zero or more
+cross-references. See documentation of
+<tt>MOSES::MOBY::Data::Xref</tt>. For example, in the
+<em>HelloBioMobyWorld</em> service one can add two cross-references:
+
+       <pre class="sscript">
+# create a simple cross-reference
+ my $simple_xref = new MOSES::MOBY::Data::Xref
+    ( id        => 'At263644',
+      namespace => 'TIGR'
+    );
+
+ # create an advanced cross-reference
+ my $advanced_xref = new MOSES::MOBY::Data::Xref
+    ( id           => 'X112345',
+      namespace    => 'EMBL',
+      service      => 'getEMBLRecord',
+      authority    => 'www.illuminae.com',
+      evidenceCode => 'IEA',
+      xrefType     => 'transform'
+    );
+
+# add them to the output object (which has an article name 'greeting')
+$response->greeting->add_xrefs ($simple_xref);
+$response->greeting->add_xrefs ($advanced_xref);
+</pre>
+
+       <dt class="sb"> Creating a service note:
+  <dd> Just use the method <tt>serviceNotes</tt> on the <tt>$context</tt>
+parameter:
+
+       <pre class="sscript">
+$context->serviceNotes ("This is my note...");</pre>
+<p>
+
+
+</dl>
+<p>
 
 
 <!--
@@ -2159,15 +2293,15 @@
 also use a try-catch-finally block structure if C<Error.pm> has been
 installed in your system. See its documentation for details.
 
-Here's an example. See the L<MOBY::Exception> module for other
+Here's an example. See the L<MOSES::MOBY::Exception> module for other
 pre-defined exception types:
 
    try {
-      open (IN, $file) || $obj->throw( -class => 'MOBY::FileOpenException',
+      open (IN, $file) || $obj->throw( -class => 'MOSES::MOBY::FileOpenException',
                                        -text => "Cannot open file $file for reading",
                                        -value => $!);
    }
-   catch MOBY::Exception with {
+   catch MOSES::MOBY::Exception with {
        my $err = shift;   # get the Error object
        # Perform general exception handling code for any MOBY exception.
    }
@@ -2219,51 +2353,51 @@
 <dl>
   <dt>The core:
        <dl>
-	 <dt><!-- <a href="MOBY/Base.html"> -->MOBY/Base</a></dt>
-	 <dt><!-- <a href="MOBY/Package.html"> -->MOBY/Package</a></dt>
-	 <dt><!-- <a href="MOBY/Service/ServiceBase.html"> -->MOBY/Service/ServiceBase</a></dt>
-	 <dt><!-- <a href="MOBY/Config.html"> -->MOBY/Config</a></dt>
-	 <dt><!-- <a href="MOBY/Parser.html"> -->MOBY/Parser</a> (also a part of
+	 <dt><!-- <a href="MOSES/MOBY/Base.html"> -->MOSES/MOBY/Base</a></dt>
+	 <dt><!-- <a href="MOSES/MOBY/Package.html"> -->MOSES/MOBY/Package</a></dt>
+	 <dt><!-- <a href="MOSES/MOBY/Service/ServiceBase.html"> -->MOSES/MOBY/Service/ServiceBase</a></dt>
+	 <dt><!-- <a href="MOSES/MOBY/Config.html"> -->MOSES/MOBY/Config</a></dt>
+	 <dt><!-- <a href="MOSES/MOBY/Parser.html"> -->MOSES/MOBY/Parser</a> (also a part of
 the core but you will rarely use it directly)</dt>
        </dl><p>
 
   <dt>BioMoby data containers:
        <dl>
-	 <dt><!-- <a href="MOBY/Data/Object.html"> -->MOBY/Data/Object</a></dt>
-	 <dt><!-- <a href="MOBY/Data/String.html"> -->MOBY/Data/String</a></dt>
-	 <dt><!-- <a href="MOBY/Data/Boolean.html"> -->MOBY/Data/Boolean</a></dt>
-	 <dt><!-- <a href="MOBY/Data/DateTime.html"> -->MOBY/Data/DateTime</a></dt>
-	 <dt><!-- <a href="MOBY/Data/Float.html"> -->MOBY/Data/Float</a></dt>
-	 <dt><!-- <a href="MOBY/Data/Integer.html"> -->MOBY/Data/Integer</a></dt>
-	 <dt><!-- <a href="MOBY/Data/ProvisionInformation.html"> -->MOBY/Data/ProvisionInformation</a></dt>
-	 <dt><!-- <a href="MOBY/Data/Xref.html"> -->MOBY/Data/Xref</a></dt>
-	 <dt><!-- <a href="MOBY/ServiceException.html"> -->MOBY/ServiceException</a></dt>
+	 <dt><!-- <a href="MOSES/MOBY/Data/Object.html"> -->MOSES/MOBY/Data/Object</a></dt>
+	 <dt><!-- <a href="MOSES/MOBY/Data/String.html"> -->MOSES/MOBY/Data/String</a></dt>
+	 <dt><!-- <a href="MOSES/MOBY/Data/Boolean.html"> -->MOSES/MOBY/Data/Boolean</a></dt>
+	 <dt><!-- <a href="MOSES/MOBY/Data/DateTime.html"> -->MOSES/MOBY/Data/DateTime</a></dt>
+	 <dt><!-- <a href="MOSES/MOBY/Data/Float.html"> -->MOSES/MOBY/Data/Float</a></dt>
+	 <dt><!-- <a href="MOSES/MOBY/Data/Integer.html"> -->MOSES/MOBY/Data/Integer</a></dt>
+	 <dt><!-- <a href="MOSES/MOBY/Data/ProvisionInformation.html"> -->MOSES/MOBY/Data/ProvisionInformation</a></dt>
+	 <dt><!-- <a href="MOSES/MOBY/Data/Xref.html"> -->MOSES/MOBY/Data/Xref</a></dt>
+	 <dt><!-- <a href="MOSES/MOBY/ServiceException.html"> -->MOSES/MOBY/ServiceException</a></dt>
        </dl><p>
 
   <dt>Access to the local cache, and BioMoby data definitions:
        <dl>
-	 <dt><!-- <a href="MOBY/Cache/Central.html"> -->MOBY/Cache/Central</a></dt>
-	 <dt><!-- <a href="MOBY/Cache/Registries.html"> -->MOBY/Cache/Registries</a></dt>
+	 <dt><!-- <a href="MOSES/MOBY/Cache/Central.html"> -->MOSES/MOBY/Cache/Central</a></dt>
+	 <dt><!-- <a href="MOSES/MOBY/Cache/Registries.html"> -->MOSES/MOBY/Cache/Registries</a></dt>
 	      <p>
 
-	 <dt><!-- <a href="MOBY/Def/Data.html"> -->MOBY/Def/Data</a></dt>
-	 <dt><!-- <a href="MOBY/Def/DataType.html"> -->MOBY/Def/DataType</a></dt>
-	 <dt><!-- <a href="MOBY/Def/Namespace.html"> -->MOBY/Def/Namespace</a></dt>
-	 <dt><!-- <a href="MOBY/Def/Relationship.html"> -->MOBY/Def/Relationship</a></dt>
-	 <dt><!-- <a href="MOBY/Def/Service.html"> -->MOBY/Def/Service</a></dt>
-	 <dt><!-- <a href="MOBY/Def/ServiceType.html"> -->MOBY/Def/ServiceType</a></dt>
+	 <dt><!-- <a href="MOSES/MOBY/Def/Data.html"> -->MOSES/MOBY/Def/Data</a></dt>
+	 <dt><!-- <a href="MOSES/MOBY/Def/DataType.html"> -->MOSES/MOBY/Def/DataType</a></dt>
+	 <dt><!-- <a href="MOSES/MOBY/Def/Namespace.html"> -->MOSES/MOBY/Def/Namespace</a></dt>
+	 <dt><!-- <a href="MOSES/MOBY/Def/Relationship.html"> -->MOSES/MOBY/Def/Relationship</a></dt>
+	 <dt><!-- <a href="MOSES/MOBY/Def/Service.html"> -->MOSES/MOBY/Def/Service</a></dt>
+	 <dt><!-- <a href="MOSES/MOBY/Def/ServiceType.html"> -->MOSES/MOBY/Def/ServiceType</a></dt>
        </dl><p>
 
   <dt> Perl Moses code generators:
        <dl>
-	 <dt><!-- <a href="MOBY/Generators/GenServices.html"> -->MOBY/Generators/GenServices</a></dt>
-	 <dt><!-- <a href="MOBY/Generators/GenTypes.html"> -->MOBY/Generators/GenTypes</a></dt>
-	 <dt><!-- <a href="MOBY/Generators/Utils.html"> -->MOBY/Generators/Utils</a></dt>
+	 <dt><!-- <a href="MOSES/MOBY/Generators/GenServices.html"> -->MOSES/MOBY/Generators/GenServices</a></dt>
+	 <dt><!-- <a href="MOSES/MOBY/Generators/GenTypes.html"> -->MOSES/MOBY/Generators/GenTypes</a></dt>
+	 <dt><!-- <a href="MOSES/MOBY/Generators/Utils.html"> -->MOSES/MOBY/Generators/Utils</a></dt>
        </dl><p>
 
   <dt> ...and the rest
        <dl>
-	 <dt><!-- <a href="MOBY/Tags.html"> -->MOBY/Tags</a></dt>
+	 <dt><!-- <a href="MOSES/MOBY/Tags.html"> -->MOSES/MOBY/Tags</a></dt>
        </dl>
 </dl>
 </div>
@@ -2310,7 +2444,7 @@
 about them. <p>
 
 And there are features (and known) bugs that should or could be
-implemented (or fixed). Here are those we am aware of (<span
+implemented (or fixed). Here are those I am aware of (<span
 class="sbred">B</span> = bug, <span class="sb">N</span> = not yet
 implemented, <span class="sb">F</span> = potential future feature):
 <p>
@@ -2327,7 +2461,7 @@
 it expands hints how to write your own service implementation. <p>
 
   <li class="tiny"> <span class="sb">(N)</span> The generated service
-implementation could have better Perl documentation listing all
+implementation could have a better Perl documentation, listing all
 available methods for inputs and outputs (the methods are already
 shown in the code, but having them also in the POD would help). <p>
 
@@ -2371,7 +2505,7 @@
 <div align=right class="address">
 <address><A HREF="mailto:martin.senger at gmail.com">Martin Senger</A><BR></address>
 <!-- hhmts start -->
-Last modified: Tue Aug  1 15:56:36 2006
+Last modified: Sat Oct 14 21:42:54 2006
 <!-- hhmts end -->
 </div>
 




More information about the MOBY-guts mailing list