roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agillil...@apache.org
Subject svn commit: r369259 - in /incubator/roller/trunk: src/org/roller/presentation/ src/org/roller/presentation/filters/ src/org/roller/presentation/velocity/ src/org/roller/presentation/weblog/actions/ src/org/roller/presentation/weblog/tags/ src/org/rolle...
Date Sun, 15 Jan 2006 19:46:21 GMT
Author: agilliland
Date: Sun Jan 15 11:46:10 2006
New Revision: 369259

URL: http://svn.apache.org/viewcvs?rev=369259&view=rev
Log:
refactoring RollerContext.getRollerContext(context) to RollerContext.getRollerContext().


Modified:
    incubator/roller/trunk/src/org/roller/presentation/RollerContext.java
    incubator/roller/trunk/src/org/roller/presentation/RollerRequest.java
    incubator/roller/trunk/src/org/roller/presentation/RollerSession.java
    incubator/roller/trunk/src/org/roller/presentation/filters/RefererFilter.java
    incubator/roller/trunk/src/org/roller/presentation/velocity/ExportRss.java
    incubator/roller/trunk/src/org/roller/presentation/weblog/actions/ToggleLinkbackDisplayAction.java
    incubator/roller/trunk/src/org/roller/presentation/weblog/tags/BigWeblogCalendarModel.java
    incubator/roller/trunk/src/org/roller/presentation/website/actions/UserNewAction.java
    incubator/roller/trunk/tests/org/roller/presentation/MockRollerContext.java

Modified: incubator/roller/trunk/src/org/roller/presentation/RollerContext.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/presentation/RollerContext.java?rev=369259&r1=369258&r2=369259&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/presentation/RollerContext.java (original)
+++ incubator/roller/trunk/src/org/roller/presentation/RollerContext.java Sun Jan 15 11:46:10
2006
@@ -94,14 +94,6 @@
     
     
     /* Returns Roller instance for specified app */
-    public static RollerContext getRollerContext(ServletContext scc) {
-        // get roller from servlet context
-        ServletContext sc = RollerContext.getServletContext();
-        return (RollerContext) sc.getAttribute(ROLLER_CONTEXT);
-    }
-    
-    
-    /* Returns Roller instance for specified app */
     public static RollerContext getRollerContext() {
         // get roller from servlet context
         ServletContext sc = RollerContext.getServletContext();

Modified: incubator/roller/trunk/src/org/roller/presentation/RollerRequest.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/presentation/RollerRequest.java?rev=369259&r1=369258&r2=369259&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/presentation/RollerRequest.java (original)
+++ incubator/roller/trunk/src/org/roller/presentation/RollerRequest.java Sun Jan 15 11:46:10
2006
@@ -144,7 +144,7 @@
         }
         
         // Bind persistence session to authenticated user, if we have one
-        RollerContext rctx = RollerContext.getRollerContext(mContext); 
+        RollerContext rctx = RollerContext.getRollerContext(); 
         Authenticator auth = rctx.getAuthenticator();
         String userName = auth.getAuthenticatedUserName(mRequest);
         if (userName != null)

Modified: incubator/roller/trunk/src/org/roller/presentation/RollerSession.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/presentation/RollerSession.java?rev=369259&r1=369258&r2=369259&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/presentation/RollerSession.java (original)
+++ incubator/roller/trunk/src/org/roller/presentation/RollerSession.java Sun Jan 15 11:46:10
2006
@@ -87,15 +87,13 @@
     {
         RollerSession rollerSession = new RollerSession();
         se.getSession().setAttribute(ROLLER_SESSION, rollerSession);
-        RollerContext rctx = 
-            RollerContext.getRollerContext(se.getSession().getServletContext());        
  
+        RollerContext rctx = RollerContext.getRollerContext();
         rctx.sessionCreated(se);           
     }    
 
     public void sessionDestroyed(HttpSessionEvent se)
     {
-        RollerContext rctx = 
-            RollerContext.getRollerContext(se.getSession().getServletContext());
+        RollerContext rctx = RollerContext.getRollerContext();
         rctx.sessionDestroyed(se);                 
         clearSession(se);        
     }

