geirm 01/04/22 11:18:45
Modified: src/java/org/apache/velocity/context
InternalContextAdapterImpl.java
InternalHousekeepingContext.java
Log:
Added support for carrying the 'current resource', i.e. Template down
through. Needed to allow #include() to do what is currently thought to
be the 'right thing'. Will revisit with an internal context rework.
Revision Changes Path
1.6 +16 -1
jakarta-velocity/src/java/org/apache/velocity/context/InternalContextAdapterImpl.java
Index: InternalContextAdapterImpl.java
===================================================================
RCS file:
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/context/InternalContextAdapterImpl.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- InternalContextAdapterImpl.java 2001/04/20 04:31:29 1.5
+++ InternalContextAdapterImpl.java 2001/04/22 18:18:44 1.6
@@ -58,6 +58,8 @@
import org.apache.velocity.context.EventCartridge;
+import org.apache.velocity.runtime.resource.Resource;
+
/**
* This adapter class is the container for all context types for internal
* use. The AST now uses this class rather than the app-level Context
@@ -86,7 +88,7 @@
*
*
* @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
- * @version $Id: InternalContextAdapterImpl.java,v 1.5 2001/04/20 04:31:29 geirm
Exp $
+ * @version $Id: InternalContextAdapterImpl.java,v 1.6 2001/04/22 18:18:44 geirm
Exp $
*/
public final class InternalContextAdapterImpl implements InternalContextAdapter
{
@@ -96,6 +98,8 @@
/** the ICB we are wrapping. We may need to make one */
InternalHousekeepingContext icb = null;
+ Resource currentResource = null;
+
/**
* CTOR takes a Context and wraps it, delegating all 'data' calls
* to it.
@@ -136,6 +140,17 @@
public EventCartridge getEventCartridge()
{
return icb.getEventCartridge( );
+ }
+
+
+ public void setCurrentResource( Resource r )
+ {
+ currentResource = r;
+ }
+
+ public Resource getCurrentResource()
+ {
+ return currentResource;
}
/* --- InternalContext interface methods --- */
1.5 +18 -1
jakarta-velocity/src/java/org/apache/velocity/context/InternalHousekeepingContext.java
Index: InternalHousekeepingContext.java
===================================================================
RCS file:
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/context/InternalHousekeepingContext.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- InternalHousekeepingContext.java 2001/04/20 04:31:30 1.4
+++ InternalHousekeepingContext.java 2001/04/22 18:18:45 1.5
@@ -58,6 +58,8 @@
import org.apache.velocity.context.EventCartridge;
+import org.apache.velocity.runtime.resource.Resource;
+
/**
* interface to encapsulate the 'stuff' for internal operation of velocity.
* We use the context as a thread-safe storage : we take advantage of the
@@ -69,7 +71,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Christoph Reck</a>
- * @version $Id: InternalHousekeepingContext.java,v 1.4 2001/04/20 04:31:30 geirm
Exp $
+ * @version $Id: InternalHousekeepingContext.java,v 1.5 2001/04/22 18:18:45 geirm
Exp $
*/
interface InternalHousekeepingContext
{
@@ -117,6 +119,21 @@
*/
void icachePut( Object key, IntrospectionCacheData o );
+ /**
+ * interface for the EventCartridge stuff. This will be moved
+ * to a separate interface
+ */
+
EventCartridge attachEventCartridge( EventCartridge ec);
EventCartridge getEventCartridge();
+
+ /**
+ * temporary fix to enable #include() to figure out
+ * current encoding.
+ *
+ */
+ Resource getCurrentResource();
+ void setCurrentResource( Resource r );
+
+
}