KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tonbeller > wcf > log > LogTag


1 /*
2  * ====================================================================
3  * This software is subject to the terms of the Common Public License
4  * Agreement, available at the following URL:
5  * http://www.opensource.org/licenses/cpl.html .
6  * Copyright (C) 2003-2004 TONBELLER AG.
7  * All Rights Reserved.
8  * You must accept the terms of that agreement to use this software.
9  * ====================================================================
10  *
11  *
12  */

13 package com.tonbeller.wcf.log;
14
15 import java.net.URL JavaDoc;
16
17 import javax.servlet.jsp.JspException JavaDoc;
18
19 import org.w3c.dom.Document JavaDoc;
20
21 import com.tonbeller.wcf.component.Component;
22 import com.tonbeller.wcf.component.ComponentTag;
23 import com.tonbeller.wcf.controller.RequestContext;
24 import com.tonbeller.wcf.form.FormDocument;
25 import com.tonbeller.wcf.utils.ResourceLocator;
26 import com.tonbeller.wcf.utils.XmlUtils;
27
28 public class LogTag extends ComponentTag {
29
30   String JavaDoc xmlUri;
31   String JavaDoc logDir;
32
33   /**
34    * loads a form from an xml file and registeres it with the controller.
35    */

36   public Component createComponent(RequestContext context) throws JspException JavaDoc {
37     try {
38
39       // parse the form xml
40
URL JavaDoc url =
41         ResourceLocator.getResource(context.getServletContext(), context.getLocale(), xmlUri);
42       Document JavaDoc doc = XmlUtils.parse(url);
43
44       //In replaceI18n(...) wird geprüft, ob "bundle"-Attribut vorhanden
45
FormDocument.replaceI18n(context, doc, null);
46
47       // create the component
48
return new LogForm(id, null, doc, logDir);
49     }
50     catch (Exception JavaDoc e) {
51       throw new JspException JavaDoc(e);
52     }
53   }
54
55   public void setXmlUri(String JavaDoc xmlUri) {
56     this.xmlUri = xmlUri;
57   }
58
59   /**
60    * Sets the logDir.
61    * @param logDir The logDir to set
62    */

63   public void setLogDir(String JavaDoc logDir) {
64     this.logDir = logDir;
65   }
66
67 }
68
Popular Tags