Categories
Uncategorized

syncing PIM data between Thunderbird Funambol and a Nokia N900 using Funambol

Since about 1 month I’m a proud owner of a Nokia N900. This gadget is really impressive, combining powerful hardware with a open source based operating system. Since it’s the very first Meamo based phone out there, it’s obvious that not everything is perfect for now.

One thing I have been struggling with is synchronizing my PIM data. On the notebook or desktop computer I’m using thunderbird together with the lightning extension (and some other useful addons) holding my contact and calendar data. This stuff should be synced to and from the N900.

The N900’s default solution for syncing is Nokia’s PC suite. Since I’m on Linux, this is no option at all. I tried to use Opensync – without succeeding. A few days ago the InternetTabletBlog published a great german article on syncing the N900 against ScheduleWorld.com. Using this information, it was pretty simple to adopt the procedure to work with Funambol.

Setting up Funambol

The installation procedure of the Funambol server is very well documented, so I’ll cover here only the main steps without going into detail.

  • Download the Funambol Server from https://www.forge.funambol.org/download/
  • sudo sh ./funambol-8.0.2.bin installs the server software by default to /opt/Funambol
  • startup the server: /opt/Funambol/bin/funambol start
  • Using funambol’s admin tool, set the server’s URL to a reasonable value
  • check if http://<servername>:8080/funambol/ds return a page like this:
    Funambol Data Synchronization Server v.8.0.1
    
    Man=Funambol
    Mod=DS Server
    SwV=8.0.1
    HwV=-
    FwV=-
    OEM=-
    DevID=funambol
    DevTyp=server
    VerDTD=1.2
    UTC=true
    SupportLargeObjs=true
    SupportNumberOfChanges=true
    Ext=X-funambol-smartslow

Setup thunderbird

  • Install Funambol Mozilla Sync Client and configure it to use the URL from the previous step.
  • Provide an arbitrary login and password, Funambol adds an user accout automatically.
  • Run the sync, your PIM data should now be copied to the Funambol server
  • Check if data was transferred by logging into http://<yourserver>:8080/funambol/webdemo

Configuring the N900

This is described in detail here, so I’ll just repeat the main steps:

… and hopefully your done.

Categories
Uncategorized

Customizing Grails data binding with a “groovy” PropertyEditor

When Grails binds data e.g. when the controller’s bindData method is called, it instantiates a GrailsDataBinder to take the action. GrailsDataBinder configures itself with  some basic ProperyEditors. The neat thing is you can extend that behaviour by adding an arbitrary named PropertyEditorRegistrar implementation to the application context. The PropertyEditorRegistrar registers one or multiple PropertyEditors.

A recent use case was the ability to look up some domain instance by a given key and use this for data binding. Coding a seperate PropertyEditor for each domain class would not really be DRY, so I decided to go the groovy way: a DomainClassLookupPropertyEditor:

public class DomainClassLookupPropertyEditor extends PropertyEditorSupport {

    Class domainClass
    String property
    boolean doAssert = true

    String getAsText() {
        value."$property"
    }

    void setAsText(String text) {
        value = domainClass."findBy${StringUtils.capitalize(property)}"(text)
        assert doAssert && value, "no $domainClass found for $property '$text'"
    }

}

The PropertyEditor calls the domain class’ findBy<Property> method to look up the desired instance. The PropertyRegistrar looks like this:

public class MyPropertyEditorRegistrar implements PropertyEditorRegistrar {
    public void registerCustomEditors(PropertyEditorRegistry propertyEditorRegistry) {
        propertyEditorRegistry.registerCustomEditor(Author, new DomainClassLookupPropertyEditor(domainClass: Author, property: "name"))
        propertyEditorRegistry.registerCustomEditor(Book, new DomainClassLookupPropertyEditor(domainClass: Book, property: "isbn"))
    }
}

Last, we need to configure that in resources.groovy:

beans = {
    myEditorRegistrar(MyPropertyEditorRegistrar)
}