Page 1 of 1

--Application and Server zones

PostPosted: Thu Oct 02, 2014 3:26 pm
by Development@SIB


This article is outdated - please use our new system at

https://doc.sibvisions.com




We recommend a specific file-structure for JVx applications because every JVx projects should use the same structure. This makes it easier to maintain applications because everything is standardized.

Our recommended structure is:

Code: Select all
<basedir>
 |- rad              (Configuration.getConfigurationDir())
   |- apps           (Configuration.getApplicationsDir())
     |- <appname>
       |- config.xml (Configuration.getApplicationZone(<appname>))
   |- server         (Configuration.getServerDir())
     |- config.xml   (Configuration.getServerZone())


The source code and IDE projects should be saved in <appname> like:

Code: Select all
- <appname>
 |- src.client
 |- src.server
 |- test
 |- libs
   |- client
   |- server
 |- .classpath
 |- .project
 |- config.xml (Configuration.getApplicationZone(<appname>))


The problem with above structure is that you need a lot of directories and the project itself is in the last level. The advantage is that you can manage multiple applications with one server configuration. But usually you havew at least one application.

We introduced a new search strategy for application and server configuration files. Before JVx 2.1, everything was file based. Every config.xml had to be available as physical file. With 2.1 this is not needed.

The new search strategy is as follows:

Application zone

Code: Select all
1: Filesystem: <appsdir>/<appname>/config.xml
2: Filesystem: <appsdir>/../config.xml
   Filesystem: <appsdir>/../../config.xml
   Filesystem: <appsdir>/../../../config.xml
   Filesystem: <appsdir>/../../../../config.xml
3: JNDI:       java:/comp/env/jvx/<appname_lowercase>/config
               (String as resource path), InputStream or IVirtualZone implementation)
4: Classpath:  /rad/apps/<appname_lowercase>/config.xml (can be disabled)
5: Classpath:  /config.xml (can be disabled)
6: EXCEPTION

Server zone

Code: Select all
1: Filesystem: <serverdir>/config.xml
2: Filesystem: <serverdir>/../server.xml
   Filesystem: <serverdir>/../../server.xml
   Filesystem: <serverdir>/../../../server.xml
   Filesystem: <serverdir>/../../../../server.xml
3: JNDI:       java:/comp/env/jvx/server/config
               (String as resource path), InputStream or IVirtualZone implementation)
4: Classpath:  /rad/server/config.xml (can be disabled)
5: Classpath:  /server.xml (can be disabled)
6: EMPTY configuration


But be careful, because ApplicationZone and ServerZone have methods for accessing files and directories:

Code: Select all
public File getDirectory();
public File getFile()

Bot methods will return null if config was loaded via JNDI or classpath.