[forge-issues] [JBoss JIRA] (FORGE-1246) CommandScopedContext may not be supported in a shared environment

George Gastaldi (JIRA) jira-events at lists.jboss.org
Fri Oct 4 15:52:02 EDT 2013


George Gastaldi created FORGE-1246:
--------------------------------------

             Summary: CommandScopedContext may not be supported in a shared environment
                 Key: FORGE-1246
                 URL: https://issues.jboss.org/browse/FORGE-1246
             Project: Forge
          Issue Type: Enhancement
          Components: UI - API
    Affects Versions: 2.0.0.Alpha13
            Reporter: George Gastaldi
            Priority: Minor
             Fix For: 2.x Future


CommandScopedContext uses a static LinkedList to store the current UIContext. This is not suitable if forge is run in a shared environment, like a web application for example. 

One solution would be to introduce a unique identifier and store the UIContext in a map:

{code:java}
public interface Identifier {
    public String getIdentifier();
}
@ApplicationScoped
public class GlobalIdentifier implements Identifier {
    public String getIdentifier() {
         return "DEFAULT";
     }
}

// Enable this if run in a web environment
@SessionScoped
@Alternative
public class SessionIdentifier implements Identifier {
    public String getIdentifier() {
         // return the session identifier
     }
}
{code}
and CommandScopedContext could lookup this object to fetch the specific reference identifier.

In CommandScopedContext: 
{code:java}
   @Override
   public void contextInitialized(UIContext context)
   {
      Identifier id = ...; // lookup using BeanManager
      CONTEXT_MAP.put(id.getIdentifier(),context);
   }
   private UIContext getCurrentContext()
   {
      Identifier id = ...; // lookup using BeanManager
      return CONTEXT_MAP.get(id.getIdentifier());
   }
{code}



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the forge-issues mailing list