docs: LP1599600 clean up source callout formatting and resize images user/jlundgren/lp1599600_introducing_opensrf
authorJeanette Lundgren <jlundgren@cwmars.org>
Wed, 21 Jun 2017 18:48:19 +0000 (14:48 -0400)
committerJeanette Lundgren <jlundgren@cwmars.org>
Wed, 21 Jun 2017 18:48:19 +0000 (14:48 -0400)
Signed-off-by: Jeanette Lundgren <jlundgren@cwmars.org>
docs/development/intro_opensrf.adoc
docs/media/CONNECT.png
docs/media/REQUEST.png

index 2bce37b..0b1e0ce 100644 (file)
@@ -110,14 +110,14 @@ HTTP client.
 [source,bash]
 --------------------------------------------------------------------------------
 # curl request broken up over multiple lines for legibility
-curl -H "X-OpenSRF-service: opensrf.simple-text"                                \ # <1>
-    --data 'osrf-msg=[                                                          \ # <2>
-        {"__c":"osrfMessage","__p":{"threadTrace":0,"locale":"en-CA",           \ # <3>
-            "type":"REQUEST","payload": {"__c":"osrfMethod","__p":              \
-                {"method":"opensrf.simple-text.reverse","params":["foobar"]}    \
-            }}                                                                  \
-        }]'                                                                     \
-http://localhost/osrf-http-translator                                           \ # <4>
+curl -H "X-OpenSRF-service: opensrf.simple-text"                                // <1>
+    --data 'osrf-msg=[                                                          // <2>
+        {"__c":"osrfMessage","__p":{"threadTrace":0,"locale":"en-CA",           // <3>
+            "type":"REQUEST","payload": {"__c":"osrfMethod","__p":              
+                {"method":"opensrf.simple-text.reverse","params":["foobar"]}    
+            }}                                                                  
+        }]'                                                                     
+http://localhost/osrf-http-translator                                           // <4>
 --------------------------------------------------------------------------------
 
 <1> The `X-OpenSRF-service` header identifies the OpenSRF service of interest.
@@ -155,18 +155,18 @@ configuration files shipped with the OpenSRF source, but this is configurable.
 [source,bash]
 --------------------------------------------------------------------------------
 # HTTP response broken up over multiple lines for legibility
