001    /**
002     *  Licensed to the Apache Software Foundation (ASF) under one or more
003     *  contributor license agreements.  See the NOTICE file distributed with
004     *  this work for additional information regarding copyright ownership.
005     *  The ASF licenses this file to You under the Apache License, Version 2.0
006     *  (the "License"); you may not use this file except in compliance with
007     *  the License.  You may obtain a copy of the License at
008     *
009     *     http://www.apache.org/licenses/LICENSE-2.0
010     *
011     *  Unless required by applicable law or agreed to in writing, software
012     *  distributed under the License is distributed on an "AS IS" BASIS,
013     *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     *  See the License for the specific language governing permissions and
015     *  limitations under the License.
016     */
017    package org.apache.geronimo.kernel.config;
018    
019    import org.apache.geronimo.kernel.repository.Artifact;
020    
021    import java.io.IOException;
022    import java.util.List;
023    
024    /**
025     *
026     *
027     *
028     * @version $Rev: 706640 $ $Date: 2008-10-21 14:44:05 +0000 (Tue, 21 Oct 2008) $
029     */
030    public interface PersistentConfigurationList {
031    
032        static final String PERSISTENT_CONFIGURATION_LIST = "PersistentConfigurationList";
033        
034        boolean isKernelFullyStarted();
035    
036        void setKernelFullyStarted(boolean kernelFullyStarted);
037    
038        void save() throws IOException;
039    
040        List<Artifact> restore() throws IOException;
041    
042        /**
043         * Adds a configuration to the list, but does not mark it as started.
044         */
045        void addConfiguration(Artifact configName);
046    
047        /**
048         * Indicates that the configuration should be started when the server is
049         * started.  The configuration should have been previously added with
050         * addConfiguration.
051         */
052        void startConfiguration(Artifact configName);
053    
054        /**
055         * Indicates that the configuration should not be started when the
056         * server is started.  The configuration should have been previously added
057         * with addConfiguration (and presumably started with startConfiguration).
058         */
059        void stopConfiguration(Artifact configName);
060    
061        /**
062         * Removes all record of the specified configuration from the configuration
063         * list.  This is somewhat unusual -- normally you want to remember the
064         * settings in case the configuration is deployed again later.
065         */
066        void removeConfiguration(Artifact configName);
067    
068        /**
069         * Gets all configurations in the list matching the specified query,
070         * whether they are marked at starting or not.
071         * 
072         * @param query The artifact to search for, normally not fully resolved
073         *              so there may be multiple matches or matches that are not
074         *              exactly equal to the argument.
075         *
076         * @return The matching artifacts that have data in the config list.
077         */
078        Artifact[] getListedConfigurations(Artifact query);
079    
080        /**
081         * Migrates settings from an old version of a configuration to a newer
082         * version of the configuration.  Used when an updated version is deployed
083         * with a newer version number in the name, but the settings used for the
084         * previous version should be carried forward.
085         *
086         * @param oldName        The name that the existing settings are under
087         * @param newName        The name to move the settings to
088         * @param configuration  The configuration itself, which can be used to
089         *                       verify that all the settings are still valid as
090         *                       they are migrated.
091         */
092        void migrateConfiguration(Artifact oldName, Artifact newName, Configuration configuration);
093    
094        /**
095         * This method checks if there are any custom gbean attributes in the configuration.
096         *
097         * @param configName Name of the configuration
098         * @return true if the configuration contains any custom gbean attributes
099         */
100        boolean hasGBeanAttributes(Artifact configName);
101    }