KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > portal > setup > impl > sl > dbloader > hibernate > HibernateSchemaLoaderConfigImpl


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.sl.dbloader.hibernate;
10
11 import org.jboss.portal.setup.sl.HibernateSchemaLoaderConfig;
12 import org.jboss.portal.setup.sl.SchemaLoadType;
13 import org.jboss.portal.setup.impl.sl.SchemaLoaderConfiBase;
14 import org.jboss.portal.setup.config.HibernateConfig;
15 import org.jboss.portal.setup.PortalSetupException;
16
17 import java.util.List JavaDoc;
18 import java.util.ArrayList JavaDoc;
19 import java.util.regex.Pattern JavaDoc;
20
21 /**
22  * @author <a HREF="mailto:palber@novell.com">Polina Alber</a>
23  * Date: Apr 13, 2005; Time: 1:59:32 PM
24  * @jmx.mbean
25  * @jboss.xmbean
26  * @since JBoss portal 2.0
27  * Class org.jboss.portal.setup.impl.sl.dbloader.hibernate.HibernateSchemaLoaderConfigImpl
28  */

29 public class HibernateSchemaLoaderConfigImpl extends SchemaLoaderConfiBase implements HibernateSchemaLoaderConfig
30 {
31    private static final String JavaDoc hbm = "*.hbm.xml";
32
33    private String JavaDoc m_schemaQueryStr = null;
34    boolean m_useSchemaExport = true;
35    private HibernateConfig m_hibernateConfig = null;
36    private String JavaDoc m_schemaLoaderClassName = null;
37
38    public HibernateSchemaLoaderConfigImpl()
39    {
40       super(new String JavaDoc[]{hbm});
41    }
42
43    /**
44     * @param classname a name of a class that implements <code>SchemaLoader</code>
45     * @jmx.managed-attribute
46     */

47    public void setSchemaLoaderClass(String JavaDoc classname)
48    {
49       m_schemaLoaderClassName = classname;
50    }
51
52    /**
53     * @return a name of a class that implements <code>SchemaLoader</code>
54     * @jmx.managed-attribute
55     */

56    public String JavaDoc getSchemaLoaderClass()
57    {
58       return m_schemaLoaderClassName;
59    }
60
61
62    /**
63     * @return a rule of schema loading; supported rules are new only, always (reloads every time),
64     * update
65     * @jmx.managed-attribute
66     */

67    public String JavaDoc getSchemaLoadRule()
68    {
69       SchemaLoadType type = getSchemaLoadType();
70       return type == null ? null : type.toString();
71    }
72
73    /**
74     * @param rule of schema loading; supported rules are new only, always (reloads every time),
75     * update
76     * @jmx.managed-attribute
77     */

78    public void setSchemaLoadRule(String JavaDoc rule) throws PortalSetupException
79    {
80       setSchemaLoadType(rule);
81    }
82
83
84    /**
85     * @return a schema validation query string
86     * @jmx.managed-attribute
87     */

88    public String JavaDoc getSchemaQueryString()
89    {
90       return m_schemaQueryStr;
91    }
92
93    /**
94     * @param queryStr a schema validation query string
95     * @jmx.managed-attribute
96     */

97    public void setSchemaQueryString(String JavaDoc queryStr)
98    {
99       m_schemaQueryStr = queryStr;
100    }
101
102
103    /**
104     * @return hibernate configuration
105     * @jmx.managed-attribute
106     */

107    public HibernateConfig getHibernateConfig()
108    {
109       return m_hibernateConfig;
110    }
111
112    /**
113     * @param hbConfig a hibernate configuration
114     * @jmx.managed-attribute
115     */

116    public void setHibernateConfig(HibernateConfig hbConfig)
117    {
118       m_hibernateConfig = (HibernateConfig)hbConfig.getConfiguration();
119    }
120
121    /**
122     * @return a boolean flag; when 'true' means that <code>SchemaExport</code> for schema loading
123     */

124    public boolean getUseHibernateSchemaExport()
125    {
126       return m_useSchemaExport;
127    }
128
129 }
130
Popular Tags