
com.alanbuttars.commons.config.ConfigurationDirectoryImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of commons-config Show documentation
Show all versions of commons-config Show documentation
Commons Config is an API which provides elegant interaction with configuration files.
The newest version!
/*
* Copyright (C) Alan Buttars
*
* 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 com.alanbuttars.commons.config;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import com.alanbuttars.commons.config.event.DirectoryFileEvent;
import com.alanbuttars.commons.config.event.FileEvent;
import com.alanbuttars.commons.config.eventbus.EventBus;
/**
* {@link Configuration} implementation used for directories. Instances of this class maintain a mapping of the relative
* file path to the directory, like so:
*
*
* EventBus eventBus = new EventBusSyncImpl();
* Watch watch = Watch.config().withEventBus(eventBus);
*
* // watches the directory specified in the master YAML under the 'clients' file entry
* ConfigurationDirectoryImpl config = watch.directory("clients");
*
* // grabs watchedDirectory/apple.properties
* File appleFile = config.getValue().get("apple.properties");
*
* // grabs watchedDirectory/google.properties
* File googleFile = config.getValue().get("google.properties");
*
* // grabs watchedDirectory/paypal/venmo.properties
* File venmoFile = config.getValue().get("paypal/venmo.properties");
*
* // grabs watchedDirectory/paypal/braintree.properties
* File braintreeFile = config.getValue().get("paypal/braintree.properties");
*
*
* @author Alan Buttars
*
*/
public class ConfigurationDirectoryImpl extends ConfigurationAbstractImpl
© 2015 - 2025 Weber Informatics LLC | Privacy Policy