1 17 package org.alfresco.config.source; 18 19 import java.io.BufferedInputStream ; 20 import java.io.FileInputStream ; 21 import java.io.IOException ; 22 import java.io.InputStream ; 23 import java.util.Collections ; 24 import java.util.List ; 25 26 import org.apache.commons.logging.Log; 27 import org.apache.commons.logging.LogFactory; 28 29 34 public class FileConfigSource extends BaseConfigSource 35 { 36 private static Log logger = LogFactory.getLog(FileConfigSource.class); 37 38 45 public FileConfigSource(String filename) 46 { 47 this(Collections.singletonList(filename)); 48 } 49 50 54 public FileConfigSource(List <String > sourceStrings) 55 { 56 super(sourceStrings); 57 } 58 59 65 protected InputStream getInputStream(String sourceString) 66 { 67 InputStream is = null; 68 69 try 70 { 71 is = new BufferedInputStream (new FileInputStream (sourceString)); 72 } 73 catch (IOException ioe) 74 { 75 if (logger.isDebugEnabled()) 76 { 77 logger.debug("Failed to obtain input stream to file: " + sourceString, ioe); 78 } 79 } 80 81 return is; 82 } 83 } 84 | Popular Tags |