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   * @author <a href="mailto:epugh@opensourceconnections.com">Eric Pugh</a>
33   * @version $Id: AlternativeComponentImpl.java 223140 2004-11-01 13:29:25Z epugh $
34   */
35  public class AlternativeComponentImpl
36          extends AbstractLogEnabled
37          implements Initializable, Disposable, SimpleComponent,
38              Contextualizable
39  {
40      private String appRoot;
41      private String appRoot2;
42  
43      public void initialize() throws Exception
44      {
45      }
46  
47      public void dispose()
48      {
49      }
50  
51      public void test()
52      {
53          setupLogger(this, "AlternativeSimpleComponent");
54          getLogger().debug("test");
55          getLogger().debug("ComponentAppRoot = "+appRoot);
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      /**
70       * @return Returns the appRoot.
71       */
72      public String getAppRoot()
73      {
74          return appRoot;
75      }
76  
77      /**
78       * @return Returns the appRoot2.
79       */
80      public String getAppRoot2()
81      {
82          return appRoot2;
83      }
84  
85  }