1   package org.apache.fulcrum.testcontainer;
2   
3   /*
4    * Copyright 2004 The Apache Software Foundation.
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License")
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
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  }