Changes for page TopicMap Engine
Last modified by christoph_lechleitner@iteg_at on 2013-02-02 07.31:25
From version 1.1
edited by christoph_lechleitner@iteg_at
on 2012-06-14 06.08:40
on 2012-06-14 06.08:40
Change comment:
There is no comment for this version
To version 3.1
edited by christoph_lechleitner@iteg_at
on 2013-02-02 07.30:12
on 2013-02-02 07.30:12
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
-
Objects (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -1,37 +1,233 @@ 1 -(% class="contentLayout" data-atlassian-layout="{~"name~":~"pagelayout-two-right~",~"columns~":[~"large~",~"aside~"],~"header~":true,~"footer~":true}" %) 1 +//**TM2JDBC** is a implementation of the TopicMaps API ([[TMAPI 2.0.2>>url:http://www.tmapi.org/2.0/||shape="rect"]]). It is a fast, production-grade Topic Maps Engine with a small dependency footprint. TM2JDBC uses a relational database to store its data, and is verified to operate with Apache Derby, MySQL, MSSQL Server and Oracle databases.// 2 + 3 +TM2JDBC is released in version 1.0.1. This release features some dependency updates and minor corrections of inconsistencies within the code, but is fully compatible to version 0.9.0. 4 + 5 +* Updated TMAPI dependency to version 2.0.2 (the prior version already was compliant with TMAPI 2.0.2, but still referenced a snapshot as the final library was not released) 6 +* OSGi support – The library now comes packaged as an OSGi-bundle, which allows it to be deployed to your OSGi container of choice. This has no side-effencts on non-OSGi projects 7 +* Updated clazzes.org-dependencies to the current version 8 + 9 +If you are using maven, you can use the new version by adding the following snippets to your {{code language="none"}}pom.xml{{/code}} file: 10 + 2 2 ((( 3 -(% class="header" %) 4 -((( 5 -This is the home of the TopicMap Engine space. 12 + 6 6 7 -To help you on your way, we've inserted some of our favourite macros on this home page. As you start creating pages, blogging and commenting you'll see the macros below fill up with all the activity in your space. 14 +{{code language="none"}} 15 +<dependency> 16 + <groupId>org.clazzes</groupId> 17 + <artifactId>tm2jdbc</artifactId> 18 + <version>1.0.1</version> 19 +</dependency> 20 + 21 + 22 +... 23 + 24 +<repository> 25 + <id>org.clazzes</id> 26 + <name>Clazzes.org repository.</name> 27 + <url>http://maven.clazzes.org</url> 28 +</repository> 29 +{{/code}} 30 + 31 + 8 8 ))) 9 9 10 -(% class="columnLayout twoColumns" %) 34 +If you do not use maven, you can download the .jar files manually from our repository at [[http:~~/~~/maven.clazzes.org/org/clazzes/tm2jdbc>>url:http://maven.clazzes.org/org/clazzes/tm2jdbc||shape="rect"]]. 35 +Alternatively, you can check out the sources directly from our SVN Repository: 36 + 37 +{{code language="none"}} 38 +http://svn.clazzes.org/svn/topicmaps/trunk/tm2jdbc/ 39 + 40 +{{/code}} 41 + 42 += {{id name="TopicMapEngineHome-SetupandUsageNotes"/}}Setup and Usage Notes = 43 + 44 +TM2JDBC needs a relational database and the appropriate JDBC 4.0 compatible driver to function. However it does not have any direct dependencies to a specific JDBC connector. Instead, it expects a {{code language="none"}}javax.sql.DataSource{{/code}} to be set as a property (see below), which it will use to obtain database connections. Although the engine should function with any DataSource implementation, we strongly recommend to use the [[Apache Commons DBCP>>url:http://commons.apache.org/dbcp/||shape="rect"]] library. A rudimentary set-up for a {{code language="none"}}BasicDataSource{{/code}} can be found in the class {{code language="none"}}org.clazzes.tm2jdbc.util.test.DataSourceProvider{{/code}}. 45 + 46 +=== {{id name="TopicMapEngineHome-ProvidingaDataSource"/}}Providing a DataSource === 47 + 48 +To handle database connectivity, the TM2JDBC engine relies on a{{code language="none"}}javax.sql.DataSource{{/code}} to be set for the property ##(% class="nolink" %)http:~/~/psi.clazzes.org/topicmaps/db-connection/datatsource(%%)## in the Factory (attempting to call {{code language="none"}}newTopicMapSystem(){{/code}} without the property being set causes an{{code language="none"}}IllegalStateException{{/code}} to be thrown. The property string can also be accessed directly via the Enum object{{code language="none"}}org.clazzes.tm2jdbc.voc.PropertyKey.CONNECTION_DATASOURCE{{/code}}. The most basic setup could look like this: 49 + 11 11 ((( 12 -(% class="cell large" %) 13 -((( 14 -(% class="innerCell" %) 15 -((( 16 -{{recently-updated/}} 51 + 52 + 53 +{{code language="java"}} 54 +BasicDataSource datasource = new BasicDataSource(); 55 +datasource.setDefaultAutoCommit(false); 56 + 57 +datasource.setInitialSize(4); 58 +datasource.setMinIdle(1); 59 +datasource.setMaxIdle(8); 60 +datasource.setMaxActive(8); 61 +datasource.setMaxWait(3000); 62 + 63 +datasource.setDriverClassName(driver); 64 + 65 +datasource.setPassword(password); 66 +datasource.setUsername(user); 67 +datasource.setUrl(url); 68 + 69 +TopicMapSystemFactory factory = TopicMapSystemFactory.newInstance(); 70 +factory.setProperty(PropertyKey.CONNECTION_DATASOURCE.getURI(), dsProvider.getDataSource()); 71 + 72 +TopicMapSystem system = factory.newTopicMapSystem(); 73 +{{/code}} 74 + 75 + 17 17 ))) 18 -))) 19 19 20 -(% class="cell aside" %) 78 +=== {{id name="TopicMapEngineHome-RunningtheDBSetupUtilityincommandline"/}}Running the DBSetup Utility in commandline === 79 + 80 +The engine provides a setup-utility to create the tables it needs in a provided database schema. This utility can either be run as a standalone java executable (in the command line, via a shell script etc.) or instanciated as a Java Object by your own code (see below). The class name is {{code language="none"}}org.clazzes.tm2jdbc.jdbc.setup.DBSetup{{/code}}. For testing and development, it may be useful to run the setup utility in commandline or the development evironment of your choice. The standard use-case is to set up the database schema, but you can also use it to drop all tables in the schema. 81 +Making sure that the appropriate database drivers are added to the classpath, the accepts arguments like this: 82 + 21 21 ((( 22 -(% class="innerCell" %) 23 -((( 24 -====== {{id name="TopicMapEngineHome-Navigatespace"/}}Navigate space ====== 84 + 25 25 26 -{{locationSearch reference="WebHome"/}} 86 +{{code language="none"}} 87 +DBSetup {derby|mssql|mysql|oracle} {{ [-h <HOSTNAME>] [-t <PORT>] [-n <SCHEMA NAME>] } | {--url <DATABASE-URL>}} -u <USER> -p <PASSWORD> [-d <DRIVER-CLASSNAME> ] [--debug] [--drop|--force-drop] [--nosetup] 88 +{{/code}} 27 27 28 - {{documentTreeroot="document:TME.WebHome"/}}90 + 29 29 ))) 92 + 93 +Below is a listing of all argument flags and the default values: 94 + 95 +|=((( 96 +Flag 97 +)))|=((( 98 +Default Value 99 +)))|=((( 100 +Description 30 30 ))) 102 +|((( 103 +{{code language="none"}} 104 +-h 105 +{{/code}} 106 +)))|((( 107 +127.0.0.1 108 +)))|((( 109 +The hostname/address of your database server. **Caution: When using Oracle database systems, the hostname is interpreted as a TNS name, which is resolved to an IP locally. Alternatively, you may also specify a string like{{code language="none"}}<IP-HOST>/<SID>{{/code}}** 31 31 ))) 111 +|((( 112 +{{code language="none"}} 113 +-t 114 +{{/code}} 115 +)))|((( 116 +//default port// 117 +)))|((( 118 +If omitted, the default port for the specified database server is used 119 +))) 120 +|((( 121 +{{code language="none"}} 122 +-n 123 +{{/code}} 124 +)))|((( 125 +topicmaps 126 +)))|((( 127 + 128 +))) 129 +|((( 130 +{{code language="none"}} 131 +--url 132 +{{/code}} 133 +)))|((( 134 +//none// 135 +)))|((( 136 +Alternatively to entering the hostname, port and schema name, you can supply the jdbc url directly. 137 +))) 138 +|((( 139 +{{code language="none"}} 140 +-u 141 +{{/code}} 142 +)))|((( 143 +//none// 144 +)))|((( 145 +You must enter a username and password 146 +))) 147 +|((( 148 +{{code language="none"}} 149 +-p 150 +{{/code}} 151 +)))|((( 152 +//none// 153 +)))|((( 154 + 155 +))) 156 +|((( 157 +{{code language="none"}} 158 +-d 159 +{{/code}} 160 +)))|((( 161 +//default driver class// 162 +)))|((( 163 +If you want to use a different driver class than the default, you can specify the fully qualified classname using this flag. Make sure that the class is added to the classpath. 164 +))) 165 +|((( 166 +{{code language="none"}} 167 +--debug 168 +{{/code}} 169 +)))|((( 170 +//false// 171 +)))|((( 172 +Produces a verbose output 173 +))) 174 +|((( 175 +{{code language="none"}} 176 +--drop 177 +{{/code}} 178 +)))|((( 179 +//false// 180 +)))|((( 181 +Drops all tables in the schema, causes the utility to fail on errors 182 +))) 183 +|((( 184 +{{code language="none"}} 185 +--force-drop 186 +{{/code}} 187 +)))|((( 188 +//false// 189 +)))|((( 190 +Drops all tables in the schema, ignoring any errors (Use to clean the schema if it was corrupted or not created completely) 191 +))) 192 +|((( 193 +{{code language="none"}} 194 +--nosetup 195 +{{/code}} 196 +)))|((( 197 +//false// 198 +)))|((( 199 +Skip setting up the schema. 200 +))) 32 32 33 -(% class="footer" %) 202 +=== {{id name="TopicMapEngineHome-RunningtheDBSetupUtilityinJava"/}}Running the DBSetup Utility in Java === 203 + 204 +The database setup-utility also can be run in java. For this case it provides a constructor which takes a {{code language="none"}}javax.sql.DataSource{{/code}}, and provides the methods {{code language="none"}}setUpDB(boolean debug){{/code}} and {{code language="none"}}dropAllTables(boolean supressErrors){{/code}}. It is recommended to use these instead of running the {{code language="none"}}main(String[] args){{/code}} method with the appropriate arguments. 205 + 206 +=== {{id name="TopicMapEngineHome-JUnittesting"/}}JUnit testing === 207 + 208 +TMAPI provides an extensive suite of Testcases to assure compliancy, which is also included in the TM2JDBC package. As the original tests were not conceived for engines which are based on an RDBMS, the {{code language="none"}}setUp(){{/code}} and {{code language="none"}}tearDown(){{/code}} methods where modified to initialize and drop the database schema between every test. You are welcome to subject the engine to additional tests (we would especially appreciate you to share the results with us), and for this purpose TM2JDBC provides the utility class{{code language="none"}}org.clazzes.tm2jdbc.util.test.DataSourceProvider{{/code}} (depends on Apache commons DBCP). 209 +It is recommended to use this utility in all test cases as follows: 210 + 34 34 ((( 35 35 213 + 214 +{{code language="java"}} 215 +protected DataSourceProvider dsProvider; 216 + 217 +protected void setUp() throws Exception { 218 +super.setUp(); 219 +if (dsProvider == null) { 220 +dsProvider = DataSourceProvider.getProvider(); 221 +dsProvider.setUpDB(); 222 + 223 +//set up factory etc. here ... 224 +factory.setProperty(PropertyKey.CONNECTION_DATASOURCE.getURI(), dsProvider.getDataSource()); 225 +//... 226 +} 227 +} 228 + 229 +protected void tearDown() throws Exception { 230 +dsProvider.dropDB(); 231 +} 232 +{{/code}} 36 36 ))) 37 -)))
- Confluence.Code.ConfluencePageClass[0]
-
- Id
-
... ... @@ -1,1 +1,1 @@ 1 -68968 71 +689682 - URL
-
... ... @@ -1,1 +1,1 @@ 1 -https://clazzes.atlassian.net/wiki/spaces/TME/pages/68968 7/TopicMap Engine Home1 +https://clazzes.atlassian.net/wiki/spaces/TME/pages/689682/TopicMap Engine Home