DimensioneX Change language Dimx remote update


Home
Features
Play Online
Download
Forum
Tutorial
Documentation
Wiki
Support
Resources
Members
Gadgets
Contacts
Links






free screen-saver
Fantasy Screensavers and Desktop Backgrounds

 


DimensioneX on SourceForge.net

 

Allowing remote update of 
the DimensioneX engine 
hosted under Tomcat 4

KB Article n. 015
Date: May, 15th, 2003
Originally for: Tomcat 4 - any DimensioneX version

Abstract

This article explains how to allow remote update of a DimensioneX engine, hosted on Tomcat 4

 

Prerequisites

We will assume here that you have:

- Java2 installed and working (JRE or SDK this is not important)

- Tomcat 4 (a stable version) installed and working.

- DimensioneX properly installed and working.

We suppose in this article that you want to modify this installation so that a specific user is able to remotely update the DimensioneX engine and games without bothering the machine administrator. 

 

Basic idea

The goal can be accomplished by allowing the remote game administrator to remotely manage the dimx folder, contained in your tomcat_installation/webapps folder. This implies:

  • The dimx folder must be remotely accessible via FTP so you have to set up an FTP service and account which has read/write access on that folder. 
  • This already gives the remote administrator the possibility to update the game files (DXW) the skins files (DXS) the game server properties (worldnav.properties) and all the remaining stuff except for the game engine's Java class files. Reason for this is that the game engine classes are usually contained in a single JAR file, located in the dimx/WEB-INF/lib folder, which gets loaded once at Tomcat's startup.

 

How to solve it

In order to overcome this obstacle you need to take advantage of a Tomcat's feature named Servlet Reloading

Basically, with this feature you can replace any servlet and class file by simply overwriting the old with the new version, without any problems of file locking. Furthermore, the Tomcat 4 server will automatically detect the changed classes and will reload them so the game can be restarted in the updated game engine.

You need to take the following steps:

  1. Stop the Tomcat server
  2. In your Tomcat 4 installation folder, locate the conf folder
  3. There, you will find a server.xml file. Make a backup copy of it and then open it in a text editor.
  4. Using the Find function of the text editor, look for the words: Root Context
  5. You will find out that this string appears inside a comment. Now create some space above this comment and insert the following lines in bold, until the text looks as follows:

 

...

<!-- 
Enables servlet reloading by default.
--> 
<DefaultContext reloadable="true" /> 

<!-- Tomcat Root Context -->
...

 

  1. Save and close the server.xml file.
  2. Now locate the Tomcat_install/webapps/dimx/WEB-INF folder. It has a lib and a system folder in it.
  3. Open the lib folder and rename the JAR file you will find so that it has a .ZIP extension. This is sufficient to open it with a double click (you need to have WinZip installed for this)
  4. Once you have opened the ZIP, you will see the classes contained in our former JAR file. Now extract all the classes while preserving the folder structure in a new folder named:

    (drive_letter):\(tomcat_install)\webapps\dimx\WEB-INF\classes

    Like this, you will create a new folder named classes and place all the contents of the JAR file in it.
  5. Now you just close the ZIP file and delete it or move it somewhere outside the Tomcat webapps tree. The game engine classes are now available from the classes folder. Double check that the classes folder contains a cleoni folder. If it is not like this, it means you have unpacked the ZIP without preserving the folder structure, so you need to redo step 9 above.
  6. Restart Tomcat. 

If you performed the steps above correctly: 

the game engine classes (contained in the dimx/WEB-INF/classes tree) can be updated anytime via FTP. Tomcat sees the change and reloads them automatically.

the game files, skins, properties and all the remaining stuff are in the dimx/WEB-INF/system tree and can be updated anytime via FTP. To make the game engine to reload them, just use the admin's interface by using an URL like this:

http://(your_host):(your_port)/dimx/servlet/multiplayer?game=X?view=admin

 

 

Conclusions

  • DimensioneX runs on Tomcat 4. You can obtain hosting from anyone offering a web space under Tomcat 4.
  • To update the game engine and game files, an FTP account should be set up to allow file upload to the dimx tree.
  • Normally, Tomcat 4 needs to be restarted each time the game engine is updated. Moreover, that files are locked during normal server running so they cannot be updated via FTP.
  • By following the steps described in this article, you take advantage of Tomcat 4's Servlet Reloading feature, so your DimX installation can be entirely managed by a remote admin via a simple FTP account.