throw new UnsupportedOperationException("Stateless pseudo-scope does not have a Context object"); case METHOD: if ( !Contexts.isMethodContextActive() ) return Contexts.getMethodContext(); case EVENT: if ( !Contexts.isEventContextActive() ) return Contexts.getEventContext(); case PAGE: if ( !Contexts.isPageContextActive() ) return Contexts.getPageContext(); case CONVERSATION: if ( !Contexts.isConversationContextActive() ) return Contexts.getConversationContext(); case SESSION: if ( !Contexts.isSessionContextActive() ) return Contexts.getSessionContext(); case APPLICATION: if ( !Contexts.isApplicationContextActive() ) return Contexts.getApplicationContext(); case BUSINESS_PROCESS: if ( !Contexts.isBusinessProcessContextActive() ) return Contexts.getBusinessProcessContext();
/** * Search in all contexts */ public Object lookup(String name) { return Contexts.lookupInStatefulContexts(name); }
public static CaptchaImage instance() { if ( !Contexts.isApplicationContextActive() ) { throw new IllegalStateException("No application context active"); } return (CaptchaImage) Contexts.getApplicationContext().get(CaptchaImage.class); }
public String[] getSession() { String[] names={}; if(org.jboss.seam.contexts.Contexts.isSessionContextActive()) { names = org.jboss.seam.contexts.Contexts.getSessionContext().getNames(); } Arrays.sort(names); return names; }
public String[] getConversation() { String[] names = {}; if ( org.jboss.seam.contexts.Contexts.isConversationContextActive()) { names = org.jboss.seam.contexts.Contexts.getConversationContext().getNames(); } Arrays.sort(names); return names; }
public static HotDeploymentStrategy instance() { if (Contexts.getEventContext().isSet(NAME)) { return (HotDeploymentStrategy) Contexts.getEventContext().get(NAME); } return null; }
@OperationMethod public DocumentModel push(DocumentModel value) { if ("session".equalsIgnoreCase(scope)) { Contexts.getSessionContext().set(name, value); } else if ("conversation".equalsIgnoreCase(scope)) { Contexts.getConversationContext().set(name, value); } else if ("page".equalsIgnoreCase(scope)) { Contexts.getPageContext().set(name, value); } else if ("event".equalsIgnoreCase(scope)) { Contexts.getEventContext().set(name, value); } return value; }
@Observer(Identity.EVENT_POST_AUTHENTICATE) public void setUserAccountForSession() { if (Contexts.isEventContextActive() && Contexts.isSessionContextActive()) { Contexts.getSessionContext().set(AUTHENTICATED_USER, Contexts.getEventContext().get(AUTHENTICATED_USER)); } }
public static void endInitialization() { Contexts.startup(ScopeType.APPLICATION); Events.instance().raiseEvent("org.jboss.seam.postInitialization"); // Clean up contexts used during initialization Contexts.destroy( Contexts.getConversationContext() ); Contexts.conversationContext.set(null); Contexts.destroy( Contexts.getEventContext() ); Contexts.eventContext.set(null); Contexts.sessionContext.set(null); Contexts.applicationContext.set(null); log.debug("<<< End initialization"); }
public Component(Class<?> clazz, String componentName, ScopeType componentScope, boolean startup, String[] dependencies, String jndiName) { this(clazz, componentName, componentScope, startup, dependencies, jndiName, Contexts.getApplicationContext()); }
String value = (String) Contexts.getPageContext().get( pageParameter.getName() ); if (value!=null) Contexts.getEventContext().set( pageParameter.getName(), convertedValue );
public static ThemeSelector instance() { if ( !Contexts.isSessionContextActive() ) { throw new IllegalStateException("No active session context"); } return (ThemeSelector) Component.getInstance(ThemeSelector.class, ScopeType.SESSION); }
public static boolean isConversationContextActive() { return getConversationContext() != null; }
protected Context getPageContext() { return Contexts.getPageContext(); }
/** * Restore the page and conversation contexts during a JSF request */ protected void afterRestoreView(FacesContext facesContext) { boolean conversationFound = Contexts.isPageContextActive() ? Contexts.getPageContext().isSet("org.jboss.seam.jsf.SeamPhaseListener.conversationFound") : false; FacesLifecycle.resumePage(); Map parameters = facesContext.getExternalContext().getRequestParameterMap(); if (!conversationFound) // there is exceptional case when restoring of conversation wasn't called while page context was lazily initialized { ConversationPropagation.instance().restoreConversationId(parameters); conversationFound = Manager.instance().restoreConversation(); } FacesLifecycle.resumeConversation( facesContext.getExternalContext() ); postRestorePage(facesContext, parameters, conversationFound); }
protected Context getSessionContext() { return Contexts.getSessionContext(); }
/** * Returns the current documentManager if any or create a new session to the current location. */ @Override public CoreSession getOrCreateDocumentManager() { if (documentManager != null) { return documentManager; } // protect for unexpected wrong cast Object supposedDocumentManager = Contexts.lookupInStatefulContexts("documentManager"); DocumentManagerBusinessDelegate documentManagerBD = null; if (supposedDocumentManager != null) { if (supposedDocumentManager instanceof DocumentManagerBusinessDelegate) { documentManagerBD = (DocumentManagerBusinessDelegate) supposedDocumentManager; } else { log.error("Found the documentManager being " + supposedDocumentManager.getClass() + " instead of DocumentManagerBusinessDelegate. This is wrong."); } } if (documentManagerBD == null) { // this is the first time we select the location, create a // DocumentManagerBusinessDelegate instance documentManagerBD = new DocumentManagerBusinessDelegate(); Contexts.getConversationContext().set("documentManager", documentManagerBD); } documentManager = documentManagerBD.getDocumentManager(getCurrentServerLocation()); return documentManager; }
public static void endCall() { try { Contexts.destroy( Contexts.getSessionContext() ); Contexts.flushAndDestroyContexts(); if ( Manager.instance().isLongRunningConversation() ) { throw new IllegalStateException("Do not start long-running conversations in direct calls to EJBs"); } } finally { clearThreadlocals(); log.debug( "<<< End call" ); } }
@Factory(value="org.jboss.seam.core.eventContext", autoCreate=true) public Context getEventContext() { return org.jboss.seam.contexts.Contexts.getEventContext(); }
public static void endReinitialization() { Contexts.startup(ScopeType.APPLICATION); Events.instance().raiseEvent("org.jboss.seam.postReInitialization"); // Clean up contexts used during reinitialization Contexts.destroy( Contexts.getConversationContext() ); Contexts.conversationContext.set(null); Contexts.destroy( Contexts.getEventContext() ); Contexts.eventContext.set(null); Contexts.sessionContext.set(null); Contexts.applicationContext.set(null); log.debug("<<< End re-initialization"); }