|
- 1.
configTag- 2.
paramTags- 3.
databaseTags
- 3.1
nameAttribute- 3.2
paramTags for Databases- 3.3 The attr Tag
- 3.4 The
templateTag- 3.5 The
termTag- 4. Inheritance Using the
classTag- 5. Example Configuration File
config Tag
The config tag is the top most tag in the configuration file. The config
tag has no attributes and has the form:
<config> <!-- The body of the configuration file goes here --> </config>
param Tags
The param tag is used directly under the config tag to set
name/value parameter pairs which apply to the Gazelle service
itself, such as the port number to listen on. It's also used
under the database tag to set parameters Gazelle needs to
connect to a target database. The param tag has the form:
<paramname="port"value="2210"/>
Predefined Gazelle configuration param names and values:
These and any user-specific name/value pairs are passed as a parameter dictionary to the target API target_connect() function.
database Tags
Databases are defined via the database tag. The database tag
takes a name attribute.
param,
attr,
term,
and template.
The database tag has the form:
<databasename="MyDatabase"> <!--param, attr,term, andtemplatetags go here --> </database>
name Attribute
The name attribute of the database tag is the name of the database
we are searching. In the example above, the database is called
"MyDatabase." The value of the name attribute will be matched with
an incoming Z39.50 request database name.
param Tags for Databasesdatabase tag. Possible uses are host, port, username, and
password for the target database, or other database-specific
options. These name/value pairs are passed as a parameter
dictionary to the target API target_search() function.
Each attr tag corresponds to a possible Z39.50 attribute in an
incoming search request. The attr tag takes a type and a value
attribute. The type attribute is set to the value of the matching
Z39.50 attribute's type, while the value attribute is set to
the value of the Z39.50 attribute.
The attr tag has the form:
<attrtype="1"value="101"> <!-- attr,term, andtemplatetags go here --> </attr>
template Tag
A template tag is used to define a named pattern that can be
substituted for in a term tag or within the text of another
template tag. The template is invoked within other tags by
using the name prepended with a dollar sign ('$').
The template tag has the form:
<templatename="field"> <!-- text and template references go here --> </template>
There are some predefined template names that are used to form complex expressions. These are:
Example:
<templatename="and_expression"> ($lhs AND $rhs) </template> <templatename="or_expression"> ($lhs OR $rhs) </template> <templatename="andNot_expression"> ($lhs AND (NOT $rhs)) </template>
term Tag
The term tag is used to create an equivalence between a
Z39.50 attributeList+Term and a target database term.
Therefore, each attr tag or set of nested attr tags must
have at least one term tag defined within it.
The term tag has the form:
<term> <!-- Constant strings or template name fields go here --> </term>
class Tag
The configuration file supports an inheritance model which simplifies
database declarations. This makes it possible for database parameters
to be constant between several similar databases with only a few
parameters changing. With the inheritance model, you need not copy
the duplicated parameters but simply inherit those parameters from a
class tag.
class Tag
The class tag is a generic tag whose contents are inherited through the
parent attribute of the class and database tags. (Classes can inherit
other classes). It can contain any set of tags. The parameters the class
tag takes are name, (required) used to give the class an identifying name,
and parent, (optional) used to inherit from another
class(es) (see section 4.2).
parent Attribute for class and database Tags
The optional parent attribute for class and database tags is a comma
separated list of class names from which to inherit. The classes will be
inherited from left to right from the class list with later classes
overriding declarations from previously inherited classes.
For instance, in the following example, the database tag will
inherit attr tags from OneClass and from AnotherClass, with AnotherClass's attrs
possibly overriding the attrs from OneClass:
<databaseparent="OneClass,AnotherClass"> ... </database>
Classes which are inherited later in the list override tags from
previously inherited classes. Tags which are declared in the inheriting
class will override similar inherited tags. An inherited tag will only
override a tag if the tag name and attributes match and if it's at the
same level as the other tag.
For instance, if several database tags shared the same "host" and "port" params, you
could define a class tag which contained those param tags and have the
database's inherit them:
The effect is as if each<classname="CertainHost"> <paramname="host"value="my.z3950.host"/> <paramname="port"value="2210"/> </class> ... <databasename="Service One"type="Z3950"parent="CertainHost"> ... </database> ... <databasename="Service Two"type="Z3950"parent="CertainHost"> ... </database>
database tag contained the param tags contained in
the CertainHost class tag.
database Tags
The database tag can inherit param and
attr tags from a class.
The database tag has attr tags for subtags.
attr tags can be nested within other attr tags
to an arbitrary level forming a tree-like structure. When inheriting from
a class, the database tag will merge the two attribute
trees into one. Attributes at the same level in the tree which have the
same type and value will override previously
inherited attributes.
<config> <param name="port" value="2663"/> <param name="type" value="forking"/> <param name="debug" value="true"/> <param name="debugLog" value="debug.log"/> <param name="accessLog" value="access.log"/> <param name="errorLog" value="error.log"/> <!-- the following should be database-specific params --> <param name="pghost" value="hatteras.ncsa.uiuc.edu"/> <param name="pgport" value="5432"/> <param name="pguser" value="guest"/> <!param name="pgpassword" value="foobar"/> <param name="pgdbname" value="competition"/> <!param name="pgoptions" value="etc. etc."/> <database name="zaphod"> <!-- miscellaneous non-expression parameters (SQL-specific) --> <!-- Mapping of z39.50 terms and operators to target expressions. Currently, each attr or nested attr combination must have a "term" tag (or there must be a global-scope "term" tag) that defines how to build a term (the z39.50 attributePlusTerm) of an expression. Each attribute may also optionally have a "template" tag which defines how it is translated. The "template" tag is not optional if the "attr" hierarchy has no "term" tag definition, i.e., there must be some way to translate each attribute into a term. --> <attr type="1" value="1"> <template name="field">entrant.name</template> <attr type="2" value="3"> <term>$field = '$value'</term> </attr> <attr type="2" value="101"> <template name="relop"> ~~ </template> <term>$field $relop '$value'</term> </attr> </attr> <attr type="1" value="2"> <template name="field">entrant.city</template> <term>$field $relop '$value'</term> </attr> <attr type="1" value="3"> <term>entrant.state = '$value'</term> </attr> <attr type="1" value="4"> <term>$field $relop '$value'</term> <template name="field">club.clubname</template> </attr> <attr type="1" value="5"> <template name="field">entry.place</template> </attr> <attr type="1" value="6"> <template name="field">entry.score</template> </attr> <attr type="1" value="7"> <template name="field">category.categoryname</template> <term>$field $relop '$value'</term> </attr> <attr type="2" value="1"> <template name="relop"> < </template> </attr> <attr type="2" value="2"> <template name="relop"> <= </template> </attr> <attr type="2" value="3"> <template name="relop"> = </template> </attr> <attr type="2" value="4"> <template name="relop"> >= </template> </attr> <attr type="2" value="5"> <template name="relop"> > </template> </attr> <attr type="2" value="6"> <template name="relop"> <> </template> </attr> <attr type="2" value="101"> <template name="relop"> ~~ </template> </attr> <term>$field $relop $value</term> <template name="and_expression"> ($lhs AND $rhs) </template> <template name="or_expression"> ($lhs OR $rhs) </template> <template name="andNot_expression"> ($lhs AND NOT $rhs) </template> <template name="query"> select category.categoryname,entry.place,entrant.name, club.clubname,entrant.city,entrant.state from entry,entrant,club,category where entry.entrantid = entrant.entrantid and entrant.clubid = club.clubid and entry.categoryname = category.categoryname and $expression order by category.category,entry.place; </template> </database> </config>