public static Session instance() { if (!Contexts.isApplicationContextActive()) { throw new IllegalArgumentException("Application scope not active"); } return (Session) Component.getInstance(MailSession.class, APPLICATION); }
public static Principal instance() { if ( !Contexts.isApplicationContextActive() ) { throw new IllegalStateException("No active application scope"); } return (Principal) Component.getInstance(UserPrincipal.class, ScopeType.APPLICATION); }
public static Transition instance() { if ( !Contexts.isApplicationContextActive() ) { throw new IllegalStateException("No active application context"); } return (Transition) Component.getInstance(Transition.class, ScopeType.CONVERSATION); }
public static Validators instance() { if (!Contexts.isApplicationContextActive()) { throw new IllegalStateException("No active application scope"); } return (Validators) Component.getInstance(Validators.class, ScopeType.APPLICATION); }
@Override public TimeZone getTimeZone() { if (Contexts.isApplicationContextActive()) { return org.jboss.seam.international.TimeZone.instance(); } else { // we don't want to use JSF's braindead default (maybe in JSF 2) return TimeZone.getDefault(); } }
public static java.util.Locale instance() { if ( Contexts.isApplicationContextActive() ) { return (java.util.Locale) Component.getInstance(Locale.class, ScopeType.STATELESS); } else { return java.util.Locale.getDefault(); //for unit tests } } }
public ContextualAsynchronousRequest(Object timer) { this.timer = timer; this.createContexts = !Contexts.isEventContextActive() && !Contexts.isApplicationContextActive(); }
public static Pages instance() { if ( !Contexts.isApplicationContextActive() ) { throw new IllegalStateException("No active application context"); } return (Pages) Component.getInstance(Pages.class, ScopeType.APPLICATION); }
public static HttpError instance() { if ( !Contexts.isApplicationContextActive() ) { throw new IllegalStateException("No active application scope"); } return (HttpError) Component.getInstance(HttpError.class, ScopeType.APPLICATION); }
public static Dispatcher instance() { if ( !Contexts.isApplicationContextActive() ) { throw new IllegalStateException("no application context active"); } return (Dispatcher) Component.getInstance("org.jboss.seam.async.dispatcher"); }
public static SafeActions instance() { if ( !Contexts.isApplicationContextActive() ) { throw new IllegalStateException("No active application context"); } return (SafeActions) Component.getInstance(SafeActions.class, ScopeType.APPLICATION); }
public static CaptchaImage instance() { if ( !Contexts.isApplicationContextActive() ) { throw new IllegalStateException("No application context active"); } return (CaptchaImage) Contexts.getApplicationContext().get(CaptchaImage.class); }
public static Component forName(String name) { if ( !Contexts.isApplicationContextActive() ) { throw new IllegalStateException("No application context active"); } return (Component) Contexts.getApplicationContext().get( name + ".component" ); }
public static Jbpm instance() { if ( !Contexts.isApplicationContextActive() ) { throw new IllegalStateException("No application context active"); } if ( !Init.instance().isJbpmInstalled() ) { throw new IllegalStateException("jBPM support is not installed (use components.xml to install it)"); } return (Jbpm) Component.getInstance(Jbpm.class, ScopeType.APPLICATION); }
@Override public Locale getLocale() { if (Contexts.isApplicationContextActive()) { return org.jboss.seam.international.Locale.instance(); } else { return super.getLocale(); } }
public void raiseEventsAfterPhase(PhaseEvent event) { if ( Contexts.isApplicationContextActive() ) { Events.instance().raiseEvent("org.jboss.seam.afterPhase", event); } }
public static Expressions instance() { if (!Contexts.isApplicationContextActive()) { return new Expressions(); } else { return (Expressions) Component.getInstance(Expressions.class, ScopeType.APPLICATION); } }
public static ResourceLoader instance() { if (!Contexts.isApplicationContextActive()) { return new ResourceLoader(); } else { return (ResourceLoader) Component.getInstance(ResourceLoader.class, ScopeType.STATELESS); } }
public static Interpolator instance() { if (Contexts.isApplicationContextActive()) { return (Interpolator) Component.getInstance(Interpolator.class, ScopeType.APPLICATION); } else { return new Interpolator(); // for unit testing } }
@Override public Validator createValidator(String validatorId) throws FacesException { if ( Contexts.isApplicationContextActive() ) { String name = Init.instance().getValidators().get(validatorId); if (name!=null) { return (Validator) Component.getInstance(name); } } return application.createValidator(validatorId); }