1 22 package org.jboss.aspects.remoting; 23 24 import org.jboss.aop.joinpoint.Invocation; 25 import org.jboss.aop.joinpoint.InvocationBase; 26 import org.jboss.aop.metadata.MetaDataResolver; 27 import org.jboss.aop.metadata.SimpleMetaData; 28 37 public class MergeMetaDataInterceptor implements org.jboss.aop.advice.Interceptor, java.io.Serializable 38 { 39 private static final long serialVersionUID = 2424149906770308705L; 40 41 public static final MergeMetaDataInterceptor singleton = new MergeMetaDataInterceptor(); 42 43 public String getName() { return "MergeMetaDataInterceptor"; } 44 45 protected org.jboss.aop.metadata.SimpleMetaData merge(Invocation invocation, MetaDataResolver resolver, SimpleMetaData merged) 46 { 47 if (resolver == null) return merged; 48 org.jboss.aop.metadata.SimpleMetaData metadata = resolver.getAllMetaData(invocation); 49 if (metadata == null) return merged; 50 if (merged == null) 51 { 52 merged = new org.jboss.aop.metadata.SimpleMetaData(); 53 } 54 merged.mergeIn(metadata); 55 return merged; 56 } 57 58 public Object invoke(Invocation invocation) throws Throwable 59 { 60 org.jboss.aop.metadata.SimpleMetaData merged = null; 61 merged = merge(invocation, ((InvocationBase)invocation).getInstanceResolver(), merged); 62 63 org.jboss.aop.metadata.MetaDataResolver threadMetaData = org.jboss.aop.metadata.ThreadMetaData.instance().getAllMetaData(invocation); 64 merged = merge(invocation, threadMetaData, merged); 65 66 if (merged != null) 67 { 68 merged.mergeIn(invocation.getMetaData()); 70 71 invocation.setMetaData(merged); 73 } 74 return invocation.invokeNext(); 75 } 76 } 77 | Popular Tags |