1 /* 2 * Copyright 2012-2013 smartics, Kronseder & Reiner GmbH 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package de.smartics.properties.spi.config.ds; 17 18 import java.io.Serializable; 19 20 import de.smartics.properties.api.config.domain.Property; 21 22 /** 23 * Interface to access property information from a data source. 24 */ 25 public interface PropertiesDataSourceAccessor extends Serializable 26 { 27 // ********************************* Fields ********************************* 28 29 // --- constants ------------------------------------------------------------ 30 31 // ****************************** Initializer ******************************* 32 33 // ****************************** Inner Classes ***************************** 34 35 // ********************************* Methods ******************************** 36 37 // --- get&set -------------------------------------------------------------- 38 39 /** 40 * Reads the property with the given name from the data source. 41 * 42 * @param name the name of the property to fetch. 43 * @return the property or <code>null</code>, if no such property is stored in 44 * the data source. 45 * @throws IllegalArgumentException if {@code name} is blank; 46 * @throws DataSourceException on any problem accessing the data source. 47 */ 48 Property getProperty(String name) throws IllegalArgumentException, 49 DataSourceException; 50 51 /** 52 * Sets the property to the given name and value. 53 * 54 * @param name the name of the property to set. 55 * @param value the value of the property. 56 * @throws IllegalArgumentException if {@code name} is blank; 57 * @throws DataSourceException on any problem accessing the data source. 58 */ 59 void setProperty(String name, String value) throws IllegalArgumentException, 60 DataSourceException; 61 62 /** 63 * Deletes the property from the store. 64 * 65 * @param name the name of the property to delete. 66 * @throws IllegalArgumentException if {@code name} is blank; 67 * @throws DataSourceException on any problem accessing the data source. 68 */ 69 void deleteProperty(String name) throws IllegalArgumentException, 70 DataSourceException; 71 72 // --- business ------------------------------------------------------------- 73 74 // --- object basics -------------------------------------------------------- 75 76 }