Jean-Marc Orliaguet | 12 Mar 12:35

[NXThemes] Theme persistence (sort of)


Hi,
I've been experimenting with URLs.

The theme extension-point now supports URL-like sources, i.e. it is 
possible to place an XML theme file on a remote server and load it as if 
it had been embedded in the application's jar.

a typical use case is to allow several sites to use the same shared 
theme, and update themes without redeploying the application.

there is no restriction as to what protocol can be used (http://, 
ftp://, file://, your own protocol ...)

  <extension target="org.nuxeo.theme.services.ThemeService" point="themes">

    <theme>
      <src>META-INF/nxthemes-theme-default.xml</src>
    </theme>

    <theme>
      <src>ftp://login:pass@.../nxthemes-theme-remote.xml</src>
    </theme>

    <theme>
      <src>file:///home/folder/nxthemes-theme-local.xml</src>
    </theme>

  </extension>

Some of the protocols support output (currently the list is hard-coded 
as ftp:// and file://), which means that themes can be saved too. That 
is a sort of stateless persistence that relies on having an FTP server 
for instance, or simply using the local file-system. To save themes in a 
remote database, a URL handler can be written as well as long as the 
connection supports output, etc.

Here is a demo that uses a theme located in the jar ('default'), a theme 
placed on a remote FTP server ('remote') and a theme placed on the 
file-system ('local'):

http://www.medic.chalmers.se/~jmo/nuxeo5/nxthemes-2007-03-12.html

Note that themes are loaded and saved on-demand and are cached in 
memory, there is no stateful connection involved.

/JM

Gmane