Mako Configuration File Settings
There are a number of configuration files available in the /conf directory.
Each addresses a different Mako set-up—connecting Mako to other services,
data stores, etc.
The file localhost-mako-config.xml contains a basic setup for a
Mako server to run on the local machine and will provide a good example of how the configuration
files are structured. See the mobius configuration overview for
information on the elements in the top resource block of the configuration files.
The localhost config files should never be used for more than single Mako testing purposes. If you are running multiple Makos, customize the config files by assigning unique service identifiers and making any other changes necessary to specify the service as unique. When other Makos connect to a Mako started as localhost, the Mako will identify itself as "localhost" to the connecting service. This can cause problems with service name resolution.
The Mako server contains two resources that provide certain functionality and information to other Mako components. These resources are instantiated by the Mako server at startup, and are configured by the config file. The two resources for the Mako are:
- Mako Configuration
<resource name="makoConfig"... > - Mako Database Configuration
<resource name="makoDBConfig"... >
These resources must be specified in order in the config file due to dependencies on the other resources, and all of them must exist.
Mako Configuration
The Mako Configuration
resource keeps track of the information specific to the Mako Server.
This resource is defined under the
<resource name="makoConfig"
class="org.projectmobius.services.
mako.MakoConfiguration">
element. This element has a child called <mako-configuration> that
specifies the information
Mako Configuration may potentially need to establish connections with GMEs
—for example, to use a GME in order to obtain
schema for the Mako to use to publish XML documents.
The <mako-configuration> element has one child,
<gme-client-configuration>. It can have any number
of <gme ... /> children, each of which has a single
attribute that specifies the service ID of a GME the Mako is to
contact when it starts up. When you're running Mako in a Grid environment,
it will often be the case that you'll want to start your Mako and have it
query a GME for schema to use.
The localhost-mako-gme-config.xml
configuration file contains an example of how you would specify the service
ID of a GME client to connect to on start up. Swap out the example service ID
with an actual running GME service ID and start the Mako, passing it your modified
config file. The Mako will then be able to use the schema stored in the GME
to publish XML documents.
Mako Database Configuration
This resource contains information
about the databases the Mako will use and enables access and modification of the databases.
This resource will have various definitions depending on the sort of
database or database connection service the Mako will use. The files in the /conf
directory contain many examples of useful database configurations for Mako. Here is a sample:
- in
localhost-mako-xindice-config.xml and localhost-mako-exist-config.xml <resource name="xmlDBConfig" class="org.projectmobius.xmldb. XMLDBConfiguration">is used for connecting to the Xindice or eXist XML databases - in
localhost-mako-xbridge-config.xml <resource name="xbridgeConfig" class="org.projectmobius.xbridge. MakoXBridgeConfiguration">is used for connecting to the XQuark Bridge XML database - in
localhost-vmako-config.xml <resource name="vmakoConfig" class="org.projectmobius.services. vmako.VMakoConfiguration">is used when we want to aggregate multiple Mako servers into a VMako (see our VMako QuickStart example) - and, in
localhost-mako-exampleds-config.xml, you will see syntax for how it is possible use this resource to establish a connection to a dataservice for which you've written interface classes
In many cases, it will be adequate to use Mobius's own XML database service, MakoDB, for storing data. We will discuss the configuration elements for using MakoDB in more detail, below.
The resource for using MakoDB is defined under the element
<resource name="makoDBConfig"
class="org.projectmobius.services. makodb.MakoDBConfiguration">
The resource element has a child called <makoDB-configuration ...>.
Its "id" attribute sets the name of the database in which the schema are stored.
This is important because, if you want to run multiple Makos on a host and use
MakoDB as the database services in them, you must make sure to start each Mako from a config file
having different values for the "id". Otherwise, there will be
database name collision within the MakoDBs.
The Mako Database Configuration (for MakoDB) has several important configurable elements:
<name>- This element specifies the name of the database. For MySQL's root database, this should be nothing.
<driver>- The driver class for accessing the MySQL database.
<urlPrefix>- The url prefix for accessing the database.
<host>- The host the database lives on. Usually, this will be localhost.
<port>- The port via which the database can be accessed.
<username>- The username to log into the database with. This username must have privileges to add and remove databases and tables.
<password>- The password to authenticate the username.
<pool>- This element determines how many connections to the database will be made initially. When the MakoDB needs to communicate with the MySQL database, it will get a connection, and, when its done, release it. Should it run out of available connections, it will make a new one, but this causes a slight delay. Set the pool value in anticipation of how many concurrent database operations will be needed.