1 4 package com.tc.config.schema.dynamic; 5 6 import org.apache.xmlbeans.XmlObject; 7 8 import com.tc.config.schema.context.ConfigContext; 9 10 import java.io.File ; 11 12 16 public class SubstitutedFileXPathBasedConfigItem extends FileXPathBasedConfigItem { 17 18 public SubstitutedFileXPathBasedConfigItem(ConfigContext context, String xpath, File relativeTo) { 19 super(context, xpath, relativeTo); 20 } 21 22 public SubstitutedFileXPathBasedConfigItem(ConfigContext context, String xpath) { 23 super(context, xpath); 24 } 25 26 protected Object fetchDataFromXmlObject(XmlObject xmlObject) { 27 String theString = (String ) super.fetchDataFromXmlObjectByReflection(xmlObject, "getStringValue"); 28 if (theString == null || theString.trim().length() == 0) return null; 29 String substituted = ParameterSubstituter.substitute(theString); 30 31 File out = new File (substituted); 32 if (relativeTo() != null && !out.isAbsolute()) out = new File (relativeTo(), substituted); 33 return out; 34 } 35 36 } 37 | Popular Tags |