001 package org.apache.fulcrum.yaafi.framework.container;
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
023 import org.apache.avalon.framework.configuration.ConfigurationException;
024 import org.apache.avalon.framework.service.ServiceException;
025 import org.apache.fulcrum.yaafi.framework.role.RoleEntry;
026
027 /**
028 * Interface for managing the lifecycle of services. It provides
029 * methods to get
030 *
031 * <ul>
032 * <li>metadata about the service components</li>
033 * <li>reconfiguring a single service</li>
034 * <li>decommissioning a signle service</li>
035 * </ul>
036 *
037 * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
038 */
039
040 public interface ServiceLifecycleManager
041 {
042 /**
043 * Get a RoleEntryImpl for a given service
044 *
045 * @param name the name of the service component
046 * @return the RoleEntryImpl
047 * @throws ServiceException the service was not found
048 */
049 RoleEntry getRoleEntry( String name )
050 throws ServiceException;
051
052 /**
053 * Get a list of all RoleEntries.
054 *
055 * @return a list of RoleEntries
056 */
057 RoleEntry[] getRoleEntries();
058
059 /**
060 * Reconfigures a set of services by calling Suspendable.suspend(),
061 * Reconfigurable.reconfigure() and Suspendable.resume().
062 *
063 * @param names the set of services to be reconfigured
064 * @exception ServiceException one of the service was not found
065 * @throws ConfigurationException the reconfiguration failed
066 */
067 void reconfigure( String[] names )
068 throws ServiceException, ConfigurationException;
069
070 /**
071 * Decommision the given service by calling Startable.stop()
072 * and Disposable.dispose().
073 *
074 * The state of the service component is the same as using lazy
075 * initialization. Therefore a new service instance will be created
076 * if the service is reused again. If you are keeping an instance
077 * of the service you are out of luck.
078 *
079 * @param name the name of the service
080 * @exception ServiceException the service was not found
081 */
082 void decommision( String name )
083 throws ServiceException;
084 }