<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">Hi everyone!</div><div class="gmail_quote"><br></div><div class="gmail_quote">2014-09-12 20:20 GMT+02:00 Malte Reissig <span dir="ltr"><<a href="mailto:mre@deepamehta.de" target="_blank">mre@deepamehta.de</a>></span>:<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
 My latest dm4-freifunk-api plugin should not even compile with the<br>
current 4.4-SNAPSHOT and that's why I wonder where you got that specific<br>
"dms.createTopic(...)"-statement from. To make it easier I would suggest<br>
to go back the 4.3 stable with our development.<br></blockquote><div><br></div><div>I've got it working with 4.4-SNAPSHOT now. </div><div><br></div><div>The only change that was required was [1]. It now imports the data fine and I can see it in the webclient! Very cool!</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Nonetheless your error message points to a completely different issue<br>
which I did not ran into, we're missing a Transaction around our<br>
CREATE-operation. Please try to wrap the "dms.createTopic()"-call into a<br>
Transaction by using something similar to the following code.<br>
<br>
DeepaMehtaTransaction tx = dms.beginTx();<br>
try {<br>
     // do stuff here<br>
     dms.createTopic(....);<br>
     tx.succes();<br>
} catch (Exception) {<br>
     tx.failure()<br>
} finally() {<br>
     tx.finish();<br>
}<br></blockquote><div><br></div><div>That fixed it! Thanks! </div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
And because of your question regarding the use of "Jackson": Since<br>
DeepaMehta 4 already ships with Jettison, I would ditch another JSON<br>
lib, yes. Jettison is pretty straightforward to use and we anyway have<br>
to be parsing the whole API directory very carefully (manually) cause of<br>
its wilderness. Lets get in touch somewhen soon for solving the open<br>
questions regarding how to complete the application model in<br>
dm4-freifunk-api for your queries.<br></blockquote><div><br></div><div>I'll write you a mail on the topic. I've made some progress on my original idea to just parse the JSON schema for creating the topic types and I and Andi think that's probably the best way. The schema and the data is prone to rather a lot of changes and maintaining a fork in Java of the schema is something I'd rather would avoid. I'm quite late on the problem but I think it's still a feasible way to go. </div><div><br></div><div>The basic idea is to parse the schema and create the topic types (likely for multiple versions) and then parse the current API data and import things. The big advantage of this approach would be - if it works - that getting the data into DeepaMehta is no problem in the future. All moving parts are the API schema and the community data. </div><div><br></div><div>I hope I have some basic implementation ready by Sunday and then I'll see how good this will work. </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
Tomorrow I will update my repo to be compatible with 4.3 and also solve<br>
the TransactionException issue. We can then still upgrade to DM 4.4<br>
later, after its released.<br></blockquote><div><br></div><div>It's working now with 4.4-SNAPSHOT after adding the transaction code. </div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
Cheers,<br>
Malte<br></blockquote><div><br></div><br class="">2014-09-12 21:39 GMT+02:00 Jörg Richter <span dir="ltr"><<a href="mailto:jri@deepamehta.de" target="_blank">jri@deepamehta.de</a>></span>:<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">If your code is invoked via a resource method (= invoked via a HTTP request), be it directly or indirectly, just annotate the resource method with @Transactional. This will create a transaction on a per-request basis.<br></blockquote><div><br></div><div>Ah. I've tried that as I stumbled upon the Trac-Ticket but it did not work. Now I know why :) </div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">However, if your code is NOT invoked via a HTTP request -- e.g. when you are in a migration or in a test -- you must create the transaction manually, as Malte mentioned. That is, ONE transaction wrapping your entire migration (resp. test) code. Hint: calling tx.failure() is not necessary.<br><br>This ticket (and its comments) explain the new transaction handling of upcoming DM 4.4.:<br><a href="https://trac.deepamehta.de/ticket/698" target="_blank">https://trac.deepamehta.de/ticket/698</a><br><br>DM 4.4 will contain considerable API changes against DM 4.3. You possibly will have less adaption work when jumping on the 4.4-SNAPSHOT train right now (master branch).<br></blockquote><div><br></div><div>Okay. Thanks for the help and I think I'll go this way as everything is working now fine!</div><div><br></div><div>Thanks again for the help from everyone. </div><div><br></div><div>regards</div><div>Martin </div><div> </div><div><br></div><div>1: <a href="https://github.com/freifunk/query.api.freifunk.net/commit/e0ec028555a8ef8897cb34e9d94d5e02249355e3">https://github.com/freifunk/query.api.freifunk.net/commit/e0ec028555a8ef8897cb34e9d94d5e02249355e3</a> </div></div></div></div>