separate REST gateway now compiles ... installation is untested
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 29 Aug 2005 15:58:28 +0000 (15:58 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 29 Aug 2005 15:58:28 +0000 (15:58 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@1757 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/Makefile
Open-ILS/src/apachemods/Makefile
Open-ILS/src/apachemods/fieldmapper_lookup-gen.pl
Open-ILS/src/apachemods/fieldmapper_lookup.h
Open-ILS/src/apachemods/mod_rest_gateway.c
Open-ILS/src/apachemods/mod_rest_gateway.h
OpenSRF/src/Makefile
install.sh

index 7effd12..59ed4c4 100644 (file)
@@ -3,17 +3,25 @@ export LD_OPTS                        = -L $(TMPDIR) -L .
 export CC_OPTS                 = -g -Wall -O2 -fPIC -I$(LIBXML2_HEADERS) -I$(APACHE2_HEADERS) \
                                                                -I$(LIBXML2_HEADERS)/libxml  -I$(TMP) -I$(TMPDIR)
 
-all: mod_xmltools
+all: mod_xmltools mod_ils_rest_gateway
 
 
 install:       perl-install web-install string-templates-install storage-bootstrap xsl-install
 
-web-install:   webcore-install autojs-install  mod_xmltools-install 
+web-install:   webcore-install autojs-install  mod_xmltools-install mod_ils_rest_gateway-install
 
 
 # -----------------------------------------------------------------------------------
 # Web stuff
 # -----------------------------------------------------------------------------------
+mod_ils_rest_gateway:
+       echo $@
+       make -C apachemods mod_ils_rest_gateway.so
+
+mod_ils_rest_gateway-install:
+       echo $@
+       make -C apachemods mod_ils_rest_gateway-install
+
 mod_xmltools:
        echo $@
        make -C apachemods mod_xmltools.so
index da90b63..f634481 100644 (file)
@@ -5,9 +5,9 @@
 
 LD_OPTS        += -lxml2 -lc_utils -lxslt
 
-all: mod_xmltools.so
+all:   mod_xmltools.so mod_ils_rest_gateway.so
 
-install:       mod_xmltools-install
+install:       mod_xmltools-install mod_ils_rest_gateway-install libfieldmapper-install
 
 mod_xmltools.so: apachetools.o  xmltools.o mod_xmltools.c mod_xmltools.h
        echo $@
@@ -22,6 +22,49 @@ xmltools.o:  xmltools.c xmltools.h
        echo $@
        $(CC) -c $(CC_OPTS) xmltools.c -o $@
 
+fieldmapper_lookup.c:  fieldmapper_lookup.h
+       ./fieldmapper_lookup-gen.pl fieldmapper_lookup.c
+
+json_xml.o:    json_xml.c json_xml.h
+       echo $@
+       $(CC) -c $(CC_OPTS) json_xml.c -o $@
+
+fieldmapper_lookup.o:  fieldmapper_lookup.c fieldmapper_lookup.h
+       echo $@
+       $(CC) -c $(CC_OPTS) fieldmapper_lookup.c -o $@
+
+libfieldmapper.so:     fieldmapper_lookup.o
+       echo $@
+       $(CC) $(LD_OPTS) -shared -W1 fieldmapper_lookup.o -o $@
+
+libfieldmapper-install:        libfieldmapper.so
+       echo installing libfieldmapper.so
+       mkdir -p $(INCLUDEDIR)/
+       cp fieldmapper_lookup.h $(INCLUDEDIR)/
+       cp libfieldmapper.so $(LIBDIR)/libfieldmapper.so
+
+ils_rest_gateway.o:     mod_rest_gateway.c mod_rest_gateway.h fieldmapper_lookup.h
+       echo $@
+       $(CC) -c $(CC_OPTS) mod_rest_gateway.c -o $@
+
+mod_ils_rest_gateway.so:     libfieldmapper.so ils_rest_gateway.o
+       echo $@
+       $(CC) $(LD_OPTS) -shared -W1 ils_rest_gateway.o -lfieldmapper -o $@
+
+
+mod_ils_rest_gateway-install:
+       echo $@
+       $(APXS2) -i -a -n mod_ils_rest_gateway mod_ils_rest_gateway.so
+       echo "-----------------------------------------------";
+       echo -e "* Important * : Change httpd.conf from this: \n \
+               LoadModule mod_ils_rest_gateway_module modules/mod_ils_rest_gateway.so \n \
+               to this: \n \
+               LoadModule mod_ils_rest_gateway    modules/mod_ils_rest_gateway.so"
+       echo -e "Supported configuration options:\
+                       \nILSRestGatewayConfig <config-file>\
+       echo "-----------------------------------------------";
+       echo ""
+
 mod_xmltools-install:
        echo $@
        $(APXS2) -i -a -n mod_xmltools mod_xmltools.so
@@ -40,4 +83,5 @@ mod_xmltools-install:
 
 clean:
        echo $@
-       /bin/rm -f *.o xmltools mod_xmltools.so
+       /bin/rm -f *.o xmltools mod_xmltools.so libfieldmapper.so mod_ils_rest_gateway.so
+       /bin/rm -f fieldmapper_lookup.c
index 04a8480..06ae767 100755 (executable)
@@ -5,6 +5,7 @@ use lib '../perlmods/';
 my $map = {};
 eval "
        use lib '../perlmods/';
+       use lib '../../../OpenSRF/src/perlmods/';
        use OpenILS::Utils::Fieldmapper;  
 ";
 $map = $Fieldmapper::fieldmap unless ($@);
@@ -55,19 +56,19 @@ print SOURCE <<C;
 }
 
 int isFieldmapper(char* class) {
-       if (class == NULL) return NULL;
+       if (class == NULL) return 0;
 C
 
 for my $object (keys %$map) {
        my $short_name= $map->{$object}->{hint};
-       print SOURCE "  else if (!strcmp(class, \"$short_name\")) return 1;";
+       print SOURCE "  else if (!strcmp(class, \"$short_name\")) return 1;\n";
 }
 print SOURCE <<C;
-       return NULL;
+       return 0;
 }
 
-int fm_ntop(char* class, char* field);
-       if (class == NULL) return NULL;
+int fm_ntop(char* class, char* field) {
+       if (class == NULL) return 0;
 C
 
 
@@ -81,6 +82,6 @@ for my $object (keys %$map) {
        print SOURCE "  }\n"
 }
 
-print SOURCE " return -1;\n}";
+print SOURCE " return -1;\n}\n";
 warn  "done\n";
 
index 2e4d9c8..70de9ca 100644 (file)
@@ -2,12 +2,7 @@
 #include <string.h>
 #include <stdio.h>
 
-/* the JSON parser, so we can read the response we're XMLizing */
-#include "objson/object.h"
-#include "objson/json_parser.h"
-#include "utils.h"
-
 int isFieldmapper(char*);
-int fm_ntop(char*,char*);
-char* fm_pton(char*,int);
+char * fm_pton(char *, int);
+int fm_ntop(char *, char *);
 
index ec4a547..e04de6b 100644 (file)
@@ -1,4 +1,4 @@
-#include "mod_ils_gateway.h"
+#include "mod_rest_gateway.h"
 
 char* ils_rest_gateway_config_file;
 
index a60f431..45fe84b 100644 (file)
@@ -14,7 +14,7 @@
 #include "objson/object.h"
 #include "objson/json_parser.h"
 
-#include "rest_xml.h"
+#include "json_xml.h"
 #define GATEWAY_CONFIG "ILSRestGatewayConfig"
 #define MODULE_NAME "ils_rest_gateway_module"
 #define CONFIG_CONTEXT "rest_gateway"
index e5beeff..60ce608 100644 (file)
@@ -21,7 +21,7 @@ export CC_OPTS                        = -g -Wall -O2 -fPIC -I$(LIBXML2_HEADERS) -I$(APACHE2_HEADERS)
                                                                -I$(LIBXML2_HEADERS)/libxml  -I$(TMP) -I$(TMPDIR)
 
 
-all: prep router srfsh jserver gateway rest_gateway
+all: prep router srfsh jserver gateway
 
 install: install-prep transport-install stack-install gateway-install  \
                router-install srfsh-install jserver-install perl-install                       \
@@ -58,9 +58,6 @@ srfsh: stack
 gateway:       stack 
        make -C gateway
 
-rest_gateway:  stack 
-       make -e -C gateway rest_gateway
-
 jserver: c_utils
        make -C jserver
 
index 6633bf5..ee4016f 100755 (executable)
@@ -150,11 +150,7 @@ function runInstall {
                                ;;
 
                        "opensrf_gateway" )
-                               if building;    then 
-                                       $MAKE -C "$OPENSRFDIR" "gateway"; 
-                                       $MAKE -C "$OPENSRFDIR" "rest_gateway"; 
-                               fi;
-
+                               if building; then $MAKE -C "$OPENSRFDIR" "gateway"; fi;
                                if installing; then $MAKE -C "$OPENSRFDIR" "gateway-install"; fi;
                                ;;
 
@@ -185,6 +181,7 @@ function runInstall {
 
                        "openils_web" )
                                if building; then $MAKE -C "$OPENILSDIR" "mod_xmltools"; fi;
+                               if building; then $MAKE -C "$OPENILSDIR" "mod_ils_rest_gateway"; fi;
                                if installing; then $MAKE -C "$OPENILSDIR" "web-install"; fi;
                                ;;