{
//Ensure that the servlet service is initialized
TurbineServices.getInstance().initService(ServletService.SERVICE_NAME, conf);
ResourceService serviceConf = ((TurbineServices) TurbineServices.getInstance())
.getResources(RegistryService.SERVICE_NAME);
String mapFile = null;
Vector names = new Vector();
int refreshRate = 0;
// read the configuration keys
try
{
directory = serviceConf.getString("directory");
mapFile = serviceConf.getString("mapping", DEFAULT_MAPPING);
extension = serviceConf.getString("extension", DEFAULT_EXTENSION);
refreshRate = serviceConf.getInt("refreshRate", DEFAULT_REFRESH);
verbose = serviceConf.getInt("verbose", DEFAULT_VERBOSE);
mapFile = TurbineServlet.getRealPath(mapFile);
directory = TurbineServlet.getRealPath(directory);
}
catch (Throwable t)
{
throw new InitializationException("Unable to initialize CastorRegistryService, missing config keys");
}
// build the map of default fragments, eahc registry must be associated
// with at least one fragment
try
{
ResourceService defaults = serviceConf.getResources("default");
Iterator i = defaults.getKeys();
while (i.hasNext())
{
String name = (String) i.next();
String fragmentFileName = defaults.getString(name);
String absFileName = new File(directory, fragmentFileName + extension).getAbsolutePath();
// add this name in the list of available registries
names.add(name);