Creating a Bulk Insert File


You can use a list of keys or a bulk insert file (BIF) to populate a collection’s field values. The Gateway Developer’s Kit includes a utility program, fscrawl, which creates the BIF file, given a directory, for a file-system gateway. You can modify fscrawl to create a BIF file for your gateway’s documents.

The fscrawl source code exists in the following directory, where install_dir is the directory in which K2 is installed:

/install_dir/k2/samples/client/c/GDK/fscrawl

where install_dir is the directory in which K2 is installed. The files are shown below:

-rwxr-xr-x 1 user 1059 Mar 22 15:17 Makefile
-rwxr-xr-x 1 user 2738 Oct 23 01:44 fscrawl.c
-rwxr-xr-x 1 user 6351 Oct 23 01:44 fscrawl.mak

You can execute the make command and specify the platform (production or debug) on Unix as follows:

make _ssol26

make _ssol26d

The make file creates the executable in the respective subdirectory of where the source code is located, as follows:

drwxr-xr-x 2 user 512 Mar 22 17:30 _ssol26
drwxr-xr-x 2 user 512 Mar 22 17:30 _ssol26d

You can create the BIF file by specifying the name of the BIF file and the name of the source directory, as follows:

fscrawl 1.bif _ssol26

In this example, fscrawl creates a BIF file named 1.bif that contains a key for each file in the compilation directory, _ssol26:

cd /install_dir/k2/samples/client/c/GDK/fscrawl
more 1.bif

VdkVgwKey: _ssol26/fscrawl.o
<<EOD>>
VdkVgwKey: _ssol26/fscrawl
<<EOD>>

In this example, fscrawl creates a BIF file named 2.bif that contains a key for each file in the test documentation directory, testdocs:

fscrawl 2.bif \
/install_dir/k2/samples/client/c/GDK/vgwsamp/testdocs
more 2.bif

VdkVgwKey: /install_dir/k2/samples/client/c/GDK/vgwsamp
/testdocs/howto.doc
<<EOD>>
VdkVgwKey: /install_dir/k2/samples/client/c/GDK/vgwsamp
/testdocs/vrtyPress.txt
<<EOD>>