001    package org.apache.fulcrum.yaafi.framework.component;
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    
022    import org.apache.avalon.framework.configuration.Configuration;
023    import org.apache.avalon.framework.context.Context;
024    import org.apache.avalon.framework.logger.Logger;
025    import org.apache.avalon.framework.parameters.Parameters;
026    import org.apache.avalon.framework.service.ServiceManager;
027    
028    /**
029     * This class implements the lifecycle contract of a service component
030     * instance.
031     *
032     * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
033     */
034    
035    public interface ServiceComponentLifecycle
036    {
037        /**
038         * Loads the implementaion class.
039         *
040         * @param classLoader the classloader to use for loading the implementation class
041         * @throws ClassNotFoundException loading of the class failed
042         */
043        void loadImplemtationClass(ClassLoader classLoader) throws ClassNotFoundException;
044    
045        /**
046         * Incarnates a service component instance.
047         * @throws Exception the operation failed
048         */
049        void incarnate() throws Exception;
050    
051        /**
052         * Reconfigures a service component instance
053         * @throws Exception the operation failed
054         */
055        void reconfigure() throws Exception;
056    
057        /**
058         * Decommisions a service component instance.
059         * @throws Exception the operation failed
060         */
061        void decommision() throws Exception;
062    
063        /**
064         * Dispose a service component instance.
065         */
066        void dispose();
067    
068        /**
069         * @return Returns the instance of the singleton
070         * @throws Exception the operation failed
071         */
072        Object getInstance() throws Exception;
073    
074        /**
075         * Sets the logger to be used by this component.
076         *
077         * @param logger The logger to set
078         */
079        void setLogger(Logger logger);
080    
081        /**
082         * Sets the ServiceManager to be used by this component.
083         *
084         * @param serviceManager The serviceManager to set.
085         */
086        void setServiceManager(ServiceManager serviceManager);
087    
088        /**
089         * Sets the Context to be used by this component.
090         *
091         * @param context The context to set.
092         */
093        void setContext(Context context);
094    
095        /**
096         * Sets the Configuration to be used by this component.
097         *
098         * @param configuration The configuration to set.
099         */
100        void setConfiguration(Configuration configuration);
101    
102        /**
103         * Sets the Parameters to be used by this component.
104         *
105         * @param parameters The paramaters to set.
106         */
107        void setParameters(Parameters parameters);
108    }