From: Jeanette Lundgren Date: Wed, 21 Jun 2017 18:48:19 +0000 (-0400) Subject: docs: LP1599600 clean up source callout formatting and resize images X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fuser%2Fjlundgren%2Flp1599600_introducing_opensrf;p=working%2FEvergreen.git docs: LP1599600 clean up source callout formatting and resize images Signed-off-by: Jeanette Lundgren --- diff --git a/docs/development/intro_opensrf.adoc b/docs/development/intro_opensrf.adoc index 2bce37b784..0b1e0cea63 100644 --- a/docs/development/intro_opensrf.adoc +++ b/docs/development/intro_opensrf.adoc @@ -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] -------------------------------------------------------------------------------- - - 3 - 1 - perl - OpenSRF::Application::Demo::SimpleText - 100 + // <1> + 3 // <2> + 1 // <3> + perl // <4> + OpenSRF::Application::Demo::SimpleText // <5> + 100 // <6> - 1000 - opensrf.simple-text_unix.log - opensrf.simple-text_unix.sock - opensrf.simple-text_unix.pid - 5 - 15 - 2 - 5 + 1000 // <7> + opensrf.simple-text_unix.log // <8> + opensrf.simple-text_unix.sock // <9> + opensrf.simple-text_unix.pid // <10> + 5 // <11> + 15 // <12> + 2 // <13> + 5 // <14> @@ -395,14 +395,14 @@ of publicly accessible services: .Making a service publicly accessible in `opensrf_core.xml` [source,xml] -------------------------------------------------------------------------------- - + // <1> router - public.localhost + public.localhost // <2> opensrf.math - opensrf.simple-text + opensrf.simple-text // <3> -------------------------------------------------------------------------------- @@ -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. - - + reporter:label="Open User Summary"> // <1> + // <2> + // <3> - + // <4> - + // <5> - - + // <6> + // <7> @@ -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."; } -------------------------------------------------------------------------------- diff --git a/docs/media/CONNECT.png b/docs/media/CONNECT.png index b30d4028ac..cc04e1d65d 100644 Binary files a/docs/media/CONNECT.png and b/docs/media/CONNECT.png differ diff --git a/docs/media/REQUEST.png b/docs/media/REQUEST.png index 0f6ac2d40e..2f27dbda5c 100644 Binary files a/docs/media/REQUEST.png and b/docs/media/REQUEST.png differ