1 package org.andromda.core.common;
2
3 import java.io.File;
4 import java.io.IOException;
5
6 /***
7 * An interface for objects responsible for mapping types in the object model to JDBC and
8 * SQL database types.
9 *
10 * <p> The mappings might change based upon the database being used and/or
11 * a set of project based peferences for how to map types to the database. <p>
12 *
13 * @author Matthias Bohlen
14 * @author <A HREF="http://www.amowers.com">Anthony Mowers</A>
15 *
16 */
17 public interface DbMappingTable
18 {
19
20 /***
21 * reads the mapping rules from an XML file.
22 *
23 * @param mappingConfig file for which to read the mapping rules
24 * @throws RepositoryReadException thrown if an error is encountered during parsing
25 * @throws IOException thrown if an IO error occurs while reading the file
26 */
27 public void read(File mappingConfig)
28 throws RepositoryReadException, IOException;
29
30 /***
31 * Returns the JDBC type for the given Java type.
32 *
33 * @param javaType name of the Java type (e.g. "java.util.Date")
34 * @return String name of the JDBC type (e.g. "DATE")
35 */
36 public String getJDBCType(String javaType);
37
38 /***
39 * Returns the SQL type for the fiven Java type.
40 * See your database docs for this syntax.
41 * @param javaType name of the Java type (e.g. "java.math.BigDecimal")
42 * @param sqlFieldLength desired field length in the database table
43 * @return String the complete SQL field syntax (e.g. "DECIMAL(9)")
44 */
45 public String getSQLType(String javaType, String desiredFieldLength);
46
47 }