struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddew...@apache.org
Subject svn commit: r470504 - in /struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles: servlet/TilesServlet.java taglib/InitDefinitionsTag.java util/DefinitionsUtil.java util/TilesUtil.java util/TilesUtilImpl.java
Date Thu, 02 Nov 2006 20:25:45 GMT
Author: ddewolf
Date: Thu Nov  2 12:25:45 2006
New Revision: 470504

URL: http://svn.apache.org/viewvc?view=rev&rev=470504
Log:
Getting rid of DefinitionsUtil; Setting up Preparers

Removed:
    struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/util/DefinitionsUtil.java
Modified:
    struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/servlet/TilesServlet.java
    struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/taglib/InitDefinitionsTag.java
    struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/util/TilesUtil.java
    struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/util/TilesUtilImpl.java

Modified: struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/servlet/TilesServlet.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/servlet/TilesServlet.java?view=diff&rev=470504&r1=470503&r2=470504
==============================================================================
--- struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/servlet/TilesServlet.java
(original)
+++ struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/servlet/TilesServlet.java
Thu Nov  2 12:25:45 2006
@@ -29,7 +29,6 @@
 import org.apache.tiles.definition.DefinitionsFactory;
 import org.apache.tiles.definition.DefinitionsFactoryConfig;
 import org.apache.tiles.definition.DefinitionsFactoryException;
-import org.apache.tiles.util.DefinitionsUtil;
 import org.apache.tiles.util.TilesUtil;
 import org.apache.tiles.util.TilesUtilImpl;
 
@@ -186,6 +185,7 @@
             TilesAccess.setApplicationContext(context, tilesContext);
             TilesUtil.setTilesUtil(new TilesUtilImpl(tilesContext));
             initDefinitionsFactory(context, fconfig);
+            initPreparerFactory();
         } catch (TilesException e) {
             saveExceptionMessage(config, e);
             throw new ServletException(e.getMessage(), e);
@@ -242,12 +242,16 @@
         // Create configurable impl
         try {
 
-            definitionFactory = DefinitionsUtil.createDefinitionsFactory(
+            definitionFactory = TilesUtil.createDefinitionsFactory(
                 factoryConfig);
         } catch (DefinitionsFactoryException ex) {
             ex.printStackTrace();
             throw new ServletException(ex.getMessage(), ex);
         }
+    }
+
+    private void initPreparerFactory() {
+        TilesUtil.createPreparerFactory();
     }
 
 

Modified: struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/taglib/InitDefinitionsTag.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/taglib/InitDefinitionsTag.java?view=diff&rev=470504&r1=470503&r2=470504
==============================================================================
--- struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/taglib/InitDefinitionsTag.java
(original)
+++ struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/taglib/InitDefinitionsTag.java
Thu Nov  2 12:25:45 2006
@@ -74,8 +74,6 @@
      * Do start tag.
      */
     public int doStartTag() throws JspException {
-        TilesApplicationContext tilesContext =
-            TilesAccess.getApplicationContext(pageContext.getServletContext());
         DefinitionsFactory factory = TilesUtil.getDefinitionsFactory();
         if (factory != null) {
             return SKIP_BODY;

Modified: struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/util/TilesUtil.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/util/TilesUtil.java?view=diff&rev=470504&r1=470503&r2=470504
==============================================================================
--- struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/util/TilesUtil.java
(original)
+++ struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/util/TilesUtil.java
Thu Nov  2 12:25:45 2006
@@ -22,6 +22,8 @@
 
 import org.apache.tiles.TilesApplicationContext;
 import org.apache.tiles.TilesRequestContext;
+import org.apache.tiles.preparer.PreparerFactory;
+import org.apache.tiles.preparer.BasicPreparerFactory;
 import org.apache.tiles.definition.*;
 
 import javax.servlet.jsp.PageContext;
@@ -165,6 +167,13 @@
     }
 
     /**
+     * Get preparer factory
+     */
+    public static PreparerFactory getPreparerFactory() {
+        return tilesUtilImpl.getPreparerFactory();
+    }
+
+    /**
      * Create Definition impl from specified configuration object.
      * Create a ConfigurableDefinitionsFactory and initialize it with the configuration
      * object. This later can contain the impl classname to use.
@@ -212,4 +221,8 @@
         tilesUtilImpl = new TilesUtilImpl(null);
     }
 
+    public static void createPreparerFactory() {
+        tilesUtilImpl.createPreparerFactory();
+
+    }
 }

Modified: struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/util/TilesUtilImpl.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/util/TilesUtilImpl.java?view=diff&rev=470504&r1=470503&r2=470504
==============================================================================
--- struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/util/TilesUtilImpl.java
(original)
+++ struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/util/TilesUtilImpl.java
Thu Nov  2 12:25:45 2006
@@ -26,13 +26,14 @@
 import org.apache.tiles.TilesRequestContext;
 import org.apache.tiles.context.BasicTilesContextFactory;
 import org.apache.tiles.definition.*;
+import org.apache.tiles.preparer.BasicPreparerFactory;
+import org.apache.tiles.preparer.PreparerFactory;
 
 import javax.servlet.jsp.PageContext;
 import java.io.IOException;
 import java.io.Serializable;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
-import java.net.MalformedURLException;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
@@ -56,6 +57,9 @@
     public static final String DEFINITIONS_FACTORY =
         "org.apache.tiles.DEFINITIONS_FACTORY";
 
+    public static final String PREPARER_FACTORY =
+        "org.apache.tiles.PREPARER_FACTORY";
+
     /**
      * Constant used to store ComponentDefinitions graph.
      */
@@ -168,6 +172,16 @@
     }
 
     /**
+     * Get preparer factory.
+     *
+     * @return
+     * @throws DefinitionsFactoryException
+     */
+    public PreparerFactory getPreparerFactory() {
+        return (PreparerFactory) applicationContext.getApplicationScope().get(PREPARER_FACTORY);
+    }
+
+    /**
      * Create Definition impl from specified configuration object.
      * Create an instance of the impl with the class specified in the config
      * object. Then, initialize this impl and finally store the impl in
@@ -275,10 +289,13 @@
      */
     protected void makeDefinitionsFactoryAccessible(
         DefinitionsFactory factory) {
-
         applicationContext.getApplicationScope().put(DEFINITIONS_FACTORY, factory);
     }
 
+    protected void makePreparerFactoryAccessible(PreparerFactory factory) {
+        applicationContext.getApplicationScope().put(PREPARER_FACTORY, factory);
+    }
+
 
     /**
      * Parses a comma-delimited string for a list of config filenames.
@@ -295,4 +312,8 @@
     }
 
 
+    public void createPreparerFactory() {
+        PreparerFactory preparerFactory = new BasicPreparerFactory();
+        makePreparerFactoryAccessible(preparerFactory);
+    }
 }



Mime
View raw message