NetworkedPlanet | TMCore Engine API Guide |
The interface
NetworkedPlanet.TMAPI.ITopicMapSystem
represents a connection to a TMCore system. In the TMCore system, the
topic maps that it manages are each assigned a unique identifier string
specifed by the Name property of the
ITopicMap
instance. The property
ITopicMapSystem.TopicMapNames
returns a
read-only IList
containing the
Name property value of all topic maps that are
currently accesible through the
ITopicMapSystem
. The
ITopicMapSystem
method
GetTopicMap(String)
is an access method to
retrieve an ITopicMap
from the
ITopicMapSystem
using the value of its
Name property as a key.
In addition, the ITopicMapSystem
interface allows you to create a new topic map in the TMCore system. To
create a new topic map, you will need to specify the unqiue name under
which the topic map should be stored. If you specify a name which is
already in use, a TopicMapExists
exception will
be thrown.
An ITopicMapSystem
instance cannot
be created directly, the TMCore API does not publicly expose a class
that implements this interface. Instead you must use the class
NetworkedPlanet.TMAPI.TopicMapSystemFactory
to
configure and initialise an
ITopicMapSystem
instance. The
configuration required for an
ITopicMapSystem
is specified as a
collection of name/value pairs as shown in the following table:
Table 5.1. ITopicMapSystem Configuration Properties
Property Name | Required? | Description |
networkedplanet.tmcore.dbconnect | YES | The database connect string used to access the SQLServer instance that holds the TMCore system tables. |
networkedplanet.tmcore.commandtimeout | NO | The number of seconds that a TMRQL command executed via
ITopicMapSystem.ExecuteQuery or
ITopicMapSystem.ExecuteQueries will
time out after. Default value is 15. |
The TopicMapSystemFactory
class provides an
overloaded method GetTopicMapSystem()
that
accepts this configuration information in a number of different ways.
The method GetTopicMapSystem()
with no
arguments will configure the
ITopicMapSystem
instance using the local
application configuration file. This file is an XML file that is named
either Web.config
for web applications or
for
applications (e.g. AppName
.configMyApp.exe.config
for an
application called MyApp.exe
). The configuration
information must go in the <appSettings>
element of the config file. More information about the appSettings and
configuration files can be found here
on the Microsoft MSDN site. An example of an application
configuration file is shown below:
Example 5.1. A simple .config file for a TMCore Application
<?xml version="1.0" encocing="utf-8" ?> <configuration> ... <appSettings> <add key="networkedplanet.tmcore.dbconnect" value="Data Source=localhost;Integrated Security=SSPI; Initial Catalog=topicmap" /> ... </appSettings> ... </configuration>
If you wish to retrieve the configuration information in some
other way, or wish to include a hard-coded set of configuration
parameters in your application, you can instead use the method
GetTopicMapSystem(NameValueCollection)
. The
NameValueCollection
parameter contains the
property/value pairs to configure the
ITopicMapSystem
that will be
returned.