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.PrintStream; 19 20 /** 21 * Interface to connect to a database to persist properties and to allow the 22 * management of the database infrastructure. That is 23 * <ol> 24 * <li>Create and drop the properties table.</li> 25 * <li>Fill table with properties initially.</li> 26 * </ol> 27 */ 28 public interface PropertiesDataSourceManager extends 29 PropertiesDataSourceDescriptor 30 { 31 // ********************************* Fields ********************************* 32 33 // --- constants ------------------------------------------------------------ 34 35 // ****************************** Initializer ******************************* 36 37 // ****************************** Inner Classes ***************************** 38 39 // ********************************* Methods ******************************** 40 41 // --- get&set -------------------------------------------------------------- 42 43 /** 44 * Returns a reference to the data source proxy used to connect to the data 45 * source. 46 * 47 * @return a reference to the data source proxy used to connect to the data 48 * source. 49 */ 50 DataSourceProxy getDataSourceProxy(); 51 52 // --- business ------------------------------------------------------------- 53 54 /** 55 * Creates the configuration on the referenced data source. 56 * 57 * @throws DataSourceException on any problem accessing the data source. 58 */ 59 void createConfigTable() throws DataSourceException; 60 61 /** 62 * Drops the configuration table from the referenced data source. 63 * 64 * @throws DataSourceException on any problem accessing the data source. 65 */ 66 void dropConfigTable() throws DataSourceException; 67 68 /** 69 * Prints the contents of the data source to the given stream. Useful for 70 * debugging. 71 * 72 * @param out the stream to write to. 73 * @throws NullPointerException if {@code out} is <code>null</code>. 74 * @throws DataSourceException on any problem accessing the data source. 75 */ 76 void print(final PrintStream out) throws NullPointerException, 77 DataSourceException; 78 79 // --- object basics -------------------------------------------------------- 80 81 }