[jboss-cvs] jboss-seam/src/ioc/org/jboss/seam/ioc/spring ...

Gavin King gavin.king at jboss.com
Wed Jun 20 04:23:16 EDT 2007


  User: gavin   
  Date: 07/06/20 04:23:16

  Modified:    src/ioc/org/jboss/seam/ioc/spring   ContextLoader.java
                        SpringELResolver.java
  Log:
  split up Lifecycle, much better
  
  Revision  Changes    Path
  1.5       +20 -12    jboss-seam/src/ioc/org/jboss/seam/ioc/spring/ContextLoader.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ContextLoader.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/ioc/org/jboss/seam/ioc/spring/ContextLoader.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -b -r1.4 -r1.5
  --- ContextLoader.java	20 Mar 2007 21:33:02 -0000	1.4
  +++ ContextLoader.java	20 Jun 2007 08:23:16 -0000	1.5
  @@ -13,7 +13,7 @@
   import org.jboss.seam.annotations.Name;
   import org.jboss.seam.annotations.Scope;
   import org.jboss.seam.annotations.Startup;
  -import org.jboss.seam.contexts.Lifecycle;
  +import org.jboss.seam.contexts.ServletLifecycle;
   import org.springframework.web.context.ConfigurableWebApplicationContext;
   import org.springframework.web.context.WebApplicationContext;
   import org.springframework.web.context.support.XmlWebApplicationContext;
  @@ -31,39 +31,47 @@
   public class ContextLoader
   {
      private WebApplicationContext webApplicationContext;
  -   private String[] configLocations = {XmlWebApplicationContext.DEFAULT_CONFIG_LOCATION};
  +   private String[] configLocations = { XmlWebApplicationContext.DEFAULT_CONFIG_LOCATION };
      
      @Create 
      public void create() throws Exception
      {
  -      ServletContext servletContext = Lifecycle.getServletContext();
  -      try {
  +      ServletContext servletContext = ServletLifecycle.getServletContext();
  +      try 
  +      {
            webApplicationContext = createContextLoader(servletContext);
            servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, webApplicationContext);
            startupContextLoader(webApplicationContext);
  -      } catch (Exception e) {
  +      } 
  +      catch (Exception e) 
  +      {
            servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, e);
            throw e;
         }
      }
      
  -   protected WebApplicationContext createContextLoader(ServletContext servletContext) {
  +   protected WebApplicationContext createContextLoader(ServletContext servletContext) 
  +   {
         XmlWebApplicationContext xmlWebApplicationContext = new XmlWebApplicationContext();
         xmlWebApplicationContext.setServletContext(servletContext);
         xmlWebApplicationContext.setConfigLocations(getConfigLocations());
         return xmlWebApplicationContext;
      }
      
  -   protected void startupContextLoader(WebApplicationContext webApplicationContext) {
  -      if(webApplicationContext instanceof ConfigurableWebApplicationContext) {
  -         ((ConfigurableWebApplicationContext)webApplicationContext).refresh();
  +   protected void startupContextLoader(WebApplicationContext webApplicationContext) 
  +   {
  +      if(webApplicationContext instanceof ConfigurableWebApplicationContext) 
  +      {
  +         ((ConfigurableWebApplicationContext) webApplicationContext).refresh();
         }
      }
   
      @Destroy
  -   public void destroy() {
  -      if(webApplicationContext != null && webApplicationContext instanceof ConfigurableWebApplicationContext) {
  -         ((ConfigurableWebApplicationContext)webApplicationContext).close();
  +   public void destroy() 
  +   {
  +      if (webApplicationContext != null && webApplicationContext instanceof ConfigurableWebApplicationContext) 
  +      {
  +         ((ConfigurableWebApplicationContext) webApplicationContext).close();
         }
      }
      
  
  
  
  1.4       +2 -2      jboss-seam/src/ioc/org/jboss/seam/ioc/spring/SpringELResolver.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: SpringELResolver.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/ioc/org/jboss/seam/ioc/spring/SpringELResolver.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- SpringELResolver.java	30 May 2007 00:35:47 -0000	1.3
  +++ SpringELResolver.java	20 Jun 2007 08:23:16 -0000	1.4
  @@ -17,7 +17,7 @@
   import org.jboss.seam.annotations.Name;
   import org.jboss.seam.annotations.Scope;
   import org.jboss.seam.annotations.Startup;
  -import org.jboss.seam.contexts.Lifecycle;
  +import org.jboss.seam.contexts.ServletLifecycle;
   import org.jboss.seam.el.EL;
   import org.jboss.seam.log.LogProvider;
   import org.jboss.seam.log.Logging;
  @@ -77,7 +77,7 @@
            // We only resolve root variable.
            return null;
         }
  -      ServletContext servletContext = Lifecycle.getServletContext();
  +      ServletContext servletContext = ServletLifecycle.getServletContext();
         if (servletContext == null)
         {
            log.debug("Could not locate seam stored servletContext.  Skipping.");
  
  
  



More information about the jboss-cvs-commits mailing list