It is often useful to have a property that maps Strings to other components. In Nucleus, properties of type atg.nucleus.ServiceMap are assumed to perform this mapping. For example, a cities property might map a city name to the weather component monitoring it:

import atg.nucleus.*;

public ServiceMap getCities ();
public void setCities (ServiceMap cities);

The corresponding properties file might initialize the cities property as follows:


The ServiceMap class is a subclass of java.util.Hashtable, so you can access it with all the normal Hashtable methods such as get, keys, size, and so on. In this case, the key atlanta maps to the component found at /services/weather/cities/atlanta, and so on for the other cities. The following code accesses the Weather component for a particular city:

Weather w = (Weather) (getCities ().get ("tampa"));

loading table of contents...