Jini and Network Computing/Using Configuration Files

From Wikibooks, open books for an open world
< Jini and Network Computing
Jump to: navigation, search

The net.jini.config package provides the facility to utilize live objects for configuring not just Jini services, but any Java application that can have this package and the associated dependencies in its classpath. The primary implementation of the net.jini.config.Configuration interface is the net.jini.config.ConfigurationFile class.

The net.jini.config.ConfigurationProvider Service Provider Interface (SPI) provides the generic mechanism for allowing a service deployer to provide a configuration in whatever way is appropriate. In almost all cases, the correct way to get a configuration for a service is to use the expression:

String args[] = ...
Configuration config = ConfigurationProvider.getInstance(args);

For many types of services, the args[] value is the set of command line arguments that the Java virtual machine would be started with.

Services utilizing the com.sun.jini.start package, will receive the args[] value in the required constructor which has the signature <init>( java.lang.String[], com.sun.jini.start.LifeCycle ).

The ConfigurationProvider javadocs provides more information on how one can use the SPI to provide a completely different source for configuration data.


Jini and Network Computing