Export From and Import To Nuxeo ECM Repository

Based on information on http://community.nuxeo.com/5.3/books/nuxeo-book/html/nuxeo-core-io.html, I successfully exported and imported a domain from a repository to another.

This is important for multi-tenancy as if the users in a tenant grow too high, the performance of server will deteriorate. In this case, it is necessary to migrate the tenant to another server.

Although the documents can be migrate with tools, there are some other database tables that need to migrate manually.

Posted in Software Development | Tagged | Leave a comment

Create New Repository in Nuxeo

Nuxeo documentation Using several repositories in the same Nuxeo instance shows how to use multiple repositories in a Nuxeo instance.

For Nuxeo version 5.5, it seems the steps are a little bit different.

  1. in templates\<template>\nxserver\config, create a custom copy of default-repository-config.xml, edit the file for the name of new repository.
  2. create a custom copy from templates\common\config\platform-config.xml. Edit the file accordingly for the new repository.
    <?xml version="1.0"?>
    <component version="1.0" name="org.nuxeo.ecm.platform.api.ProductionPlatform">
      <extension point="repositories" target="org.nuxeo.ecm.core.api.repository.RepositoryManager">
        <documentation>The production repository</documentation>
        <repository name="production" label="Production Repository" />  
      </extension>
    </component>
    
  3. create a new database and add the db name in nuxeo.conf (for DatabaseName property in 1.)
  4. if Nuxeo can start without error, then logon to Nuxeo web application (with Administrator user) to create a domain for the new repository.
Posted in Nuxo, Software Development | Tagged | Leave a comment

JAX-RS: @QueryParam and @PathParam

Query Parameters (@QueryParam):
used to extract query parameters from the Query component of the request URL

Path Parameters (@PathParam):
used to extract method parameter of a request method

(more info: http://jersey.java.net/nonav/documentation/latest/user-guide.html)

There is no hard rule to choose between @QueryParam and @PathParam. However I think it makes sense to use @QueryParam for mandatory parameters and @PathParam for optional parameters (0, 1 or  N). In addition, this will make client implementation slightly simpler.

Posted in Uncategorized | Leave a comment

Software Lifecycle

image

Over the years, based on observation on the open source projects I use, the software companies I was working in, I think there is a certain pattern for productivity of software productivity over time.

At the beginning (Phase I), new technologies are explored, new frameworks are applied and the business requirement is not clear. Therefore this is the learning and exploring phase for the development team.

When the team becomes productive with the platform, the productivity start accelerating (Phase II). More people will be put into the team at this phase. As the infrastructure is basically complete, every team member is familiar with the APIs and modules.

Phase III is the maturing period when the product is launched to market. Based on new requirement, more and more enhancement is added into the product. As the application is still relatively new, customization is still relatively cheap.

In Phase IV, the product is basically mature and feature-rich. Before this stage, software quality is often ignored for faster time to market. On the other hands, for the team that invest more in architecture and enforce software quality, this is the pay-off. (Nevertheless, I agree that shipped product is better than perfect product.)

I have observed that a few open source projects achieve Curve A through evolving architecture. New technologies are applied to their adaptive core. The architecture is modular that extension module can be plugged into the core. The examples I am aware are Spring Framework, Nuxeo (CMS), NetBeans, Eclipse, JBoss and Joomla!. I don’t mean these projects are perfect, but at least they confine the sloppiness in limited scope.

Projects achieve Curve B through refactoring and maybe partial rewrite. Unused and obsolete feature are abandoned, new features are applied through extensions. Design patterns are applied to the hotspots. The software quality is maintained defensively. Nevertheless the slight decrease in productivity is inevitable as the codebase is increasing.

Most companies I was working in follows Curve C. As quality is less tangible than revenue and cost, the quality deteriorates until it becomes too late to notice and too costly to recover. As the development cost rise, it eats into profit margin and therefore there is urgent need to rush for delivery. Then “quick fix” starts appear here and there. Duplication increases as developers are afraid to modify existing codes. The software is being bogged down by its own weight.

At the end, there is no silver bullet to overcome this – dilemma between short term growth and long term sustainability.  The success of those open source projects are because of their top talents in teams and unlikely to be imitated elsewhere. But the lesson I learn is that software debt in architecture has highest interest rate. Software quality issue can be fixed but architecture defect is risky and costly to “patch”.

Posted in Software Development | Leave a comment

Nuxeo User Management

As I need to use Automation to create new user and group, I was studying their relationship in Nuxeo Platform.

Although their simple fields are defined in user.xsd and group.xsd schema respectively, their relationship between each other is defined in default-sql-directories-bundle.xml which is stored in <nxserver>/config. default-sql-directories-bundle.xml extends extension point “directories” of org.nuxeo.ecm.directory.sql.SQLDirectoryFactory.

Posted in Software Development | Tagged | Leave a comment

Mistery of Lookup.Result

I encountered a weird problem that method resultChanged(LookupEvent) of my LookupListener is not fired.

Tried many way but could figure out the reason.

Then I look into the javadoc of Lookup.Result and read this:

 Sometimes people report that their listener is not receiving
 events (for example IZ 191471)
 or that the listener receives few events, but then it stops
 listening.
 Such behavior is often caused by not keeping strong reference to
 the {@link Result} object. When it gets garbage collected
 it can no longer deliver events. Thus remember to keep reference
 to the object you are attaching listener to.

Keeping strong reference to Result instance solves my problem : )

(one way to keep strong reference is using static variable in class)

Posted in Software Development | Tagged | Leave a comment

JavaFX 2 in NetBeans Platform Application with JFXPanel

Yesterday I tried to integrate JavaFX 2.0 into my NetBeans Platform application. The process is not as smooth as I would expect, but it is successful at the end.

fxchart

The steps are essentially:

  1. Download JavaFX SDK from http://javafx.com/
  2. Copy jfxrt.jar from <JAVAFX>/lib to <NETBEANS>/platform/lib and *.dll from <JAVAFX>/bin to <NETBEANS>/platform/bin.
    sidenote: it seems that for current release, it is unnecessary to use custom launcher to launch JavaFX (as shown in reference 1). According to reference 3,
    “Creating an instance of the JFXPanel class implicitly starts the JavaFX runtime.”
    (EDIT: I found that in order to bundle JavaFX into my NetBean Platform application, I need to copy those *.dll into folder <MODULE>\release\modules\lib)
  3. Restart NetBeans IDE. (I am not very sure whether this is necessary, but before restarting IDE, my application just consistently hanged when the JavaFX top component was opened.)
  4. Download JavaFX Samples from http://www.oracle.com/technetwork/java/javafx/downloads/index.html. Adapt the SwingInterop sample to a new TopComponent. The porting is straightforward but remember to change the TopComponent’s layout to BorderLayout.
  5. That’s all.

The reason for me to explore JavaFX is its nice chart capabilities. Embedding JavaFX into Swing seems quite convenient as long as to invoke JavaFX UI code in JavaFX thread through

Platform.runLater(new Runnable() …)

References:

  1. http://netbeans.dzone.com/javafx-2-in-netbeans-rcp
  2. http://www.aljoscha-rittner.de/blog/archive/2011/03/04/javafxdev-netbeans-platform-with-javafx-2-0ea/
  3. http://docs.oracle.com/javafx/2.0/swing/jfxpub-swing.htm
Posted in Uncategorized | 1 Comment