001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.commons.configuration2.builder; 018 019import javax.sql.DataSource; 020 021/** 022 * <p> 023 * Definition of a properties interface for parameters of a database configuration. 024 * </p> 025 * <p> 026 * The properties defined by this interface are used to configure a {@code DatabaseConfiguration} instance. They mainly 027 * specify the database tables containing configuration properties. Note that many properties are mandatory; they must 028 * be provided, otherwise the builder for database configurations throws an exception. 029 * </p> 030 * <p> 031 * <strong>Important note:</strong> This interface is not intended to be implemented by client code! It defines a set of 032 * available properties and may be extended even in minor releases. 033 * </p> 034 * 035 * @since 2.0 036 * @param <T> the type of the result of all set methods for method chaining 037 */ 038public interface DatabaseBuilderProperties<T> { 039 /** 040 * Enables or disable auto commit mode. If enabled, the database configuration instance performs a commit after each 041 * database update. 042 * 043 * @param f the value of the auto commit flag 044 * @return a reference to this object for method chaining 045 */ 046 T setAutoCommit(boolean f); 047 048 /** 049 * Sets the name of this configuration instance. This property is needed if a single database table contains the data of 050 * multiple configuration instances. Then SQL statements generated by the configuration contain an additional constraint 051 * filtering the configuration name column for this name. 052 * 053 * @param name the name of this configuration instance 054 * @return a reference to this object for method chaining 055 */ 056 T setConfigurationName(String name); 057 058 /** 059 * Sets the name of the table column containing the configuration name. This property is needed if a single database 060 * table contains the data of multiple configuration instances. Then this column is used as discriminator to select a 061 * specific configuration instance. 062 * 063 * @param name the column name 064 * @return a reference to this method for method chaining 065 */ 066 T setConfigurationNameColumn(String name); 067 068 /** 069 * Sets the data source for the database configuration. All database connections are obtained from this data source. 070 * This is a mandatory property. 071 * 072 * @param src the data source for the database configuration 073 * @return a reference to this object for method chaining 074 */ 075 T setDataSource(DataSource src); 076 077 /** 078 * Sets the name of the table column containing configuration keys. This is a mandatory property. 079 * 080 * @param name the column name 081 * @return a reference to this object for method chaining 082 */ 083 T setKeyColumn(String name); 084 085 /** 086 * Sets the name of the table containing configuration data. Database configuration will access this database table. 087 * This is a mandatory property. 088 * 089 * @param name the name of the table with configuration data 090 * @return a reference to this object for method chaining 091 */ 092 T setTable(String name); 093 094 /** 095 * Sets the name of the table column containing the configuration property value. This is a mandatory property. 096 * 097 * @param name the column name 098 * @return a reference to this object for method chaining 099 */ 100 T setValueColumn(String name); 101}