Last week, I was at the Nuxeo office to learn more about the new Java based Nuxeo Product : Nuxeo 5. The main goals were to discover the product, learn how to developp extensions and evaluate the cost of a migration from a simple CPS 3.4 instance. First day or how to setup my developpement environment ------------------------------------------------------ I had set up a dev environment on my own, late on sunday evening to gain time... Florent helped me in configuring Eclipse in order to make Maven works well. The Jboss IDE plugin is not mandatory and the dev quickstart howto gives the main lines. I learned about Maven and why it was used : maven automatically knows your the dependencies of your Java project when you declare the deps in the pom file. The plugin in eclipse makes a direct link to the compiled library in the local repository (installed by the mvn install command). I was then able to launch my first *ant deploy* and run Jboss : first impression : uuuhhh my computer is very slow ! It is a 3 years old laptop ( P4 2.8Ghz 1Go RAM ). It takes more than 3mn to start Jboss ! Thinking about buying a new Core 2 Duo plenty of RAM !! I already had read and experienced the sample tutorial which is not ended at the moment (for the paper version) but the subversion works well and contains all the file needed to compile. First changes on the templates and on the action Java beans : all is good. Good journey ! Tomorrow I will try to code my own document type Second day : What about a migration from CPS 3.4 ------------------------------------------------ The document model of nuxeo 5 is very close from CPS. The good things have been kept. A document is a collection a schema with a layout attached to it. The migration should'nt be very difficult... but... in Nuxeo 5 not all the documents of CPS are available by default : only the attached file document and a *Note* document are available. So, to migrate from CPS we have to developp all the base documents of CPS. The first one, is the web document that is a flexible document. It has flexible parts and the schema contains complex type (lists of files, url...) Nuxeo Core is able to deal with such types since it is based on the XMLSchema model and implements the complex Types, sequences and list. The document model is based on list of string or blobs that represents the File list, the Url list, the Content list and the Image List. A string field is also reserved to store the final presentation layout of all those fields. After developping the core model of the document, I have to present it thru the Nuxeo webapp. Not a lot of problem for the presentation side, but for the modification layer, it appeared that there are no JSF component yet to present the flexible layout. We talked with Anahide that should look at this part in the next weeks following my formation... And last, the export/import mecanism is not direct. I have to export all the CPS document database in a manner that can be imported with the Nuxeo Core API. No automtic script is available for now. So... Instead of developping our own base document model, we decided to wait for Nuxeo to take time to think about the model they want to implement and perhaps help them to developp it... The other Third day : the workflow engine ------------------------------- After deciding that we won't migrate immediatly from CPS 3.4, i interested myself about the workflow model, since we have some specific applications we want to developp around it... The model is more powerful than the CMF/CPS model. Each document follows a lifecycle state that is just an information at a given time of the life of the document. A workflow can be attached to the document at one of this moment to claim for actions from actors : review a document, approbate it, in serial or parallel. The workflow engine is based on the jBPM engine from JBoss. A good introduction to the workflows in general can be found on this site_. The workflows are coded in XML with the jBPM format. The business process is composed of nodes and transition. You can associate custom action handlers on events on the graph : before enter a node, after enter a node, on a transition etc... This model is very powerful and very deep to explore in just on day. Informations can be found in the example workflows of Nuxeo 5 : - resources/workflows/ directory of the org.nuxeo.ecm.webapp project - implementation of action handlers can be found in org.nuxeo.ecm.platform.workflow.jbpm-document-handlers - web client screen in org.nuxeo.ecm.platform.workflow.client It appears that until you exactly know what you want to do with workflows it is difficult to find an more suitable example than the ones packaged with Nuxeo. .. site_ : http://www.wfmc.org/standards/docs/tc003v11.pdf Fourth day : no more HSQL database ---------------------------------- All the datasources of Nuxeo that need a database backend use the HSQL database embedded in Jboss. From a production point of view, it is not a very good solution and the goal of this day is to declare Postgres as the new backend for datasources. The first datasource is the *nxsqldirectory* datasource that is used by the directory and the vocabularies. I only need to declare a new extension point that overrides the default one. The datasources file are kept in the *datasources* directory of the deployment dir (nuxeo.ear). Not all of them are stored there but it is a design goal and soon all the remaining datasources will be kept there. I did have to rewrite the setup-xxx.sql files that create the database since the dialect used in the setup files is not accepted by Postgres. The only change is this one : - HSQL : CREATE TABLE user IF EXISTS; - Postgres : CREATE TABLE IF EXISTS user; The Postgres syntax works in HSQL, so it should be possible to replace it in the default files to be more conformant to standards (it also work like this in MySQL cf http://jira.nuxeo.org/browse/NXP-707). One thing to know is also that if the database goes down, Nuxeo direcories don't try to reconnect and send an error. This has been reported as a bug in http://jira.nuxeo.org/browse/NXP-700. Now we must migrate the JackRabbit file system based repository and put it in Postgres. This is not very difficult : the demorepos-ds-bundle.xml must be deleted an replaced by an extension point. There is a bug that makes the name *demo* mandatory for the name of at least one repository (http://jira.nuxeo.org/browse/NXP-699). When changing a repository configuration, I also experienced I had to delete the data/NXRuntime/repos directory in order to reload a new configuration since the JCR configuration is stored there. Now, all my persistent data are stored in Postgres. The same manipulation are as easy for Mysql or any other RDBMS that has a JDBC driver. I managed to developp a whole project that configures all datasources in Postgres. I will publish it a soon as it will be completely ready (I still have things to change or add to the configuration).
Fifth day : Customizing the look -------------------------------- We all want to customize the look and feel of our brand new application. In Nuxeo 5, it is quite simple : it's again an extension point to declare. The extension point are provided by the org.nuxeo.theme.services.ThemeService component. You must first declare a *themes* extension that is responsible for the layout of your page. Basically this is an XML declaring the layout of the page and the styles applied to it. Then you must declare a *views* extension that is the definition for a page fragment, for instance you can declare a *nuxeo5 footer* widget. All this configuration is kept in the *theme-contrib.xml* file in the OSGI-INF folder of the org.nuxeo.ecm.webapp project. Then you must customize the theme extension. This is done by editing the *nxthemes-setup.xml* file (in the META-INF folder of the webapp). In this file, you first declare the layout for different pages of your app and then what you put inside (with XPath syntax). Finally, you define the CSS in an XML manner. Some documentation is available in the doc folder of the org.nuxeo.theme.core project. Of course you can define several themes, that can fit in different parts of your site, depending on the server, domain or workspace. Conclusion ---------- Nuxeo 5 is a cool application framework. Nuxeo kept all the good concepts of CPS (component model, extension, schema) and ported them to the Java platform. Knowing CPS, it was quite easy to enter the Nuxeo 5 architecture. Basic concepts of Java programming are of course needed, plus and introduction to EJB3 and Seam (for me it wasn't very difficult to dive into those concepts). The framework is of course at the beginning of its life, and there are still some lack of feature comparing to CPS but I'm sure Nuxeo is going to the right direction especially if they follow the roadmap they published. -- Damien METZLER Service Informatique France - Leroy Merlin <http://pwebsif.fr.corp.leroymerlin.com:8080/> Mail : damien.metzler _at_ ext.leroymerlin.fr Tél : 03 28 80 89 03 Ce message et toutes les pièces jointes sont établis à l'attention exclusive de leurs destinataires et sont confidentiels. Si vous recevez ce message par erreur, merci de le détruire et d'en avertir immédiatement l'expéditeur. L'internet ne permettant pas d'assurer l'intégrité de ce message, le contenu de ce message ne représente en aucun cas un engagement de la part de Leroy Merlin. _______________________________________________ ECM mailing list [email protected] http://lists.nuxeo.com/mailman/listinfo/ecm
