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 like this:

cities=\
        atlanta=/services/weather/cities/atlanta,\
        boston=/services/weather/cities/boston,\
        tampa=/services/weather/cities/tampa,\
        phoenix=/services/weather/cities/phoenix

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, etc. 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 would access the Weather component for a particular city:

Weather w = (Weather) (getCities ().get ("tampa"));
 
loading table of contents...