-[{"__c":"osrfMessage","__p":                                                    \ # <1>
-    {"threadTrace":0, "payload":                                                \ # <2> 
-        {"__c":"osrfResult","__p":                                              \ # <3>
-            {"status":"OK","content":"raboof","statusCode":200}                 \ # <4>
-        },"type":"RESULT","locale":"en-CA"                                      \ # <5>
+[{"__c":"osrfMessage","__p":                                                    // <1>
+    {"threadTrace":0, "payload":                                                // <2> 
+        {"__c":"osrfResult","__p":                                              // <3>
+            {"status":"OK","content":"raboof","statusCode":200}                 // <4>
+        },"type":"RESULT","locale":"en-CA"                                      // <5>
     }
 },
-{"__c":"osrfMessage","__p":                                                     \ # <6>
-    {"threadTrace":0,"payload":                                                 \ # <7>
-        {"__c":"osrfConnectStatus","__p":                                       \ # <8>
-            {"status":"Request Complete","statusCode":205}                      \ # <9>
-        },"type":"STATUS","locale":"en-CA"                                      \ # <10>
+{"__c":"osrfMessage","__p":                                                     // <6>
+    {"threadTrace":0,"payload":                                                 // <7>
+        {"__c":"osrfConnectStatus","__p":                                       // <8>
+            {"status":"Request Complete","statusCode":205}                      // <9>
+        },"type":"STATUS","locale":"en-CA"                                      // <10>
     }
 }]
 --------------------------------------------------------------------------------
@@ -323,21 +323,21 @@ element (corresponding to the XPath `/opensrf/default/apps/`):
 [source,xml]
 --------------------------------------------------------------------------------
 <apps>
-  <opensrf.simple-text>                                                      <!-- <1> -->
-    <keepalive>3</keepalive>                                                 <!-- <2> -->
-    <stateless>1</stateless>                                                 <!-- <3> -->        
-    <language>perl</language>                                                <!-- <4> -->
-    <implementation>OpenSRF::Application::Demo::SimpleText</implementation>  <!-- <5> -->
-    <max_requests>100</max_requests>                                         <!-- <6> -->
+  <opensrf.simple-text>                                                      // <1>
+    <keepalive>3</keepalive>                                                 // <2>
+    <stateless>1</stateless>                                                 // <3>        
+    <language>perl</language>                                                // <4>
+    <implementation>OpenSRF::Application::Demo::SimpleText</implementation>  // <5>
+    <max_requests>100</max_requests>                                         // <6>
     <unix_config>
-      <max_requests>1000</max_requests>                                      <!-- <7> -->
-      <unix_log>opensrf.simple-text_unix.log</unix_log>                      <!-- <8> -->
-      <unix_sock>opensrf.simple-text_unix.sock</unix_sock>                   <!-- <9> -->
-      <unix_pid>opensrf.simple-text_unix.pid</unix_pid>                     <!-- <10> -->
-      <min_children>5</min_children>                                        <!-- <11> -->
-      <max_children>15</max_children>                                       <!-- <12> -->
-      <min_spare_children>2</min_spare_children>                            <!-- <13> -->
-      <max_spare_children>5</max_spare_children>                            <!-- <14> -->
+      <max_requests>1000</max_requests>                                      // <7>
+      <unix_log>opensrf.simple-text_unix.log</unix_log>                      // <8>
+      <unix_sock>opensrf.simple-text_unix.sock</unix_sock>                   // <9>
+      <unix_pid>opensrf.simple-text_unix.pid</unix_pid>                      // <10>
+      <min_children>5</min_children>                                         // <11>
+      <max_children>15</max_children>                                        // <12>
+      <min_spare_children>2</min_spare_children>                             // <13>
+      <max_spare_children>5</max_spare_children>                             // <14>
     </unix_config>
   </opensrf.simple-text>
 
@@ -395,14 +395,14 @@ of publicly accessible services:
 .Making a service publicly accessible in `opensrf_core.xml`
 [source,xml]
 --------------------------------------------------------------------------------
-<router>                                                                     <!-- <1> --
+<router>                                                                     // <1
     <!-- This is the public router. On this router, we only register applications
      which should be accessible to everyone on the opensrf network -->
     <name>router</name>
-    <domain>public.localhost</domain>                                        <!-- <2> -->
+    <domain>public.localhost</domain>                                        // <2>
     <services>
         <service>opensrf.math</service> 
-        <service>opensrf.simple-text</service>                               <!-- <3> -->
+        <service>opensrf.simple-text</service>                               // <3>
     </services>
 </router>
 --------------------------------------------------------------------------------
@@ -478,28 +478,28 @@ Received Data: {
   "__c":"opensrf.simple-text",
   "__p":{
     "api_level":1,
-    "stream":0,                                                      \ # <1>
+    "stream":0,                                                      // <1>
     "object_hint":"OpenSRF_Application_Demo_SimpleText",
     "remote":0,
-    "package":"OpenSRF::Application::Demo::SimpleText",              \ # <2>
-    "api_name":"opensrf.simple-text.reverse",                        \ # <3>
+    "package":"OpenSRF::Application::Demo::SimpleText",              // <2>
+    "api_name":"opensrf.simple-text.reverse",                        // <3>
     "server_class":"opensrf.simple-text",
-    "signature":{                                                    \ # <4>
-      "params":[                                                     \ # <5>
+    "signature":{                                                    // <4>
+      "params":[                                                     // <5>
         {
           "desc":"The string to reverse",
           "name":"text",
           "type":"string"
         }
       ],
-      "desc":"Returns the input string in reverse order\n",          \ # <6>
-      "return":{                                                     \ # <7>
+      "desc":"Returns the input string in reverse order\n",          // <6>
+      "return":{                                                     // <7>
         "desc":"Returns the input string in reverse order",
         "type":"string"
       }
     },
-    "method":"text_reverse",                                         \ # <8>
-    "argc":1                                                         \ # <9>
+    "method":"text_reverse",                                         // <8>
+    "argc":1                                                         // <9>
   }
 }
 --------------------------------------------------------------------------------
@@ -539,21 +539,21 @@ use strict;
 use OpenSRF::AppSession;
 use OpenSRF::System;
 
-OpenSRF::System->bootstrap_client(config_file => '/openils/conf/opensrf_core.xml'); # <1>
+OpenSRF::System->bootstrap_client(config_file => '/openils/conf/opensrf_core.xml'); // <1>
 
-my $session = OpenSRF::AppSession->create("opensrf.simple-text");                   # <2>
+my $session = OpenSRF::AppSession->create("opensrf.simple-text");                   // <2>
 
 print "substring: Accepts a string and a number as input, returns a string\n";
-my $result = $session->request("opensrf.simple-text.substring", "foobar", 3);       # <3>
-my $request = $result->gather();                                                    # <4>
+my $result = $session->request("opensrf.simple-text.substring", "foobar", 3);       // <3>
+my $request = $result->gather();                                                    // <4>
 print "Substring: $request\n\n";
 
 print "split: Accepts two strings as input, returns an array of strings\n";
-$request = $session->request("opensrf.simple-text.split", "This is a test", " ");   # <5>
+$request = $session->request("opensrf.simple-text.split", "This is a test", " ");   // <5>
 my $output = "Split: [";
 my $element;
-while ($element = $request->recv()) {                                               # <6>
-    $output .= $element->content . ", ";                                            # <7>
+while ($element = $request->recv()) {                                               // <6>
+    $output .= $element->content . ", ";                                            // <7>
 }
 $output =~ s/, $/]/;
 print $output . "\n\n";
@@ -565,12 +565,12 @@ my @many_strings = [
     "And then seventy desserts to finish off the day"
 ];
 
-$result = $session->request("opensrf.simple-text.statistics", @many_strings);       # <8>
-$request = $result->gather();                                                       # <9>
+$result = $session->request("opensrf.simple-text.statistics", @many_strings);       // <8>
+$request = $result->gather();                                                       // <9>
 print "Length: " . $result->{'length'} . "\n";
 print "Word count: " . $result->{'word_count'} . "\n";
 
-$session->disconnect();                                                             # <10>
+$session->disconnect();                                                             // <10>
 --------------------------------------------------------------------------------
 
 <1> The `OpenSRF::System->bootstrap_client()` method reads the OpenSRF
@@ -683,20 +683,20 @@ reading, updating, and deleting all of the defined classes.
 <class id="mous" controller="open-ils.cstore open-ils.pcrud"
  oils_obj:fieldmapper="money::open_user_summary"
  oils_persist:tablename="money.open_usr_summary"
- reporter:label="Open User Summary">                                       <!-- <1> -->
-    <fields oils_persist:primary="usr" oils_persist:sequence="">           <!-- <2> -->
-        <field name="balance_owed" reporter:datatype="money" />            <!-- <3> -->
+ reporter:label="Open User Summary">                                       // <1>
+    <fields oils_persist:primary="usr" oils_persist:sequence="">           // <2>
+        <field name="balance_owed" reporter:datatype="money" />            // <3>
         <field name="total_owed" reporter:datatype="money" />
         <field name="total_paid" reporter:datatype="money" />
         <field name="usr" reporter:datatype="link"/>
     </fields>
     <links>
-        <link field="usr" reltype="has_a" key="id" map="" class="au"/>     <!-- <4> -->
+        <link field="usr" reltype="has_a" key="id" map="" class="au"/>     // <4>
     </links>
-    <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">  <!-- <5> -->
+    <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">  // <5>
         <actions>
-            <retrieve permission="VIEW_USER">                              <!-- <6> -->
-                <context link="usr" field="home_ou"/>                      <!-- <7> -->
+            <retrieve permission="VIEW_USER">                              // <6>
+                <context link="usr" field="home_ou"/>                      // <7>
             </retrieve>
         </actions>
     </permacrud>
@@ -847,7 +847,7 @@ sub text_split {
     my $delimiter = shift || ' ';
 
     my @split_text = split $delimiter, $text;
-    foreach my $string (@split_text) {           # <1>
+    foreach my $string (@split_text) {           // <1>
         $conn->respond($string);
     }
     return undef;
@@ -856,7 +856,7 @@ sub text_split {
 __PACKAGE__->register_method(
     method    => 'text_split',
     api_name  => 'opensrf.simple-text.split',
-    stream    => 1                              # <2>
+    stream    => 1                              // <2>
 );
 --------------------------------------------------------------------------------
 
@@ -945,21 +945,21 @@ and retrieve persistent values.
 
 [source,perl]
 --------------------------------------------------------------------------------
-use OpenSRF::Utils::Cache;                                       # <1>
+use OpenSRF::Utils::Cache;                                       // <1>
 sub test_cache {
     my $self = shift;
     my $conn = shift;
     my $test_key = shift;
-    my $cache = OpenSRF::Utils::Cache->new('global');            # <2>
-    my $cache_key = "opensrf.simple-text.test_cache.$test_key";  # <3>
-    my $result = $cache->get_cache($cache_key) || undef;         # <4>
+    my $cache = OpenSRF::Utils::Cache->new('global');            // <2>
+    my $cache_key = "opensrf.simple-text.test_cache.$test_key";  // <3>
+    my $result = $cache->get_cache($cache_key) || undef;         // <4>
     if ($result) {
         $logger->info("Resolver found a cache hit");
         return $result;
     }
-    sleep 10;                                                    # <5>
-    my $cache_timeout = 300;                                     # <6>
-    $cache->put_cache($cache_key, "here", $cache_timeout);       # <7>
+    sleep 10;                                                    // <5>
+    my $cache_timeout = 300;                                     // <6>
+    $cache->put_cache($cache_key, "here", $cache_timeout);       // <7>
     return "There was no cache hit.";
 }
 --------------------------------------------------------------------------------
index b30d402..cc04e1d 100644 (file)
Binary files a/docs/media/CONNECT.png and b/docs/media/CONNECT.png differ
index 0f6ac2d..2f27dbd 100644 (file)
Binary files a/docs/media/REQUEST.png and b/docs/media/REQUEST.png differ