You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

jackcess-2.xml 8.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <?xml version="1.0"?>
  2. <document>
  3. <properties>
  4. <author email="jahlborn@users.sf.net">James Ahlborn</author>
  5. <title>Upgrading from Jackcess 1.x to 2.x</title>
  6. </properties>
  7. <body>
  8. <section name="Jackcess 2.0">
  9. <subsection name="I'm Scared!">
  10. <p>
  11. Step back from the keyboard and take a moment to catch your breath. I
  12. know the idea of upgrading to a new major version of a software
  13. project can be a bit daunting. A completely re-written library means
  14. a whole new set of bugs to work through! Rest assured, however,
  15. <u>the changes from Jackcess 1.x to 2.x are largely cosmetic!</u> The
  16. core code is functionally unchanged, just shuffled around and tweaked.
  17. So, once an existing project has been updated for the new API, things
  18. should work pretty much the same as they did before (for better or
  19. worse!). That begs the question, of course, why mess everything up in
  20. the first place?
  21. </p>
  22. </subsection>
  23. <subsection name="Why rock the boat?">
  24. <p>
  25. The Jackcess project is over 8 years old at this point, and as any
  26. developer knows, projects tend to accumulate cruft over the years.
  27. The available functionality has grown dramatically from the initial
  28. release while still retaining binary compatibility across most
  29. releases. This has been quite an effort and, unfortunately, has
  30. caused the API to become a bit unwieldy. The 2.x release is an
  31. attempt to rework the API to make it both more approachable for new
  32. users as well as more convenient for power users.
  33. </p>
  34. <p>
  35. While an initial compile of existing code against the new 2.x API may
  36. generate a fair bit of compile warnings, many of the changes are
  37. fairly superficial (e.g. classes moving to new packages). All of the
  38. changes that were made were made in an attempt to make the API more
  39. useable and to follow API design best practices. Change for the sake
  40. of change was avoided (e.g. just "prettying" up existing method
  41. names).
  42. </p>
  43. </subsection>
  44. <subsection name="So what changed?">
  45. <p>
  46. Functionally speaking, Jackcess is largely unchanged. The core
  47. codebase is largely the same, just re-arranged. The only major
  48. changes regarding functionality are:
  49. </p>
  50. <ul>
  51. <li><b>"Simple" index support has been removed.</b></li>
  52. <ul>
  53. <li>In older releases, Jackcess did not fully understand how
  54. indexes worked. When that functionality was fully grasped,
  55. "big" index support was added, but the "simple" support was left
  56. as the default for backwards compatibility. In later releases,
  57. after the "big" index support was stabilized, it became the
  58. default. Now, there really isn't any reason to keep the old,
  59. broken support.</li>
  60. </ul>
  61. <li><b>Foreign Key constraints are now enforced by default.</b></li>
  62. <ul>
  63. <li>Similarly, foreign key constraints were only recently
  64. understood by jackess. For backwards compatibility, enforcement
  65. was not made the default. This tends to confuse new users, as the
  66. general expectation of a database is that it will enforce
  67. constraints (unless told otherwise). Unlike "simple" index
  68. support (which was removed completely), foreign key constraint
  69. enforcement can still be disabled.</li>
  70. </ul>
  71. </ul>
  72. <p>
  73. The remaining changes are largely cosmetic or just slightly different
  74. (hopefully better) ways to do the same things. Among these changes,
  75. the major ones are:
  76. </p>
  77. <ul>
  78. <li><b>The public API classes are now primarily interfaces.</b></li>
  79. <ul>
  80. <li>Making the primary API classes interfaces allows more
  81. flexibility in the implementation without affecting the API. It
  82. also makes a more clear distinction between methods that are
  83. intended to be used externally and those that are intended for
  84. internal use. This makes the API much more approachable for new
  85. users.</li>
  86. <li>Note that there are some "advanced" methods which may be
  87. useful to the occassional power user which are no longer available
  88. from the public API. These methods, however, <i>are still
  89. available</i> on the implementation classes.</li>
  90. </ul>
  91. <li><b>Most instance construction is now handled via builder classes.</b></li>
  92. <ul>
  93. <li>Since the public API is now primarily interfaces, some sort of
  94. factory type class is necessary to construct the relevant
  95. implementations. These new factory classes follow the builder
  96. pattern which is a very convenient programming style which has the
  97. secondary benefit of removing the need for complex constructors
  98. with many parameters.</li>
  99. </ul>
  100. <li><b>The various (and confusing) methods for constructing Iterables
  101. have been replaced by an Iterable builder.</b></li>
  102. <ul>
  103. <li>There were a variety of methods on the Cursors for
  104. constructing different Iterable/Iterator instances with different
  105. options. These have all been combined into a single Iterable
  106. builder class which is both easier and more convenient to work
  107. with.</li>
  108. </ul>
  109. <li><b>Many secondary "utility" classes were moved to the "util"
  110. package.</b></li>
  111. <ul>
  112. <li>As part of making the API more approachable to new users, many
  113. of the secondary classes were moved to the "util" package. This
  114. makes the primary API more obvious.</li>
  115. </ul>
  116. <li><b>A row is now a Row.</b></li>
  117. <ul>
  118. <li>A row of data, previously typed as a
  119. <code>Map&lt;String,Object&gt;</code>, is now explicitly typed as
  120. a Row. This makes code much more readable as well as allows for
  121. additional functionality beyond the basic Map. Since the Row
  122. interface extends <code>Map&lt;String,Object&gt;</code>, old code
  123. can remain largely untouched.</li>
  124. </ul>
  125. <li><b><code>Attachment.getFileData</code> now returns the "real"
  126. data.</b></li>
  127. <ul>
  128. <li>Previously, this method returned the internal representation
  129. of the attachment data, which included a wrapper and the data in a
  130. possibly compressed form. Now that the internal format has been
  131. deciphered, this method has been changed to return the actual
  132. attachment content (which is most likely what people would desire
  133. from that method in the first place). The internal representation
  134. can be retrieved from <code>Attachment.getEncodedFileData</code>
  135. if necessary.</li>
  136. </ul>
  137. </ul>
  138. <h4>Working with Jackcess Encrypt</h4>
  139. <p>
  140. If you are using the <a href="https://jackcessencrypt.sourceforge.io/">Jackcess Encrypt</a> project, then you will need to
  141. use a version compatible with the relevant Jackess API.
  142. Fortunately, the major versions match, so it's pretty simple:
  143. </p>
  144. <ul>
  145. <li>Jackcess 2.x -&gt; Jackcess Encrypt 2.y</li>
  146. <li>Jackcess 1.x -&gt; Jackcess Encrypt 1.y</li>
  147. </ul>
  148. </subsection>
  149. <subsection name="What does this mean for 1.x?">
  150. <p>
  151. Moving forward, all new feature development will be in Jackcess 2.x.
  152. The Jackcess 1.x code has been branched at version 1.2.14 and some
  153. bugfixes may be backported to that branch on a case by case basis.
  154. However, no new feature development will be done on the 1.x branch.
  155. </p>
  156. </subsection>
  157. <subsection name="What did we miss?">
  158. <p>
  159. This upgrade guide attempts to hit all the high-points for upgrading
  160. from Jackcess 1.x to 2.x. If you feel that it is incorrect or missing
  161. a key bit of information, please, <a href="https://sourceforge.net/p/jackcess/discussion/456474/">drop us a line</a>!
  162. </p>
  163. <p>
  164. Some <a href="https://sourceforge.net/p/jackcess/discussion/456474/thread/8b76f73b/">additional notes</a> from a migration effort.
  165. </p>
  166. </subsection>
  167. </section>
  168. </body>
  169. </document>