Sedna Module for Apache HTTP Server
version 1.5
Copyright (C) 2010, Apache License 2.0
The Institute for System Programming of the Russian Academy of Sciences
________________________________________________________________________________
Note! Please, read the LICENSE, before using the system. If you do not agree
to all the terms of the LICENSE, you must not install or use Sedna or Sedna
Module for Apache HTTP Server.
CONTENTS:
1. Description
2. Requirements
3. Installation Process
- Unix Platform
- Windows Platform
4. Sedna Configuration
5. Testing the Installation
6. Processing HTTP Request Parameters
7. Support and Feedback
________________________________________________________________________________
1. Description
Sedna Module for Apache is a module for Apache HTTP server which handles
requests to XQuery files by executing XQuery expressions inside Sedna DBMS
(http://modis.ispras.ru/sedna). The module is configured to handle the requests
of "sedna-handler" handler. For example the directive:
"AddHandler sedna-handler .xqy .xquery"
in Apache configuration file httpd.conf will cause Apache HTTP server to deliver
all requests to .xqy and .xquery files to Sedna module.
________________________________________________________________________________
2. Requirements
a. Apache HTTP Server (2.0 or higher):
http://httpd.apache.org/
b. Apache HTTP Request Library:
http://httpd.apache.org/apreq/
Sedna Module for Apache have been tested under Apache HTTP Server 2.0.
________________________________________________________________________________
3. Installation Process
Linux Platform:
===============
On Linux Platform you should build module with "apxs" which is part of the
Apache HTTP Server package:
- Install Apache Server, libapreq and Sedna according to their installation
(or compilation) instructions. Make sure that Apache HTTP server loads
libapreq module at startup (your http.conf file should contain the directive:
'LoadModule apreq_module modules/apreq_module2.so').
- Copy the following files to the 'mod_sedna' directory:
* all *.h files from the directory <libapreq-dev>/include;
* apreq_module_apache2.h from <libapreq-dev>/module/apache2;
* libsedna.h, libsedna_pic.a and sp_defs.h from <sedna-dir>/driver/c
directory.
- Edit mod_sedna.h in order to set LOG_DIR properly. It should point to the
existing directory with permission to the Apache process to write a file.
- Run the following command from the mod_sedna directory:
apxs -c -i -a mod_sedna.c libsedna_pic.a
This command will compile mod_sedna, install it into Apache HTTP Server
extensions path and configure Apache HTTP Server to load mod_sedna at startup.
- To make Apache to handle requests to XQuery files with Sedna DBMS put the
following line to the Apache configuration file:
AddHandler sedna-handler .xqy .xquery
Windows platform
================
For Windows platform we provide prebuilt module for the Apache 2.0. It is built
with VC6 (just as Apache itself) and can be found in the win32/modules folder.
Either it's possble to build module from sources. It can be built with Microsoft
Visul Studio. If you don't have Visual Studio there is a free Expression version
is available for download from the Microsoft's site. Note that it's better to
build also libsedna and Apache server with the same Visual Studio version.
1. Download Apache Win32 sources and open it with Visual Studio development
environment.
2. Copy files from the mod_sedna\win32\src directory to the
<apache_sources>\modules\generators.
3. Add mod_sedna as existing project to the Apache solution.
4. Download and install Apache HTTP Request Library at
http://httpd.apache.org/apreq/.
5. Copy *.h files from the <libapreq>\src directory to the
<apache_sources>\modules\generators
6. Add to the mod_sedna project:
- libsednamd.lib from the Sedna directory
- libapreq2.lib from the libapreq directory
7. Add libapr, libraprutil and libhttpd to the mod_sedna project dependencies.
8. Build the Apache solution
9. Build the mod_sedna project
Installation of the already compiled project:
- Copy file mod_sedna.so to your <ServerRoot>\modules directory
- Add these instructions to your Apache configuration file
LoadModule sedna_module modules/mod_sedna.so
LoadModule apreq_module modules/mod_apreq.so
AddHandler sedna-handler .xqy .xquery
________________________________________________________________________________
4. Sedna Configuration
With each request to .xqy and .xquery file Sedna Module for Apache tries to
connect to Sedna and execute the XQuery expression in Sedna.
The default connection parameters are:
URL = "localhost"
DATABASE NAME = "web"
LOGIN = "SYSTEM"
PASSWORD = "MANAGER"
You can customize any of these parameters by passing with the HTTP request any
of this parameters:
se_url - the URL of the computer running Sedna
se_db - the name of the database
se_login - the login
se_password - the password
For example, a request to Apache:
http://localhost/sedna/index.xquery?se_url=rhine&se_db=x
causes Sedna module to connect to the database 'x' on Sedna running on the RHINE
host.
Sedna module works with XML documents stored in the Sedna. If your servlet
contains the following XQuery expression
for $in in document("person")/person/*
where $i/age = 30
return $i
then it is assumed that the document "person" resides in the database "web" (or
another specified with se_db).
________________________________________________________________________________
5. Testing the Installation
With the instruction:
AddHandler sedna-handler .xqy .xquery
in the httpd.conf file Apache will pass all requests to .xqy and .xquery files
to the Sedna XML Database. To test that your installation works you can create
some XQuery file (for example test.xquery) with the following content:
<html>
<head><title>Test page</title></head>
<body><h1>Hello, world</h1></body>
</html>
Place this file to the htdocs directory of your Apache installation and type:
http://localhost/test.xquery
inside your browser. In case of correct installation you will see the HTML page.
________________________________________________________________________________
6. Processing HTTP Request Parameters
In order to get HTTP request parameters servlets should access built-in XML
document. The document's name is "request_parameters". It has a structure like
this:
<request>
<param name="name-1">value-1</param>
<param name="name-2">value-2</param>
<param name="name-3">value-3</param>
</request>
If there are several (name-value) pairs with the same name in HTTP request then
several 'param' elements reside in the 'request_parameters' document structure.
Let us suppose that we need to process Web form with 'login' and 'password'
fields. The example of accessing this parameters looks like:
let $login:=document("request_parameters")/request/param[@name="login"]/text(),
$passw:=document("request_parameters")/request/param[@name="passw"]/text()
return ...
________________________________________________________________________________
7. Support and Feedback
Please, feel free to contact us with questions, suggestions, bug reports and
comments:
http://lists.sourceforge.net/lists/listinfo/sedna-discussion
For up-to-date information and new versions of Sedna visit the Sedna homepage:
http://modis.ispras.ru/sedna