Newsletter sign-up
View all newsletters

Sign up for our technology specific newsletters.

Enterprise Java
Email Address:

Automatic software distribution of Java applications

How is Java going to help in software distribution? How is it going to relieve the IS manager from the burden of shared drives and fixed media?

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone

Page 3 of 4

Proprietary server example

The proprietary server has more functionality than the http method and does not require the existence of a costly Web server. The purpose of this server is to feed files to client modules across the Internet, for the use of distribution and updates. The server can process various commands from client objects. The following commands are the minimum needed.

  • GetBundleList(String bundlename);
  • GetFile(String fileName);


When the server receives the GetBundleList command, it reads in the versions of each file associated with the bundle. This can be done in various ways. Easiest is the creation of a configuration file, similar to the configuration file used in the http server. To create a more dynamic system that does not require updating a configuration file each time a file has changed, the following method could be used.



A base class called DistributeClass is created. This class looks like



   public class DistributeClass
{ public float revision = 0.0;
} // end class DistributeClass


Each distributed class inherits this class and sets the revision to the current revision of the file. In addition, all files for a bundle are placed into a directory with the bundle's name. When the server gets a request for a bundle, it goes to the directory and creates the bundle list array by loading in each class in the directory using classLoader. At this time it overloads the returned object to a DistributeClass type, and gets the revision of the object. This is placed in the bundle list array. The entire array is then passed back to the client program.

The client program compares the bundle list array to one created for its own bundle. This is done in the same way as the server, searching a given directory for all of its class files, loading them with classLoader, and getting the revision.

One problem with this method is that it only works with Java classes. GIFs, bitmaps, and other files cannot be distributed automatically this way. However, it makes distribution of new files a breeze. The developer creates a new revision of a class, tests it, debugs it, gets it approved, and then the class is placed into the bundle directory. It will then automatically propagate out to all clients.

Since there is only single inheritance in Java, this could pose a problem if all your classes now need to inherit this base class. However, there does not seem to be a way around this in the current release of Java. If Java had a dynamic "new (class)", where a class could be created on the fly and methods called, then the inheritance would not be needed.



For example:

   String classname = recvName();
   Object o = new (classname);
   float revision = o.revision;<


This code will not work in current Java implementation. The documentation for JDK 1.0 says the following will snippet should work.



        b=new("Class"+"A")


This code actually flags an unsupported feature error in the compiler.

What should work is overloading the class loader to read in from a local file. For an example of this, see http://www.digitalfocus.com/digitalfocus/faq/VM.html#VM_2. The class is loaded using the class loader, the object cast to the base class, and the revision checked.

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone
Comment
Login
Forgot your account info?
Add comment
Anonymous comments subject to approval. Register here for member benefits.
Have a JavaWorld account? Log in here. Register now for a free account.
Resources