Hyrax - Frequently Asked Questions: Difference between revisions

From OPeNDAP Documentation
⧼opendap2-jumptonavigation⧽
Line 5: Line 5:
* TypeMatch
* TypeMatch


The TypeMatch regular expression is used to match file names with their type. For example, a file ending with the extension .hdf would match and be handled by the hdf4 module. '''''Note: The regular expression must match the file including the path to the file name.'''''
The TypeMatch regular expression is used to match file names with their type. For example, a file ending with the extension .hdf would match and be handled by the hdf4 module.
 
'''''Note: The regular expression must match the file including the path to the file name.'''''


The TypeMatch parameter is a list of handler/module names and a regular expression separated by a colon. If the regular expression matches an item, then the BES uses the associated handler/module. Each <handler>:<regular expression> pair is followed by a semicolon. This is used when creating containers in the BES (the 'set container' command). The example regular expression says to use the 'h4' handler for any file with an extension of 'hdf', 'HDF' or 'eos' which may also end in '.gz' or '.bz2' or '.Z'. In the latter case the file will be treated as a compressed file.
The TypeMatch parameter is a list of handler/module names and a regular expression separated by a colon. If the regular expression matches an item, then the BES uses the associated handler/module. Each <handler>:<regular expression> pair is followed by a semicolon. This is used when creating containers in the BES (the 'set container' command). The example regular expression says to use the 'h4' handler for any file with an extension of 'hdf', 'HDF' or 'eos' which may also end in '.gz' or '.bz2' or '.Z'. In the latter case the file will be treated as a compressed file.

Revision as of 22:29, 28 March 2008

Regular expression matches in BES

There are two regular expression matches in the BES, both configured in the BES configuration file bes.conf.

  • TypeMatch

The TypeMatch regular expression is used to match file names with their type. For example, a file ending with the extension .hdf would match and be handled by the hdf4 module.

Note: The regular expression must match the file including the path to the file name.

The TypeMatch parameter is a list of handler/module names and a regular expression separated by a colon. If the regular expression matches an item, then the BES uses the associated handler/module. Each <handler>:<regular expression> pair is followed by a semicolon. This is used when creating containers in the BES (the 'set container' command). The example regular expression says to use the 'h4' handler for any file with an extension of 'hdf', 'HDF' or 'eos' which may also end in '.gz' or '.bz2' or '.Z'. In the latter case the file will be treated as a compressed file.

 Example:
 BES.Catalog.catalog.TypeMatch=h4.*\.(hdf|HDF|eos)(\.gz|\.bz2|\.Z)?$;
  • Include/Exclude directive

The Include/Exclude parameters in the BES configuration file tells the BES what files and directories to include/exclude in its catalog response. Normally, when a client asks for a data catalog, all files and directories are shown. Use the following two parameters to customize this behavior. Each parameter is a list of regular expressions, each followed by a semicolon (last one must also end with a semicolon as in the example below.) First, the Include parameter is applied to the node, and then the Exclude parameter is applied. All collections of nodes are shown. In the default values below, all nodes are included (the Include parameter) except those that begin with a dot (the Exclude parameter).

 Example:
 BES.Catalog.catalog.Include=;
 BES.Catalog.catalog.Exclude=^\..*;
  • There is a binary included in the distribution that will allow you to test a regular expression. The besregtest binary is run with the type of regular expression (type, include or exclude), the regular expression enclosed in quotes, and then the list of things to match. Here is the output of the usage of besregtest:
Usage: besregtest include|exclude|type <regular_expression> <string_to_match>
  samples:
    besregtest include "123456;" 01234567 matches 6 of 8 characters
    besregtest include "^123456$;" 01234567 does not match
    besregtest include "^123456$;" 123456 matches all 6 of 6 characters
    besregtest include ".*\.nc$;" fnoc1.nc matches
    besregtest include ".*\.nc$;" fnoc1.ncd does not matche
    besregtest type "nc:.*\.nc$;nc:.*\.nc\.gz$;ff:.*\.dat$;ff:.*\.dat\.gz$;" fnoc1.nc matches type nc

Question 2

Question 3

Question 4

Question 5

Question 6

Question 7

Question 8

Question 9