1 23 package org.enhydra.xml.xmlc.taskdef; 24 25 import java.io.File ; 26 27 28 34 public abstract class XmlcUtils { 35 36 39 public static final String DEFAULT_OPTIONS_FILETYPE = ".xmlc"; 40 41 44 public static final String DEFAULT_OPTIONS_FILENAME = "options" + DEFAULT_OPTIONS_FILETYPE; 45 46 50 public static final String DEFAULT_UTILS_CLASS_KEY = "xmlcutils.classname"; 51 52 56 public static final String DEFAULT_UTILS_CLASS_NAME = DefaultXmlcUtilsImpl.class.getName(); 57 58 59 63 protected XmlcUtils() {} 64 65 69 80 public abstract String [] getOptionFiles(File theDirectory); 81 82 96 public abstract String [] getOptionFiles(File theDirectory, String theOptionsFileName); 97 98 112 public abstract String [] getOptionFiles(File theDirectory, String [] theOptionsFileNames); 113 114 128 public abstract String [] getOptionFiles(File [] theDirectories, String theOptionsFileName); 129 130 144 public abstract String [] getOptionFiles(File [] theDirectories, String [] theOptionsFileNames); 145 146 176 public abstract String buildFullBaseFileName(String thePackageName, 177 String thePackageDir, 178 String theBaseFileName); 179 180 191 public abstract String buildClassName(String theFullBaseFileName, 192 String theModifier); 193 194 205 public static XmlcUtils create() { 206 XmlcUtils retVal = null; 207 String defaultUtilsClassName = System.getProperty(DEFAULT_UTILS_CLASS_KEY, DEFAULT_UTILS_CLASS_NAME); 208 try { 209 Class classObj = Class.forName(defaultUtilsClassName, true, XmlcUtils.class.getClassLoader()); 210 if (XmlcUtils.class.isAssignableFrom(classObj)) { 211 retVal = (XmlcUtils)classObj.newInstance(); 212 } else { 213 System.out.println ("WARNING: A \"" + defaultUtilsClassName + 217 "\" object is not an instance of a \""+ 218 XmlcUtils.class.getName() + "\" object."); 219 } 220 } catch (Exception e) { 221 System.out.println("WARNING: Could not instantiate class [" + defaultUtilsClassName + "]."+e); 223 } 224 if (null == retVal) retVal = new DefaultXmlcUtilsImpl(); 225 return retVal; 226 } 227 228 } 229 | Popular Tags |