try
{
List defaultModules = defaultModulesMetaData.getModules();
for (Iterator iterator = defaultModules.iterator(); iterator.hasNext();)
{
ModuleMetaData module = (ModuleMetaData)iterator.next();
//check if defaults contains all information
if (module.getType() == null ||
module.getImplementation() == null ||
//module.getJNDIName() == null ||
module.getServiceName() == null ||
module.getConfig() == null)
{
logger.error("Default module configuration isn't complete" + module);
throw new IdentityException("Default module configuration must be complete");
}
//store them as maps for different implementations
String implType = module.getImplementation();
Map implementation;
if (defaultImplementations.containsKey(implType))
{
implementation = (Map)defaultImplementations.get(implType);
}
else
{
implementation = new HashMap();
}
//store per implementation
implementation.put(module.getType(), module);
defaultImplementations.put(implType, implementation);
}
}
catch (Exception e)
{
throw new IdentityException("Error during processing default configuration file", e);
}
//process modules for instantiation
for (Iterator iterator = modulesMetaData.getModules().iterator(); iterator.hasNext();)
{
ModuleMetaData module = (ModuleMetaData) iterator.next();
//log.info("Processing module: " + module.getType() + "/" + module.getImplementation());// + "/" + module.getClassName());
IdentityMetadataProcessor.updateModuleWithDefaults(module, defaultImplementations);
//generate initial options
Map configOptions = module.getConfig().getOptions();
Map optionMap = new HashMap();
for (Iterator iterator1 = configOptions.keySet().iterator(); iterator1.hasNext();)
{
String optionName = (String) iterator1.next();
ConfigOptionMetaData option = (ConfigOptionMetaData) configOptions.get(optionName);
optionMap.put(optionName, option.getValue());
}
//instantiate the module
//IdentityModuleService moduleService = null;
if (module.getClassName() == null)
{
throw new IdentityException("No classname defined for module type: " + module.getType()
+ ". Wrong configuration.");
}
modulesList.add(new ModuleServiceMetaData(module, optionMap));