private static ScopeType getOutScope(ScopeType specifiedScope, Component component) { ScopeType scope = component==null ? EVENT : component.getScope(); if (scope==STATELESS) { scope = EVENT; } if (specifiedScope!=UNSPECIFIED) { scope = specifiedScope; } return scope; }
public boolean isInterceptorEnabled() { return getComponent().getScope() == CONVERSATION; }
public static FacesMessages instance() { Component component = Component.forName(StatusMessages.COMPONENT_NAME); if(component != null && !component.getScope().isContextActive()) { throw new IllegalStateException("No active "+component.getScope().name()+" context"); } //Attempting to get the instance anyway for backwards compatibility with some potential hack situations. return (FacesMessages) Component.getInstance(StatusMessages.COMPONENT_NAME); } }
public static StatusMessages instance() { Component component = Component.forName(StatusMessages.COMPONENT_NAME); if(component != null && !component.getScope().isContextActive()) { throw new IllegalStateException("No active "+component.getScope().name()+" context"); } //Attempting to get the instance anyway for backwards compatibility with some potential hack situations. return (StatusMessages) Component.getInstance(COMPONENT_NAME); }
protected static void runTasks() { Component component = Component.forName(StatusMessages.COMPONENT_NAME); if( component != null && !component.getScope().isContextActive() ) { return; } //Attempting to get the instance anyway for backwards compatibility with some potential hack situations. StatusMessages statusMessages = instance(); if ( statusMessages != null ) { statusMessages.doRunTasks(); } }
protected static synchronized List<SeamComponentInfo> listNuxeoComponents() { if (components == null) { components = new ArrayList<>(); for (String cName : listAllComponentsNames()) { SeamComponentInfoImpl desc = new SeamComponentInfoImpl(); Component comp = Component.forName(cName); String className = comp.getBeanClass().getName(); // if (className.startsWith("org.nuxeo")) { if (!className.startsWith("org.jboss")) { desc.setName(cName); desc.setScope(comp.getScope().toString()); desc.setClassName(className); @SuppressWarnings("rawtypes") Set<Class> ifaces = comp.getBusinessInterfaces(); if (ifaces != null && ifaces.size() > 0) { for (Class<?> iface : ifaces) { desc.addInterfaceName(iface.getName()); } } desc.addInterfaceName(comp.getBeanClass().getName()); components.add(desc); } } Collections.sort(components); } return components; } }
/** * Startup all @Startup components in the given scope */ static void startup(ScopeType scopeType) { Context context = Contexts.getApplicationContext(); for ( String name: context.getNames() ) { Object object = context.get(name); if ( object!=null && (object instanceof Component) ) { Component component = (Component) object; if ( component.isStartup() && component.getScope()==scopeType ) { startup(component); } } } }
switch (seamComponent.getScope())
private void remove() { getComponent().getScope().getContext().remove( getComponent().getName() ); if ( log.isDebugEnabled() ) { log.debug( "Stateful component was removed: " + getComponent().getName() ); } }
/** * Startup a component and all its dependencies */ static void startup(Component component) { if ( component.isStartup() ) { for ( String dependency: component.getDependencies() ) { Component dependentComponent = Component.forName(dependency); if (dependentComponent!=null) { startup(dependentComponent); } } } if ( !component.getScope().getContext().isSet( component.getName() ) ) { log.debug( "starting up: " + component.getName() ); component.newInstance(); } }
component.getScope();
if (component!=null) ScopeType scope = component.getScope(); if ( scope!=ScopeType.STATELESS && scope.isContextActive() )
if ( observer.getComponent().hasUnwrapMethod() ) listener = observer.getComponent().getScope().getContext().get(name);
", scope: " + getScope() + ", type: " + getType() + ", class: " + getBeanClass().getName() +
ScopeType scopeFactory = factoryMethod.getComponent().getScope();