for (Scope s : scopes)
contextScopeKey.addScope(s);
*/
// find scoped controller
MutableMetaDataRepository mmdr = repository.getMetaDataRepository();
MetaDataRetrieval mdr = mmdr.getMetaDataRetrieval(scopeKey);
if (mdr == null)
{
mdr = new MemoryMetaDataLoader(scopeKey);
mmdr.addMetaDataRetrieval(mdr);
}
MetaDataItem<ScopedKernelController> controllerItem = mdr.retrieveMetaData(ScopedKernelController.class);
ScopedKernelController scopedController;
if (controllerItem != null)
{
scopedController = controllerItem.getValue();
}
else
{
AbstractController parentController = null;
ScopeKey parentKey = scopeKey.getParent();
while (parentController == null && parentKey != null)
{
MetaDataRetrieval pmdr = mmdr.getMetaDataRetrieval(parentKey);
if (pmdr != null)
{
MetaDataItem<ScopedKernelController> pci = pmdr.retrieveMetaData(ScopedKernelController.class);
if (pci != null)
{
parentController = pci.getValue();
}
}