Montag
 
   

Montag Configuration Guide

Notice: This guide always refers to the latest Montag version.

Montag Requirements

In short, Montag requires:

  • A Java Runtime Environment Version 1.4.x.
  • A Java Application Server compliant to the Servlet 2.4 specification (J2EE 1.4);
    i.e. : Apache Tomcat 5.
  • A Native XML Database providing a Java implementation of the XML:DB API.


Warning
Montag doesn't seem fully compatible with the new Java 5 (Java 1.5) Runtime Environment, because of Apache Axis related problems, so you should stay with 1.4.x versions.
For any question or doubt contact me through the forums, the mailing list or private mail.


Installing Montag

Montag installation is very straightforward. Here is a simple step-by-step procedure:

  1. Download the latest binary distribution and extract the archive everywhere you want.
  2. Copy in the montag/WEB-INF/lib directory the jar files needed for working with your XML Database.
    They are provided by the database vendor and change for every different database, but often are a set of jars implementing the database core classes, the XML-RPC protocol and the XML:DB API; here are the jars needed for three common XML databases (note the use of the wildcard) :
    • Apache Xindice 1.1 :
      • xindice*.jar
      • xmldb*.jar
      • xmlrpc*.jar
    • dbXML 2.0 :
      • dbxml*.jar
      • xmldb*.jar
      • xmlrpc*.jar
    • eXist 1.0 :
      • exist*.jar
      • xmldb*.jar
      • xmlrpc*.jar
      • resolver*.jar
      • commons-pool*.jar
      • jakarta-oro*.jar
      • antlr*.jar
    If you have any problem or want to let us know the configuration of some other XML database, please contact me through the forums, the mailing list or private mail.
  3. Deploy Montag into your application server.
    For information on doing this, refer to your application server documentation.
    For example, if you use Apache Tomcat you can deploy Montag simply copying its directory into the Tomcat webapps directory.


Warning
If your montag/WEB-INF/lib directory already contains the jar libraries of an old XML Database and you want to install a new database, you must first delete the jar files of your old database and then copy the new ones.
Mixing different jar files from different databases may cause a lot of problems.


That's all.
Now ... jump to the next section!

Configuring Montag

Montag must be configured in order to interact with a specific XML Database and to properly deploy its Web Services.
Starting from version 0.7, you can easily configure it through these three XML files:

  • montag-config.xml
  • local-config.xml
  • remote-config.xml

All these configuration files are in the montag/WEB-INF/conf directory.
So...let's go.

Configuring the montag-config.xml file

This is the main configuration file and it's the unique mandatory configuration step.
Look at this example:

                    
                        <montag-config>
                    
                            <db-driver>org.apache.xindice.client.xmldb.DatabaseImpl</db-driver>
                            
                            <db-uri>xmldb:xindice://localhost:8080/db</db-uri>
                            
                            <services mode="local">
                                <CollectionManager deploy="yes" logRequests="yes" logResponses="yes"/>
                                <AddDocument deploy="yes" logRequests="yes" logResponses="yes"/>
                                <RemoveDocument deploy="yes" logRequests="yes" logResponses="yes"/>
                                <GetDocument deploy="yes" logRequests="yes" logResponses="yes"/>
                                <QueryService deploy="yes" logRequests="yes" logResponses="yes"/>
                                <XUpdateService deploy="yes" logRequests="yes" logResponses="yes"/>
                            </services>
                    
                        </montag-config>
                    
                

You must first configure the XML Database driver to use through the db-driver element and your network database URI through the db-uri element.
Then, you must set the Montag working mode through the mode attribute of the services element; it can take two values:

  • local: for local working mode.
  • remote: for remote working mode.

Finally, you must configure the deploy information of every service, modifying, for every corresponding element, the following attributes:

  • deploy (yes or no): controls the deployment of the single service; if set to no, the service will not be visible and callable.
  • logRequests (yes or no): controls the logging of the SOAP requests for the service. If you don't want to log any SOAP request (this could speed up your service), set it to no.
  • logResponses (yes or no): controls the logging of the SOAP responses sent by the service. If you don't want to log any SOAP response (this could speed up your service), set it to no.


Note
For additional information on Montag Web Services, local and remote modes, see the Web Services Working Guide.


Configuring the local-config.xml file

This step is necessary only if you have configured Montag Web Services to operate in local mode and if the services will access XML Database collections protected by user name and password that you don't want to pass in SOAP headers: the services will read this file for getting the authentication info in order to access the collections.
So, you must store here the usernames and passwords of the XML Database collections.
The structure is very simple; here is an example:

                
                        <local-config>
                        
                                <collection name="test1">
                                                <username>user1</username>
                                                <password>pass1</password>
                                </collection>
                                
                                <collection name="test1/test2">
                                                <username>user2</username>
                                                <password>pass2</password>
                                </collection>
                                
                        </local-config>
                
                

The xml elements to configure are:

collection
This represents the XML Database collection for which you are specifying the authentication info: the name attribute is mandatory and provides the name of the collection with its full path from the root collection.
There can be multiple collection elements, each for every collection for which you want to provide user name and password.
username
This element provides the username for accessing the collection pointed out by its parent element.
It's a mandatory child of the collection element.
password
This element provides the password for accessing the collection pointed out by its parent element.
It's a mandatory child of the collection element.

So, you have to define a collection element, with its username and password children, for every "protected" database collection you want to access.
It's simple.
And it's all.

Configuring the remote-config.xml file

This step is necessary only if you have configured Montag Web Services to operate in remote mode and if you want to tweak the default settings.
This is the default configuration file provided:

                
                        <remote-config>
                        
                            <session-threshold>10</session-threshold>
                            
                            <session-timeout>30</session-timeout>
                            
                        </remote-config>
                
                

The xml elements to configure are:

session-threshold
This represents the maximum number of active sessions; if exceeded, Montag starts the "search and remove" of timed out sessions.
session-timeout
This represents the maximum time (in minutes) of inactivity for a session; when the session threshold is exceeded, sessions with an inactivity time greater than the session timeout will be removed.

Advanced configuration topics

Guard filters configuration

This section is for those who knows Java Servlets Version 2.4.
Montag is deployed with two servlet filters, acting as "guards", forbidding the access to some web resources. They are:

GuardFilter
For filtering and forbidding access to generic web resources.
AxisGuardFilter
This filter was designed for forbidding the access to the /servlet/AxisServlet resource and the listing of available services.

Use them as more appropriate for your system.

Final words

Montag configuration is now easy and straightforward.
If you have any problem or want to contribute making better this document, please use the forums, the mailing list, or send me an e-mail, putting the word Montag in the subject, at sb_tourist@tin.it.

by Sergio Bossa; Version 2.0