001package org.apache.fulcrum.testcontainer;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 *   http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022import java.io.File;
023
024import org.apache.avalon.framework.activity.Disposable;
025import org.apache.avalon.framework.activity.Initializable;
026import org.apache.avalon.framework.context.Context;
027import org.apache.avalon.framework.context.ContextException;
028import org.apache.avalon.framework.context.Contextualizable;
029import org.apache.avalon.framework.logger.AbstractLogEnabled;
030
031/**
032 * Interface of the component
033 *
034 * @author <a href="mailto:quintonm@bellsouth.net">Quinton McCombs</a>
035 * @version $Id$
036 */
037public class SimpleComponentImpl
038        extends AbstractLogEnabled
039        implements Initializable, Disposable, SimpleComponent,
040            Contextualizable
041{
042    private String appRoot;
043    private String appRoot2;
044
045    public void initialize() throws Exception
046    {
047    }
048
049    public void dispose()
050    {
051    }
052
053    public void test()
054    {
055        setupLogger(this, "SimpleComponent");
056        getLogger().debug("test");
057        getLogger().debug("ComponentAppRoot = "+appRoot);
058        getLogger().debug("ComponentAppRoot2 = "+appRoot2);
059    }
060
061    public void contextualize(Context context) throws ContextException
062    {
063        appRoot = (String) context.get("componentAppRoot");
064        if (context.get("urn:avalon:home") instanceof File){
065            appRoot2 = (context.get("urn:avalon:home")).toString();
066        }
067        else {
068            appRoot2 = (String)context.get("urn:avalon:home");
069        }
070    }
071
072    /**
073     * @return Returns the appRoot.
074     */
075    public String getAppRoot()
076    {
077        return appRoot;
078    }
079
080    /**
081     * @return Returns the appRoot2.
082     */
083    public String getAppRoot2()
084    {
085        return appRoot2;
086    }
087
088}