{
for (Iterator iterator = datasources.iterator(); iterator.hasNext();)
{
DatasourceServiceMetaData datasourceService = (DatasourceServiceMetaData)iterator.next();
DatasourceMetaData ds = datasourceService.getDatasource();
//instantiate datasource using MC
String entryName = "portal:identity=Datasource,type=" + ds.getName();
AbstractBeanMetaData dsBMD = new AbstractBeanMetaData(entryName,
ds.getClassName());
AbstractPropertyMetaData propertyBMD = new AbstractPropertyMetaData("identityContext", identityContext);
dsBMD.addProperty(propertyBMD);
propertyBMD = new AbstractPropertyMetaData("jndiBinder", getServiceJNDIBinder());
dsBMD.addProperty(propertyBMD);
//initiate parameters from <config>
for (Iterator iterator1 = datasourceService.getOptions().keySet().iterator(); iterator1.hasNext();)
{
String propertyKey = (String)iterator1.next();
String propertyValue = (String)datasourceService.getOptions().get(propertyKey);
//if (log.isDebugEnabled()) log.debug("adding parameter: " + propertyKey + " ; " + propertyValue);
propertyBMD = new AbstractPropertyMetaData(propertyKey, propertyValue);
dsBMD.addProperty(propertyBMD);
}
// Installation
//beans.add(dsBMD);
KernelControllerContext controllerContext = kernel.getController().install(dsBMD);
Object datasource = controllerContext.getTarget();
//make a part of identityContext
//moduleService.setIdentityContext(identityContext);
//register as an mbean
if (isRegisterMBeans() && (ds.getServiceName() != null))
{
unregisterMBean(ds.getServiceName());
registerMBean(ds.getServiceName(), datasource);
}
}
}