private static InputSource getConfigSource(Class pAppClass) throws DataNotFoundException { URL resource = pAppClass.getResource(CONFIG_FILE_NAME); String resourceFileName = resource.toExternalForm(); File resourceFile = new File(resourceFileName); InputStream configResourceStream = pAppClass.getResourceAsStream(CONFIG_FILE_NAME); if (null == configResourceStream) { throw new DataNotFoundException( "unable to find XML configuration file resource: " + CONFIG_FILE_NAME + " for class: " + pAppClass.getName()); } InputSource inputSource = new InputSource(configResourceStream); if (!resourceFile.exists()) { inputSource.setSystemId(resourceFileName); } return (inputSource); }
// // private methods // private static URL getClassLocation() { // get location of GenerationTarget.class Class<?> thisClass = GenerationTarget.class; URL url = thisClass.getResource(thisClass.getSimpleName() + ".class"); return url; } // end getClassLocation()