[jboss-user] [EJB3] - DNA integration with Java EE

Administrator Administrator do-not-reply at jboss.com
Thu Jan 20 11:01:19 EST 2011


Administrator Administrator [http://community.jboss.org/people/admin] modified the document:

"DNA integration with Java EE "

To view the document, visit: http://community.jboss.org/docs/DOC-12952

--------------------------------------------------------------
h2. JBoss DNA integration with enterprise services or one of possible answers to the Ultimate Question of Life, the Universe, and Everything 
Well, while the answer is not that simple like *42 (http://en.wikipedia.org/wiki/42_(number))* but considering that JBoss DNA will utilize other JBoss technologies and frameworks (http://www.jboss.org/projects) it is not that complex either - the integration picture might look like following:
 http://community.jboss.org/servlet/JiveServlet/showImage/102-12952-1-1073/dna-jee.PNG  http://community.jboss.org/servlet/JiveServlet/downloadImage/102-12952-1-1073/450-267/dna-jee.PNG 
 #  (#)
h3. Why Seam?
Basically it explained in short here http://seamframework.org/Home/WhySeam
Many people think that JBoss Seam is just another JSF integration framework. No, it’s not just. J
It’s all about integration infrastructure, conversation management (http://docs.jboss.com/seam/2.1.0.SP1/reference/en-US/html/concepts.html), various services support, and bijection (http://docs.jboss.com/seam/2.1.0.SP1/reference/en-US/html/concepts.html#d0e3941). One might call it “*+universal glue for services+*” – at least in Java world. 

Some advantages of using *Seam* as the core of web service layer infrastructure (from DNA prospective):
*View & presentation layer*:
-         built-in support for *JSF* (generic); 
-         built-in support for *RichFaces* and *Facelets* (Rich JSF implementation – *AJAX**+XHTML*)
-          http://docs.jboss.com/seam/2.1.0.SP1/reference/en-US/html/remoting.html Seam Remoting
-         integration with alternative view layers (http://seamframework.org/Documentation/AlternativeViewLayersOverview):  http://seamframework.org/Documentation/GWT GWT,  http://seamframework.org/Documentation/Hessian Hessian,  http://docs.jboss.com/seam/2.1.0.SP1/reference/en-US/html/wicket.html Wicket, and  http://seamframework.org/Documentation/Flex Flex
+-        + flexible  http://docs.jboss.com/seam/2.1.0.SP1/reference/en-US/html/jbpm.html#d0e6504 page flow: - +stateless navigation model(+Using JSF or Seam navigation rules+)+ and +stateful navigation model (JBPM)+
-         +support for reporting services:  http://docs.jboss.com/seam/2.1.0.SP1/reference/en-US/html/itext.html iText PDF,  http://docs.jboss.com/seam/2.1.0.SP1/reference/en-US/html/excel.html MS Excel,  http://docs.jboss.com/seam/2.1.0.SP1/reference/en-US/html/mail.html e-mail,+ 
*Services layer*:
-         built-in support for business processes and decisions: JBoss *Rules* (*Drools) and JBoss JBPM (http://docs.jboss.com/seam/2.1.0.SP1/reference/en-US/html/jbpm.html#d0e6803)*; 
-         advanced security model (http://docs.jboss.com/seam/2.1.0.SP1/reference/en-US/html/security.html) based on JAAS.
-         Spring framework integration (http://docs.jboss.com/seam/2.1.0.SP1/reference/en-US/html/spring.html);
-         Web services (http://docs.jboss.com/seam/2.1.0.SP1/reference/en-US/html/webservices.html);
-          http://docs.jboss.com/seam/2.1.0.SP1/reference/en-US/html/rss.html RSS support;
-         Flexible  http://docs.jboss.com/seam/2.1.0.SP1/reference/en-US/html/configuration.html packaging model;
h2. View & presentation layer

I respectfully disagree with romney (DNA user interface discussion (http://www.jboss.com/index.html?module=bb&op=viewtopic&t=132054)) and not convinced that “+FLEX would be *the preferred choice* because it would support a dynamic user interface which will support a very expressive type of user interface. I[romney] believe html/Ajax have some limitation in this area especially when dealing with large amount of data/information.+”

I’m not against it as one of possible implementations but Flex may have as many limitations as any other RIA framework (http://www.hciidc.in/2008/07/21/flex-limitations/) – everything depends on a design - for example, loading millions of records at a time (instead of paging) might “kill” any even native application. Also in order to integrate with Flex some intermediate framework(s)/service(s) needs to be deployed/configured onto application server – like Granite Data Services (http://www.graniteds.org/confluence/pages/viewpage.action?pageId=229378) which adds an extra level of complexity. 

On the other hand there are other ways to implement rich UI while still having it simple, maintainable and thin.

Java Server Faces technology (http://java.sun.com/javaee/javaserverfaces/) allows abstracting particular presentation format from middle tier UI controller layer and follows MVC pattern (http://java.sun.com/javaee/5/docs/tutorial/doc/bnaqd.html) - it separates model (*UIComponent*) from RenderKits which in turn allows using different render kits while still having same POJO Web controller layer.
*JSF* has flexible functionality to substitute not only different rendering kits on the fly or by configuration but also it allows plugging in *JSF phase listeners* to do custom work – e.g. invoke business rules to decide, load or create view page on the fly, etc. Other frameworks like *JBoss Seam* are going much further than that. 

Different *free rendering kits exists on JSF market* – such as JBoss RichFaces (http://www.jboss.org/jbossrichfaces/) (XHTML, JS, AJAX), Facelets (https://facelets.dev.java.net/) (JSF templates + declarative composition of UI components using XHTML), XulFaces (http://xulfaces.sourceforge.net/) (JSF + XUL), project Woodstock (http://woodstock.dev.java.net/), ICESoft ICEfaces (http://www.icefaces.org/main/product/product-overview.iface),  Mobile JSF (https://mobilejsf.dev.java.net/) (WML, XHTML-MP), and many more. 

*JBoss RichFaces* (JSF+AJAX) is very powerful, feature rich, lightweight and simple to use AJAX framework that implements *Java Server Faces* spec and supports dynamic interface based on *JS + XHTML* – de-facto standards for dynamic web applications:
-         100+ components and UI controls (http://www.jboss.org/file-access/default/members/jbossrichfaces/freezone/docs/devguide/en/html/RichFacesComponentsLibrary.html) (including but not limiting to calendar (http://livedemo.exadel.com/richfaces-demo/richfaces/calendar.jsf?c=calendar&tab=usage), inplace input (http://livedemo.exadel.com/richfaces-demo/richfaces/inplaceInput.jsf?c=inplaceInput&tab=usage) and select (http://livedemo.exadel.com/richfaces-demo/richfaces/inplaceSelect.jsf?c=inplaceSelect&tab=usage), tree (http://livedemo.exadel.com/richfaces-demo/richfaces/tree.jsf?c=tree&tab=usage), toolbar (http://livedemo.exadel.com/richfaces-demo/richfaces/toolBar.jsf?c=toolBar&tab=usage), menu (http://livedemo.exadel.com/richfaces-demo/richfaces/dropDownMenu.jsf?c=menuGroup&tab=usage), tabbed panels (http://livedemo.exadel.com/richfaces-demo/richfaces/tabPanel.jsf?c=tabPanel&tab=usage), etc);
-          http://www.jboss.org/file-access/default/members/jbossrichfaces/freezone/docs/devguide/en/html/fileUpload.html Ajax-ed files upload to server (an example -  http://livedemo.exadel.com/richfaces-demo/richfaces/fileUpload.jsf?c=fileUpload&tab=usage http://livedemo.exadel.com/richfaces-demo/richfaces/fileUpload.jsf?c=fileUpload&tab=usage)
-         Plug-n-skin (http://livedemo.exadel.com/richfaces-demo/richfaces/plugnskin.jsf?c=plugnskin&tab=usage)
-         Standard JSF controls extended to support AJAX; 
-         drag (http://livedemo.exadel.com/richfaces-demo/richfaces/dragSupport.jsf?c=dragSupport&tab=usage) and drop (http://livedemo.exadel.com/richfaces-demo/richfaces/dragSupport.jsf?c=dropSupport&tab=usage) support. 
-         JQuery support (http://www.jboss.org/file-access/default/members/jbossrichfaces/freezone/docs/devguide/en/html/jQuery.html) (see example with *+Fisheye effect+* - http://livedemo.exadel.com/richfaces-demo/richfaces/jQuery.jsf?c=jQuery&tab=usage );
-         JS effects (http://livedemo.exadel.com/richfaces-demo/richfaces/effect.jsf?c=effect&tab=usage);
-          
It is very easy to develop rich UI while still having thin client (without any necessity to download any plug-ins or virtual machines). See more examples here - http://livedemo.exadel.com/richfaces-demo/richfaces/support.jsf  

On the other hand, same company (http://www.exadel.com/web/portal/home) that gave us *RichFaces* and *Ajax4Jsf* – also gave another alternative - Exadel Flamingo (http://exadel.com/web/portal/flamingo) – an integration of *Flex and JavaFX* with JBoss Seam, and Exadel Fiji (http://exadel.com/web/portal/fiji) that extends JSF by allowing the use of *Flex with JSF* components and within a jsf page. See examples here - http://exadel.com/web/portal/flamingo/demo and here - http://livedemo.exadel.com/fiji-demo/

Another alternative would be to use XULFaces (http://xulfaces.sourceforge.net/) – an integration of *Java Server Faces* and XUL (http://www.mozilla.org/projects/xul/) – powerful +XML User Interface Language+ that relies on multiple existing web standards and technologies, including  http://en.wikipedia.org/wiki/Cascading_Style_Sheets CSS,  http://en.wikipedia.org/wiki/JavaScript JavaScript, and  http://en.wikipedia.org/wiki/Document_Object_Model DOM and *integrates with native UI*. For example, XulRunner (http://en.wikipedia.org/wiki/XULRunner) might be very serious alternative to other approaches, and already used to some degree in famous IDEs like Eclipse (http://ftp.mozilla.org/pub/mozilla.org/xulrunner/eclipse/) and NetBeans (http://wiki.netbeans.org/EmbeddedBrowser) as embedded Internet browser widget. 

I believe that *putting all eggs into single UI basket might be disastrous* to any project with UI functionality – a number of new RIA frameworks are emerging as we speak. Who knows, the *Java FX* might be the next killer RIA in the nearest future – based on declarative language + extremely mature MVC UI framework *Swing* + newest enhancements  in deployment model, Swing and applet in JRE 6u10 (http://java.sun.com/javase/6/webnotes/6u10.html) might completely change the picture of RIA and desktop.

I don’t want to start another thread about which platform/framework is better - *that’s not the point that I’m trying to make*. My point is simple: *I believe in “AND” (integration) - in contrast with “OR” or “VS” (**segregation**)*. J 

*Proper infrastructure for middle layer that rely on standards is the key to success for an enterprise application* - that will enable and simplify access to an application from different existing and new clients and let community to do any other way.

h2. Services layer
h3. Java Content Repository API (a.k.a. JSR-170 (http://jcp.org/en/jsr/detail?id=170) and JSR-283 (http://jcp.org/en/jsr/detail?id=283))
No questions here – it simple and powerful way to access hierarchical and flat content *from Java applications* using loose coupling like following:

// Get the Repository object 
InitialContext ctx = ... Repository repository = (Repository)ctx.lookup("myrepo");
// Get a Credentials object 
Credentials credentials = new SimpleCredentials("MyName", "MyPassword".toCharArray());

// Get a Session 
Session mySession = repository.login(credentials, "MyWorkspace");

// get root node
Node root = mySession.getRootNode();
// get child node
Node node = root.getNode(“/a/b/c”);


Apache JackRabbit (http://jackrabbit.apache.org/) s a fully conforming implementation of the Content Repository for Java Technology API (JCR) and supports different deployment modes including *embedded JCR container (http://jackrabbit.apache.org/deployment-models.html)* mode. However, it has some performance limitations (in the current design) – http://wiki.apache.org/jackrabbit/Performance

One of other possible implementations might use *JBoss Cache (http://www.jboss.org/jbosscache/)* in its core – together with graph API. Sounds strange? From bird's-eye view prospective – perhaps. But closer look shows similarity in architecture: transactional tree structure of nodes (http://www.jboss.org/file-access/default/members/jbosscache/freezone/docs/3.0.0.CR3/userguide_en/html_single/index.html#architecture.tree_structure) with caching, clustering (http://www.jboss.org/file-access/default/members/jbosscache/freezone/docs/3.0.0.CR3/userguide_en/html_single/index.html#clustering) and persistence support (http://www.jboss.org/file-access/default/members/jbosscache/freezone/docs/3.0.0.CR3/userguide_en/html_single/index.html#cl.impls) (*JDBCCacheLoader*, FileCacheLoader, Amazon S3 CacheLoader, ETC) out of box – it might be an excellent choice for lightweight implementation of JCR API. 
Typical JBoss usage example:
   // Let's get a hold of the root node.
   Node rootNode = cache.getRoot();
 
   // Remember, JBoss Cache stores data in a tree structure.
   // All nodes in the tree structure are identified by Fqn objects.
   Fqn peterGriffinFqn = Fqn.fromString("/griffin/peter");
 
   // Create a new Node
   Node peterGriffin = rootNode.addChild(peterGriffinFqn);
 
   // let's store some data in the node
   peterGriffin.put("isCartoonCharacter", Boolean.TRUE);
   peterGriffin.put("favoriteDrink", new Beer());
It looks very similar to JCR access code example above, isn’t it?

What about applications that built using technologies other than Java? The answer is also simple –it is essential to support widely deployed open standard’s and de-facto implementations - see below.
h3. WebDAV (http://www.webdav.org/)
Despite on critique and its limitations this standard is not dead yet and might be useful by allowing external clients such as Microsoft Windows and Apple OS X to connect to, read and edit the content from JCR compliant repository. However, it has some issues in  http://en.wikipedia.org/wiki/Windows_Vista Windows Vista, only the WebDAV redirector is present by default; the original "Web folders" client has been removed. The "Web folders" client is only present if the  http://www.microsoft.com/downloads/details.aspx?familyid=17C36612-632E-4C04-9382-987622ED1D64&displaylang=en Microsoft Update for Web Folders is installed.

For example, Apache JackRabbit has  http://jackrabbit.apache.org/jackrabbit-webdav-library.html WebDAV module  in the form of Servlet packaged in  http://jackrabbit.apache.org/jackrabbit-web-application.html WAR application – specifically  http://jackrabbit.apache.org/api/1.4/org/apache/jackrabbit/webdav/jcr/JCRWebdavServerServlet.html JCRWebdavServerServlet.
h3. +Common Internet File System+ +(CIFS)+ support
Another possible extension for JBoss DNA is to support CIFS (http://www.samba.org/cifs/). CIFS is the standard file sharing protocol on the Microsoft Windows platform (e.g. Map Network Drive ...). 

 http://jcifs.samba.org/ JCIFS  is a client library that implements the CIFS/SMB networking protocol in 100% Java.

 *http://www.alfresco.com/products/aifs/ Alfresco JLAN* uses a virtual file system interface that allows plugging in custom file system implementation with the core server handling all of the network protocol exchange between the client and server. JLAN is Java implementation of Window's CIFS (Common Internet File System), in addition to supporting NFS and FTP.

*Apache commons VFS* provides  http://commons.apache.org/vfs/filesystems.html#CIFS access to the files on a CIFS server.  

h3. Service auto discovery (zero configuration networking (http://en.wikipedia.org/wiki/Zeroconf))
Federated repository works with multiple resources that require some sort of configuration and automatic discovery of services on IP networks. While it is might be difficult to enable *zeroconf* for some external resources without prior deploying some agents – it worth to at least enable auto-discovery of JBoss DNA Federated repository – it might be very important for JBoss DNA clients and for JBoss DNA itself in a scenario where DNA repository might sit on top of hierarchy of other DNA repositories. It is very likely scenario for global companies that have distributed, independently managed offices but still want to benefit from federated repository features. 

 *http://www.apple.com/macosx/technology/bonjour.html Bonjour*, formerly *Rendezvous*, is Apple Inc.'s trade name for its implementation of *Zeroconf*, a service discovery protocol. Bonjour locates devices such as printers, as well as other computers, and the services that those devices offer on a local network using multicast Domain Name System service records. This feature used in *iTunes* to advertise playlist.

 http://www.apple.com/support/downloads/bonjourforwindows.html Bonjour for Windows includes a plug-in for Internet Explorer, so you can set up a Bonjour-enabled device without knowing its IP address.

 *http://jmdns.sourceforge.net/ JmDNS* as a pure Java implementation of *mDNS/DNS-*SD might help with implementing discovery of other instances of JBoss DNA repository. It is used by  http://activemq.apache.org/discovery.html Apache ActiveMQ which implements Discovery Agent to detect remote services such as remote JMS brokers.

h3. Atom based publishing service
JCR + Atom Publishing Protocol (http://www.ietf.org/rfc/rfc5023.txt) – seams to be a winning combination based on REST (http://en.wikipedia.org/wiki/Representational_State_Transfer) principles. 
It is especially important for those who don’t want to use JCR or Java APIs directly. 
JAX-RS (https://jsr311.dev.java.net/) (a.k.a JSR-311 (http://jcp.org/en/jsr/detail?id=311) The Java^TM^ API for RESTful Web Services) and its implementations like JBoss RestEasy (http://www.jboss.org/resteasy/), Jersey (https://jersey.dev.java.net/)  plus Apache Abdera (http://incubator.apache.org/abdera/) (high performance implementation of Atom Syndication Format ( http://www.ietf.org/rfc/rfc4287.txt RFC 4287) and Atom Publishing Protocol ( http://www.ietf.org/rfc/rfc5023.txt RFC 5023) specifications) and Rome (https://rome.dev.java.net/) (+RSS 0.90, RSS 0.91 Netscape, RSS 0.91 Userland, RSS 0.92, RSS 0.93, RSS 0.94, RSS 1.0, RSS 2.0, Atom 0.3, and Atom 1.0+), will make an implementation as simple as possible. 

Not to mention that RestEasy now implements Atom (http://bill.burkecentral.com/2008/11/10/jax-rs-atom-support-with-resteasy/) (thanks to Randall for pointing that out) and supports various marshallers like JAXB, JAXB +JSON.

h3. Content Management Interoperability Services API (a.k.a CMIS)
An emerging standard (http://en.wikipedia.org/wiki/Content_Management_Interoperability_Services) is a nice addition to *JCR* and *APP* way to access content repositories of any sort based on *Web Services*. It is already been supported by open source community – Alfresco CMIS (http://wiki.alfresco.com/wiki/CMIS) – is an example). Basically, it completes the picture of the repository API - JCR, Atom Publishing Protocol, and WebDAV may work together to satisfy any customer needs.
h3. Open Search
It is difficult to imagine having any sort of repository without ability to search. It is not surprising that JCR API specification has at least ¼ of entire spec space allocated for search capability. But again, what about applications that built using technologies other than Java? 

The Open Search (http://www.opensearch.org/) might be the answer together with Lucene Web Service (http://lucene-ws.net/) implementation – which is a *REST-compliant Java servlet* capable of searching and managing multiple *Lucene indices via the web*. It is built upon the Atom Publishing Protocol and *conforms to the OpenSearch 1.1* standard. It sounds very promising.

h3. JBoss DNA packaging and deployment
JBoss DNA consist of lots of modules and services – so it is very important to define proper packaging that suits most of use cases and deployment models while still having small number of artifacts.

IMO, RESTful service (any other WS planned?) as well as web UI application components as well as other DNA services might be deployed in any particular combination – part of standard enterprise archive (*EAR*  ) as two independent   *WAR* modules + DNA JCR implementationas JBoss service archive  http://community.jboss.org/docs/DOC-12212 SAR and/or as JEE standard  http://java.sun.com/j2ee/connector/overview.html JCA Connector + DNA other services (EJB3 artefacts likeSLSB/SFSB, MDB, TB, etc) .

For example, Apache JackRabbit has  http://jackrabbit.apache.org/jackrabbit-jca-resource-adapter.html JCA Resource Adapter and  http://jackrabbit.apache.org/deployment-models.html various deployment scenarios.

Additionally, having standard packaging artefacts like above actually will enable JBoss DNA deployment onto JEE servers different from JBoss  AS (for instance, if a client will require).

 http://docs.codehaus.org/display/MAVENUSER/Creating+JBoss+SAR+(Service+ARchive)+Artifacts Maven has support for standard and non standard JBoss packaging artefacts – thanks to guys from Codehouse.org and    http://maven.apache.org/plugins/index.html Maven plugins comunity.

h2. References
http://docs.jboss.com/seam/2.1.0.SP1/reference/en-US/html/        JBoss Seam 2.1.0.SP1, Builtin support for JSF and Richfaces
http://docs.jboss.com/seam/2.1.0.SP1/reference/en-US/html/concepts.html#d0e3491    Context Management
http://docs.jboss.com/seam/2.1.0.SP1/reference/en-US/html/webservices.html   Webservices, REST (RestEasy integration) 
http://docs.jboss.com/seam/2.1.0.SP1/reference/en-US/html/remoting.html        Remoting/AJAX
http://docs.jboss.com/seam/2.1.0.SP1/reference/en-US/html/events.html#d0e5013        URL rewriting / bookmarkable pages
http://docs.jboss.com/seam/2.1.0.SP1/reference/en-US/html/events.html#events.pageaction.navigation   Flexible Navigation
http://docs.jboss.com/seam/2.1.0.SP1/reference/en-US/html/jbpm.html Support for JBPM
http://docs.jboss.com/seam/2.1.0.SP1/reference/en-US/html/drools.html    Support for Drools
http://docs.jboss.com/seam/2.1.0.SP1/reference/en-US/html/spring.html    Spring Framework integration      

http://docs.jboss.com/seam/2.1.0.SP1/reference/en-US/html/groovy.html   Groovy integration
http://docs.jboss.com/seam/2.1.0.SP1/reference/en-US/html/wicket.html   Wicket integration
http://docs.jboss.com/seam/2.1.0.SP1/reference/en-US/html/gwt.html       Google Web Toolkit integration

http://docs.jboss.com/seam/2.1.0.SP1/reference/en-US/html/security.html JAAS Security
http://docs.jboss.com/seam/2.1.0.SP1/reference/en-US/html/itext.html      iText/PDF integration
http://docs.jboss.com/seam/2.1.0.SP1/reference/en-US/html/rss.html        RSS support

http://docs.jboss.com/seam/2.1.0.SP1/reference/en-US/html/configuration.html Flexible packaging in JEE5 (http://docs.jboss.com/seam/2.1.0.SP1/reference/en-US/html/configuration.html%20Flexible%20packaging%20in%20JEE5) / JSE     

http://java.dzone.com/articles/flex-j2ee-developers-case-gran         Flex for J2EE Developers (using Seam)
http://www.seamframework.org/Community/FlexAndSeamIntegration          Flex and Seam Integration

http://livedemo.exadel.com/richfaces-demo/richfaces/support.jsf   RichFaces Demo

http://exadel.com/web/portal/flamingo      With Exadel Flamingo, Flex or JavaFX can be easily *glued to Seam or Spring*. And, in the future, Flamingo will be extended to provide glue for other RIA technologies.
http://www.infoq.com/news/2008/06/flamingo-flex-and-java-dev       Introductory article
http://www.jamesward.com/wordpress/2008/09/05/integrating-flex-and-jsf-with-exadel-fiji/      Another article 
http://exadel.com/web/portal/flamingo/demo         Exadel Flamingo demo
http://demo.flamingo.exadel.com/booking/  
http://livedemo.exadel.com/fiji-demo/       Exadel Fiji extends JSF by allowing the use of Flex with JSF components and within a jsf page.
--------------------------------------------------------------

Comment by going to Community
[http://community.jboss.org/docs/DOC-12952]

Create a new document in EJB3 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=102&containerType=14&container=2029]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110120/de6d1fb5/attachment-0001.html 


More information about the jboss-user mailing list