The list service provides an abstract implementation of the List datastructure. This implementation allows you to create lists that are stored on multiple physical locations, you can create lists in your configuration file (config.xml) with the xms.dataservices.list.ConfigFileStringList, or in a separate file with xms.dataservices.list.PropertyFileStringList, or in a database with xms.dataservices.list.DBStringList.
Here is an example list in the config.xml file:
<service class="xms.dataservices.list.XMSStringListService"> <list name="list1" class="xms.dataservices.list.ConfigFileStringList"> <item>One</item> <item>Two</item> </list> <list name="list2" class="xms.dataservices.list.ConfigFileStringList"> <item>Apple</item> <item>Orange</item> </list> </service>
![]() | Note |
|---|---|
| ConfigFileStringList's can be modified at runtime, but any changes to the list will be lost when the server restarts. | |
First create a file with each list item on its own line
One Two
Now add a list mapping to the file in your config.xml:
<service class="xms.dataservices.list.XMSStringListService">
<list name="fileList"
class="xms.dataservices.list.PropertyFileStringList"
path="/path/to/my/list/file.properties"
cache="true" />
</service>
![]() | Note |
|---|---|
| By using cache="true" the file is not reloaded every time the list is accessed by the server. You can set the cachetimeout attribute to an integer value that correspondes to the number of miliseconds the file will be cached for. By default cachetimeout is set to zero, which caches indefinitely. | |
To use a database with XMS you need to create the connection using the XMS DataSource Service. There are examples in the Configuring a JDBC Datasource section.
<service class="xms.dataservices.list.XMSStringListService">
<list name="dbList"
class="xms.dataservices.list.DBStringList"
datasourcename="myDatasource"
sql="SELECT email FROM email_list;"
column="email"
table="email_list" />
</service>