[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Annotation processing

alesj do-not-reply at jboss.com
Tue Sep 4 05:46:14 EDT 2007


"alesj" wrote : 
  | "adrian at jboss.org" wrote : 
  |   | Also the BasicBeanAdapter and related classes need fixing such that they use the MetaData not the MetaDataRetrieval.
  |   | 
  |   | The same is true of its usage in the Scoping.
  |   | 
  | MetaData has all the required functionality - as MetaDataRetrieval?
  | 
  | Scoping as in PreInstall stuff that we did?
  | 
Yup, it was easy to move annotations handling to plain MetaData lookup. :-)

I also (re)moved the part in PreInstallAction where MetaDataRetrieval was referenced from KernelMetaDataRepository.

But I guess this code cannot be changed to use plain MetaData since I _need_ to build the whole MetaDataRetrieval for the scope - similar to how we do it for ControllerContext's MetaData (hidden in BasicKernelMetaDataRepository).


  |          // 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();
  |                   }
  |                }
  |                parentKey = parentKey.getParent();
  |             }
  |             if (parentController == null)
  |             {
  |                if (controller instanceof AbstractController == false)
  |                   throw new IllegalArgumentException("Underlying controller not AbstractController instance!");
  |                parentController = (AbstractController) controller;
  |             }
  |             scopedController = new ScopedKernelController(controller.getKernel(), parentController);
  |             ((MutableMetaData)mdr).addMetaData(scopedController, ScopedKernelController.class);
  |          }
  |          scopedController.addControllerContext(context);
  |       }
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4080779#4080779

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4080779



More information about the jboss-dev-forums mailing list