View Javadoc

1   /**
2    * Copyright 2010-2013 The Kuali Foundation
3    *
4    * Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php
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 org.kuali.common.jdbc.supplier;
17  
18  import org.kuali.common.jdbc.SqlReader;
19  
20  /**
21   * Simple builder that creates a SqlLocationSupplier for a location
22   * 
23   * @author andrewlubbers
24   * @deprecated
25   */
26  @Deprecated
27  public class SqlExtensionSupplierBuilder implements LocationExtensionSupplierBuilder {
28  
29  	private final static String DEFAULT_EXTENSION = "sql";
30  
31  	String extension = DEFAULT_EXTENSION;
32  	String encoding;
33  	SqlReader sqlReader;
34  
35  	@Override
36  	public String getExtension() {
37  		return extension;
38  	}
39  
40  	public void setExtension(String extension) {
41  		this.extension = extension;
42  	}
43  
44  	@Override
45  	public LocationSupplier buildSupplier(String location) {
46  		SqlLocationSupplier supplier = new SqlLocationSupplier(location);
47  
48  		// set optional properties. These have well-defined defaults in SqlLocationSupplier, but may be overridden
49  		if (encoding != null) {
50  			supplier.setEncoding(encoding);
51  		}
52  
53  		if (sqlReader != null) {
54  			supplier.setReader(sqlReader);
55  		}
56  
57  		return supplier;
58  	}
59  
60  	public String getEncoding() {
61  		return encoding;
62  	}
63  
64  	public void setEncoding(String encoding) {
65  		this.encoding = encoding;
66  	}
67  
68  	public SqlReader getSqlReader() {
69  		return sqlReader;
70  	}
71  
72  	public void setSqlReader(SqlReader sqlReader) {
73  		this.sqlReader = sqlReader;
74  	}
75  }