View Javadoc

1   /*
2   MadCaching is a Tile Caching solution
3   Copyright (C) 2005  Mac Vu
4   
5   This program is free software; you can redistribute it and/or
6   modify it under the terms of the GNU General Public License
7   as published by the Free Software Foundation; either version 2
8   of the License, or (at your option) any later version.
9   
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  GNU General Public License for more details.
14  
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18   */
19  package com.macvu.tiles;
20  
21  import org.apache.struts.tiles.ComponentDefinition;
22  import com.macvu.tiles.xmlDefinition.XmlCacheDefinition;
23  
24  public class CacheComponentDefinition extends ComponentDefinition {
25      CacheInformation cacheInformation;
26      protected String inherit;
27  
28      /*
29          Currently there is only 2 types of process types:  XSL and JSP.
30          XSL - is the transformation file.
31          JSP - is the normal JSP  file.
32          */
33      protected String processType;
34  
35      public CacheComponentDefinition() {
36          super();
37      }
38  
39      public CacheComponentDefinition(XmlCacheDefinition xmlCacheDefinition) {
40          super(xmlCacheDefinition);
41          cacheInformation = new CacheInformation(xmlCacheDefinition.getCacheInformation());
42          cacheInformation.setParent(this);
43          inherit = xmlCacheDefinition.getExtends();
44      }
45  
46      public String getProcessType() {
47          return processType;
48      }
49  
50      public void setProcessType(String processType) {
51          this.processType = processType;
52      }
53  
54      public CacheInformation getCacheInformation() {
55          return cacheInformation;
56      }
57  
58      public void setCacheInformation(CacheInformation cacheInformation) {
59          this.cacheInformation = cacheInformation;
60          cacheInformation.setParent(this);
61      }
62  
63      /***
64       * Set extends.
65       *
66       * @param name Name of the extended definition.
67       */
68      public void setExtends(String name) {
69          inherit = name;
70      }
71  
72      /***
73       * Get extends.
74       *
75       * @return Name of the extended definition.
76       */
77      public String getExtends() {
78          return inherit;
79      }
80  
81      /***
82       * Get extends flag.
83       */
84      public boolean isExtending() {
85          return inherit != null;
86      }
87  
88      public String toString() {
89          return "{name=" + name +
90                  ", path=" + path +
91                  ", role=" + role +
92                  ", controller=" + controller +
93                  ", controllerType=" + controllerType +
94                  ", controllerInstance=" + getControllerInstance() +
95                  ", attributes=" + attributes +
96                  ", cacheAttributes=" + cacheInformation + "}\n";
97      }
98  }