1 9 package org.jboss.portal.setup.impl.sl; 10 11 import org.jboss.portal.setup.sl.SchemaLoaderConfig; 12 import org.jboss.portal.setup.sl.SchemaLoadType; 13 import org.jboss.portal.setup.PortalSetupException; 14 import org.jboss.portal.setup.impl.config.ConfigurationImpl; 15 import org.jboss.portal.setup.config.Configuration; 16 17 import java.util.List ; 18 import java.util.ArrayList ; 19 import java.util.Iterator ; 20 import java.util.Arrays ; 21 import java.net.MalformedURLException ; 22 import java.net.URL ; 23 import java.io.FileNotFoundException ; 24 25 31 public abstract class SchemaLoaderConfiBase extends ConfigurationImpl implements SchemaLoaderConfig 32 { 33 private List m_schemaURIs = new ArrayList (); 34 private List m_filePatterns = new ArrayList (); 35 private SchemaLoadType m_type = null; 36 37 protected SchemaLoaderConfiBase(String [] filePatterns) 38 { 39 m_filePatterns.addAll(Arrays.asList(filePatterns)); 40 41 } 42 43 47 public SchemaLoadType getSchemaLoadType() 48 { 49 return m_type; 50 } 51 52 56 public void setSchemaLoadType(String type) throws PortalSetupException 57 { 58 m_type = SchemaLoadType.parseString(type); 59 } 60 61 62 66 public List getSchemaLoadURIs() 67 { 68 return m_schemaURIs; 69 } 70 71 77 public void addSchemaLoadURI(String schemaFileURI) throws PortalSetupException 78 { 79 ClassLoader cl = Thread.currentThread().getContextClassLoader(); 81 URL resource = cl.getResource(schemaFileURI); 82 if (null == resource) 83 { 84 throw new PortalSetupException("Specified resource '" + schemaFileURI + "' cannot be found!"); 85 } 86 m_schemaURIs.add(schemaFileURI); 87 } 88 89 95 public void setSchemaLoadURIs(List schemaFilesURIs) throws PortalSetupException 96 { 97 if (schemaFilesURIs != null) 98 { 99 Iterator iter = schemaFilesURIs.iterator(); 100 while (iter.hasNext()) 101 { 102 String uri = (String )iter.next(); 103 this.addSchemaLoadURI(uri); 104 } 105 } 106 } 107 108 112 public List getSchemaFilePattern() 113 { 114 return m_filePatterns; 115 } 116 117 } 118 | Popular Tags |