KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > velocity > context > InternalHousekeepingContext


1 package org.apache.velocity.context;
2
3 /*
4  * Copyright 2001,2004 The Apache Software Foundation.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18
19 import org.apache.velocity.util.introspection.IntrospectionCacheData;
20
21 import org.apache.velocity.runtime.resource.Resource;
22
23 /**
24  * interface to encapsulate the 'stuff' for internal operation of velocity.
25  * We use the context as a thread-safe storage : we take advantage of the
26  * fact that it's a visitor of sorts to all nodes (that matter) of the
27  * AST during init() and render().
28  *
29  * Currently, it carries the template name for namespace
30  * support, as well as node-local context data introspection caching.
31  *
32  * @author <a HREF="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
33  * @author <a HREF="mailto:Christoph.Reck@dlr.de">Christoph Reck</a>
34  * @version $Id: InternalHousekeepingContext.java,v 1.6.12.1 2004/03/03 23:22:54 geirm Exp $
35  */

36 interface InternalHousekeepingContext
37 {
38     /**
39      * set the current template name on top of stack
40      *
41      * @param s current template name
42      */

43     void pushCurrentTemplateName( String JavaDoc s );
44
45     /**
46      * remove the current template name from stack
47      */

48     void popCurrentTemplateName();
49     
50     /**
51      * get the current template name
52      *
53      * @return String current template name
54      */

55     String JavaDoc getCurrentTemplateName();
56
57     /**
58      * Returns the template name stack in form of an array.
59      *
60      * @return Object[] with the template name stack contents.
61      */

62     Object JavaDoc[] getTemplateNameStack();
63
64     /**
65      * returns an IntrospectionCache Data (@see IntrospectionCacheData)
66      * object if exists for the key
67      *
68      * @param key key to find in cache
69      * @return cache object
70      */

71     IntrospectionCacheData icacheGet( Object JavaDoc key );
72     
73     /**
74      * places an IntrospectionCache Data (@see IntrospectionCacheData)
75      * element in the cache for specified key
76      *
77      * @param key key
78      * @param o IntrospectionCacheData object to place in cache
79      */

80     void icachePut( Object JavaDoc key, IntrospectionCacheData o );
81
82     /**
83      * temporary fix to enable #include() to figure out
84      * current encoding.
85      *
86      */

87     Resource getCurrentResource();
88     void setCurrentResource( Resource r );
89     
90     
91 }
92
Popular Tags