/** * Loads resources from the module class loader */ @Override public Collection<URL> getResources(String name) { try { final HashSet<URL> resources = new HashSet<URL>(); Enumeration<URL> urls = module.getClassLoader().getResources(name); while (urls.hasMoreElements()) { resources.add(urls.nextElement()); } return resources; } catch (Exception e) { throw new ResourceLoadingException(e); } }
private Properties loadProperties(URL url) { Properties properties = new Properties(); try { properties.load(url.openStream()); } catch (IOException e) { throw new ResourceLoadingException(e); } return properties; }
public Collection<URL> getResources(String name) { try { final ClassLoader tccl = Thread.currentThread().getContextClassLoader(); if (tccl != null) { List<URL> urls = Collections.asList(tccl.getResources(name)); Iterator<URL> it = urls.iterator(); while (it.hasNext()) { URL url = it.next(); if (!url.toString().contains("Pax-Exam-Probe")) { it.remove(); } } return urls; } else { return Collections.asList(getClass().getClassLoader().getResources(name)); } } catch (IOException e) { throw new ResourceLoadingException(e); } }
@Override public Class<?> classForName(String name) { try { return classLoader().loadClass(name); } catch (ClassNotFoundException e) { throw new ResourceLoadingException(ERROR_LOADING_CLASS + name, e); } catch (LinkageError e) { throw new ResourceLoadingException(ERROR_LOADING_CLASS + name, e); } catch (TypeNotPresentException e) { throw new ResourceLoadingException(ERROR_LOADING_CLASS + name, e); } }
public <T> BackedAnnotatedType<T> getBackedAnnotatedType(final Class<T> rawType, final Type baseType, final String bdaId, final String suffix) { try { return backedAnnotatedTypes.getCastValue(new TypeHolder<T>(rawType, baseType, bdaId, suffix)); } catch (RuntimeException e) { if (e instanceof TypeNotPresentException || e instanceof ResourceLoadingException) { BootstrapLogger.LOG.exceptionWhileLoadingClass(rawType.getName(), e); throw new ResourceLoadingException("Exception while loading class " + rawType.getName(), e); } throw e; } catch (Error e) { if(e instanceof NoClassDefFoundError || e instanceof LinkageError) { throw new ResourceLoadingException("Error while loading class " + rawType.getName(), e); } BootstrapLogger.LOG.errorWhileLoadingClass(rawType.getName(), e); throw e; } }
@Override public Class<?> apply(Metadata<String> from) { try { return resourceLoader.classForName(from.getValue()); } catch (ResourceLoadingException e) { throw BootstrapLogger.LOG.errorLoadingBeansXmlEntry(from.getValue(), from.getLocation(), e.getCause()); } catch (Exception e) { throw BootstrapLogger.LOG.errorLoadingBeansXmlEntry(from.getValue(), from.getLocation(), e); } } }
private Properties loadProperties(URL url) { Properties properties = new Properties(); try { properties.load(url.openStream()); } catch (IOException e) { throw new ResourceLoadingException(e); } return properties; }
@Override public Class<?> classForName(String name) { try { return classLoader().loadClass(name); } catch (ClassNotFoundException e) { throw new ResourceLoadingException(ERROR_LOADING_CLASS + name, e); } catch (LinkageError e) { throw new ResourceLoadingException(ERROR_LOADING_CLASS + name, e); } catch (TypeNotPresentException e) { throw new ResourceLoadingException(ERROR_LOADING_CLASS + name, e); } }
public <T> BackedAnnotatedType<T> getBackedAnnotatedType(final Class<T> rawType, final Type baseType, final String bdaId, final String suffix) { try { return backedAnnotatedTypes.getCastValue(new TypeHolder<T>(rawType, baseType, bdaId, suffix)); } catch (RuntimeException e) { if (e instanceof TypeNotPresentException || e instanceof ResourceLoadingException) { BootstrapLogger.LOG.exceptionWhileLoadingClass(rawType.getName(), e); throw new ResourceLoadingException("Exception while loading class " + rawType.getName(), e); } throw e; } catch (Error e) { if(e instanceof NoClassDefFoundError || e instanceof LinkageError) { throw new ResourceLoadingException("Error while loading class " + rawType.getName(), e); } BootstrapLogger.LOG.errorWhileLoadingClass(rawType.getName(), e); throw e; } }
@Override public Class<?> apply(Metadata<String> from) { try { return resourceLoader.classForName(from.getValue()); } catch (ResourceLoadingException e) { throw BootstrapLogger.LOG.errorLoadingBeansXmlEntry(from.getValue(), from.getLocation(), e.getCause()); } catch (Exception e) { throw BootstrapLogger.LOG.errorLoadingBeansXmlEntry(from.getValue(), from.getLocation(), e); } } }
private Properties loadProperties(URL url) { Properties properties = new Properties(); try { properties.load(url.openStream()); } catch (IOException e) { throw new ResourceLoadingException(e); } return properties; }
/** * If the class name is found in additionalClasses then return it. * * Otherwise the class will be loaded from the module ClassLoader */ @Override public Class<?> classForName(String name) { try { if (classes.containsKey(name)) { return classes.get(name); } final Class<?> clazz = module.getClassLoader().loadClass(name); classes.put(name, clazz); return clazz; } catch (ClassNotFoundException | LinkageError e) { throw new ResourceLoadingException(e); } }
@Override public Class<?> classForName(String name) { try { return classLoader().loadClass(name); } catch (ClassNotFoundException e) { throw new ResourceLoadingException(ERROR_LOADING_CLASS + name, e); } catch (LinkageError e) { throw new ResourceLoadingException(ERROR_LOADING_CLASS + name, e); } catch (TypeNotPresentException e) { throw new ResourceLoadingException(ERROR_LOADING_CLASS + name, e); } }
public <T> BackedAnnotatedType<T> getBackedAnnotatedType(final Class<T> rawType, final Type baseType, final String bdaId, final String suffix) { try { return backedAnnotatedTypes.getCastValue(new TypeHolder<T>(rawType, baseType, bdaId, suffix)); } catch (RuntimeException e) { if (e instanceof TypeNotPresentException || e instanceof ResourceLoadingException) { BootstrapLogger.LOG.exceptionWhileLoadingClass(rawType.getName(), e); throw new ResourceLoadingException("Exception while loading class " + rawType.getName(), e); } throw e; } catch (Error e) { if(e instanceof NoClassDefFoundError || e instanceof LinkageError) { throw new ResourceLoadingException("Error while loading class " + rawType.getName(), e); } BootstrapLogger.LOG.errorWhileLoadingClass(rawType.getName(), e); throw e; } }
@Override public Class<?> apply(Metadata<String> from) { try { return resourceLoader.classForName(from.getValue()); } catch (ResourceLoadingException e) { throw BootstrapLogger.LOG.errorLoadingBeansXmlEntry(from.getValue(), from.getLocation(), e.getCause()); } catch (Exception e) { throw BootstrapLogger.LOG.errorLoadingBeansXmlEntry(from.getValue(), from.getLocation(), e); } } }
private Properties loadProperties(URL url) { Properties properties = new Properties(); try { properties.load(url.openStream()); } catch (IOException e) { throw new ResourceLoadingException(e); } return properties; }
/** * Loads a resource from the module class loader */ @Override public URL getResource(String name) { try { return module.getClassLoader().getResource(name); } catch (Exception e) { throw new ResourceLoadingException(e); } }
@Override public Class<?> classForName(String name) { try { return classLoader().loadClass(name); } catch (ClassNotFoundException e) { throw new ResourceLoadingException(ERROR_LOADING_CLASS + name, e); } catch (LinkageError e) { throw new ResourceLoadingException(ERROR_LOADING_CLASS + name, e); } catch (TypeNotPresentException e) { throw new ResourceLoadingException(ERROR_LOADING_CLASS + name, e); } }
public <T> BackedAnnotatedType<T> getBackedAnnotatedType(final Class<T> rawType, final Type baseType, final String bdaId, final String suffix) { try { return backedAnnotatedTypes.getCastValue(new TypeHolder<T>(rawType, baseType, bdaId, suffix)); } catch (RuntimeException e) { if (e instanceof TypeNotPresentException || e instanceof ResourceLoadingException) { BootstrapLogger.LOG.exceptionWhileLoadingClass(rawType.getName(), e); throw new ResourceLoadingException("Exception while loading class " + rawType.getName(), e); } throw e; } catch (Error e) { if(e instanceof NoClassDefFoundError || e instanceof LinkageError) { throw new ResourceLoadingException("Error while loading class " + rawType.getName(), e); } BootstrapLogger.LOG.errorWhileLoadingClass(rawType.getName(), e); throw e; } }
@Override public Class<?> apply(Metadata<String> from) { try { return resourceLoader.classForName(from.getValue()); } catch (ResourceLoadingException e) { throw BootstrapLogger.LOG.errorLoadingBeansXmlEntry(from.getValue(), from.getLocation(), e.getCause()); } catch (Exception e) { throw BootstrapLogger.LOG.errorLoadingBeansXmlEntry(from.getValue(), from.getLocation(), e); } } }