Configuring Mulgara as a Web Application


The standard distribution includes a jar that contains Mulgara configured as a web application running behind the "Jetty":http://www.mortbay.org/jetty/ HTTP server.  The package is actually configured to run several web applications: 
* localhost:8080 - read/write services 
*** localhost:8080/ - A generated HTML page with a list of current services
*** localhost:8080/webui/ - webui servlet
*** localhost:8080/tutorial/ - tutorial servlet
*** localhost:8080/sparql/  - sparql read/write endpoint
*** localhost:8080/tql/  -  tql read/write service
* localhost:8081 - read only services
*** localhost:8081/sparql/  - sparql read-only endpoint
*** localhost:8081/tql/  -  tql read-only service
* ..to be completed..

<pre>

To be precise, Mulgara does not read source:trunk/conf/mulgara-config.xml. Instead, the build process copies this file to source:trunk/conf/core/mulgara-x-config.xml and reads this file instead. The reason for this indirection is because the build modifies some tags inside the original file. These tags can be recognized easily as they start and end with the @ character.

Configuration schema elements:

*!ExternalConfigPaths*  - sets paths (and files) for configuration files needed by other components.
<pre>
<pre>

*Jetty* - options controlling Jetty configuration.
<pre>
<pre>
<pre>
<pre>
<pre>
<pre>
<pre>
<pre>
<pre>
<pre>
<pre>
<pre>
<pre>
<pre>

*Global Configuration*
<pre>
<pre>
<pre>
<pre>
<pre>

*Database-related configuration options*
* TripleStoreImplementation - The database class. Currently this will only be set to _org.mulgara.resolver.Database_.
* RelatedQueryHandler - This identifies a class that supports an obsolete feature (ignore).
* PersistentNodePoolFactory - The class that manages internal resource identifiers persistently.
* TemporaryNodePoolFactory - The class that manages internal resource identifiers in memory only.
* PersistentStringPoolFactory - The class that manages the storage of URIs and literals persistently.
* TemporaryStringPoolFactory - The class that manages the storage of URIs and literals in memory only.
* PersistentResolverFactory - The class that manages RDF statements (storage, indexing, searching, etc) persistently.
* TemporaryResolverFactory - The class that manages RDF statements in memory only.

Rule Engine config:
<pre>
* (may be repeated)

Content Handlers  (see wikipage x):
* DefaultContentHandler - The default class to use to load a file and return triples.
* ContentHandler (one or more) - A class for loading a file and returning triples. e.g. type="org.mulgara.content.mp3.MP3ContentHandle" 
* ResolverFactory (one or more) - A class for accessing graph URIs as sets of triples/quads. Resolvers can either specify the URI of a *type* that they handle (where this type will be manually defined by the user when creating a graph), or else specify the URI scheme that it will deal with (e.g. http).  e.g.  type="org.mulgara.resolver.xsd.XSDResolverFactory" 

Other
* StartupScript - script to run in iTQL startup
* Smtp - server for email notifications

h2. Web Server integration

Notice that Mulgara's configuration file provides minimal web server configuration that applies globally.

h3. Jetty

Currently Mulgara ships with an embedded Jetty webserver.  The [[MulgaraConf]] configuration specifies a few global options, to which the webdefault.xml file adds a few more; to customize you have to configure each webservice (a servlet).

WebDefault config file: This config file is a "Jetty default deployment descriptor":http://docs.codehaus.org/display/JETTY/webdefault.xml, which is "applied to a web application BEFORE the application's own WEB-INF/web.xml. It is used to save a web application from having to define a lot of house-keeping and container-specific elements in their own web.xml files", such as configurations for the standard mechanisms such as JSP, the default servlet and the Invoker.

<pre>

h2. Tomcat

The same services to be set up in Jetty are also configured in a WAR file for different deployment scenarios. All the required libraries are included in the WAR file. The services are all declared in source:trunk/src/war/mulgara/WEB-INF/web.xml.

<pre>