public String getName() { return name == null ? Seam.getComponentName(componentClass) : name; }
public static void flush() { Seam.clearComponentNameCache(); try { Field f = Seam.class.getDeclaredField("CLASSLOADERS_LOADED"); f.setAccessible(true); ((Set<?>) f.get(null)).clear(); } catch (ReflectiveOperationException e) { log.warn("Can't flush seam class loader cache", e); } try { // TODO: check if this would be needed for Studio hot reload (?) flushWebResources(); } catch (ReflectiveOperationException | JMException e) { log.error("Cannot flush web resources, did you start with the sdk profile active ?", e); } }
public static EjbDescriptor getEjbDescriptor(Class clazz) { EjbDescriptor info = EJB_DESCRIPTOR_CACHE.get(clazz); if (info != null) { return info; } else if (!CLASSLOADERS_LOADED.contains(clazz.getClassLoader())) { cacheEjbDescriptors(clazz); return EJB_DESCRIPTOR_CACHE.get(clazz); } return null; }
public static String getEjbName(Class<?> clazz) { switch ( getComponentType(clazz) ) { case ENTITY_BEAN: case JAVA_BEAN: return null; case STATEFUL_SESSION_BEAN: return clazz.isAnnotationPresent(STATEFUL) ? getStatefulEjbName(clazz) : getEjbNameFromDescriptor(clazz); case STATELESS_SESSION_BEAN: return clazz.isAnnotationPresent(STATELESS) ? getStatelessEjbName(clazz) : getEjbNameFromDescriptor(clazz); case SINGLETON_SESSION_BEAN: return clazz.isAnnotationPresent(SINGLETON) ? getSingletonEjbName(clazz) : getEjbNameFromDescriptor(clazz); case MESSAGE_DRIVEN_BEAN: return clazz.isAnnotationPresent(MESSAGE_DRIVEN) ? getMessageDrivenEjbName(clazz) : getEjbNameFromDescriptor(clazz); default: throw new IllegalArgumentException(); } }
Seam.clearComponentNameCache(); for ( String name: init.getHotDeployableComponents() ) Pages pages = (Pages) ServletLifecycle.getServletContext().getAttribute(Seam.getComponentName(Pages.class)); if (pages != null) { Lifecycle.cleanupApplication(); ServletLifecycle.getServletContext().removeAttribute(Seam.getComponentName(Exceptions.class)); init.setWarTimestamp(warRootDeploymentStrategy.getTimestamp()); log.debug ("done redeploying page descriptors");
protected String getJndiName(Class<?> beanClass) { if (beanClass.isAnnotationPresent(JndiName.class)) { return beanClass.getAnnotation(JndiName.class).value(); } else { String jndiPattern = Init.instance().getJndiPattern(); if (jndiPattern == null) { throw new IllegalArgumentException( "You must specify org.jboss.seam.core.init.jndiPattern or use @JndiName: " + beanClass.getName() ); } return jndiPattern.replace("#{ejbName}", Seam.getEjbName(beanClass)); } }
this.startup = startup; this.dependencies = dependencies; type = Seam.getComponentType( getBeanClass() ); interceptionEnabled = Seam.isInterceptionEnabled( getBeanClass() ); perNestedConversation = hasAnnotation(getBeanClass(), PerNestedConversation.class);
private static String getEjbNameFromDescriptor(Class<?> clazz) { EjbDescriptor ejbDescriptor = getEjbDescriptor(clazz); return ejbDescriptor==null ? null : ejbDescriptor.getEjbName(); }
public static boolean isInterceptionEnabled(Class<?> clazz) { ComponentType componentType = getComponentType(clazz); if ( componentType==ENTITY_BEAN ) { return false; } else if ( getComponentType(clazz)==MESSAGE_DRIVEN_BEAN ) { return true; } else if ( clazz.isAnnotationPresent(BypassInterceptors.class) ) { return false; } else { return true; } }
public ScopeType getScope() { return scope == null ? Seam.getComponentScope(componentClass) : scope; }
protected Component getComponent() { if (isSeamComponent && component==null) { component = Seam.componentForName(componentName); } return component; }
private void installRole(Class<?> scannedClass, Role role) { ScopeType scope = Seam.getComponentRoleScope(scannedClass, role); addComponentDescriptor( new ComponentDescriptor( role.name(), scannedClass, scope ) ); }
private String getJndiName(Context applicationContext) { if ( getBeanClass().isAnnotationPresent(JndiName.class) ) { return getBeanClass().getAnnotation(JndiName.class).value(); } else { switch (type) { case ENTITY_BEAN: case JAVA_BEAN: return null; default: if (applicationContext==null) return null; //TODO: Yew!!! String jndiPattern = Init.instance().getJndiPattern(); if (jndiPattern==null) { throw new IllegalArgumentException("You must specify org.jboss.seam.core.init.jndiPattern or use @JndiName: " + name); } return jndiPattern.replace( "#{ejbName}", Seam.getEjbName(getBeanClass()) ); } } }
/** * Get the bean class from a container-generated proxy * class * */ public static Class getEntityClass(Class clazz) { while (clazz != null && !Object.class.equals(clazz)) { if (clazz.isAnnotationPresent(Entity.class)) { return clazz; } else { EjbDescriptor ejbDescriptor = Seam.getEjbDescriptor(clazz); if (ejbDescriptor != null) { return ejbDescriptor.getBeanType() == ComponentType.ENTITY_BEAN ? clazz : null; } else { clazz = clazz.getSuperclass(); } } } return null; }
/** * Get the default scope * @see Scope */ public static ScopeType getComponentScope(Class<?> clazz) { return clazz.isAnnotationPresent(Scope.class) ? clazz.getAnnotation(Scope.class).value() : getComponentType(clazz).getDefaultScope(); }
public Component(Class<?> clazz, String componentName) { this(clazz, componentName, Seam.getComponentScope(clazz), false, new String[0], null); }
init( Seam.componentForName(defaultComponentName) );
public static JBossClusterMonitor getInstance(ServletContext ctx) { return (JBossClusterMonitor) ctx.getAttribute(Seam.getComponentName(JBossClusterMonitor.class)); } }
EjbDescriptor ejbDescriptor = getEjbDescriptor(clazz); if (ejbDescriptor == null)
/** * Get the scope for a role * @see Scope */ public static ScopeType getComponentRoleScope(Class clazz, Role role) { return role.scope()==ScopeType.UNSPECIFIED ? getComponentType(clazz).getDefaultScope() : role.scope(); }