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

alesj do-not-reply at jboss.com
Tue Sep 4 09:56:56 EDT 2007


"alesj" wrote : 
  | OK, I'll then put the getScopeMetaData/isEmpty ugliness into RetrievalBridge. :-)

  |    public MetaData getScopeMetaData(ScopeKey scopeKey)
  |    {
  |       if (scopeKey == null)
  |          throw new IllegalArgumentException("Null scope key");
  | 
  |       if (retrieval instanceof MetaDataContext)
  |       {
  |          MetaDataContext context = (MetaDataContext)retrieval;
  |          List<MetaDataRetrieval> matchingRetrievals = new ArrayList<MetaDataRetrieval>();
  |          List<MetaDataRetrieval> localRetrievals = context.getLocalRetrievals();
  |          for (MetaDataRetrieval localRetrieval : localRetrievals)
  |          {
  |             if (scopeKey.equals(localRetrieval.getScope()))
  |                matchingRetrievals.add(localRetrieval);
  |          }
  |          if (matchingRetrievals.isEmpty() == false)
  |             return new MetaDataRetrievalToMetaDataBridge(new AbstractMetaDataContext(context, matchingRetrievals));
  |       }
  |       else if (scopeKey.equals(retrieval.getScope()))
  |          return new MetaDataRetrievalToMetaDataBridge(new AbstractMetaDataContext(retrieval));
  |       return null;
  |    }
  | 
  |    public boolean isEmpty()
  |    {
  |       return retrieval.isEmpty();
  |    }
  | 

This is what I've pushed in (also added MetaDataRetrieval.isEmpty()). I think it should do the trick.

But if I want to remove the hack with joinpoint being ControllerContext aware, I need to get the context's name from somewhere.



  |       ScopeKey instanceKey = new ScopeKey(CommonLevels.INSTANCE, "<context_name>");
  |       MetaData instanceMetaData = metaData.getScopeMetaData(instanceKey);
  |       if (instanceMetaData != null && instanceMetaData.isEmpty() == false)
  |       {
  |          return true;  
  |       }
  | 

Perhaps put in in the MetaData under 'ControllerContext.name' name?
And push in/out this info in KernelControllerContextAction.dispatchJoinPoint invocation?
Or just simply put in in for good when we first create MetaData for context - in PreInstallAction?

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

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



More information about the jboss-dev-forums mailing list