001: /*
002: * The contents of this file are subject to the Sapient Public License
003: * Version 1.0 (the "License"); you may not use this file except in compliance
004: * with the License. You may obtain a copy of the License at
005: * http://carbon.sf.net/License.html.
006: *
007: * Software distributed under the License is distributed on an "AS IS" basis,
008: * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
009: * the specific language governing rights and limitations under the License.
010: *
011: * The Original Code is The Carbon Component Framework.
012: *
013: * The Initial Developer of the Original Code is Sapient Corporation
014: *
015: * Copyright (C) 2003 Sapient Corporation. All Rights Reserved.
016: */
017:
018: package org.sape.carbon.services.sqldataloader.total;
019:
020: import java.util.HashMap;
021: import java.util.Map;
022:
023: import org.sape.carbon.core.component.ComponentConfiguration;
024: import org.sape.carbon.services.sql.connection.ConnectionFactory;
025:
026: /**
027: * Configuration interface used by SqlBeanDataLoader
028: *
029: * Copyright 2003 Sapient
030: * @since carbon 2.1
031: * @author Akash Tayal, May 2003
032: * @version $Revision: 1.1 $($Author: ghinkl $ / $Date: 2003/09/30 02:08:19 $)
033: */
034: public interface SqlBeanDataLoaderConfiguration extends
035: ComponentConfiguration {
036:
037: /**
038: * DataLoadQuery defines the query to retreive the data to be cached
039: *
040: * @return the query to retreive the data for the cache
041: */
042: String getDataLoadQuery();
043:
044: /**
045: * Sets the SQL query to retreive the data to be cached
046: *
047: * @param dataLoadQuery to load data
048: */
049: void setDataLoadQuery(String dataLoadQuery);
050:
051: /**
052: * KeyColumn defines the name of the column acting as the key for the
053: * accessing specific values in the map stored in cache
054: *
055: * @return the name of column acting as key for map
056: */
057: String getKeyColumn();
058:
059: /**
060: * Sets the column name acting as the key for accessing values from the
061: * map
062: *
063: * @param keyColumn name acting as the key of the map
064: */
065: void setKeyColumn(String keyColumn);
066:
067: /**
068: * ConnectionFactory defines the reference to ConnectionFactory component
069: *
070: * @return reference to ConnectionFactory component
071: */
072: ConnectionFactory getConnectionFactory();
073:
074: /**
075: * Sets the reference to ConnectionFactory componenent
076: *
077: * @param connectionFactory to ConnectionFactory component
078: */
079: void setConnectionFactory(ConnectionFactory connectionFactory);
080:
081: /**
082: * BeanClass defines the bean representing the value attribute in the map
083: * This class must have a public default constructor and
084: * must provide a setter for each attribute defined in BeanAttribute
085: *
086: * @return the class for storing the cache data
087: */
088: Class getBeanClass();
089:
090: /**
091: * Sets the Javabean that will store the data retreived from database.
092: * The value attribute of map stored in cache returns this bean.
093: * This class must have a public default constructor and
094: * must provide a setter for each attribute defined in BeanAttribute
095: *
096: * @param beanClass name the of JavaBean storing the data from database
097: */
098: void setBeanClass(Class beanClass);
099:
100: /** Providing default value to Map type */
101: Class MapType = HashMap.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 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 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 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 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 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 getBeanAttribute(String 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 key, String 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 newMap);
176: }
|