Split services into separate files
authorAdam Dickmeiss <adam@indexdata.dk>
Fri, 15 Jan 2010 12:20:34 +0000 (13:20 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Fri, 15 Jan 2010 12:25:36 +0000 (13:25 +0100)
The example configuration file pazpar2.cfg.dist now includes a default
service default.xml (part of etc). And default.xml includes
settings/edu.xml. The default.xml file (not to be confused with
settings/defaults.xml) is a template for jsdemo and other services.
The Debian package installs /etc/pazpar2/server.xml which is now
the main pazpar2 configuration (used to be called pazpar2.cfg).
server.xml includes services from /etc/pazpar2/services-enabled/*.xml .
The default.xml (from etc) is installed in /etc/pazpar2/services-available
and a symlink to it is created from services-enabled. The default.xml
service is unnamed and, thus, will be used by jsdemo and test1.

debian/cfg.patch [deleted file]
debian/pazpar2.default
debian/pazpar2.dirs
debian/pazpar2.postinst [new file with mode: 0644]
debian/rules
debian/server.xml [new file with mode: 0644]
etc/default.xml [new file with mode: 0644]
etc/pazpar2.cfg.dist

diff --git a/debian/cfg.patch b/debian/cfg.patch
deleted file mode 100644 (file)
index fa3c658..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-5,6c5
-<     <listen port="9004"/>
-<     <proxy host="localhost:80"/>
----
->     <listen port="8004"/>
index 66c435a..ccf9281 100644 (file)
@@ -7,4 +7,4 @@
 #
 
 # Additional options that are passed to the Daemon.
-DAEMON_OPTS="-D -u nobody -p /var/run/pazpar2.pid -l /var/log/pazpar2.log -f /etc/pazpar2/pazpar2.cfg"
+DAEMON_OPTS="-D -u nobody -p /var/run/pazpar2.pid -l /var/log/pazpar2.log -f /etc/pazpar2/server.xml"
index 06f5d75..6e3ab5d 100644 (file)
@@ -1,4 +1,6 @@
 etc/pazpar2
 etc/pazpar2/settings
+etc/pazpar2/services-enabled
+etc/pazpar2/services-available
 usr/bin
 usr/sbin
diff --git a/debian/pazpar2.postinst b/debian/pazpar2.postinst
new file mode 100644 (file)
index 0000000..bf54741
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh
+set -e
+
+if [ "$1" != "configure" ]; then
+    exit 0
+fi
+if [ -x "/etc/init.d/pazpar2" ]; then
+       update-rc.d pazpar2 defaults >/dev/null
+       if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
+               invoke-rc.d pazpar2 start || exit $?
+       else
+               /etc/init.d/pazpar2 start || exit $?
+       fi
+       ln -sf ../services-available/default.xml \
+               /etc/pazpar2/services-enabled/default.xml
+fi
+exit 0
index 802373f..2281048 100755 (executable)
@@ -78,8 +78,8 @@ binary-arch: build install
        # pazpar2-doc package
        mv $(CURDIR)/debian/pazpar2/usr/share/doc/pazpar2/* $(CURDIR)/debian/pazpar2-doc/usr/share/doc/pazpar2-doc
        # pazpar2 package
-       cp $(CURDIR)/etc/pazpar2.cfg.dist $(CURDIR)/debian/pazpar2/etc/pazpar2/pazpar2.cfg
-       patch $(CURDIR)/debian/pazpar2/etc/pazpar2/pazpar2.cfg $(CURDIR)/debian/cfg.patch
+       cp $(CURDIR)/debian/server.xml $(CURDIR)/debian/pazpar2/etc/pazpar2/server.xml
+       cp $(CURDIR)/etc/default.xml $(CURDIR)/debian/pazpar2/etc/pazpar2/services-available/
        cp etc/settings/*.xml $(CURDIR)/debian/pazpar2/etc/pazpar2/settings/
        cp etc/*.xsl $(CURDIR)/debian/pazpar2/etc/pazpar2/
        # pazpar2-apache2 package
diff --git a/debian/server.xml b/debian/server.xml
new file mode 100644 (file)
index 0000000..520f62d
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<pazpar2 xmlns="http://www.indexdata.com/pazpar2/1.0">
+  
+  <server>
+    <listen port="8004"/>
+    <settings src="settings/edu.xml"/>
+    <include src="services-enabled/*.xml"/>
+  </server>
+  
+</pazpar2>
+<!-- Keep this comment at the end of the file
+     Local variables:
+     mode: nxml
+     End:
+-->
+
diff --git a/etc/default.xml b/etc/default.xml
new file mode 100644 (file)
index 0000000..81526b9
--- /dev/null
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<service  xmlns="http://www.indexdata.com/pazpar2/1.0">
+  <timeout session="60" z3950_operation="30" z3950_session="180"/>
+  <settings src="settings/edu.xml"/>
+  
+  <relevance>
+    <icu_chain id="relevance" locale="en">
+      <transform rule="[:Control:] Any-Remove"/>
+      <tokenize rule="l"/>
+      <transform rule="[[:WhiteSpace:][:Punctuation:]] Remove"/>
+      <casemap rule="l"/>
+    </icu_chain>
+  </relevance>
+  
+  <sort>
+    <icu_chain id="sort" locale="en">
+      <transform rule="[[:Control:][:WhiteSpace:][:Punctuation:]] Remove"/>
+      <casemap rule="l"/>
+    </icu_chain>
+  </sort>
+  
+  <mergekey>
+    <icu_chain id="mergekey" locale="en">
+      <tokenize rule="l"/>
+      <transform rule="[[:Control:][:WhiteSpace:][:Punctuation:]] Remove"/>
+      <casemap rule="l"/>
+    </icu_chain>
+  </mergekey>
+  
+  <!-- we try to keep same order as in marc21.xsl -->
+  <metadata name="id" brief="yes"/>
+  <metadata name="lccn" merge="unique"/>
+  <metadata name="isbn"/>
+  <metadata name="issn"/>
+  <metadata name="tech-rep-nr"/>
+  <metadata name="author" brief="yes" termlist="yes" merge="unique" 
+           rank="2" mergekey="optional"/>
+  <metadata name="author-title"/>
+  <metadata name="author-date"/>
+  <metadata name="corporate-name"/>
+  <metadata name="corporate-location"/>
+  <metadata name="corporate-date"/>
+  <metadata name="meeting-name"/>
+  <metadata name="meeting-location"/>
+  <metadata name="meeting-date"/>
+  <metadata name="date" brief="yes" sortkey="numeric" type="year"
+           merge="range" termlist="yes"/>
+  <metadata name="title" brief="yes" sortkey="skiparticle"
+           merge="longest" rank="6" mergekey="required"/>
+  <metadata name="title-remainder" brief="yes" merge="longest" rank="5"/>
+  <metadata name="title-responsibility" brief="yes" merge="longest"/>
+  <metadata name="title-dates" brief="yes" merge="longest"/>
+  <metadata name="title-medium" brief="yes" merge="longest"/>
+  <metadata name="title-number-section" brief="yes" merge="longest"/>
+  <metadata name="medium" brief="yes" merge="no" mergekey="optional"/>
+  <metadata name="iii-id" brief="yes" merge="no"/>
+  <metadata name="edition"/>
+  <metadata name="publication-place"/>
+  <metadata name="publication-name"/>
+  <metadata name="publication-date"/>
+  <metadata name="physical-extent"/>
+  <metadata name="physical-format"/>
+  <metadata name="physical-dimensions"/>
+  <metadata name="physical-accomp"/>
+  <metadata name="physical-unittype"/>
+  <metadata name="physical-unitsize"/>
+  <metadata name="physical-specified"/>
+  
+  <metadata name="series-title"/>
+  
+  <metadata name="description" brief="yes" merge="unique" rank="3"/>
+  <metadata name="subject-long" rank="3"/>
+  <metadata name="subject" termlist="yes" rank="0"/>
+  <metadata name="snippet" brief="yes" merge="unique"/>
+  <metadata name="electronic-url" brief="yes" merge="no"/>
+  <metadata name="electronic-format-type" />
+  <metadata name="electronic-format-instruction" />
+  <metadata name="electronic-url" brief="yes" merge="no"/>
+  <metadata name="electronic-text" brief="yes" merge="no"/>
+  <metadata name="electronic-note"/>
+  <metadata name="citation"/>
+  <metadata name="holding"/>
+  <metadata name="fulltext"/>
+  <metadata name="locallocation" brief="yes"/>
+  <metadata name="callnumber" brief="yes"/>
+  <metadata name="publicnote" brief="yes"/>
+  
+  <!-- journals -->
+  <metadata name="journal-title"/>
+  <metadata name="journal-subpart"/>
+  <metadata name="volume-number"/>
+  <metadata name="issue-date"/>
+  <metadata name="issue-number"/>
+  
+  <metadata name="url_recipe" setting="postproc" brief="yes" merge="no"/>
+  <metadata name="open_url_resolver" setting="parameter" merge="no"/>
+  <metadata name="open-url" merge="longest"/>
+  <metadata name="use_url_proxy" setting="postproc" brief="yes" merge="no"/>
+  
+  <metadata name="publisher"/>
+  <metadata name="available"/>
+  <metadata name="due"/>
+  <metadata name="thumburl" brief="yes" merge="unique"/>
+  <metadata name="score"/>
+</service>
+<!-- Keep this comment at the end of the file
+     Local variables:
+     mode: nxml
+     End:
+-->
+
index 68e4d47..a66b18e 100644 (file)
@@ -4,111 +4,7 @@
   <server>
     <listen port="9004"/>
     <proxy host="localhost:80"/>
-    <settings src="settings/edu.xml"/>
-
-    <relevance>
-      <icu_chain id="relevance" locale="en">
-        <transform rule="[:Control:] Any-Remove"/>
-        <tokenize rule="l"/>
-        <transform rule="[[:WhiteSpace:][:Punctuation:]] Remove"/>
-        <casemap rule="l"/>
-      </icu_chain>
-    </relevance>
-
-    <sort>
-      <icu_chain id="sort" locale="en">
-        <transform rule="[[:Control:][:WhiteSpace:][:Punctuation:]] Remove"/>
-        <casemap rule="l"/>
-      </icu_chain>
-    </sort>
-    
-    <mergekey>
-      <icu_chain id="mergekey" locale="en">
-        <tokenize rule="l"/>
-        <transform rule="[[:Control:][:WhiteSpace:][:Punctuation:]] Remove"/>
-        <casemap rule="l"/>
-      </icu_chain>
-    </mergekey>
-    
-    <service>
-      <timeout session="60" z3950_operation="30" z3950_session="180"/>
-
-      <!-- we try to keep same order as in marc21.xsl -->
-      <metadata name="id" brief="yes"/>
-      <metadata name="lccn" merge="unique"/>
-      <metadata name="isbn"/>
-      <metadata name="issn"/>
-      <metadata name="tech-rep-nr"/>
-      <metadata name="author" brief="yes" termlist="yes" merge="unique" 
-        rank="2" mergekey="optional"/>
-      <metadata name="author-title"/>
-      <metadata name="author-date"/>
-      <metadata name="corporate-name"/>
-      <metadata name="corporate-location"/>
-      <metadata name="corporate-date"/>
-      <metadata name="meeting-name"/>
-      <metadata name="meeting-location"/>
-      <metadata name="meeting-date"/>
-      <metadata name="date" brief="yes" sortkey="numeric" type="year"
-        merge="range" termlist="yes"/>
-      <metadata name="title" brief="yes" sortkey="skiparticle"
-        merge="longest" rank="6" mergekey="required"/>
-      <metadata name="title-remainder" brief="yes" merge="longest" rank="5"/>
-      <metadata name="title-responsibility" brief="yes" merge="longest"/>
-      <metadata name="title-dates" brief="yes" merge="longest"/>
-      <metadata name="title-medium" brief="yes" merge="longest"/>
-      <metadata name="title-number-section" brief="yes" merge="longest"/>
-      <metadata name="medium" brief="yes" merge="no" mergekey="optional"/>
-      <metadata name="iii-id" brief="yes" merge="no"/>
-      <metadata name="edition"/>
-      <metadata name="publication-place"/>
-      <metadata name="publication-name"/>
-      <metadata name="publication-date"/>
-      <metadata name="physical-extent"/>
-      <metadata name="physical-format"/>
-      <metadata name="physical-dimensions"/>
-      <metadata name="physical-accomp"/>
-      <metadata name="physical-unittype"/>
-      <metadata name="physical-unitsize"/>
-      <metadata name="physical-specified"/>
-
-      <metadata name="series-title"/>
-
-      <metadata name="description" brief="yes" merge="unique" rank="3"/>
-      <metadata name="subject-long" rank="3"/>
-      <metadata name="subject" termlist="yes" rank="0"/>
-      <metadata name="snippet" brief="yes" merge="unique"/>
-      <metadata name="electronic-url" brief="yes" merge="no"/>
-      <metadata name="electronic-format-type" />
-      <metadata name="electronic-format-instruction" />
-      <metadata name="electronic-url" brief="yes" merge="no"/>
-      <metadata name="electronic-text" brief="yes" merge="no"/>
-      <metadata name="electronic-note"/>
-      <metadata name="citation"/>
-      <metadata name="holding"/>
-      <metadata name="fulltext"/>
-      <metadata name="locallocation" brief="yes"/>
-      <metadata name="callnumber" brief="yes"/>
-      <metadata name="publicnote" brief="yes"/>
-
-      <!-- journals -->
-      <metadata name="journal-title"/>
-      <metadata name="journal-subpart"/>
-      <metadata name="volume-number"/>
-      <metadata name="issue-date"/>
-      <metadata name="issue-number"/>
-
-      <metadata name="url_recipe" setting="postproc" brief="yes" merge="no"/>
-      <metadata name="open_url_resolver" setting="parameter" merge="no"/>
-      <metadata name="open-url" merge="longest"/>
-      <metadata name="use_url_proxy" setting="postproc" brief="yes" merge="no"/>
-
-      <metadata name="publisher"/>
-      <metadata name="available"/>
-      <metadata name="due"/>
-      <metadata name="thumburl" brief="yes" merge="unique"/>
-      <metadata name="score"/>
-    </service>
+    <include src="default.xml"/>
   </server>
   
 </pazpar2>