TMNav comes with a predefined configuration file with acts as a default-Configuration. This file is contained in tmnav.jar (defaultConfig.props in org/tm4j/tmnav/app) and it is not intended to be changed by the user. However, you are free to experiment and overide any of the there defined properties with your own values. You do so, by telling TMNav about your custom configuration at startup.
Pass TMNav on startup time the path to a configuration-file (in java-properties format) with the -c option.
Monitor TMNavs startup-message on System.out in order to see if your configuration is used.
The following is an example for a configuration file that loads two topicmaps on startup.
## --------------------- MEMORY_PROVIDER ----------------------------- ## This property must point to the "id" of a providerdesc provider0.desc=Memory-providerdesc ## used for display purposes provider0.name=Default Provider ## specifying params provider0.tm4j.topicmap.0=/home/cf/topicmaps/greek.xtm.xml provider0.tm4j.topicmap.1=/home/cf/topicmaps/kings_and_queens.xtm
You may include provider descriptions in your Configuration. This allows you to create an instance of that provider either manually in the Create Provider-Dialog or programmatically a startup time. See the section Creating providers on startup of this chapter for a description how to create an instance of a provider at startup time
The default-configuration of TMNav already contains descriptions for the in-memmory and for the hibernate-provider
All entries for one provider description are grouped by a common prefix which has the form providerdescN where N is a placeholder for an Integer. At startup time TMNav reads all continously numbered provider descriptions and stops, if no key providerdescN can be found for the next Integer N. Since the default-configuration of TMNav already contains provider descriptions numbered with 0 and 1, you should start your own descriptons with number 2.
## ----------------- Hibernate-Provider ------------------- ## The classname of the factory, which creates instances of this provider ## This property is the only mandatory one providerdesc0.factory=org.tm4j.topicmap.hibernate.TopicMapProviderFactoryImpl ## Used as an identifier for provider-instances, that should be created ## on startup-time (for an example see below section Provider-Instances) ## if no instance of this provider is created a startup-time it is safe ## to leave this property undefined providerdesc0.id=JDBC-providerdesc ## The jar, which contains the factory class. This property is ## only intended as a hint to the user, in the case that the ## factory class could not be found providerdesc0.jar=tm4jjdbc.jar ## A human readable name providerdesc0.name=JDBC-Provider ## A short human-readable description providerdesc0.description=This provider stores TopicMaps in a relational Database which is accessed via JDBC. Be sure to have the following jars on your classpath: hibernate.jar, commons-lang.jar, commons-logging.jar, commons-collections.jar, odmg.jar ## The names of properties that this provider ## recognizes on initialisation time providerdesc0.prop0=hibernate.dialect providerdesc0.prop1=hibernate.connection.driver_class providerdesc0.prop2=hibernate.connection.url providerdesc0.prop3=hibernate.connection.username providerdesc0.prop4=hibernate.connection.password providerdesc0.prop5=hibernate.connection.pool_size providerdesc0.prop6=hibernate.statement_cache.size
The following properties may be used to describe a provider. Only the factory-Property is mandatory.
Every property must be prefixed with providerdescX. where X is an Integer
Properties
The classname of the factory, which creates instances of this provider. The specified class must implement the org.tm4j.topicmap.TopicMapProviderFactory-Interface and must provide a no-argument-constructor.
The id is used, when creating a provider a startuptime. If you do not plan to configure providers which shall be created a startup time, you currently do no need to specify an id. If you specify an id, be sure to use one, which is unique for all providerdescriptions. The two default descriptions for the in-memory-provider and the hibernate-provider use the keys Memory-providerdesc and JDBC-providerdesc.
A name for display purposes. Use something meaningful to you.
A short human-readable description, which is currently used in the Create Provider-Dialog. It may be helpful to mention here all additional libraries which must be on the classpath in order to work with that provider
Names the .jar-file that contains the factory class. This property is only intended as a hint to the user. It is included in an error message in the case that the factory class could not be found
Name of a Property which will be passed to the Provider a creation time. N is meant as placeholder for an Integer. You may specify any number of properties, as long as they are numbered continously, starting with 0. The Properties specified here are used to build the properties-Editor in the Create Provider-Dialog.
You may describe Provider-Instances in you user configuration file in order to let TMNav create them at startup time.
To enable TMNav to create an instance of a Provider you must add a provider description for that provider. Please refer to the preceding section if you are unsure how to add a provider description.
All entries for one provider instance are grouped by a common prefix which has the form providerN where N is a placeholder for an Integer. At startup time TMNav reads all continously numbered provider and stops, if no key providerN can be found for the next Integer N.
This provider-configuration refers to the provider description from the preceding section
## --------------------- ORA ----------------------------- ## ora-jdbc-provider loaded a startup time provider0.desc=JDBC-providerdesc provider0.name=ORA provider0.hibernate.dialect=cirrus.hibernate.sql.OracleDialect provider0.hibernate.connection.driver_class=oracle.jdbc.OracleDriver provider0.hibernate.connection.url=jdbc:oracle:thin:@192.168.10.177:1521:ORC1 provider0.hibernate.connection.username=tm4j provider0.hibernate.connection.password=hibernate provider0.hibernate.show_sql=true
The following properties may be used to specify a provider which should be instantiate at startup time, along with some additional properties. Only the desc-Property is mandatory.
Every property must be prefixed with providerN where N must be replaced with an Integer
Povider Instance-Properties
Contains the value of the id-attribute of the provider description that is used to instantiate this instance.
A name used for display purposes. Not mandatory but useful
All further properties which are prefixed by providerN are passed unaltered to the provider at creation time. Please refer to tm4js developer-documentation for a list of supported properties for the various providers.