1 22 package org.jboss.aop.proxy.container; 23 24 import org.jboss.aop.Advisor; 25 import org.jboss.aop.ClassAdvisor; 26 import org.jboss.aop.Domain; 27 import org.jboss.aop.InstanceAdvisor; 28 import org.jboss.aop.InstanceAdvisorDelegate; 29 import org.jboss.aop.MethodInfo; 30 import org.jboss.aop.advice.AspectDefinition; 31 import org.jboss.aop.advice.Interceptor; 32 import org.jboss.aop.introduction.InterfaceIntroduction; 33 import org.jboss.aop.joinpoint.Joinpoint; 34 import org.jboss.aop.metadata.SimpleMetaData; 35 37 43 public class InstanceProxyContainer extends ClassProxyContainer implements InstanceAdvisor 44 { 45 Advisor classAdvisor; 46 InstanceAdvisorDelegate delegate; 47 48 public InstanceProxyContainer(String name, ProxyAdvisorDomain instanceDomain, Advisor classAdvisor, Object metaDataContext) 49 { 50 super(name, instanceDomain); 51 this.classAdvisor = classAdvisor; 52 instanceDomain.setAdvisor(this); 53 setMetadataContext(metaDataContext); 54 delegate = new InstanceAdvisorDelegate(classAdvisor, this); 55 delegate.initialize(); 56 initialise(classAdvisor.getClazz()); 57 } 58 59 public static InstanceProxyContainer createInstanceProxyContainer(Advisor classAdvisor, InterfaceIntroduction introduction, Object metaDataContext) 60 { 61 ProxyAdvisorDomain domain = new ProxyAdvisorDomain(classAdvisor.getManager(), classAdvisor.getClazz(), false, true); 62 if (introduction != null) 63 { 64 domain.addInterfaceIntroduction(introduction); 65 } 66 67 InstanceProxyContainer ia = new InstanceProxyContainer(classAdvisor.getName(), domain, classAdvisor, metaDataContext); 68 69 return ia; 70 } 71 72 public Advisor getClassAdvisor() 73 { 74 return classAdvisor; 75 } 76 77 public Object getPerInstanceAspect(String aspectName) 78 { 79 return delegate.getPerInstanceAspect(aspectName); 80 } 81 82 public Object getPerInstanceAspect(AspectDefinition def) 83 { 84 return delegate.getPerInstanceAspect(def); 85 } 86 87 public Object getPerInstanceJoinpointAspect(Joinpoint joinpoint, AspectDefinition def) 88 { 89 return delegate.getPerInstanceJoinpointAspect(joinpoint, def); 90 } 91 92 public SimpleMetaData getMetaData() 93 { 94 return delegate.getMetaData(); 95 } 96 97 public Domain getDomain() 98 { 99 return (Domain)super.getManager(); 100 } 101 102 105 public boolean hasInterceptors() 106 { 107 throw new RuntimeException ("Not implemented"); 108 } 109 110 113 public Interceptor[] getInterceptors() 114 { 115 throw new RuntimeException ("Not implemented"); 116 } 117 118 121 public Interceptor[] getInterceptors(Interceptor[] baseChain) 122 { 123 throw new RuntimeException ("Not implemented"); 124 } 125 126 129 public void insertInterceptor(Interceptor interceptor) 130 { 131 throw new RuntimeException ("Not implemented"); 132 } 133 134 137 public void removeInterceptor(String name) 138 { 139 throw new RuntimeException ("Not implemented"); 140 } 141 142 145 public void appendInterceptor(Interceptor interceptor) 146 { 147 throw new RuntimeException ("Not implemented"); 148 } 149 150 153 public void insertInterceptorStack(String stackName) 154 { 155 throw new RuntimeException ("Not implemented"); 156 } 157 158 161 public void removeInterceptorStack(String name) 162 { 163 throw new RuntimeException ("Not implemented"); 164 } 165 166 169 public void appendInterceptorStack(String stackName) 170 { 171 throw new RuntimeException ("Not implemented"); 172 } 173 174 177 public void insertInterceptor(int index, Interceptor interceptor) 178 { 179 throw new RuntimeException ("Not implemented"); 180 } 181 182 185 public void appendInterceptor(int index, Interceptor interceptor) 186 { 187 throw new RuntimeException ("Not implemented"); 188 } 189 190 public void removeFromDomain() 191 { 192 ProxyAdvisorDomain domain = (ProxyAdvisorDomain)super.manager; 193 domain.removeAdvisor(this); 194 } 195 196 200 public MethodInfo getMethodInfo(long hash) 201 { 202 MethodInfo info = super.getMethodInfo(hash); 203 if (classAdvisor instanceof ClassAdvisor && info.getAdvisedMethod().equals(info.getUnadvisedMethod())) 204 { 205 MethodInfo superInfo = classAdvisor.getMethodInfo(hash); 206 if (superInfo != null) 207 { 208 info.setUnadvisedMethod(superInfo.getUnadvisedMethod()); 209 } 210 } 211 212 return info; 213 } 214 215 protected Advisor getParentAdvisor() 216 { 217 return classAdvisor; 218 } 219 } 220 | Popular Tags |