geirm 02/01/03 04:40:23
Modified: src/java/org/apache/velocity/runtime RuntimeInstance.java
RuntimeServices.java
Log:
Changed the notion of 'Application Context' to that of
'Application Attributes' so it's easy to mix components that use
this feature w/o fear of collusion, or the requirement to collude when
developing the components.
Revision Changes Path
1.13 +14 -7
jakarta-velocity/src/java/org/apache/velocity/runtime/RuntimeInstance.java
Index: RuntimeInstance.java
===================================================================
RCS file:
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/RuntimeInstance.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- RuntimeInstance.java 25 Nov 2001 14:00:13 -0000 1.12
+++ RuntimeInstance.java 3 Jan 2002 12:40:23 -0000 1.13
@@ -69,6 +69,7 @@
import java.util.Enumeration;
import java.util.TreeMap;
import java.util.Vector;
+import java.util.HashMap;
import org.apache.velocity.Template;
@@ -143,7 +144,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Jeff Bowden</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Geir Magusson Jr.</a>
- * @version $Id: RuntimeInstance.java,v 1.12 2001/11/25 14:00:13 geirm Exp $
+ * @version $Id: RuntimeInstance.java,v 1.13 2002/01/03 12:40:23 geirm Exp $
*/
public class RuntimeInstance implements RuntimeConstants, RuntimeServices
{
@@ -215,7 +216,7 @@
* application for use in application supplied/specified
* pluggable components
*/
- private Object applicationContext = null;
+ private Map applicationAttributes = null;
public RuntimeInstance()
@@ -232,13 +233,19 @@
*/
introspector = new Introspector( this );
+
+ /*
+ * and a store for the application attributes
+ */
+
+ applicationAttributes = new HashMap();
}
/*
* This is the primary initialization method in the Velocity
* Runtime. The systems that are setup/initialized here are
* as follows:
- *
+ *
* <ul>
* <li>Logging System</li>
* <li>ResourceManager</li>
@@ -1085,14 +1092,14 @@
return introspector;
}
- public Object getApplicationContext()
+ public Object getApplicationAttribute( Object key)
{
- return applicationContext;
+ return applicationAttributes.get( key );
}
- public void setApplicationContext( Object o )
+ public Object setApplicationAttribute( Object key, Object o )
{
- applicationContext = o;
+ return applicationAttributes.put( key, o );
}
}
1.4 +3 -3
jakarta-velocity/src/java/org/apache/velocity/runtime/RuntimeServices.java
Index: RuntimeServices.java
===================================================================
RCS file:
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/RuntimeServices.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- RuntimeServices.java 31 Oct 2001 02:59:28 -0000 1.3
+++ RuntimeServices.java 3 Jan 2002 12:40:23 -0000 1.4
@@ -107,7 +107,7 @@
* Currently implemented by RuntimeInstance.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Geir Magusson Jr.</a>
- * @version $Id: RuntimeServices.java,v 1.3 2001/10/31 02:59:28 geirm Exp $
+ * @version $Id: RuntimeServices.java,v 1.4 2002/01/03 12:40:23 geirm Exp $
*/
public interface RuntimeServices
{
@@ -424,8 +424,8 @@
public Introspector getIntrospector();
/*
- * Return the current application context
+ * Return the specified applcation attribute
*/
- public Object getApplicationContext();
+ public Object getApplicationAttribute( Object key );
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>