001    /*****************************************************************************
002     * Copyright (C) PicoContainer Organization. All rights reserved.            *
003     * ------------------------------------------------------------------------- *
004     * The software in this package is published under the terms of the BSD      *
005     * style license a copy of which has been included with this distribution in *
006     * the LICENSE.txt file.                                                     *
007     *                                                                           *
008     *****************************************************************************/
009    package org.picocontainer.script.testmodel;
010    
011    import org.picocontainer.Disposable;
012    import org.picocontainer.Startable;
013    
014    /**
015     * An abstract component and three dependancies used for testing.
016     */
017    public abstract class X implements Startable, Disposable {
018    
019        public static String componentRecorder = "";
020    
021        public static void reset() {
022            componentRecorder = "";
023        }
024    
025        public void start() {
026            componentRecorder += "<" + code();
027        }
028    
029        public void stop() {
030            componentRecorder += code() + ">";
031        }
032    
033        public void dispose() {
034            componentRecorder += "!" + code();
035        }
036    
037        private String code() {
038            String name = getClass().getName();
039            return name.substring(name.lastIndexOf('.') + 1, name.length());
040        }
041    
042    }