All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jitsi.impl.configuration.ConfigurationStore Maven / Gradle / Ivy

Go to download

libjitsi is an advanced Java media library for secure real-time audio/video communication

The newest version!
/*
 * Copyright @ 2015 Atlassian Pty Ltd
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.jitsi.impl.configuration;

import java.io.*;

import org.jitsi.util.xml.*;

/**
 * Abstracts the runtime storage, the serialization and deserialization of the
 * configuration properties and their associated values of
 * ConfigurationServiceImpl and the format of the configuration file.
 * Thus ConfigurationServiceImpl can operate regardless of these
 * specifics and takes care of asking the VetoableChangeListeners,
 * converting the property values to the requested types and notifying the
 * PropertyChangeListeners.
 *
 * @author Lyubomir Marinov
 */
public interface ConfigurationStore
{

    /**
     * Gets the value in this ConfigurationStore of a property with a
     * specific name.
     *
     * @param name the name of the property to get the value of
     * @return the value in this ConfigurationStore of the property
     * with the specified name; null if the property with the specified
     * name does not have an association with a value in this
     * ConfigurationStore
     */
    public Object getProperty(String name);

    /**
     * Gets the names of the properties which have values associated in this
     * ConfigurationStore.
     *
     * @return an array of Strings which specify the names of the
     * properties that have values associated in this
     * ConfigurationStore; an empty array if this instance contains no
     * property values
     */
    public String[] getPropertyNames();

    /**
     * Determines whether a specific name stands for a system property.
     *
     * @param name the name of a property which is to be determined whether it
     * is a system property
     * @return true if the specified name stands for a system property;
     * false, otherwise
     */
    public boolean isSystemProperty(String name);

    /**
     * Removes all property name-value associations currently present in this
     * ConfigurationStore and deserializes new property name-value
     * associations from a specific File which presumably is in the
     * format represented by this instance.
     *
     * @param file the File to be read and to deserialize new property
     * name-value associations from into this instance
     * @throws IOException if there is an input error while reading from the
     * specified file
     * @throws XMLException if parsing the contents of the specified
     * file fails
     */
    public void reloadConfiguration(File file)
        throws IOException,
               XMLException;

    /**
     * Removes the value association in this ConfigurationStore of the
     * property with a specific name. If the property with the specified name is
     * not associated with a value in this ConfigurationStore, does
     * nothing.
     *
     * @param name the name of the property which is to have its value
     * association in this ConfigurationStore removed
     */
    public void removeProperty(String name);

    /**
     * Sets the value of a non-system property with a specific name to a
     * specific value in this ConfigurationStore.
     *
     * @param name the name of the non-system property to be set to the
     * specified value in this ConfigurationStore
     * @param value the value to be assigned to the non-system property with the
     * specified name in this ConfigurationStore
     */
    public void setNonSystemProperty(String name, Object value);

    /**
     * Sets a property with a specific name to be considered a system property
     * by the ConfigurationStore.
     *
     * @param name the name of the property to be set as a system property in
     * this ConfigurationStore
     */
    public void setSystemProperty(String name);

    /**
     * Stores/serializes the property name-value associations currently present
     * in this ConfigurationStore into a specific OutputStream
     * in the format represented by this instance.
     *
     * @param out the OutputStream to receive the serialized form of
     * the property name-value associations currently present in this
     * ConfigurationStore
     * @throws IOException if there is an output error while storing the
     * properties managed by this ConfigurationStore into the specified
     * file
     */
    public void storeConfiguration(OutputStream out)
        throws IOException;
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy