KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sape > carbon > services > sqldataloader > mru > SqlBeanMapMRUDataLoaderConfiguration


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.mru;
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 SqlBeanMRUDataLoader.
28  *
29  * Copyright 2003 Sapient
30  * @since carbon 2.0
31  * @author Akash Tayal, May 2003
32  * @version $Revision: 1.1 $($Author: ghinkl $ / $Date: 2003/09/30 02:08:19 $)
33  */

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

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

48     void setDataLoadQuery(String JavaDoc dataLoadQuery);
49
50     /**
51      * ConnectionFactory defines the reference to ConnectionFactory component
52      *
53      * @return reference to ConnectionFactory component
54      */

55     ConnectionFactory getConnectionFactory();
56
57     /**
58      * Sets the reference to ConnectionFactory componenent
59      *
60      * @param reference to ConnectionFactory component
61      */

62     void setConnectionFactory(ConnectionFactory connectionFactory);
63
64     // Configuration for implementation of map that acts as the value stored
65
// in cache
66

67     /** Providing default value to Map type. */
68     Class JavaDoc ValueMapType = HashMap JavaDoc.class;
69
70     /**
71      * Accessor for Map implementation type. This implementation
72      * will drive the type of map stored as value in the cache.
73      * If no implementation configured, the default is configured as
74      * <code>java.util.HashMap</code>
75      *
76      * @return the map type of cache
77      */

78     Class JavaDoc getValueMapType();
79
80     /**
81      * Sets the map implementation type used to store the cache
82      *
83      * @param fully qualified map implementation class name
84      */

85     void setValueMapType(Class JavaDoc valueMapType);
86
87     /**
88      * Accessor for comparator implementation class. If not specified,
89      * the default implementation provided by map implementation
90      * specified in ValueMapType atribute will be used.
91      *
92      * @return the comparator implementation
93      */

94     Class JavaDoc getComparator();
95
96     /**
97      * Sets the class name for comparator implementation
98      *
99      * @param class name specifying the comparator implementation to be used
100      */

101     void setComparator(Class JavaDoc comparator);
102
103
104     /**
105      * KeyColumn defines the name of the column acting as the key for the
106      * accessing specific values in the ValueMap stored in cache
107      *
108      * @return the name of column acting as key for map
109      */

110     String JavaDoc getKeyColumn();
111
112     /**
113      * Sets the column name acting as the key for accessing values from the
114      * map
115      *
116      * @param column name acting as the key of the map
117      */

118     void setKeyColumn(String JavaDoc keyColumn);
119
120     /**
121      * BeanClass defines the bean representing the value attribute in the
122      * ValueMap. This class must have a public default constructor and
123      * must provide a setter for each attribute defined in BeanAttribute
124      *
125      * @return the class for storing the cache data
126      */

127     Class JavaDoc getBeanClass();
128
129     /**
130      * Sets the Javabean that will store the data retreived from database.
131      * The value attribute of ValueMap stored in cache returns this bean.
132      * This class must have a public default constructor and
133      * must provide a setter for each attribute defined in BeanAttribute
134      *
135      * @param name of JavaBean storing the data from database
136      */

137     void setBeanClass(Class JavaDoc beanClass);
138
139     // Bean specific properties
140

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

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

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

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

178     void setBeanAttribute(Map JavaDoc newMap);
179 }
Popular Tags