Modified: incubator/roller/trunk/src/org/roller/presentation/filters/RefererFilter.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/presentation/filters/RefererFilter.java?rev=369259&r1=369258&r2=369259&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/presentation/filters/RefererFilter.java (original)
+++ incubator/roller/trunk/src/org/roller/presentation/filters/RefererFilter.java Sun Jan
15 11:46:10 2006
@@ -84,8 +84,7 @@
         if (pageRequest != null && pageRequest.getWeblogHandle() != null &&
!isRobot) {
             String handle = pageRequest.getWeblogHandle();
             
-            RollerContext rctx =
-                    RollerContext.getRollerContext(mFilterConfig.getServletContext());
+            RollerContext rctx = RollerContext.getRollerContext();
             
             // Base page URLs, with and without www.
             String basePageUrlWWW =

Modified: incubator/roller/trunk/src/org/roller/presentation/velocity/ExportRss.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/presentation/velocity/ExportRss.java?rev=369259&r1=369258&r2=369259&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/presentation/velocity/ExportRss.java (original)
+++ incubator/roller/trunk/src/org/roller/presentation/velocity/ExportRss.java Sun Jan 15
11:46:10 2006
@@ -59,8 +59,8 @@
         
         ctx = new VelocityContext();
         
-        RollerContext rollerCtx = RollerContext.getRollerContext(
-                                      RollerContext.getServletContext());
+        RollerContext rollerCtx = RollerContext.getRollerContext();
+        
         loadPageHelper();
         
         loadDates(website);

Modified: incubator/roller/trunk/src/org/roller/presentation/weblog/actions/ToggleLinkbackDisplayAction.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/presentation/weblog/actions/ToggleLinkbackDisplayAction.java?rev=369259&r1=369258&r2=369259&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/presentation/weblog/actions/ToggleLinkbackDisplayAction.java
(original)
+++ incubator/roller/trunk/src/org/roller/presentation/weblog/actions/ToggleLinkbackDisplayAction.java
Sun Jan 15 11:46:10 2006
@@ -72,8 +72,7 @@
 		String url = null;
 		try
 		{
-			RollerContext rctx = RollerContext.getRollerContext(
-				rreq.getServletContext());
+			RollerContext rctx = RollerContext.getRollerContext();
 			url = rctx.getContextUrl( req, rreq.getWebsite());
 			res.sendRedirect(url);
 		}

Modified: incubator/roller/trunk/src/org/roller/presentation/weblog/tags/BigWeblogCalendarModel.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/presentation/weblog/tags/BigWeblogCalendarModel.java?rev=369259&r1=369258&r2=369259&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/presentation/weblog/tags/BigWeblogCalendarModel.java
(original)
+++ incubator/roller/trunk/src/org/roller/presentation/weblog/tags/BigWeblogCalendarModel.java
Sun Jan 15 11:46:10 2006
@@ -129,8 +129,7 @@
         try 
         {
 			RollerRequest rreq = RollerRequest.getRollerRequest(mReq);
-			RollerContext rctx = 
-				RollerContext.getRollerContext(rreq.getServletContext());
+			RollerContext rctx = RollerContext.getRollerContext();
             StringBuffer sb = new StringBuffer();
             
             // get the 8 char YYYYMMDD datestring for day, returns null 

Modified: incubator/roller/trunk/src/org/roller/presentation/website/actions/UserNewAction.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/presentation/website/actions/UserNewAction.java?rev=369259&r1=369258&r2=369259&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/presentation/website/actions/UserNewAction.java
(original)
+++ incubator/roller/trunk/src/org/roller/presentation/website/actions/UserNewAction.java
Sun Jan 15 11:46:10 2006
@@ -115,7 +115,7 @@
         UserFormEx form = (UserFormEx)actionForm;
         RollerRequest rreq = RollerRequest.getRollerRequest(request);
         ServletContext ctx = rreq.getServletContext();
-        RollerContext rollerContext = RollerContext.getRollerContext(ctx);
+        RollerContext rollerContext = RollerContext.getRollerContext();
 
         boolean reg_allowed = 
                 RollerRuntimeConfig.getBooleanProperty("users.registration.enabled");

Modified: incubator/roller/trunk/tests/org/roller/presentation/MockRollerContext.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/tests/org/roller/presentation/MockRollerContext.java?rev=369259&r1=369258&r2=369259&view=diff
==============================================================================
--- incubator/roller/trunk/tests/org/roller/presentation/MockRollerContext.java (original)
+++ incubator/roller/trunk/tests/org/roller/presentation/MockRollerContext.java Sun Jan 15
11:46:10 2006
@@ -1 +1 @@
-/*
 * Created on Mar 4, 2004
 */
package org.roller.presentation;
import java.io.File;
import
javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.http.HttpServletRequest;
import
org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.roller.RollerException;

/**
* @author lance.lavandowska
 */
public class MockRollerContext extends RollerContext
{
  
 private static Log mLogger =
        LogFactory.getFactory().getInstance(MockRollerContext.class);
   private static ServletContext mContext = null;
    public void init(ServletContext sc)
   {
        mLogger.debug("MockRollerContext initializing");
        
        // initialize
super 
        super.contextInitialized(new ServletContextEvent(sc));
        
        //
Save context in self and self in context
        mContext = sc;
        mContext.setAttribute(ROLLER_CONTEXT,
this);
        mContext.setAttribute("org.roller.absoluteContextURL", "/");
     }
    //-----------------------------------------------------------------------
    /**
Because I cannot set the super's values, I have to
     * overide the methods as well */ 

    public static RollerContext getRollerContext(ServletContext sc)
    {
        // get
roller from servlet context
        return (RollerContext) mContext.getAttribute(ROLLER_CONTEXT);
   }
    //-----------------------------------------------------------------------
    /**
Because I cannot set the super's values, I have to
     * overide the methods as well */ 

    public static ServletContext getServletContext()
    {
        return mContext;
    }

   //-----------------------------------------------------------------------
    /** Because
I cannot set the super's values, I have to
     * overide the methods as well */
    public
String getRollerVersion()
    {
        return super.getRollerVersion();
    }
    //-----------------------------------------------------------------------
 
   /** Because I cannot set the super's values, I have to
     * overide the methods as well
*/
    public String getRollerBuildTime()
    {
        return super.getRollerBuildTime();
   }
    //-----------------------------------------------------------------------
    /**
Because I cannot set the super's values, I have to
     * overide the methods as well */
   public String getRollerBuildUser()
    {
        return super.getRollerBuildUser();
  
 }

    //-----------------------------------------------------------------------
    /**
Because I cannot set the super's values, I have to
     * overide the methods as well */
   public String getAbsoluteContextUrl()
    {
        return "";
    }
    //-----------------------------------------------------------------------
   /** Because I cannot set the super's values, I have to
     * overide the methods as well
*/
    public String getAbsoluteContextUrl(HttpServletRequest request)
    {
        return
request.getScheme(
 ) +"://" + request.getServerName() + "";
    }
    //-----------------------------------------------------------------------
   /** Because I cannot set the super's values, I have to
     * overide the methods as well
*/
    /* not available anymore ... use the new config classes instead -- Allen G
    public
RollerConfigData getRollerConfig()
    {
        return super.getRollerConfig();
    }
  
 */
    //------------------------------------------------------------------------
    public
String getConfigPath() 
    {
        String root = System.getProperty("ro.build");
     
  String configPath =
            root
                + File.separator
                +
"roller"
                + File.separator
                + "WEB-INF"
                + File.separator
               + "roller-config.xml";
        return configPath;
    }
    protected void
upgradeDatabaseIfNeeded() throws RollerException
    {
        // for now, this is a no-op
   }

}
\ No newline at end of file
+/*
 * Created on Mar 4, 2004
 */
package org.roller.presentation;
import java.io.File;
import
javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.http.HttpServletRequest;
import
org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.roller.RollerException;

/**
* @author lance.lavandowska
 */
public class MockRollerContext extends RollerContext
{
  
 private static Log mLogger =
        LogFactory.getFactory().getInstance(MockRollerContext.class);
   private static ServletContext mContext = null;
    public void init(ServletContext sc)
   {
        mLogger.debug("MockRollerContext initializing");
        
        // initialize
super 
        super.contextInitialized(new ServletContextEvent(sc));
        
        //
Save context in self and self in context
        mContext = sc;
        mContext.setAttribute(ROLLER_CONTEXT,
this);
        mContext.setAttribute("org.roller.absoluteContextURL", "/");
     }
    //-----------------------------------------------------------------------
    /**
Because I cannot set the super's values, I have to
     * overide the methods as well */ 

    public static RollerContext getRollerContext()
    {
        // get roller from servlet
context
        return (RollerContext) mContext.getAttribute(ROLLER_CONTEXT);
    }
    //-----------------------------------------------------------------------
   /** Because I cannot set the super's values, I have to
     * overide the methods as well
*/  
    public static ServletContext getServletContext()
    {
        return mContext;
   }

    //-----------------------------------------------------------------------
    /**
Because I cannot set the super's values, I have to
     * overide the methods as well */
   public String getRollerVersion()
    {
        return super.getRollerVersion();
    }
   //-----------------------------------------------------------------------
    /** Because
I c
 annot set the super's values, I have to
     * overide the methods as well */
    public
String getRollerBuildTime()
    {
        return super.getRollerBuildTime();
    }
    //-----------------------------------------------------------------------
   /** Because I cannot set the super's values, I have to
     * overide the methods as well
*/
    public String getRollerBuildUser()
    {
        return super.getRollerBuildUser();
   }

    //-----------------------------------------------------------------------
    /**
Because I cannot set the super's values, I have to
     * overide the methods as well */
   public String getAbsoluteContextUrl()
    {
        return "";
    }
    //-----------------------------------------------------------------------
   /** Because I cannot set the super's values, I have to
     * overide the methods as well
*/
    public String getAbsoluteContextUrl(HttpServletRequest request)
    {
        return
request.getScheme() +"://" + reques
 t.getServerName() + "";
    }
    //-----------------------------------------------------------------------
   /** Because I cannot set the super's values, I have to
     * overide the methods as well
*/
    /* not available anymore ... use the new config classes instead -- Allen G
    public
RollerConfigData getRollerConfig()
    {
        return super.getRollerConfig();
    }
  
 */
    //------------------------------------------------------------------------
    public
String getConfigPath() 
    {
        String root = System.getProperty("ro.build");
     
  String configPath =
            root
                + File.separator
                +
"roller"
                + File.separator
                + "WEB-INF"
                + File.separator
               + "roller-config.xml";
        return configPath;
    }
    protected void
upgradeDatabaseIfNeeded() throws RollerException
    {
        // for now, this is a no-op
   }

}
\ No newline at end of file



Mime
View raw message