1 package org.apache.fulcrum.yaafi.framework.container; 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 23 import org.apache.avalon.framework.configuration.ConfigurationException; 24 import org.apache.avalon.framework.service.ServiceException; 25 import org.apache.fulcrum.yaafi.framework.role.RoleEntry; 26 27 /** 28 * Interface for managing the lifecycle of services. It provides 29 * methods to get 30 * 31 * <ul> 32 * <li>metadata about the service components</li> 33 * <li>reconfiguring a single service</li> 34 * <li>decommissioning a signle service</li> 35 * </ul> 36 * 37 * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a> 38 */ 39 40 public interface ServiceLifecycleManager 41 { 42 /** 43 * Get a RoleEntryImpl for a given service 44 * 45 * @param name the name of the service component 46 * @return the RoleEntryImpl 47 * @throws ServiceException the service was not found 48 */ 49 RoleEntry getRoleEntry( String name ) 50 throws ServiceException; 51 52 /** 53 * Get a list of all RoleEntries. 54 * 55 * @return a list of RoleEntries 56 */ 57 RoleEntry[] getRoleEntries(); 58 59 /** 60 * Reconfigures a set of services by calling Suspendable.suspend(), 61 * Reconfigurable.reconfigure() and Suspendable.resume(). 62 * 63 * @param names the set of services to be reconfigured 64 * @exception ServiceException one of the service was not found 65 * @throws ConfigurationException the reconfiguration failed 66 */ 67 void reconfigure( String[] names ) 68 throws ServiceException, ConfigurationException; 69 70 /** 71 * Decommision the given service by calling Startable.stop() 72 * and Disposable.dispose(). 73 * 74 * The state of the service component is the same as using lazy 75 * initialization. Therefore a new service instance will be created 76 * if the service is reused again. If you are keeping an instance 77 * of the service you are out of luck. 78 * 79 * @param name the name of the service 80 * @exception ServiceException the service was not found 81 */ 82 void decommission( String name ) 83 throws ServiceException; 84 }