com.wassilak.configuration_service.service.Service Maven / Gradle / Ivy
Show all versions of configuration-service Show documentation
package com.wassilak.configuration_service.service;
import com.wassilak.configuration_service.configuration.Configuration;
import java.io.File;
/**
* The Service interface defines the behavior of the Service object, which
* provides users the ability to store and retrieve Configuration objects.
*
* Copyright (C) 2014 John Wassilak ([email protected])
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*/
public interface Service {
/**
* The loadConfiguration method attempts to read a Configuration object
* from the given file location. The file is expected to be encrypted with
* the given encryption password.
*
* @param fileLocation The file location of the persisted
* Configuration object.
* @param encryptionPassword The password to use when decrypting the file.
* @return The Configuration object stored at the given file location.
* @throws ServiceException If an exception occurs while trying to read a
* Configuration object from the given file
* location.
*/
public Configuration loadConfiguration(File fileLocation,
String encryptionPassword)
throws ServiceException;
/**
* The persistConfiguration method attempts to store the given
* Configuration object at the given file location. The method uses the
* given encryption password to encrypt the file.
*
* @param fileLocation The file location to persist the Configuration
* object to.
* @param configuration The Configuration object to persist.
* @param encryptionPassword The password to use when encrypting the file.
* @throws ServiceException If an exception occurs while trying to persist
* the given Configuration object to the given
* file location.
*/
public void persistConfiguration(File fileLocation,
Configuration configuration,
String encryptionPassword)
throws ServiceException;
}