KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sape > carbon > services > sqldataloader > total > SqlBeanDataLoaderConfiguration


1 /*
2  * The contents of this file are subject to the Sapient Public License
3  * Version 1.0 (the "License"); you may not use this file except in compliance
4  * with the License. You may obtain a copy of the License at
5  * http://carbon.sf.net/License.html.
6  *
7  * Software distributed under the License is distributed on an "AS IS" basis,
8  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
9  * the specific language governing rights and limitations under the License.
10  *
11  * The Original Code is The Carbon Component Framework.
12  *
13  * The Initial Developer of the Original Code is Sapient Corporation
14  *
15  * Copyright (C) 2003 Sapient Corporation. All Rights Reserved.
16  */

17
18 package org.sape.carbon.services.sqldataloader.total;
19
20 import java.util.HashMap JavaDoc;
21 import java.util.Map JavaDoc;
22
23 import org.sape.carbon.core.component.ComponentConfiguration;
24 import org.sape.carbon.services.sql.connection.ConnectionFactory;
25
26 /**
27  * Configuration interface used by SqlBeanDataLoader
28  *
29  * Copyright 2003 Sapient
30  * @since carbon 2.1
31  * @author Akash Tayal, May 2003
32  * @version $Revision: 1.1 $($Author: ghinkl $ / $Date: 2003/09/30 02:08:19 $)
33  */

34 public interface SqlBeanDataLoaderConfiguration extends
35     ComponentConfiguration {
36
37     /**
38      * DataLoadQuery defines the query to retreive the data to be cached
39      *
40      * @return the query to retreive the data for the cache
41      */

42     String JavaDoc getDataLoadQuery();
43
44     /**
45      * Sets the SQL query to retreive the data to be cached
46      *
47      * @param dataLoadQuery to load data
48      */

49     void setDataLoadQuery(String JavaDoc dataLoadQuery);
50
51     /**
52      * KeyColumn defines the name of the column acting as the key for the
53      * accessing specific values in the map stored in cache
54      *
55      * @return the name of column acting as key for map
56      */

57     String JavaDoc getKeyColumn();
58
59     /**
60      * Sets the column name acting as the key for accessing values from the
61      * map
62      *
63      * @param keyColumn name acting as the key of the map
64      */

65     void setKeyColumn(String JavaDoc keyColumn);
66
67     /**
68      * ConnectionFactory defines the reference to ConnectionFactory component
69      *
70      * @return reference to ConnectionFactory component
71      */

72     ConnectionFactory getConnectionFactory();
73
74     /**
75      * Sets the reference to ConnectionFactory componenent
76      *
77      * @param connectionFactory to ConnectionFactory component
78      */

79     void setConnectionFactory(ConnectionFactory connectionFactory);
80
81     /**
82      * BeanClass defines the bean representing the value attribute in the map
83      * This class must have a public default constructor and
84      * must provide a setter for each attribute defined in BeanAttribute
85      *
86      * @return the class for storing the cache data
87      */

88     Class JavaDoc getBeanClass();
89
90     /**
91      * Sets the Javabean that will store the data retreived from database.
92      * The value attribute of map stored in cache returns this bean.
93      * This class must have a public default constructor and
94      * must provide a setter for each attribute defined in BeanAttribute
95      *
96      * @param beanClass name the of JavaBean storing the data from database
97      */

98     void setBeanClass(Class JavaDoc beanClass);
99
100     /** Providing default value to Map type */
101     Class JavaDoc MapType = HashMap JavaDoc.class;
102
103     /**
104      * Accessor for Map implementation type. This implementation
105      * will drive the type of holding map used for the cache.
106      * If no value provided the default is configured as
107      * <code>java.util.HashMap</code>
108      *
109      * @return the map type of cache
110      */

111     Class JavaDoc getMapType();
112
113     /**
114      * Sets the map implementation type used to store the cache
115      *
116      * @param mapType fully qualified map implementation class name
117      */

118     void setMapType(Class JavaDoc mapType);
119
120     /**
121      * Accessor for comparator implementation class. If not specified,
122      * the default implementation provided by map implementation
123      * specified in MapType atribute will be used.
124      *
125      * @return the comparator implementation
126      */

127     Class JavaDoc getComparator();
128
129     /**
130      * Sets the class name for comparator implementation
131      *
132      * @param comparator class name specifying the comparator implementation to be used
133      */

134     void setComparator(Class JavaDoc comparator);
135
136     // Bean specific properties
137

138     /**
139      * Map of beanAttribute contains key as the DB column name and value as the
140      * bean property name. This defines the mapping between Db columns and
141      * bean attributes. The keys of this map must match the name of DB columns
142      * (case sensitive) returned from the ResultSet obtained by executing the
143      * dataload query and the values in the map must have respective setters
144      * defined in the BeanClass.
145      *
146      * @return the map of bean attributes and respective Db columns
147      */

148     Map JavaDoc getBeanAttribute();
149
150     /**
151      * Accessor for the bean attribute name for the specified Db column
152      *
153      * @param key Db column
154      * @return the specific bean attrbiute for the Db column
155      */

156     String JavaDoc getBeanAttribute(String JavaDoc key);
157
158     /**
159      * Sets the bean attribute name for the specified Db column
160      *
161      * @param key Db column
162      * @param value bean attribute
163      */

164     void setBeanAttribute(String JavaDoc key, String JavaDoc value);
165
166     /**
167      * Sets the map containing Db column to bean attribute mapping
168      * The keys of this map must match the name of DB columns
169      * (case sensitive) returned from the ResultSet obtained by executing the
170      * dataload query and the values in the map must have respective setters
171      * defined in the BeanClass.
172      *
173      * @param newMap mapping of Db column to bean attribute
174      */

175     void setBeanAttribute(Map JavaDoc newMap);
176 }
Popular Tags