public boolean isInterceptorEnabled() { return getComponent().getType()!=ENTITY_BEAN; }
public boolean isInterceptorEnabled() { return getComponent().getType() == STATEFUL_SESSION_BEAN; }
public List<Class> getSeamInterfaces() { List<Class> interfaces = new ArrayList<Class>(); Component component = getComponent(); // Attempt to piece together all of the possible interfaces to apply // to our proxy. if ( component != null && component.isInterceptionEnabled() ) { if (component.getType().isSessionBean()) { interfaces.addAll(component.getBusinessInterfaces()); } else { interfaces.add(HttpSessionActivationListener.class); interfaces.add(Mutable.class); } interfaces.add(Proxy.class); } return interfaces; }
public Object callComponentMethod(Object instance, Method method, Object... parameters) { Class[] paramTypes = method.getParameterTypes(); String methodName = method.getName(); try { Method interfaceMethod = instance.getClass().getMethod(methodName, paramTypes); if ( paramTypes.length==0 || interfaceMethod.getParameterTypes().length==0 ) { return Reflections.invokeAndWrap(interfaceMethod, instance); } else if ( parameters.length>0 ) { return Reflections.invokeAndWrap(interfaceMethod, instance, parameters); } else { return Reflections.invokeAndWrap(interfaceMethod, instance, this); } } catch (NoSuchMethodException e) { String message = "method not found: " + method.getName() + " for component: " + name; if ( getType().isSessionBean() ) { message += " (check that it is declared on the session bean business interface)"; } throw new IllegalArgumentException(message, e); } }
private synchronized Class<ProxyObject> getProxyFactory() { if (factory==null) { factory = createProxyFactory( getType(), getBeanClass(), getBusinessInterfaces() ); } return factory; }
public boolean isInterceptorEnabled() { return getComponent().getType()==JAVA_BEAN && getComponent().beanClassHasAnnotation(Transactional.class); }
if (component.getType().isSessionBean() && component.getBusinessInterfaces().size() > 0) "Type cannot be determined for component [%s]. Please ensure that it has a local interface.", component)); else if (component.getType().equals(ComponentType.ENTITY_BEAN)) else if (component.getType().equals(ComponentType.JAVA_BEAN))
if (component.getType().isSessionBean() && component.getBusinessInterfaces().size() > 0)
Class clz = null; if (component.getType().isSessionBean() && component.getBusinessInterfaces().size() > 0) { for (Class c : component.getBusinessInterfaces()) {
switch (seamComponent.getType())
@AroundInvoke public Object aroundInvoke(InvocationContext invocation) throws Exception { try { return invocation.proceed(); } catch (Exception e) { if ( isRollbackRequired(e, getComponent().getType() == JAVA_BEAN) ) { try { Transaction.instance().setRollbackOnly(); } catch (Exception te) {} //swallow } throw e; } }
"Component: " + getName() + ", scope: " + getScope() + ", type: " + getType() + ", class: " + getBeanClass().getName() + ( jndiName==null ? "" : ", JNDI: " + jndiName )