KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > portal > setup > impl > dl > dbloader > hibernate > HibernateStatementMetaData


1 /*****************************************
2  * *
3  * JBoss Portal: The OpenSource Portal *
4  * *
5  * Distributable under LGPL license. *
6  * See terms of license at gnu.org. *
7  * *
8  *****************************************/

9 package org.jboss.portal.setup.impl.dl.dbloader.hibernate;
10
11
12 import org.jboss.portal.setup.impl.dl.dbloader.ColumnMetaData;
13 import org.jboss.portal.setup.impl.dl.dbloader.DbStatementMetaData;
14 import org.jboss.portal.setup.impl.dl.dbloader.ValueRowMetaData;
15 import org.jboss.portal.setup.PortalSetupException;
16 import org.jboss.portal.common.util.XML;
17 import org.w3c.dom.Element JavaDoc;
18
19
20 import java.awt.*;
21 import java.util.*;
22
23 /**
24  * @author <a HREF="mailto:palber@novell.com">Polina Alber</a>
25  * Date: Apr 14, 2005; Time: 3:30:33 PM
26  * @since JBoss portal 2.0
27  * Class org.jboss.portal.setup.impl.dl.dbloader.hibernate.HibernateStatementMetaData
28  */

29 public class HibernateStatementMetaData extends DbStatementMetaData
30 {
31    HibernateStatementMetaData(Element JavaDoc config) throws PortalSetupException
32    {
33       super(config);
34    }
35
36    /**
37     * @param column an XML element describing column referenced by a statement
38     * @return a column metadata
39     */

40    protected ColumnMetaData buildColumnMetaData(Element JavaDoc column)
41    {
42       Element JavaDoc name = XML.getUniqueChild(column, "name", true);
43       Element JavaDoc size = XML.getUniqueChild(column, "size", false);
44       Element JavaDoc javaType = XML.getUniqueChild(column, "type", true);
45       ColumnMetaData md = new HibernateColumnMetaData(XML.asString(name),
46          XML.asString(javaType)
47          , null == size ? -1 : Integer.parseInt(XML.asString(size)));
48       return md;
49    }
50
51    protected ValueRowMetaData buildValueRowMetaData(Element JavaDoc row) throws PortalSetupException
52    {
53       String JavaDoc values = XML.asString(row);
54       ValueRowMetaData vrmd = new ValueRowMetaData(values, getColumns());
55       return vrmd;
56    }
57 }
58
Popular Tags