001 /**
002 * Copyright 2010-2013 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.kuali.common.jdbc.supplier;
017
018 import org.kuali.common.jdbc.SqlReader;
019
020 /**
021 * Simple builder that creates a SqlLocationSupplier for a location
022 *
023 * @author andrewlubbers
024 * @deprecated
025 */
026 @Deprecated
027 public class SqlExtensionSupplierBuilder implements LocationExtensionSupplierBuilder {
028
029 private final static String DEFAULT_EXTENSION = "sql";
030
031 String extension = DEFAULT_EXTENSION;
032 String encoding;
033 SqlReader sqlReader;
034
035 @Override
036 public String getExtension() {
037 return extension;
038 }
039
040 public void setExtension(String extension) {
041 this.extension = extension;
042 }
043
044 @Override
045 public LocationSupplier buildSupplier(String location) {
046 SqlLocationSupplier supplier = new SqlLocationSupplier(location);
047
048 // set optional properties. These have well-defined defaults in SqlLocationSupplier, but may be overridden
049 if (encoding != null) {
050 supplier.setEncoding(encoding);
051 }
052
053 if (sqlReader != null) {
054 supplier.setReader(sqlReader);
055 }
056
057 return supplier;
058 }
059
060 public String getEncoding() {
061 return encoding;
062 }
063
064 public void setEncoding(String encoding) {
065 this.encoding = encoding;
066 }
067
068 public SqlReader getSqlReader() {
069 return sqlReader;
070 }
071
072 public void setSqlReader(SqlReader sqlReader) {
073 this.sqlReader = sqlReader;
074 }
075 }