The Source for Java Technology Collaboration


The Confguration Extension, found in the net.jxta.ext.config, aims to unify JXTA Platform configuration related tasks. As such, the initial implementation is comprised largely of existing configuration utilities, namely:

  • ConfigDialog (non-ui elements, support for updating an existing PlatformConfig)
  • net.jxta.util.config APIs (note: these APIs are marked as deprecated)
  • MyJXTA[2] (profiles)

For this initial release no changes where made to the JXTA Platform in how it manages the resulting PlatformConfig. In addition to aggregating various configuration utilitilies, the Configuration Extension aims to be forward looking in anticipation of forthcoming JXTA Platform configuration improvements, including:

  • dynamic/runtime configuration
  • disabling security (primiarily for development cycles)
  • support for multiple transports of the same type
  • support for varying tranport port bindings
  • system/environment profiling in order to auto-generate the best-fit local configuration

In addition to the above, the Configuration Extension provides:

  • configurable RendezVous and Relay bootstrap URIs
  • consistent addressing scheme as all addresses are represented as URIs
  • support for configuration "Profiles" which can be viewed as templates (e.g. edge, super)
  • obtain resources via URIs (vs assuming resources are local files)
  • ability to vary the target persistence directory (aids in PlatformConfig generation en masse)
  • ability to configure an existing PlatformConfig and retrieve the resultant PlatformConfig
  • probe for available local ports during PlatformConfig generation

The Configuration Extension does not, as of yet, have a UI element. It is anticipated that any number of UIs can be readily tiered above the current work.

The Configurator's default constructor in addition to the constructors which accept String arguments will look for an existing PlatformConfig residing in the specified JXTA_HOME to use to seed the newly created Configurator instances. If the PlatformConfig can not be found, the profile.xml file will be used. If neither of the files can be found, the Profile.EDGE profile will be used as a seed.

Following are a number of Configuration Extension code samples.

Trivial configuration that will effectively result in a prototypical JXTA Edge configuration:

  try {
    new Configurator("myPrincipal", "myPassword").save();
  } catch (ConfiguratorException ce) {
    ...
  }

One can invoke a number of Configurator setters to generate specific configurations:

  Configurator c = new Configurator();

  c.set(...);

  try{
    c.save(new File(System.getProperty("home.dir")));
  } catch (ConfiguratorException ce) {
    ...
  }

A Profile can be used to seed the defaults:

  Configurator c = new Configurator(Profile.EDGE);

  c.set(...);

  try {
    c.save();
  } catch (ConfiguratorException ce) {
    ...
  }

An existing PlatformConfig can be used to seed the defaults:

  PlatformConfig pc = ...
  Configurator c = new Configurator(pc);

  c.set(...);

  try {
    c.save();
  } catch (ConfiguratorException ce) {
    ...
  }

Lastly, one can register their own "configurator process" within the Platform as follows:

import net.jxta.peergroup.Configurator;
import net.jxta.impl.protocol.PlatformConfig;
import java.io.File;

public class MyConfigurator
implements Configurator {

  public PlatformConfig getPlatformConfig() {
    ...
  }

  public boolean save() {
    return save(null);
  }

  public boolean save(File f) {
    ...
  }

  public void setPlatformConfig(PlatformConfig pc) {
    ...
  }

  public void setReconfigure(boolean r) {
    ...
  }
}

and register the newly minted Configurator:

...
PeerGroupFactory.setConfiguratorClass(MyConfigurator.class);
...

A trivial Configurator implementation can be found in the "JXTA Extention" package as net.jxta.ext.config.TrivialConfigurator.

-- JamesTodd - 21 Nov 2003

Topic ExtConfigurator . { Edit | Ref-By | Printable | Diffs r3 < r2 < r1 | More }
 XML java.net RSS

Revision r3 - 06 Dec 2003 - 03:57:00 - Main.gonzo
Parents: WebHome