public static List<URL> getResources(String resourcePath, Class<?> caller) throws IOException { return getResources(resourcePath, caller.getClassLoader()); }
public static List<URL> getResources(String resourcePath, Class<?> caller) throws IOException { return getResources(resourcePath, caller.getClassLoader()); }
public static List<URL> getResources(String resourcePath, Class<?> caller) throws IOException { return getResources(resourcePath, caller.getClassLoader()); }
public static List<Properties> loadDescriptors(String descriptorPath, ClassLoader classLoader) { List<Properties> descriptorFiles = new ArrayList<Properties>(); try { List<URL> resources = ClassUtil.getResources(descriptorPath, classLoader); if(resources.isEmpty()) { throw new IllegalStateException("Failed to locate any model descriptor file by the name '" + descriptorPath + "' on the classpath."); } for(URL resource : resources) { InputStream resStream = resource.openStream(); descriptorFiles.add(loadDescriptor(resStream)); } } catch (IOException e) { throw new IllegalStateException("Unexpected IO Exception when reading Dynamic Namespace Descriptor files from classpath.", e); } return descriptorFiles; }
public static List<Properties> loadDescriptors(String descriptorPath, ClassLoader classLoader) { List<Properties> descriptorFiles = new ArrayList<Properties>(); try { List<URL> resources = ClassUtil.getResources(descriptorPath, classLoader); if(resources.isEmpty()) { throw new IllegalStateException("Failed to locate any model descriptor file by the name '" + descriptorPath + "' on the classpath."); } for(URL resource : resources) { InputStream resStream = resource.openStream(); descriptorFiles.add(loadDescriptor(resStream)); } } catch (IOException e) { throw new IllegalStateException("Unexpected IO Exception when reading Dynamic Namespace Descriptor files from classpath.", e); } return descriptorFiles; }
public static List<Properties> loadDescriptors(String descriptorPath, ClassLoader classLoader) { List<Properties> descriptorFiles = new ArrayList<Properties>(); try { List<URL> resources = ClassUtil.getResources(descriptorPath, classLoader); if(resources.isEmpty()) { throw new IllegalStateException("Failed to locate any model descriptor file by the name '" + descriptorPath + "' on the classpath."); } for(URL resource : resources) { InputStream resStream = resource.openStream(); descriptorFiles.add(loadDescriptor(resStream)); } } catch (IOException e) { throw new IllegalStateException("Unexpected IO Exception when reading Dynamic Namespace Descriptor files from classpath.", e); } return descriptorFiles; }
private static InputStream getMappingModelConfigStream(String urn, String fileName) throws IOException, EDIConfigurationException { List<URL> urnFiles = ClassUtil.getResources(EDI_MAPPING_MODEL_URN, EDIUtils.class); boolean ignoreVersion = false; String modelConfigFile = urnFileString.substring(0, urnFileString.length() - EDI_MAPPING_MODEL_URN.length()) + fileName; List<URL> urlList = ClassUtil.getResources(fileName, EDIUtils.class);
private SchemaResolver() throws IOException { List<URL> urnFiles = ClassUtil.getResources("/fragment.xml", EclipseFragmentXMLValidator.class);
private static InputStream getMappingModelConfigStream(String urn, String fileName) throws IOException, EDIConfigurationException { List<URL> urnFiles = ClassUtil.getResources(EDI_MAPPING_MODEL_URN, EDIUtils.class); boolean ignoreVersion = false; String modelConfigFile = urnFileString.substring(0, urnFileString.length() - EDI_MAPPING_MODEL_URN.length()) + fileName; List<URL> urlList = ClassUtil.getResources(fileName, EDIUtils.class);
private static InputStream getMappingModelConfigStream(String urn, String fileName) throws IOException, EDIConfigurationException { List<URL> urnFiles = ClassUtil.getResources(EDI_MAPPING_MODEL_URN, EDIUtils.class); boolean ignoreVersion = false; String modelConfigFile = urnFileString.substring(0, urnFileString.length() - EDI_MAPPING_MODEL_URN.length()) + fileName; List<URL> urlList = ClassUtil.getResources(fileName, EDIUtils.class);
private SchemaResolver() throws IOException { List<URL> urnFiles = ClassUtil.getResources("/fragment.xml", EclipseFragmentXMLValidator.class);
private SchemaResolver() throws IOException { List<URL> urnFiles = ClassUtil.getResources("/fragment.xml", EclipseFragmentXMLValidator.class);
private static InputStream getMappingModelConfigStream(String urn, String fileName) throws IOException, EDIConfigurationException { List<URL> urnFiles = ClassUtil.getResources(EDI_MAPPING_MODEL_URN, EDIUtils.class); boolean ignoreVersion = false; String modelConfigFile = urnFileString.substring(0, urnFileString.length() - EDI_MAPPING_MODEL_URN.length()) + fileName; List<URL> urlList = ClassUtil.getResources(fileName, EDIUtils.class);
/** * Will try to create a List of classes that are listed * in the passed in file. * The fileName is expected to be found on the classpath. * * @param fileName The name of the file containing the list of classes, * one class name per line. * @param instanceOf The instanceof filter. * @return List<Class<T>> list of the classes contained in the file. */ public static <T> List<Class<T>> getClasses(final String fileName, Class<T> instanceOf) { AssertArgument.isNotNull( fileName, "fileName" ); AssertArgument.isNotNull( instanceOf, "instanceOf" ); long start = System.currentTimeMillis(); List<Class<T>> classes = new ArrayList<Class<T>>(); List<URL> cpURLs; int resCount = 0; try { cpURLs = getResources(fileName, ClassUtil.class); } catch (IOException e) { throw new RuntimeException("Error getting resource URLs for resource : " + fileName, e); } for (URL url : cpURLs) { addClasses(url, instanceOf, classes); resCount++; } logger.debug("Loaded " + classes.size() + " classes from " + resCount + " URLs through class list file " + fileName + ". Process took " + (System.currentTimeMillis() - start) + "ms. Turn on debug logging for more info."); return classes; }
/** * Will try to create a List of classes that are listed * in the passed in file. * The fileName is expected to be found on the classpath. * * @param fileName The name of the file containing the list of classes, * one class name per line. * @param instanceOf The instanceof filter. * @return List<Class<T>> list of the classes contained in the file. */ public static <T> List<Class<T>> getClasses(final String fileName, Class<T> instanceOf) { AssertArgument.isNotNull( fileName, "fileName" ); AssertArgument.isNotNull( instanceOf, "instanceOf" ); long start = System.currentTimeMillis(); List<Class<T>> classes = new ArrayList<Class<T>>(); List<URL> cpURLs; int resCount = 0; try { cpURLs = getResources(fileName, ClassUtil.class); } catch (IOException e) { throw new RuntimeException("Error getting resource URLs for resource : " + fileName, e); } for (URL url : cpURLs) { addClasses(url, instanceOf, classes); resCount++; } logger.debug("Loaded " + classes.size() + " classes from " + resCount + " URLs through class list file " + fileName + ". Process took " + (System.currentTimeMillis() - start) + "ms. Turn on debug logging for more info."); return classes; }
/** * Will try to create a List of classes that are listed * in the passed in file. * The fileName is expected to be found on the classpath. * * @param fileName The name of the file containing the list of classes, * one class name per line. * @param instanceOf The instanceof filter. * @return List<Class<T>> list of the classes contained in the file. */ public static <T> List<Class<T>> getClasses(final String fileName, Class<T> instanceOf) { AssertArgument.isNotNull( fileName, "fileName" ); AssertArgument.isNotNull( instanceOf, "instanceOf" ); long start = System.currentTimeMillis(); List<Class<T>> classes = new ArrayList<Class<T>>(); List<URL> cpURLs; int resCount = 0; try { cpURLs = getResources(fileName, ClassUtil.class); } catch (IOException e) { throw new RuntimeException("Error getting resource URLs for resource : " + fileName, e); } for (URL url : cpURLs) { addClasses(url, instanceOf, classes); resCount++; } logger.debug("Loaded " + classes.size() + " classes from " + resCount + " URLs through class list file " + fileName + ". Process took " + (System.currentTimeMillis() - start) + "ms. Turn on debug logging for more info."); return classes; }