Commits

tbrugz committed 4c45dde

util: ParametrizedProperties: @includes directive may point to resources

Comments (0)

Files changed (2)

src/tbrugz/sqldump/datadump/SQLQueries.java

 	static final String PROP_QUERIES_ADD_TO_MODEL = PROP_QUERIES+".addtomodel";
 	static final String PROP_QUERIES_SCHEMA = PROP_QUERIES+".schemaname";
 
-	static final String DEFAULT_QUERIES_SCHEMA = "SQLQUERY";
+	static final String DEFAULT_QUERIES_SCHEMA = "SQLQUERY"; //XXX: default schema to be current schema for dumping?
 	
 	static Log log = LogFactory.getLog(SQLQueries.class);
 	

src/tbrugz/sqldump/util/ParametrizedProperties.java

 		if(includes!=null) {
 			String[] files = includes.split(",");
 			for(String f: files) {
-				File ff = new File(f.trim());
+				f = f.trim();
+				File ff = new File(f);
 				if(loadedPropFiles.containsKey(ff)) {
 					if(loadedPropFiles.get(ff)) {
 						log.warn("already loaded prop file: "+ff.getAbsolutePath());
 					this.load(new FileInputStream(ff));
 					log.info("loaded @include: "+ff.getAbsolutePath());
 				} catch (IOException e) {
-					log.warn("error loading @include '"+ff.getAbsolutePath()+"': "+e.getMessage());
-					log.debug("error loading @include: "+ff.getAbsolutePath(), e);
+					InputStream is = ParametrizedProperties.class.getResourceAsStream(f);
+					try {
+						this.load(is);
+						log.info("loaded @include resource: "+f);
+					}
+					catch(IOException e2) {
+						log.warn("error loading @include '"+ff.getAbsolutePath()+"': "+e.getMessage());
+						log.debug("error loading @include: "+ff.getAbsolutePath(), e);
+					}
 				}
 			}
 		}