1 9 package org.jboss.portal.setup.impl.dl; 10 11 import org.jboss.portal.setup.dl.DataLoader; 12 import org.jboss.portal.setup.dl.DataLoaderConfig; 13 import org.jboss.portal.setup.PortalSetupException; 14 import org.jboss.portal.setup.PortalSetupConstants; 15 import org.jboss.portal.setup.impl.config.ConfigurationImpl; 16 import org.jboss.portal.common.util.XML; 17 import org.w3c.dom.Element ; 18 19 20 import java.util.List ; 21 import java.util.ArrayList ; 22 23 29 public abstract class DataLoaderBase extends ConfigurationImpl implements DataLoader, PortalSetupConstants 30 { 31 private DataLoaderConfig m_config = null; 32 33 36 public DataLoaderConfig getDataLoaderConfiguration() 37 { 38 return m_config; 39 } 40 41 44 public void setDataLoaderConfiguration(DataLoaderConfig config) throws PortalSetupException 45 { 46 m_config = (DataLoaderConfig)config.getConfiguration(); 47 } 48 49 52 public boolean loadData(Element action) throws PortalSetupException 53 { 54 boolean retVal = false; 55 if (null != action) 56 { 57 58 List statementsList = new ArrayList (); 59 List statements = XML.getChildren(action, STATEMENT); 60 if (statements != null) 61 { 62 statementsList = new ArrayList (); 63 for (int i = 0; i < statements.size(); i++) 64 { 65 statementsList.add(parseStatement((Element )statements.get(i))); 66 } 67 retVal = executeStatements(statementsList); 68 69 } 70 } 71 return retVal; 72 } 73 74 79 protected abstract StatementMetaData parseStatement(Element stmtElmt) throws PortalSetupException; 80 81 82 87 protected abstract boolean executeStatements(List stmtList) throws PortalSetupException; 88 89 } 90 | Popular Tags |