1 package org.apache.fulcrum.testcontainer;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 import java.io.File;
20
21 import org.apache.avalon.framework.logger.AbstractLogEnabled;
22 import org.apache.avalon.framework.activity.Initializable;
23 import org.apache.avalon.framework.activity.Disposable;
24 import org.apache.avalon.framework.context.Contextualizable;
25 import org.apache.avalon.framework.context.Context;
26 import org.apache.avalon.framework.context.ContextException;
27
28 /**
29 * Interface of the component
30 *
31 * @author <a href="mailto:quintonm@bellsouth.net">Quinton McCombs</a>
32 * @version $Id: SimpleComponentImpl.java 223140 2004-11-01 13:29:25Z epugh $
33 */
34 public class SimpleComponentImpl
35 extends AbstractLogEnabled
36 implements Initializable, Disposable, SimpleComponent,
37 Contextualizable
38 {
39 private String appRoot;
40 private String appRoot2;
41
42 public void initialize() throws Exception
43 {
44 }
45
46 public void dispose()
47 {
48 }
49
50 public void test()
51 {
52 setupLogger(this, "SimpleComponent");
53 getLogger().debug("test");
54 getLogger().debug("ComponentAppRoot = "+appRoot);
55 getLogger().debug("ComponentAppRoot2 = "+appRoot2);
56 }
57
58 public void contextualize(Context context) throws ContextException
59 {
60 appRoot = (String) context.get("componentAppRoot");
61 if (context.get("urn:avalon:home") instanceof File){
62 appRoot2 = ((File)(context.get("urn:avalon:home"))).toString();
63 }
64 else {
65 appRoot2 = (String)context.get("urn:avalon:home");
66 }
67 }
68 /**
69 * @return Returns the appRoot.
70 */
71 public String getAppRoot()
72 {
73 return appRoot;
74 }
75
76 /**
77 * @return Returns the appRoot2.
78 */
79 public String getAppRoot2()
80 {
81 return appRoot2;
82 }
83
84 }