protected static int getTransactionTimeout(Advisor advisor, Method method) { TransactionTimeout annotation = (TransactionTimeout)advisor.resolveAnnotation(method, TransactionTimeout.class); if (annotation == null) annotation = (TransactionTimeout)advisor.resolveAnnotation(TransactionTimeout.class); if (annotation != null) { return annotation.value(); } return -1; }
public void removeAdvisor(Advisor advisor) { advisors.remove(advisor.getClazz()); }
public NewExprMatcher(Advisor advisor, NewExpr call, ASTStart start) throws NotFoundException { super(start, advisor.getManager()); this.advisor = advisor; this.call = call; }
public SoftClassMatcher(Advisor advisor, String classname, ASTStart start) { super(start, advisor.getManager()); this.advisor = advisor; this.classname = classname; this.start = start; clazz = advisor.getClazz(); }
public boolean hasSameConstructorAspectLength(Advisor other) { if (this.getClazz() != other.getClazz()) { throw new IllegalArgumentException("The advisors must be of the same type. Mine: " + this.getClazz().getName() + "; other: " + other.getClazz().getName()); } ConstructorInfo[] myInfos = this.getConstructorInfos(); ConstructorInfo[] otherInfos = other.getConstructorInfos(); return JoinPointComparator.hasSameConstructorAspectLength(myInfos, otherInfos); } }
public static InstanceProxyContainer createInstanceProxyContainer(Advisor classAdvisor, InterfaceIntroduction introduction, MetaData metaData) { String name = Domain.getDomainName(classAdvisor.getClazz(), true); ProxyAdvisorDomain domain = new ProxyAdvisorDomain(classAdvisor.getManager(), name, classAdvisor.getClazz(), true); if (introduction != null) { domain.addInterfaceIntroduction(introduction); } InstanceProxyContainer ia = new InstanceProxyContainer(classAdvisor.getName(), domain, classAdvisor, metaData); return ia; }
public static boolean hasSameMethodAspectLength(long[] myKeys, long[] otherKeys, Advisor myAdvisor, Advisor otherAdvisor) { long[] keys = JoinPointComparator.mergeMethodInfoKeys(myKeys, otherKeys); for (int i = 0 ; i < keys.length ; i++) { MethodInfo myInfo = myAdvisor.getMethodInfo(keys[i]); MethodInfo otherInfo = otherAdvisor.getMethodInfo(keys[i]); if (JoinPointComparator.hasSameInterceptorLengths(myInfo, otherInfo) != 0) { return false; } } return true; }
public Object createPerClass(Advisor advisor) { // Must be a separate line (EJBContainer cannot be dereferenced) EJBContainer container = EJBContainer.getEJBContainer(advisor); SecurityDomain securityAnnotation = (SecurityDomain) advisor.resolveAnnotation(SecurityDomain.class); //If there is no annotation, return a null action interceptor if(securityAnnotation == null) return new NullInterceptor(); CodeSource ejbCS = advisor.getClazz().getProtectionDomain().getCodeSource(); String ejbName = container.getEjbName(); return new RoleBasedAuthorizationInterceptorv2(container, ejbCS, ejbName); } }
AdviceStack stack = advisor.getManager().getAdviceStack(stackName); if(stack == null) log.warn("EJBTHREE-1480: " + stackName + " has not been defined for " + toString(advisor.getManager())); interceptors.add(new CurrentInvocationInterceptor()); Interceptor invocationContextInterceptor; Class<?> beanClass = advisor.getClazz(); HashSet<Class<?>> classes = null; if(advisor.hasAnnotation(beanMethod, lifecycleAnnotationType))
/** * Adds an advisor as a client of this binding. * <p> * <i>For internal use only.</i> * * @param advisor manages one or more joinpoints that are matched by * the bound {@link #pointcut}. */ public void addAdvisor(Advisor advisor) { if (AspectManager.verbose && logger.isDebugEnabled()) logger.debug("added advisor: " + advisor.getName() + " from binding: " + name); // Don't hold a direct reference to an advisor because of undeploy and redeploy. Use WeakRefrences because // we may be having in the future an Advisor per instance. synchronized (advisors) { advisors.put(advisor, Boolean.TRUE); } }
private Object matchClass(ClassExpression classExpression) { if (classExpression.isAnnotation()) { String sub = classExpression.getOriginal().substring(1); if (advisor.getClassMetaData().hasTag(sub)) return Boolean.TRUE; return new Boolean(advisor.hasAnnotation(clazz, sub)); } else if (classExpression.isInstanceOf()) { if (clazz == null) return Boolean.TRUE; if (Util.subtypeOf(clazz, classExpression, advisor)) return Boolean.TRUE; } else if (classExpression.isTypedef()) { if (Util.matchesTypedef(clazz, classExpression, advisor)) return Boolean.TRUE; } else { return new Boolean(classExpression.matches(this.classname)); } return Boolean.FALSE; }
if (ctCon != null) if (!advisor.getConstructorMetaData().hasGroup(ctCon, sub)) if (!advisor.getDefaultMetaData().hasTag(sub)) if (!advisor.hasAnnotation(ctCon, sub)) return Boolean.FALSE; if (!advisor.getConstructorMetaData().hasTag(refCon, sub)) if (!advisor.getDefaultMetaData().hasTag(sub)) if (!advisor.hasAnnotation(refCon, sub)) return Boolean.FALSE;
if (advisor.getFieldMetaData().hasTag(fieldName, sub) || advisor.getDefaultMetaData().hasTag(sub)) if (advisor.hasAnnotation(ctField, sub)) if (advisor.hasAnnotation(refField, sub))
if (ctMethod != null) if (!advisor.getMethodMetaData().hasGroup(ctMethod, sub)) if (!advisor.getDefaultMetaData().hasTag(sub)) if (!advisor.hasAnnotation(ctMethod, sub)) return Boolean.FALSE; if (!advisor.getMethodMetaData().hasTag(refMethod, sub)) if (!advisor.getDefaultMetaData().hasTag(sub)) if (!advisor.hasAnnotation(refMethod, sub)) return Boolean.FALSE;
/** * Indicates whether the advised class has an annotation/meta data whose name is * {@code annotation}. * * @param annotation the name of an annotation * @return {@code true} if there is an annotation/meta data whose name is {@code * annotation} */ public boolean hasAnnotation(String annotation) { return hasAnnotation(clazz, annotation); }
logger.debug("softmatch succeeded for : " + advisor.getName() + " " + binding + " " + binding.getPointcut().getExpr()); advisor.newBindingAdded(binding); logger.debug("softmatch failed for : " + advisor.getName() + " " + binding + " " + binding.getPointcut().getExpr());
@Deprecated protected MethodInfo getMethodInfo(Method method) { long hash = MethodHashing.calculateHash(method); MethodInfo info = getAdvisor().getMethodInfo(hash); if (info == null) { throw new RuntimeException("Could not resolve beanClass method from proxy call: " + method.toString()); } return info; }
throw new RuntimeException("More than one '" + type + "' method in " + advisor.getName());
if (advisor != null) if (advisor.getClassMetaData().hasTag(sub)) return true; return advisor.hasAnnotation(clazz, sub);
if (ctCon != null) if (!advisor.getConstructorMetaData().hasGroup(ctCon, sub)) if (!advisor.getDefaultMetaData().hasTag(sub)) if (!advisor.hasAnnotation(ctCon, sub)) if (!advisor.getConstructorMetaData().hasTag(refCon, sub)) if (!advisor.getDefaultMetaData().hasTag(sub)) if (!advisor.hasAnnotation(refCon, sub)) return Boolean.FALSE;