KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > portal > setup > impl > CMSSetupImpl


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;
10
11
12 import org.jboss.portal.setup.dl.DataLoaderConfig;
13
14 import org.jboss.portal.setup.PortalSetupException;
15 import org.jboss.portal.setup.CmsSetupException;
16 import org.jboss.portal.setup.SetupService;
17 import org.jboss.portal.setup.impl.dl.cmsloader.CmsDataLoader;
18 import org.jboss.portal.setup.config.CmsAccessConfig;
19
20 import org.jboss.portal.common.util.XML;
21 import org.jboss.util.StringPropertyReplacer;
22 import org.w3c.dom.Element JavaDoc;
23 import org.w3c.dom.Document JavaDoc;
24 import org.apache.log4j.Logger;
25 import org.xml.sax.SAXException JavaDoc;
26
27 import javax.xml.parsers.DocumentBuilder JavaDoc;
28 import javax.xml.parsers.ParserConfigurationException JavaDoc;
29 import java.util.List JavaDoc;
30 import java.util.ArrayList JavaDoc;
31 import java.util.Iterator JavaDoc;
32 import java.io.InputStream JavaDoc;
33 import java.io.IOException JavaDoc;
34
35 /**
36  * @author <a HREF="mailto:palber@novell.com">Polina Alber</a>
37  * Date: Apr 26, 2005; Time: 8:15:07 PM
38  * @jmx.mbean
39  * @jboss.xmbean
40  * @since JBoss portal 2.0
41  * Class org.jboss.portal.setup.impl.CMSSetupImpl
42  */

43 public class CMSSetupImpl extends SetupServiceImpl implements SetupService
44 {
45
46    private CmsAccessConfig m_cmsAccessConfig;
47
48    
49    public CMSSetupImpl()
50    {
51       super();
52       DEFAULT_DATA_URI = "org/jboss/portal/setup/impl/dl/cmsloader/portal-cms-dl.xml";
53    }
54    /**
55     * @return Cms access configuration
56     */

57    public CmsAccessConfig getCmsAccessConfig()
58    {
59       return m_cmsAccessConfig;
60    }
61
62    /**
63     * @param config a CMSAccessConfig
64     * @jmx.managed-attribute
65     */

66    public void setCmsAccessConfig(CmsAccessConfig config) throws CmsSetupException
67    {
68       m_cmsAccessConfig = (CmsAccessConfig)config.getConfiguration();
69    }
70
71
72
73    public void initializeLoaders() throws PortalSetupException
74    {
75       m_dataLoader = new CmsDataLoader();
76       ((CmsDataLoader)m_dataLoader).setCmsAccessConfig(m_cmsAccessConfig);
77       m_dataLoader.setDataLoaderConfiguration(getDataLoaderConfig());
78       parseDataLoacation();
79    }
80
81    public void load() throws PortalSetupException
82    {
83        if (!m_dataLoader.checkDataInitialized())
84       {
85          loadData();
86       }
87       else
88       {
89          if (m_log.isInfoEnabled())
90          {
91             m_log.info("CMS content have been initilized before!");
92          }
93       }
94    }
95
96    public void clearLoaders() throws PortalSetupException
97    {
98       if(null != m_dataLoader) {
99          m_dataLoader.destroy();
100       }
101    }
102
103
104 }
105
Popular Tags