Integrating into Mulgara
Since the resolver and content handler jars are external, it is difficult to integrate them into the Mulgara jar. Therefore they need to be added to the CLASSPATH environment variable to be accessible when Mulgara runs.
For systems running the Windows® operating system, set the classpath
as follows:
set CLASSPATH=%CLASSPATH%;<Full jar path>\myResolver.jar;<Full jar path>\myHandler.jar
Where myResolver.jar
and myHandler.jar
are the names of your compiled jars and <Full jar path>
is their fully qualified path (for example, C:\myResolvers
).
For systems running a Linux® or UNIX® operating system, set the classpath
as follows:
export CLASSPATH=$CLASSPATH:{Full jar path}/myResolver.jar:{Full jar path}/myHandler.jar
Both the HTTP resolver and MP3 content handler are already packaged in Mulgara so doing this with the jars created by the tutorial have no effect. They are for learning purposes only.
In addition to adding the jars to the classpath
, the server also needs to know about the new resolvers and content handlers so it can use them when required. These are stored in the mulgara-config.xml
file (see the Mulgara Configuration File section).
To include your resolver or handler in the Mulgara server, use the following steps:
- In the
mulgara-config.xml
file, find the<TripleStoreImplementation>
tag. In this section there may already be some configured resolvers and handlers. The order is not important, so find a suitable place to insert your new resolver or handler. - For resolvers, add a tag
<ResolverFactoryClass>{class name}</ResolverFactoryClass>
where{class name}
is the full class name of the resolver's factory class. For example,org.mulgara.resolver.http.HttpResolverFactory
- For content handlers, add a tag
<ContentHandlerClass>{class name}</ContentHandlerClass>
where{class name}
is the full class name of the content handler's implementation class. For example,org.mulgara.content.mp3.MP3ContentHandler
The MP3 content handler and HTTP resolver are already configured as part of Mulgara and should not be added again. They are for learning purposes only.