~~NOTRANS~~
~~Title: Application and Server Zones~~
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 as everything is standardized.
Our recommended structure is:
|- rad (Configuration.getConfigurationDir())
|- apps (Configuration.getApplicationsDir())
|-
|- config.xml (Configuration.getApplicationZone())
|- server (Configuration.getServerDir())
|- config.xml (Configuration.getServerZone())
The source code and IDE projects should be saved in like:
-
|- src.client
|- src.server
|- test
|- libs
|- client
|- server
|- .classpath
|- .project
|- config.xml (Configuration.getApplicationZone())
The problem with the 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. However, usually you have 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 ==
1: Filesystem: //config.xml
2: Filesystem: /../config.xml
Filesystem: /../../config.xml
Filesystem: /../../../config.xml
Filesystem: /../../../../config.xml
3: JNDI: java:/comp/env/jvx//config
(String as resource path), InputStream or IVirtualZone implementation)
4: Classpath: /rad/apps//config.xml (can be disabled)
5: Classpath: /config.xml (can be disabled)
6: EXCEPTION
== Server Zone ==
1: Filesystem: /config.xml
2: Filesystem: /../server.xml
Filesystem: /../../server.xml
Filesystem: /../../../server.xml
Filesystem: /../../../../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
Be careful because ApplicationZone and ServerZone have methods for accessing files and directories:
public File getDirectory();
public File getFile()
Bot methods will return null if config was loaded via JNDI or classpath.