com.cedarsolutions.server.service.IPropertiesService Maven / Gradle / Ivy
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* C E D A R
* S O L U T I O N S "Software done right."
* S O F T W A R E
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Copyright (c) 2015 Kenneth J. Pronovici.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the Apache License, Version 2.0.
* See LICENSE for more information about the licensing terms.
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Author : Kenneth J. Pronovici
* Language : Java 6
* Project : Common Java Functionality
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
package com.cedarsolutions.server.service;
import java.util.List;
import java.util.Properties;
import com.cedarsolutions.exception.InvalidDataException;
/**
* Service wrapper around PropertiesUtils.
* @author Kenneth J. Pronovici
*/
public interface IPropertiesService {
/**
* Load Java properties from disk.
* @param paths Paths of the Java properties files to process, in the desired order
* @return Properties object filled in with all properties from the passed-in files.
* @throws InvalidDataException If properties could not be loaded.
*/
Properties loadProperties(String... paths) throws InvalidDataException;
/**
* Get a list of existing prefixes which match the passed-in prefix one level down.
*
*
* For instance, if prefix is "database" and the properties object contains properties
* like "database.production.x.y" and "database.integration.x.y.", the returned list
* will contain "database.production" and "database.integration".
*
*
* @param properties Properties to look in
* @param parentPrefix Parent property prefix to use as starting point
*
* @return List of prefixes that match the passed-in prefix, always non-null.
*/
List getMatchingPrefixes(Properties properties, String parentPrefix);
/**
* Get a list of children which have a given parent prefix.
*
*
* We only find children that are one level down, i.e. if prefix is "yy.file" then we
* will find "yy.file.A", "yy.file.B", but not "yy.file.B.C".
*
*
* @param properties Properties to look in
* @param parentPrefix Parent property prefix to use as starting point
*
* @return List of children that match the passed-in parent prefix, always non-null.
*/
List getMatchingChildren(Properties properties, String parentPrefix);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy