added the <language> block to the opensrf app config so the servers
authorerickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Tue, 1 Nov 2005 22:01:21 +0000 (22:01 +0000)
committererickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
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/OpenSRF/trunk@560 9efc2488-bf62-4759-914b-345cdb29e865

bin/opensrf_all
src/libstack/osrf_system.c
src/perlmods/OpenSRF/System.pm
src/router/osrf_router_main.c

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;
-
 }