[jboss-dev-forums] [Design of POJO Server] - Re: migrating TransactionManager and Invokers to POJO

alesj do-not-reply at jboss.com
Mon Mar 31 10:59:12 EDT 2008


"alesj" wrote : 
  | Or do we really create proxy instance (if AOP present) for instance annotations?
  | 
Aha, ok this is the code:

  |          boolean hasInstanceMetaData = hasInstanceOrJoinpointMetaData(metaData);
  |          ContainerCache cache = ContainerCache.initialise(manager, clazz, metaData, hasInstanceMetaData);
  |          AOPProxyFactoryParameters params = new AOPProxyFactoryParameters();
  |          Object target = createTarget(cache, params);
  |          params.setProxiedClass(target.getClass());
  |          params.setMetaData(metaData);
  |          params.setTarget(target);
  |          params.setContainerCache(cache);
  |          params.setMetaDataHasInstanceLevelData(hasInstanceMetaData);
  |          
  |          return proxyFactory.createAdvisedProxy(params);
  |    }
  | 
  |    private boolean hasInstanceOrJoinpointMetaData(MetaData metaData)
  |    {
  |       if (metaData == null)
  |       {
  |          return false;
  |       }
  | 
  |       if (hasMetaDataAtInstanceLevel(metaData))
  |       {
  |          return true;
  |       }
  |       
  |       //Check for method annotations
  |       return hasMethodMetaData(metaData);
  |    }
  |    
  |    private boolean hasMetaDataAtInstanceLevel(MetaData metaData)
  |    {
  |       if (metaData != null)
  |       {
  |          MetaData instanceMetaData = metaData.getScopeMetaData(CommonLevels.INSTANCE);
  |          if (instanceMetaData != null && instanceMetaData.isEmpty() == false)
  |          {
  |             return true;  
  |          }
  |       }
  |       return false;
  |    }
  | 
What would this return (e.g. target == Jonathan's TransactionManager):
a) target.getClass().getAnnotation(JMX.class) == null
b) target.getClass().getAnnotation(JMX.class) == @JMX instance

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

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



More information about the jboss-dev-forums mailing list