tag:blogger.com,1999:blog-968560796164073612024-03-13T07:56:52.662-07:00Rich Client DevelopmentBrLoukhttp://www.blogger.com/profile/04035055642087481512noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-96856079616407361.post-46928929493908962702008-05-11T06:43:00.001-07:002010-04-24T03:21:06.630-07:00Rich Internet Application: Development Pet Store 2.0 using GWT and ExtJS.<div><strong><em>Introduction:</em><br /></strong><br />Google Web toolkit(GWT) is a powerful technology provided by Google Inc, It allows Java developers to write AJAX-enabled web application in the Java programming language and generate a highly optimized JavaScript.<br /><br />Ext JS, the Java script library for building rich internet application interested by GWT technology, provides an add-on library, EXT GWT, to let developers writing Ext JS components in Java.<br /><br />In this article, I will show you the architecture used to add presentation components on the top of the Pet Store 2.0 persistence layer using Ext GWT and discuss how the communication between layers could be handled.<br /><br /><strong><em>Prerequisites:</em></strong><br /><br /><br /><p>To build and run the sample, you need the following softwares:</p><br /><ul><br /><li><a href="http://code.google.com/webtoolkit/download.html">gwt-xxx-0.0.2415</a></li><br /><li><a href="http://www.extjs.com/products/gxt/download.php">Ext GWT 1.0 beta2 SDK </a></li><br /><li><a onclick="clickCount(9, 'windows');" href="http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/ganymede/M6/eclipse-jee-ganymede-M6-win32.zip" target="_blank">Eclipse IDE for Java EE Developers</a></li><br /></ul><strong><em>Getting started:</em></strong><br /><br /><br /><p>To start developing Rich Internet application with Ext GWT, the first step is to write the entire application in Java programming language using Ext GWT library. GWT comes with an embedded browser and debugger, so you can run/debug your web application.</p><br /><p>Note that all Java components will be converted as client side components into JavaScript language. Therefore, you can’t write server side components such as servlet in your GWT application, but you could write how the interaction with these components could be happened. GWT supports remote procedure call for passing Java objects to and from a server over http, so you can get/submit Data through RPC(Remote Procedure Call) or by http requests.</p><br /><p>In this sample, we only use http Data Request to interact with server.</p><br /><p><strong><em>High Level Architecture Diagram:</em></strong> </p><br /><p>To make it easier to understand RIA application development with Ext GWT, the diagram below details the architecture used for building this sample and for any kind of application using GWT.</p><br /><p><a href="http://3.bp.blogspot.com/_f_VMSwNLSM4/SCcfAlFrGNI/AAAAAAAAAAY/zYvA4WKRGvs/s1600-h/HLAD.png"><img id="BLOGGER_PHOTO_ID_5199158389638895826" style="margin: 0px auto 10px; display: block; text-align: center;" alt="" src="http://3.bp.blogspot.com/_f_VMSwNLSM4/SCcfAlFrGNI/AAAAAAAAAAY/zYvA4WKRGvs/s400/HLAD.png" border="0" /></a><br /><strong><em>Conclusion:</em></strong><br /></p><br /><p>In this article, we have seen together a kind of innovative architecture used for building RIA applications. This architecture is based on GWT to generate Ext JS components from Java code and use http requests to interact with server.</p><br /><p><strong><em>Screenshot:</em></strong><br /><a href="http://4.bp.blogspot.com/_f_VMSwNLSM4/SCcoH1FrGOI/AAAAAAAAAAg/pCBmxdVdetI/s1600-h/PetStore+with+Ext+GWT.png"><img id="BLOGGER_PHOTO_ID_5199168409797597410" style="margin: 0px auto 10px; display: block; text-align: center;" alt="" src="http://4.bp.blogspot.com/_f_VMSwNLSM4/SCcoH1FrGOI/AAAAAAAAAAg/pCBmxdVdetI/s400/PetStore+with+Ext+GWT.png" border="0" /></a><br /><strong><em>Download:</em></strong><br /></p><br /><ul><br /><li><a href="http://www.teamsoftsuite.com/MySites/brlouk/downloads/rc-development/Article2-PetStore-ExtGWT/com.brlouk.petstore.extgwt-src.zip">PetStore-ExtGWT-src</a></li><br /><br /><li><a href="http://www.teamsoftsuite.com/MySites/brlouk/downloads/rc-development/Article2-PetStore-ExtGWT/com.brlouk.petstore.extgwt-build.zip">PetStore-ExtGWT-build</a></li><br /><br /><li><a href="http://www.teamsoftsuite.com/MySites/brlouk/downloads/rc-development/Article2-PetStore-ExtGWT/com.brlouk.petstore.jee.ejb3-src.zip">PetStore-EJB3-src</a></li><br /><br /><li><a href="http://www.teamsoftsuite.com/MySites/brlouk/downloads/rc-development/Article2-PetStore-ExtGWT/petstore.sql">PetStore.sql</a></li></ul></div>BrLoukhttp://www.blogger.com/profile/04035055642087481512noreply@blogger.com0tag:blogger.com,1999:blog-96856079616407361.post-78868098225354995142008-05-06T06:43:00.000-07:002010-04-24T03:18:22.581-07:00Rich Client Platform: Development Pet Store 2.0 using Eclipse RCP and JBoss.<span style="FONT-STYLE: italic"><strong>Introduction:</strong></span><br /><br />In this article, I will show you how the combination of Eclipse RCP and EJB3 allow developers to build a rich, performed and distributed application. I will assume that you understand the basics of technologies mentioned above, and I will only explain the architecture used to efficiently handle the communication between the desktop application and the server.<br /><br />This article is based on previous articles:<br /><br /><br /><ul><li><a href="http://rc-development.blogspot.com/2008/05/deploying-java-pet-store-20-on-jboss.html">Deploying Java Pet Store 2.0 on JBOSS using Eclipse IDE</a></li><br /><li><a href="http://rc-development.blogspot.com/2008/05/blog-post.html">Rich Internet Application: Development Pet Store 2.0 using GWT and ExtJS.</a><br /></li></ul><p><strong><em>Prerequisites:</em></strong><br /></p><p><strong><em></em></strong><strong><em><br /></em></strong>To build and run the sample, you need the following software:<br /></p><ul><li><a href="http://www.eclipse.org/downloads/packages/">Eclipse IDE for Java EE Developers (178 MB)</a></li><br /><li><a href="https://sourceforge.net/project/showfiles.php?group_id=22866&package_id=16942&release_id=575410">JBoss-5.0.0.Beta4</a><br /></li></ul><p><strong><em>High Level Architecture Diagram:</em></strong><br /><br />The diagram below details the architecture used for building this sample. It shows the interaction between RCP Application and server side components. Client could discover and lookup services via JNDI as service registry.<br /><br /><br /><br /><br /><a href="http://2.bp.blogspot.com/_f_VMSwNLSM4/SCeAZVFrGQI/AAAAAAAAABo/C98QI9nKTEQ/s1600-h/HLAD-RCP.png"><img id="BLOGGER_PHOTO_ID_5199265467468552450" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://2.bp.blogspot.com/_f_VMSwNLSM4/SCeAZVFrGQI/AAAAAAAAABo/C98QI9nKTEQ/s400/HLAD-RCP.png" border="0" /></a><br /><br /></p><p></p><br /><br /><p><strong><em>Configuration:</em></strong><br /></p><p><br />Configuration always depends on the application server, but it is quite the same.<br />I details below the configuration needed to lookup services via JNDI in JBoss server.<br /></p><ul><li>JBoss Client Library : Add jboss-all-client in the classpath.</li><br /><li>PetStore client Interfaces : Add PetStore client libray in the classpath</li><br /><li>JNDI parameters : </li></ul><br /><br /><p>+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory<br />+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces<br />+ java.naming.provider.url=localhost:1099</p><br /><br /><p><strong><em>Conclusion:</em></strong> </p><br />In this article, we have seen together how we can access to distributed components by desktop application built using Eclipse RCP.<br /><br /><br /><p><strong><em>Screenshot:</em></strong><br /></p><p></p><p><a href="http://1.bp.blogspot.com/_f_VMSwNLSM4/SCeCOFFrGRI/AAAAAAAAABw/hxumHBgRsso/s1600-h/PetStore-RCP.png"><img id="BLOGGER_PHOTO_ID_5199267473218279698" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://1.bp.blogspot.com/_f_VMSwNLSM4/SCeCOFFrGRI/AAAAAAAAABw/hxumHBgRsso/s400/PetStore-RCP.png" border="0" /></a> <strong><em>Download:</em></strong></p><ul><li><strong><em><a href="http://www.teamsoftsuite.com/MySites/brlouk/Downloads/rc-development/Article3-RCP/com.brlouk.petstore.rcp.zip">PetStore-RCP-src</a></em></strong></li></ul>BrLoukhttp://www.blogger.com/profile/04035055642087481512noreply@blogger.com0tag:blogger.com,1999:blog-96856079616407361.post-53005927923494173062008-05-05T12:24:00.000-07:002010-04-24T03:17:27.184-07:00Deploying Java Pet Store 2.0 on JBOSS using Eclipse IDE<em><span style="font-weight: bold;">Introduction:</span> </em><br /><br />The java Pet store 2.0 is a reference application for building Ajax-enabled web application on Java EE 5. It is provided by the Java blueprints program at Sun Microsystems.<br />You can find more details from <a href="https://blueprints.dev.java.net/petstore/">https://blueprints.dev.java.net/petstore/</a><br /><br />Many people ask about running PetStore 2.0 with JBOSS server application or another JEE server that could be different from Sun server.<br />This tutorial is for showing you how it is possible to run PetStore 2.0 with JBoss and discuss the changes needed.<br /><br /><em style="font-weight: bold;">Prerequisites:</em><em><br /><br /></em><em></em><ul><li><em><a href="http://www.eclipse.org/downloads/packages/">Eclipse IDE for Java EE Developers (178 MB)</a><br /></em></li></ul><ul><li><a href="https://sourceforge.net/project/showfiles.php?group_id=22866&package_id=16942&release_id=575410">JBoss-5.0.0.Beta4</a></li></ul><span style="font-weight: bold; font-style: italic;">Getting started:</span><br /><br />JBoss version 5.0, is recently a Java EE 5 compatible application server. Therefore, we don’t need to refactor the code in order to disable Java 5 features like generic types and dependency injection using annotations. However, you have to paid attention on the deployment.<br />Jboss recommends using the EAR file as recommended way to deploy application. So, we need to separate the persistence layer from the other layers in order to create a jar file which contains the EJB module and a war file containing the Web module.<br />To deploy PetStore application, you need to create three eclipse projects.<br /><br /><span style="font-weight: bold; font-style: italic;">First-Step: Creation an EJB Project:</span><br /><br /><br /><p>To create a new EJB project:</p><ol><br /><li>In the J2EE perspective, select <strong>File</strong> > <strong>New</strong> > <strong>Other</strong> > <strong>EJB</strong> > <strong>EJB Project</strong>. The New EJB Project wizard opens. </li><br /><li>In the <strong>Project Name</strong> field, type a name for the EJB project. </li><br /><li><strong>Optional: </strong>To use a different workspace directory for your EJB project, modify the settings for <strong>Project contents</strong>.<br /><br /><strong>Important: </strong>If you specify a non-default project location that is already being used by another project, the project creation will fail. </li><br /><li>In the <strong>Target runtime</strong> drop-down list, select the application server that you want to target for your development. This selection affects the compilation and runtime settings by modifying the class path entries for the project. Use the <strong>New</strong> button if a target runtime does not exist, or if you want to use a different one</li></ol>Once the project is created, import entities which are located in src folder of PetStore.<br /><br /><span style="font-style: italic;">Changes needed:</span><br /><br /><ul><li>Add a persistence.xml into the META-INF directory:</li></ul><p><?xml version="1.0" encoding="UTF-8"?><br /><br /><persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"><br /><br /><persistence-unit name="PetstorePu"><br /><br /><jta-data-source>java:/DefaultDS</jta-data-source><br /><br /><properties><br /><br /><property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/><br /><br /></properties><br /><br /></persistence-unit><br /><br /></persistence><br /></p><ul><li>Setup the DB, using the HSQL Database Manager, by executing the petstore.sql script located under the setup/sql/javadb/</li></ul><span style="font-weight: bold; font-style: italic;">Second step: Creation a Dynamic Web project:</span><br /><br /><p>To create a new dynamic Web project, complete the following steps:</p><ul><li>Open the J2EE perspective. </li><br /><li>In the Project Explorer, right click on Dynamic Web Projects, and select <strong>New</strong> > <strong>Dynamic Web Project</strong> from the context menu. The New Dynamic Web Project wizard starts. </li><br /><li>Follow the project wizard prompts. </li></ul><p>Once the project is created, import all classes located in src folder of PetStore except entities classes.<br /></p><p><em>Changes needed: </em><br /></p><ul><li>Remove the resource-ref in web.xml, it’s no longer needed.</li><br /><li>Remove duplicated context-param « com.sun.faces.verifyObjects »</li></ul><span style="font-style: italic;"><span style="font-weight: bold;"><br />Third step: Creation an Enterprise Application project:</span></span><br /><br /><p>To create a J2EE enterprise application project:</p><ol><li>In the J2EE perspective, click <strong>File</strong> > <strong>New</strong> > <strong>Project</strong> > <strong>J2EE</strong> > <strong>Enterprise Application Project</strong>. </li><br /><li>In the <strong>Project Name</strong> field, type a name for the new project. </li><br /><li>To change the default project location, clear the <strong>Use default</strong> check box under <strong>Project contents</strong> and select a new location with the <strong>Browse</strong> button. </li><br /><li>In the <strong>Target runtime</strong> field, select the target runtime for the project. You can click the <strong>New</strong> button to create a new runtime for the project to use. </li><br /><li>On the JEE modules, select the two projects created above.</li><br /></ol><p>Finally, select the EAR project and click Run as>run on server.</p><p style="font-weight: bold; font-style: italic;">Download :</p><ul><li><a href="http://www.teamsoftsuite.com/MySites/brlouk/Downloads/rc-development/Article1-PetStore/com.brlouk.petstore.jee.zip">PetStore-src</a></li><li><a href="http://www.teamsoftsuite.com/MySites/brlouk/Downloads/rc-development/Article1-PetStore/com.brlouk.petstore.jee.ear.ear">PetStore-EAR</a></li></ul>BrLoukhttp://www.blogger.com/profile/04035055642087481512noreply@blogger.com2