added the <language> block to the opensrf app config so the servers
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 1 Nov 2005 22:01:21 +0000 (22:01 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 1 Nov 2005 22:01:21 +0000 (22:01 +0000)
will know which apps they need to run

e.g. <language>c</language>, <language>perl</language>

case insensitve

git-svn-id: svn://svn.open-ils.org/ILS/trunk@1939 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/examples/openils.xml.example
Open-ILS/src/Makefile
OpenSRF/bin/opensrf_all
OpenSRF/src/libstack/osrf_system.c
OpenSRF/src/perlmods/OpenSRF/System.pm
OpenSRF/src/router/osrf_router_main.c

index 04ee16a..5b74fc7 100644 (file)
@@ -68,6 +68,7 @@ For non-core config info, see the inline documentation within this file
                        <opensrf.persist>
                                <keepalive>1</keepalive>
                                <stateless>1</stateless>
+                               <language>perl</language>
                                <implementation>OpenSRF::Application::Persist</implementation>
                                <max_requests>97</max_requests>
                                <unix_config>
@@ -91,6 +92,7 @@ For non-core config info, see the inline documentation within this file
                        <open-ils.auth>
                                <keepalive>5</keepalive>
                                <stateless>1</stateless>
+                               <language>perl</language>
                                <implementation>OpenILS::Application::Auth</implementation>
                                <max_requests>93</max_requests>
 
@@ -118,6 +120,7 @@ For non-core config info, see the inline documentation within this file
                        <open-ils.search>
                                <keepalive>5</keepalive>
                                <stateless>1</stateless>
+                               <language>perl</language>
                                <implementation>OpenILS::Application::Search</implementation>
                                <max_requests>93</max_requests>
 
@@ -145,6 +148,7 @@ For non-core config info, see the inline documentation within this file
                        <open-ils.actor>
                                <keepalive>5</keepalive>
                                <stateless>1</stateless>
+                               <language>perl</language>
                                <implementation>OpenILS::Application::Actor</implementation>
                                <max_requests>93</max_requests>
 
@@ -167,6 +171,7 @@ For non-core config info, see the inline documentation within this file
                        <open-ils.cat>
                                <keepalive>5</keepalive>
                                <stateless>1</stateless>
+                               <language>perl</language>
                                <implementation>OpenILS::Application::Cat</implementation>
                                <max_requests>199</max_requests>
 
@@ -194,6 +199,7 @@ For non-core config info, see the inline documentation within this file
                        <opensrf.math>
                                <keepalive>3</keepalive>
                                <stateless>1</stateless>
+                               <language>perl</language>
                                <implementation>OpenSRF::Application::Demo::Math</implementation>
                                <max_requests>97</max_requests>
                                <unix_config>
@@ -211,6 +217,7 @@ For non-core config info, see the inline documentation within this file
                        <opensrf.dbmath> 
                                <keepalive>3</keepalive>
                                <stateless>1</stateless>
+                               <language>perl</language>
                                <implementation>OpenSRF::Application::Demo::MathDB</implementation>
                                <max_requests>99</max_requests>
                                <unix_config>
@@ -228,6 +235,7 @@ For non-core config info, see the inline documentation within this file
                        <open-ils.circ> 
                                <keepalive>3</keepalive>
                                <stateless>1</stateless>
+                               <language>perl</language>
                                <implementation>OpenILS::Application::Circ</implementation>
                                <max_requests>99</max_requests>
                                <unix_config>
@@ -258,6 +266,7 @@ For non-core config info, see the inline documentation within this file
                        <open-ils.storage>
                                <keepalive>3</keepalive>
                                <stateless>1</stateless>
+                               <language>perl</language>
                                <implementation>OpenILS::Application::Storage</implementation>
                                <unix_config>
                                        <max_requests>1000</max_requests>
@@ -291,6 +300,7 @@ For non-core config info, see the inline documentation within this file
                        <opensrf.settings>
                                <keepalive>1</keepalive>
                                <stateless>1</stateless>
+                               <language>perl</language>
                                <implementation>OpenSRF::Application::Settings</implementation>
                                <max_requests>17</max_requests>
                                <unix_config>
index 309eba8..029afe6 100644 (file)
@@ -8,8 +8,6 @@ export INCDIR = "$(INCLUDEDIR)/openils/"
 
 all: mod_xmltools mod_ils_rest_gateway c_apps
 
-
-
 install:       perl-install web-install string-templates-install storage-bootstrap cgi-bootstrap xsl-install c_apps-install
 
 web-install:   webcore-install autojs-install  mod_xmltools-install mod_ils_rest_gateway-install
index c337284..40b9dc4 100755 (executable)
@@ -91,7 +91,7 @@ function startOpenSRF {
        if [ ! -z "$OPENSRFC" ]; then
                echo "Starting OpenSRF-C...";
                # localhost will need to be changed...
-               "$BINDIR/opensrf-c" localhost "$ETCDIR//opensrf_core.xml" "opensrf"
+               "$BINDIR/opensrf-c" $(hostname -f) "$ETCDIR//opensrf_core.xml" "opensrf"
                echo "OpenSRF-C started OK";
        fi
 }
index eac1c69..419bdac 100644 (file)
@@ -87,30 +87,36 @@ int osrfSystemBootstrap( char* hostname, char* configfile, char* contextNode ) {
                i = 0;
                while( (appname = osrfStringArrayGetString(arr, i++)) ) {
 
-                       char* libfile = osrf_settings_host_value("/apps/%s/implementation", appname);
-                       info_handler("Launching application %s with implementation %s", appname, libfile);
+                       char* lang = osrf_settings_host_value("/apps/%s/language", appname);
+
+                       if(lang && !strcasecmp(lang,"c"))  {
+
+                               char* libfile = osrf_settings_host_value("/apps/%s/implementation", appname);
+               
+                               if(! (appname && libfile) ) {
+                                       warning_handler("Missing appname / libfile in settings config");
+                                       continue;
+                               }
+
+                               info_handler("Launching application %s with implementation %s", appname, libfile);
+               
+                               int pid;
+               
+                               if( (pid = fork()) ) { 
+                                       // storage pid in local table for re-launching dead children...
+                                       info_handler("Launched application child %d", pid);
        
-                       if(! (appname && libfile) ) {
-                               warning_handler("Missing appname / libfile in settings config");
-                               continue;
-                       }
-       
-                       int pid;
-       
-                       if( (pid = fork()) ) { 
-                               // storage pid in local table for re-launching dead children...
-                               info_handler("Launched application child %d", pid);
-
-                       } else {
+                               } else {
+               
+                                       fprintf(stderr, " * Running application %s\n", appname);
+                                       if( osrfAppRegisterApplication( appname, libfile ) == 0 ) 
+                                               osrf_prefork_run(appname);
        
-                               fprintf(stderr, " * Running application %s\n", appname);
-                               if( osrfAppRegisterApplication( appname, libfile ) == 0 ) 
-                                       osrf_prefork_run(appname);
-
-                               debug_handler("Server exiting for app %s and library %s", appname, libfile );
-                               exit(0);
-                       }
-               }
+                                       debug_handler("Server exiting for app %s and library %s", appname, libfile );
+                                       exit(0);
+                               }
+                       } // language == c
+               } 
        }
 
        /** daemonize me **/
index b657857..8a5f90c 100644 (file)
@@ -152,7 +152,9 @@ sub bootstrap {
 
                for my $app (@$apps) {
                        # verify we are a settings server and launch 
-                       if( $app eq "opensrf.settings" ) {
+                       if( $app eq "opensrf.settings" and 
+                               $client->config_value("apps","opensrf.settings", "language") =~ /perl/i ) {
+
                                $are_settings_server = 1;
                                $self->launch_settings();
                                sleep 1;
@@ -331,10 +333,15 @@ sub launch_settings_listener {
 sub launch_unix {
        my( $self, $apps ) = @_;
 
+       my $client = OpenSRF::Utils::SettingsClient->new();
+
        foreach my $app ( @$apps ) {
+
                next unless $app;
+               my $lang = $client->config_value( "apps", $app, "language");
 
-               if( $app eq "opensrf.settings" ) { next; }
+               next unless $lang =~ /perl/i;
+               next unless $app ne "opensrf.settings";
 
                _log( " * Starting UnixServer for $app..." );
 
index 8d715cd..e29bf92 100644 (file)
@@ -101,7 +101,6 @@ int __setupRouter( char* config, char* context ) {
        osrfRouterRun( router );
 
        return -1;
-
 }