1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.commons.jelly.test.impl;
17
18 import org.apache.commons.jelly.JellyTagException;
19 import org.apache.commons.jelly.TagSupport;
20 import org.apache.commons.jelly.XMLOutput;
21 import org.apache.commons.jelly.util.ClassLoaderUtils;
22 import org.apache.commons.logging.Log;
23 import org.apache.commons.logging.LogFactory;
24
25 /***
26 * Simple Test Tag
27 *
28 * @author <a href="mailto:vinayc@apache.org">Vinay Chandran</a>
29 */
30 public class DummyTag extends TagSupport {
31 /*** The Log to which logging calls will be made. */
32 private static final Log log = LogFactory.getLog(DummyTag.class);
33 /*** A test class to be loaded by the Tag*/
34 private String m_classToBeLoaded = null;
35
36 /***
37 *
38 * @see org.apache.commons.jelly.Tag#doTag(XMLOutput)
39 * @see org.apache.commons.jelly.tags.core.JellyTag
40 */
41 public void doTag(XMLOutput output) throws JellyTagException {
42 if (log.isDebugEnabled())
43 log.debug("********Executing DummyTag Body*********");
44 if (m_classToBeLoaded != null) {
45 try {
46 ClassLoaderUtils.loadClass(m_classToBeLoaded, getClass());
47 if (log.isDebugEnabled())
48 log.debug("Class[" + m_classToBeLoaded + "] FOUND");
49 }
50 catch (ClassNotFoundException cnfe) {
51 if (log.isWarnEnabled())
52 log.warn("Class[" + m_classToBeLoaded + "] NOT FOUND");
53 }
54
55 }
56 invokeBody(output);
57 }
58
59 /***
60 * A Test Variable(Used for testing the TagLibraryClassloader)
61 */
62 public void setLoadClass(String extraClass) {
63 m_classToBeLoaded = extraClass;
64 }
65
66 }