01: /*
02: * This file is part of PFIXCORE.
03: *
04: * PFIXCORE is free software; you can redistribute it and/or modify
05: * it under the terms of the GNU Lesser General Public License as published by
06: * the Free Software Foundation; either version 2 of the License, or
07: * (at your option) any later version.
08: *
09: * PFIXCORE is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12: * GNU Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public License
15: * along with PFIXCORE; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: *
18: */
19:
20: package de.schlund.pfixxml.targets;
21:
22: import javax.xml.transform.TransformerException;
23:
24: import org.w3c.dom.Document;
25:
26: import de.schlund.pfixxml.resources.FileResource;
27: import de.schlund.pfixxml.resources.ResourceUtil;
28: import de.schlund.pfixxml.util.Xml;
29:
30: /**
31: * XMLLeafTarget.java
32: *
33: *
34: * Created: Mon Jul 23 21:53:06 2001
35: *
36: * @author <a href="mailto:jtl@schlund.de">Jens Lautenbacher</a>
37: *
38: *
39: */
40:
41: public class XMLLeafTarget extends LeafTarget {
42:
43: public XMLLeafTarget(TargetType type, TargetGenerator gen,
44: String key, Themes themes) throws Exception {
45: this .type = type;
46: this .generator = gen;
47: this .targetkey = key;
48: this .themes = themes;
49: FileResource targetpath = ResourceUtil
50: .getFileResourceFromDocroot(key);
51: this .sharedleaf = SharedLeafFactory.getInstance()
52: .getSharedLeaf(generator.getXsltVersion(), targetpath);
53: // Create empty manager to avoid null pointer exceptions
54: this .auxdepmanager = new AuxDependencyManager(this );
55: }
56:
57: /**
58: * @see de.schlund.pfixxml.targets.TargetImpl#getValueFromDiscCache()
59: */
60: protected Object getValueFromDiscCache()
61: throws TransformerException {
62: FileResource thefile = ResourceUtil
63: .getFileResourceFromDocroot(getTargetKey());
64: if (thefile.exists() && thefile.isFile()) {
65: return Xml.parse(generator.getXsltVersion(), thefile);
66: } else {
67: return null;
68: }
69: }
70:
71: public Document getDOM() throws TargetGenerationException {
72: return (Document) this .getValue();
73: }
74:
75: }// XMLLeafTarget
|