1 4 package com.opensymphony.webwork.webFlow.collectors; 5 6 import com.opensymphony.util.FileManager; 7 import com.opensymphony.xwork.config.providers.XmlConfigurationProvider; 8 import org.apache.commons.logging.Log; 9 import org.apache.commons.logging.LogFactory; 10 11 import java.io.File ; 12 import java.io.FileInputStream ; 13 import java.io.FileNotFoundException ; 14 import java.io.InputStream ; 15 16 19 public class ArbitraryXMLConfigurationProvider extends XmlConfigurationProvider { 20 21 private static final Log LOG = LogFactory.getLog(ArbitraryXMLConfigurationProvider.class); 22 private String configFileName = "xwork.xml"; 23 private String basePathString = ""; 24 25 public ArbitraryXMLConfigurationProvider() { 26 } 27 28 public ArbitraryXMLConfigurationProvider(String filename) { 29 this.configFileName = filename; 30 this.basePathString = new File (filename).getParent() + "/"; 31 } 32 33 38 protected InputStream getInputStream(String fileName) { 39 InputStream is = null; 40 if (LOG.isDebugEnabled()) 41 LOG.debug("fileName=" + this.basePathString + fileName); 42 try { 43 is = new FileInputStream (this.basePathString + fileName); 44 } catch (FileNotFoundException e) { 45 is = FileManager.loadFile(fileName, this.getClass()); 47 } 48 49 return is; 50 } 51 } | Popular Tags |