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.

IntegrationExperiences.asciidoc 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  1. ---
  2. title: Integration Experiences
  3. order: 34
  4. layout: page
  5. ---
  6. [[integrating-vaadin-applications-with-other-technologies]]
  7. = Integrating Vaadin Applications with other technologies
  8. [[preface]]
  9. Preface
  10. ~~~~~~~
  11. The intention of this article is not to show how to integrate
  12. http://vaadin.com/[Vaadin] with some other technology, but to tell
  13. user-stories from both easy and hard customer cases where Vaadin has
  14. been combined with something else. It should also give you a pointer to
  15. what is possible and what is not.
  16. Please see the http://vaadin.com/wiki[wiki] for more extensive technical
  17. articles on various subjects. If you are interested in learning more
  18. from our developers, please contact us through
  19. http://vaadin.com/forum[our forums]. The forum messages are usually
  20. answered very rapidly (read: within a few hours during business hours).
  21. [[user-stories]]
  22. User stories
  23. ~~~~~~~~~~~~
  24. [[cloud-computing-and-vaadin]]
  25. Cloud computing and Vaadin
  26. ^^^^^^^^^^^^^^^^^^^^^^^^^^
  27. ===============================
  28. Amazon's EC2 really takes creating and serving Vaadin applications to
  29. a new level. You can literally have a new server running with server,
  30. portal and application in couple of minutes and it all just works. Of
  31. course this not only applies to Vaadin applications, but together they
  32. are a perfect fit! -*Joonas Lehtinen*
  33. ===============================
  34. link:https://aws.amazon.com/ec2/[Amazon EC2]
  35. [[cms-ala-liferay-and-vaadin]]
  36. CMS (ala Liferay) and Vaadin
  37. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  38. ===============================
  39. We wanted to be able to show some pop-up application windows that were
  40. part of our Vaadin application and that the customer themselves could
  41. write the links in their CMS without hassle. What we did was that we
  42. created an invisible Vaadin application that listened to the URL and
  43. whenever it changed due to a click on a link, it launched a new pop-up
  44. window. The solution was also highly scalable as 30.000+ users are using
  45. it daily already. -*Johannes Tuikkala*
  46. ===============================
  47. [[custom-ui-components-to-browser-with-java]]
  48. Custom UI components to browser with Java
  49. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  50. ===============================
  51. Creating your own widget for Vaadin is very easy thanks to the new
  52. eclipse plugin. All you need to do is select "Create new Widget" in
  53. eclipse and all the server and client side code is automatically
  54. generated for you. Then you'll just create the widget using Java and
  55. GWT. Using the eclipse plugin it is also much faster to set up a new
  56. Vaadin project. -*Matti Tahvonen*
  57. ===============================
  58. [[drools-and-vaadin]]
  59. Drools and Vaadin
  60. ^^^^^^^^^^^^^^^^^
  61. ===============================
  62. We required a flexible way to validate internal dependencies in highly
  63. dynamic data structures. We solved our need by integrating the Drools
  64. rule engine in our application, and with it we got a powerful
  65. content-triggered autocompletion mechanism as a freebie. We wrapped the
  66. rule engine behind a general API in a EJB, so the rule mechanism can be
  67. used by all components of the application architecture. -*Henri
  68. Muurimaa*
  69. ===============================
  70. http://jboss.org/drools[Drools]
  71. [[extending-existing-components]]
  72. Extending existing components
  73. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  74. ===============================
  75. We had a real business need for few important widgets that just were
  76. not available in Vaadin. So we extended the current table and came up
  77. with hierarchical table aka treetable. Another simple but important
  78. widget was multilingual text field. It acts just like normal textfield
  79. but when opened, you get the java field opened with multiple locale
  80. instances, it has nice UI too including user friendly flags. Great for
  81. handling i18n based data in your UI. We got multiple customer cases that
  82. enjoy these new widgets. -*Jani Laakso*
  83. ===============================
  84. [[flex-and-vaadin]]
  85. Flex and Vaadin
  86. ^^^^^^^^^^^^^^^
  87. ===============================
  88. Flex is really excellent for animations and flashy things and in this
  89. way is an ideal candidate for creating something really good looking
  90. together with Vaadin. I created a proof-of-concept flex-Vaadin
  91. application that communicates through GWT by wrapping the flex component
  92. and implementing Vaadin's paintable interface. If you know flex from
  93. before or have teams that know flex and others that know Java then this
  94. is an ideal combination. -*Kim Leppänen*
  95. ===============================
  96. http://demo.vaadin.com/coverflow/[Coverflow example with Flex+Vaadin]
  97. [[google-analytics-integration]]
  98. Google Analytics Integration
  99. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  100. ===============================
  101. For the Sampler application, we wanted to be able to see which
  102. 'samples' are interesting to the users. GWT makes it easy to integrate
  103. with JavaScript APIs, and thus making a Google Analytics component was a
  104. breeze, even without using existing GWT/Java efforts. -*Marc Englund*
  105. ===============================
  106. http://demo.vaadin.com/sampler/[Sampler]
  107. [[graphics-with-jfreechart]]
  108. Graphics with JFreeChart
  109. ^^^^^^^^^^^^^^^^^^^^^^^^
  110. ===============================
  111. It turned out surprisingly easy to add various charts to reports
  112. generated by a web application. All we needed to do is create the
  113. JFreeChart chart object and an Vaadin component automatically displays
  114. it as SVG or PNG graphics depending on the browser used. -*Henri Sara*
  115. ===============================
  116. http://dev.vaadin.com/browser/incubator/JFreeChartComponent[Vaadin:JFreeChart
  117. Component] +
  118. http://www.jfree.org/jfreechart/[JFreeChart]
  119. [[gwt-components-to-vaadin]]
  120. GWT Components to Vaadin
  121. ^^^^^^^^^^^^^^^^^^^^^^^^
  122. ===============================
  123. I wanted to create a Vaadin component out of Google's !GoogleMaps GWT
  124. Widget. In order to do this you needed to create a widgetset that
  125. includes the component and implement two methods that are required for
  126. communication between the client and the server. Quite straight forward.
  127. See the code in the incubator (link below). -*Henri Muurimaa*
  128. ===============================
  129. https://vaadin.com/directory/component/googlemaps-add-on[GoogleMaps
  130. add-on]
  131. [[javascript-libraries-and-vaadin]]
  132. Javascript libraries and Vaadin
  133. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  134. ===============================
  135. For the Sampler application, I made a code formatting and colorizing
  136. component, which makes use of the "google-code-prettify" JavaScript
  137. library. I've found existing JavaScript libraries are easy to use with
  138. GWT on the client-side. -*Marc Englund*
  139. ===============================
  140. http://demo.vaadin.com/sampler/[Sampler] +
  141. http://code.google.com/p/google-code-prettify/[Prettify]
  142. [[jquery-dojo-and-prototype-with-vaadin]]
  143. JQuery, Dojo and Prototype with Vaadin
  144. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  145. ===============================
  146. Combining Vaadin applications and client-side javascript libraries is
  147. a very interesting use-case and a very easy one to implement as well.
  148. The easiest way to accomplish this is to use a !CustomLayout with the
  149. Javascript you want. See a short demo I made below. -*Joonas Lehtinen*
  150. ===============================
  151. http://vaadin.com/forum/-/message_boards/message/18611[Discussions on
  152. the forum] +
  153. http://jole.virtuallypreinstalled.com/JQTest/[Live example of
  154. JQuery and Vaadin collaboration]
  155. [[latex-and-vaadin]]
  156. LaTeX and Vaadin
  157. ^^^^^^^^^^^^^^^^
  158. ===============================
  159. This was no doubt a very exotic combination. Our customer wanted to be
  160. able to create books that could be sent to printing based on huge
  161. amounts of data. We wrote an advanced parser (using DOM and SAX parsers)
  162. that created a file that LaTeX could interpret. LaTeX then created a PDF
  163. that was saved in a database and a link showed up in the webshop.
  164. Whenever you clicked on the link, you got finalized PDF that could be
  165. sent to printing and as a result you got a full several hundred pages
  166. long book. -*Jani Laakso*
  167. ===============================
  168. http://www.latex-project.org/[LaTeX]
  169. [[leveraging-existing-java-libraries-in-the-browser]]
  170. Leveraging existing Java libraries in the browser
  171. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  172. ===============================
  173. Recently, while making a gesture recognition component, I was able to
  174. use the Levensthein Distance algorithm implementation from the Jakarta
  175. Commons project, without any modification.The use of GWT makes it
  176. possible to leverage existing Java code on the client side - within own
  177. projects, or by making use of the vast amount of libraries available for
  178. Java. -*Marc Englund*
  179. ===============================
  180. [[moss-and-vaadin-through-iframe]]
  181. MOSS and Vaadin through IFrame
  182. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  183. ===============================
  184. The goal was to get a Vaadin application running inside the Microsoft
  185. Office Sharepoint Server (MOSS) as a portlet. What we did was that we
  186. wrote our Vaadin application and deployed it on a JBoss portal. We then
  187. took the application's URL and used MOSS' !PageViewer Webpart to have it
  188. include the application inside an IFrame. It was actually much easier
  189. that I thought. -*Johannes Tuikkala*
  190. ===============================
  191. http://blogs.technet.com/josebda/archive/2007/04/05/integrating-sharepoint-with-other-portals-and-web-applications.aspx[Integrating
  192. Sharepoint with other portals and web applications]
  193. [[moss-and-vaadin-with-sharepoint-sso]]
  194. MOSS and Vaadin with Sharepoint SSO
  195. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  196. ===============================
  197. The goal was to integrate a Vaadin application to MOSS as portal.
  198. Priority was to use SSO by Sharepoint. This was accomplished doing
  199. custom integration Webpart with C# that transfered authentication
  200. information to Vaadin before it was opened with-in IFRAME. -*Mauno
  201. Haukila*
  202. ===============================
  203. [[n-tier-jee-architecture-with-vaadin]]
  204. N-tier JEE architecture with Vaadin
  205. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  206. ===============================
  207. We have found in several larger customer cases that the best possible
  208. architecture is to separate the UI-layer from the rest. Never mix your
  209. business logic inside UI logic, there's no need to. This way the UI can
  210. be replaced in the future and also when updating old systems to use
  211. Vaadin (e.g. SWING applications that are written this way) it has been a
  212. breeze when the only thing that needs to be rewritten is the UI. Another
  213. very important factor is security, trust your data layer, do not trust
  214. your clients, using enterprise beans with JNDI helps you. Scalability
  215. and high-availability are also easier to cope with. Scale up with
  216. multiple cheap Tomcat machines acting as Vaadin clients, few powerful
  217. data servers as JBoss cluster and a good SQL server. -*Jani
  218. Laakso*
  219. ===============================
  220. image:img/n-tier.png[N-tier]
  221. [[offline-standalone-applications]]
  222. Offline / standalone applications
  223. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  224. ===============================
  225. I've made offline / standalone Vaadin applications by integrating an
  226. embedded servlet container (Jetty and Winstone so far) with Xulrunner.
  227. This is actually a quite straightforward process, requiring only a few
  228. lines of code for the basic functionality. It's really the distribution
  229. (making installers and such), and the actual application that's the hard
  230. part. -*Marc Englund*
  231. ===============================
  232. [[opensource-stack-for-customer-projects]]
  233. Opensource stack for customer projects
  234. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  235. ===============================
  236. One of our customers asked us to help them with selecting an open
  237. source stack for their open source product portfolio. What we came up
  238. with was based on our own experiences and is by no means the only
  239. possibility. What it shows though, is how Vaadin is only part of the UI
  240. layer and everything beneath it can be almost anything. -*Ville
  241. Ingman*
  242. ===============================
  243. image:img/OSStack.png[OS Stack] +
  244. link:img/OSStack.pdf[OS Stack PDF]
  245. [[pentaho-bi-suite-and-vaadin]]
  246. Pentaho BI Suite and Vaadin
  247. ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  248. ===============================
  249. Yet another way to create PDF files, but this time really tightly
  250. integrated with Vaadin. We had some data in a Vaadin table that we
  251. wanted to print as a PDF file. As each component in Vaadin has a
  252. container, the most natural way was to take the data from the container,
  253. send it through a wrapper and give it to Pentaho. Pentaho then created
  254. the PDF files without any problems. So whenever somebody wanted to print
  255. the data they were viewing in a scrollable table, they just clicked a
  256. button and everything was taken care of in the background. -*Jani
  257. Laakso*
  258. ===============================
  259. http://www.pentaho.com/[Pentaho BI Suite]
  260. [[portlets-with-vaadin]]
  261. Portlets with Vaadin
  262. ^^^^^^^^^^^^^^^^^^^^
  263. ===============================
  264. The only thing you have to do in practice when you want to write a
  265. portlet is add the portlet.xml file, where you define Vaadin's
  266. !ApplicationPortlet as the entry point. After this your application will
  267. work inside the portal. The only situation where you need to edit the
  268. Java code as well is when you want to use some portal/portlet specific
  269. features. This gives you the possibility to first develop a standard
  270. Vaadin application and then later, by just adding the portlet.xml file
  271. you have it working inside a portal. -*Jonas Granvik*
  272. ===============================
  273. http://dev.vaadin.com/wiki/Articles/PortalTools[Portal Tools]
  274. [[pdfs-fopitext-and-vaadin]]
  275. PDFs (FOP+iText) and Vaadin
  276. ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  277. ===============================
  278. When creating my printing service I used Apache FOP and iText to
  279. create PDF files from multiple XML/XSLT/PDF files just as you would
  280. normally in any Java application. The thing I found the most powerful
  281. however was the combination with these two products together with
  282. Vaadin's Embedded component. I just created the object, setSource() to
  283. my byte array and the PDF showed up in my browser together with all the
  284. buttons and widgets I also wanted on the screen. The user experience was
  285. significantly enhanced compared to having to download the PDF and click
  286. on some button in an external window. -*Fredrik Rönnlund*
  287. ===============================
  288. http://vaadin.com/book/-/page/components.embedded.html[Vaadin:Embedded] +
  289. http://xmlgraphics.apache.org/fop/[Apache FOP] +
  290. http://www.lowagie.com/iText/[iText]
  291. [[saas-with-vaadin]]
  292. SAAS with Vaadin
  293. ^^^^^^^^^^^^^^^^
  294. ===============================
  295. When writing our application as a service we had to do some serious
  296. planning beforehand as the application was going to be used by so many
  297. people. What we did was that we had one database for all users and then
  298. inserted the instance ID in all HQL/SQL clauses to be sure we were
  299. always accessing the correct instance. The instance was select at login.
  300. This didn't require any specific things from the UI part, which was
  301. created using Vaadin. -*Jani Laakso*
  302. ===============================
  303. [[single-sign-on-sso-to-liferay]]
  304. Single Sign On (SSO) to Liferay
  305. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  306. ===============================
  307. Writing a Single Sign On portlet was really easy. A Vaadin application
  308. by default only requires to be packaged as a portlet in order to work
  309. inside a portal and then by using the provided API to the portal you can
  310. easily retrieve all login information. This way the user doesn't need to
  311. login several times and context handling is also done easily. -*Jani
  312. Laakso*
  313. ===============================
  314. [[unit-testing-vaadin-applications]]
  315. Unit testing Vaadin applications
  316. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  317. ===============================
  318. Unit testing Vaadin applications is no different from unit testing any
  319. java application. What we have done however is separate the GUI from the
  320. !BusinessLogic (even so far that they are running on physically
  321. different servers). This way our most extensive testing is done on the
  322. business logic, but also on our Controller in the GUI. Having Unit tests
  323. in general has helped us build more solid applications, on all
  324. layers. -*Kim Leppänen*
  325. ===============================
  326. [[web-2.0-apis-and-vaadin]]
  327. Web 2.0 APIs and Vaadin
  328. ^^^^^^^^^^^^^^^^^^^^^^^
  329. ===============================
  330. Many "Web 2.0" APIs already have GWT bindings, making it trivial to
  331. use these. Even without existing bindings, it's easy to use JavaScript
  332. APIs from GWT, or REST/JSON/XML/etc APIs from the server-side.Google
  333. Maps, Google Analytics, Flickr, Youtube - these are some "Web 2.0" APIs
  334. that have been used. -*Marc Englund*
  335. ===============================
  336. [[webservices-and-vaadin]]
  337. Webservices and Vaadin
  338. ^^^^^^^^^^^^^^^^^^^^^^
  339. ===============================
  340. Integrating a webservice with Vaadin was really a no brainer. What we
  341. had was a UI that had to check something through a service-provider's
  342. Webservice. So when ever the UI launched the check, we called the
  343. webservice (with Pojos created by the WSDL file that we got from the
  344. service provider) and got some other Pojos as a reply. The reply then
  345. dictated what the UI would look like. -*Johannes Tuikkala*
  346. ===============================