001    /*
002     * Copyright 2005-2007 The Kuali Foundation
003     * 
004     * 
005     * Licensed under the Educational Community License, Version 2.0 (the "License");
006     * you may not use this file except in compliance with the License.
007     * You may obtain a copy of the License at
008     * 
009     * http://www.opensource.org/licenses/ecl2.php
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.kuali.rice.core.config;
018    
019    import java.util.Map;
020    
021    /**
022     * A local store for node-specific settings.  The use of the word "Node" here describes an instance of KEW
023     * (running standalone or embedded).  In a clustered environment, it is sometimes useful for individual
024     * nodes within the cluster to have their own settings.  Depending on system configuration this configuration
025     * store may or may not be available for use.  If the node settings store is not availabe then calls to
026     * query or modify the settings should be no-ops.  The availablily can be queried using the isEnabled method.
027     * 
028     * <p>Since Node Settings are runtime-mutable, it is important that implementations of this class be thread-safe.
029     * 
030     * @author Kuali Rice Team (rice.collab@kuali.org)
031     */
032    public interface NodeSettings {
033            
034            /**
035             * Retrieve the value of the setting with the given name.  Will return null if the setting with the
036             * given name does not exist or node settings are not enabled.
037             * 
038             * @return the value of the setting, null if the setting does not exis or node settings are not enabled
039             */
040        public String getSetting(String name);
041        
042        /**
043         * Set the value of the setting with the given name.  Has no effect if node settings are not enabled.
044         */
045        public void setSetting(String name, String value);
046        
047        /**
048         * Remove the given setting from the node settings.  If the setting with the given name does not
049         * exist or node settings are not enabled, then null will be returned.
050         * 
051         * @return return the value of the removed setting, null if the setting does not exist
052         *         or node settings are not enabled 
053         */
054        public String removeSetting(String name);
055        
056        /**
057             * Returns the settings of this node as an immutable Map.  If the node settings store
058             * is not enabled, then an empty Map will be returned.  The Map
059             * returned by the getSettings method is thread-safe.
060             * @return
061             */
062        public Map getSettings();
063        
064        /**
065         * Returns true if node-specific settings are enabled, false otherwise.  In the case that node settings
066         * are not enabled, the various accessor methods will effectively behave as no-ops.
067         * 
068         * @return true if node settings are enabled, false otherwise
069         */
070        public boolean isEnabled();
071        
072    }