1 package org.apache.fulcrum.yaafi.framework.component; 2 3 /* 4 * Licensed to the Apache Software Foundation (ASF) under one 5 * or more contributor license agreements. See the NOTICE file 6 * distributed with this work for additional information 7 * regarding copyright ownership. The ASF licenses this file 8 * to you under the Apache License, Version 2.0 (the 9 * "License"); you may not use this file except in compliance 10 * with the License. You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, 15 * software distributed under the License is distributed on an 16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 * KIND, either express or implied. See the License for the 18 * specific language governing permissions and limitations 19 * under the License. 20 */ 21 22 import org.apache.avalon.framework.configuration.Configuration; 23 import org.apache.avalon.framework.context.Context; 24 import org.apache.avalon.framework.logger.Logger; 25 import org.apache.avalon.framework.parameters.Parameters; 26 import org.apache.avalon.framework.service.ServiceManager; 27 28 /** 29 * This class implements the lifecycle contract of a service component 30 * instance. 31 * 32 * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a> 33 */ 34 35 public interface ServiceComponentLifecycle 36 { 37 /** 38 * Loads the implementaion class. 39 * 40 * @param classLoader the classloader to use for loading the implementation class 41 * @throws ClassNotFoundException loading of the class failed 42 */ 43 void loadImplemtationClass(ClassLoader classLoader) throws ClassNotFoundException; 44 45 /** 46 * Incarnates a service component instance. 47 * @throws Exception the operation failed 48 */ 49 void incarnate() throws Exception; 50 51 /** 52 * Reconfigures a service component instance 53 * @throws Exception the operation failed 54 */ 55 void reconfigure() throws Exception; 56 57 /** 58 * Decommisions a service component instance. 59 * @throws Exception the operation failed 60 */ 61 void decommision() throws Exception; 62 63 /** 64 * Dispose a service component instance. 65 */ 66 void dispose(); 67 68 /** 69 * @return Returns the instance of the singleton 70 * @throws Exception the operation failed 71 */ 72 Object getInstance() throws Exception; 73 74 /** 75 * Sets the logger to be used by this component. 76 * 77 * @param logger The logger to set 78 */ 79 void setLogger(Logger logger); 80 81 /** 82 * Sets the ServiceManager to be used by this component. 83 * 84 * @param serviceManager The serviceManager to set. 85 */ 86 void setServiceManager(ServiceManager serviceManager); 87 88 /** 89 * Sets the Context to be used by this component. 90 * 91 * @param context The context to set. 92 */ 93 void setContext(Context context); 94 95 /** 96 * Sets the Configuration to be used by this component. 97 * 98 * @param configuration The configuration to set. 99 */ 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 }