private Object resolveInContextObject(ELContext context, Context seamContext, Object property) { if (seamContext.isSet((String) property)) { context.setPropertyResolved(true); return seamContext.get((String) property); } else { return null; } }
static Map getConversationCache() { Map convCache = new HashMap(); String convId = findConversationId(); if (convId == null) return convCache; Context conversationContext = new ServerConversationContext(sessionMap(), convId); for (String name : conversationContext.getNames() ) { Object value = conversationContext.get(name); convCache.put(name, value); } return convCache; }
/** * Get the most recently rendered message sent using the MockTransport. */ public static MimeMessage getMailMessage() { return (MimeMessage) Contexts.getApplicationContext().get(VAR_NAME); }
public static DocumentsListsManager getDocumentListManager() { return (DocumentsListsManager) Contexts.getSessionContext().get("documentsListsManager"); }
public static WebActions getWebActions() { return (WebActions) Contexts.getConversationContext().get("webActions"); }
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" ); }
@SuppressWarnings("unchecked") private static Map<String, String> getSpringComponentNameMap() { if (Contexts.getApplicationContext().get(SPRING_COMPONENT_NAME_MAP) == null) { Contexts.getApplicationContext().set(SPRING_COMPONENT_NAME_MAP, new HashMap<String, String>()); } return (Map<String, String>) Contexts.getApplicationContext().get(SPRING_COMPONENT_NAME_MAP); }
/** * @return a cache that stores fields annotated with the @Inject annotation for the Guice component classes */ @SuppressWarnings("unchecked") private Map<Class,Collection<Field>> getGuiceComponentFieldsMap() { if (Contexts.getApplicationContext().get(GUICE_COMPONENT_FIELDS_MAP) == null) { Contexts.getApplicationContext().set(GUICE_COMPONENT_FIELDS_MAP, new HashMap<Class, Collection<Field>>()); } return (Map<Class, Collection<Field>>) Contexts.getApplicationContext().get(GUICE_COMPONENT_FIELDS_MAP); }
public static Init instance() { if ( !Contexts.isApplicationContextActive() ) { throw new IllegalStateException("No active application scope"); } Init init = (Init) Contexts.getApplicationContext().get(Init.class); //commented out because of some test cases: /*if (init==null) { throw new IllegalStateException("No Init exists"); }*/ return init; }
public static Object getInstance(String name, ScopeType scope, boolean create, boolean allowAutocreation) { Object result = scope==STATELESS ? null : scope.getContext().get(name); result = getInstance(name, create, allowAutocreation, result, scope); return result; }
private void initNamespace(String componentName, Context applicationContext) { if (applicationContext!=null) { //for unit tests! Init init = (Init) applicationContext.get(Seam.getComponentName(Init.class)); if (init!=null) { this.namespace = init.initNamespaceForName(componentName, true); } } }
/** * Convenience method that retrieves the servlet context from application * scope. * * @return the current servlet context */ public static ServletContext getCurrentServletContext() { if (!Contexts.isApplicationContextActive()) { return servletContext; } return (ServletContext) Contexts.getApplicationContext().get(SERVLET_CONTEXT_KEY); }
public static HotDeploymentStrategy instance() { if (Contexts.getEventContext().isSet(NAME)) { return (HotDeploymentStrategy) Contexts.getEventContext().get(NAME); } return null; }
public static StandardDeploymentStrategy instance() { if (Contexts.getEventContext().isSet(NAME)) { return (StandardDeploymentStrategy) Contexts.getEventContext().get(NAME); } return null; }
@Observer(value= { "org.jboss.seam.postInitialization","org.jboss.seam.postReInitialization"} ) public void postReInitialization() { HotDeploymentStrategy strategy = (HotDeploymentStrategy)Contexts.getEventContext().get(HotDeploymentStrategy.NAME); if (strategy != null) { hotDeployClassLoader = strategy.getClassLoader(); } else { hotDeployClassLoader = null; } }
@OperationMethod public void run() { StatusMessage.Severity severity = StatusMessage.Severity.valueOf(severityStr); FacesMessages facesMessages = (FacesMessages) Contexts.getConversationContext().get(FacesMessages.class); Object[] params = (Object[]) ctx.get(MESSAGE_PARAMS_KEY); if (params == null) { params = new Object[0]; } facesMessages.addFromResourceBundle(severity, message, params); }
@Observer(Identity.EVENT_POST_AUTHENTICATE) public void setUserAccountForSession() { if (Contexts.isEventContextActive() && Contexts.isSessionContextActive()) { Contexts.getSessionContext().set(AUTHENTICATED_USER, Contexts.getEventContext().get(AUTHENTICATED_USER)); } }
public void in() { Object object = getScope()==null ? Component.getInstance( getName() ) : getScope().getContext().get( getName() ); getValue().setValue( object ); }
protected static void setSeamActionContext(OperationContext context, CoreSession session) { ActionContext seamActionContext = new SeamActionContext(); NavigationContext navigationContext = (NavigationContext) Contexts.getConversationContext() .get("navigationContext"); if (navigationContext != null) { seamActionContext.setCurrentDocument(navigationContext.getCurrentDocument()); } seamActionContext.setDocumentManager(session); seamActionContext.putLocalVariable("SeamContext", new SeamContextHelper()); seamActionContext.setCurrentPrincipal(session.getPrincipal()); context.put(GetActions.SEAM_ACTION_CONTEXT, seamActionContext); }