@Test public void loadAccessValidatorTest() { List<AccessValidator> accessValidators = ServiceProvider.load(ServiceProvider.ACL_VALIDATOR_ID, AccessValidator.class); assertThat(accessValidators).isNotNull(); }
public static <T> List<T> load(String name, Class<?> clazz) { LOG.info("Looking for a resource file of name [{}] ...", name); List<T> services = new ArrayList<T>(); try { ArrayList<String> names = new ArrayList<String>(); final InputStream is = getResourceAsStream(getContextClassLoader(), name); if (is != null) { BufferedReader reader; try { reader = new BufferedReader(new InputStreamReader(is, "UTF-8")); } catch (java.io.UnsupportedEncodingException e) { reader = new BufferedReader(new InputStreamReader(is)); } String serviceName = reader.readLine(); while (serviceName != null && !"".equals(serviceName)) { LOG.info( "Creating an instance as specified by file {} which was present in the path of the context classloader.", name); if (!names.contains(serviceName)) { names.add(serviceName); } services.add((T)initService(getContextClassLoader(), serviceName, clazz)); serviceName = reader.readLine(); } reader.close(); } else { LOG.warn("No resource file with name [{}] found.", name); } } catch (Exception e) { LOG.error("Error occured when looking for resource file " + name, e); } return services; }
ServiceProvider { public static <T> List<T> load(String name, Class<?> clazz) { LOG.info("Looking for a resource file of name [{}] ...", name); List<T> services = new ArrayList<T>(); try { ArrayList<String> names = new ArrayList<String>(); final InputStream is = getResourceAsStream(getContextClassLoader(), name); if (is != null) { BufferedReader reader; try { reader = new BufferedReader(new InputStreamReader(is, "UTF-8")); } catch (java.io.UnsupportedEncodingException e) { reader = new BufferedReader(new InputStreamReader(is)); } String serviceName = reader.readLine(); while (serviceName != null && !"".equals(serviceName)) { LOG.info( "Creating an instance as specified by file {} which was present in the path of the context classloader.", name); if (!names.contains(serviceName)) { names.add(serviceName); } services.add((T)initService(getContextClassLoader(), serviceName, clazz)); serviceName = reader.readLine(); } reader.close(); } else { LOG.warn("No resource file with name [{}] found.", name); } } catch (Exception e) { LOG.error("Error occured when looking for resource file " + name, e); } return services; } }
ServiceProvider { public static <T> List<T> load(String name, Class<?> clazz) { LOG.info("Looking for a resource file of name [{}] ...", name); List<T> services = new ArrayList<T>(); try { ArrayList<String> names = new ArrayList<String>(); final InputStream is = getResourceAsStream(getContextClassLoader(), name); if (is != null) { BufferedReader reader; try { reader = new BufferedReader(new InputStreamReader(is, "UTF-8")); } catch (java.io.UnsupportedEncodingException e) { reader = new BufferedReader(new InputStreamReader(is)); } String serviceName = reader.readLine(); while (serviceName != null && !"".equals(serviceName)) { LOG.info( "Creating an instance as specified by file {} which was present in the path of the context classloader.", name); if (!names.contains(serviceName)) { names.add(serviceName); } services.add((T)initService(getContextClassLoader(), serviceName, clazz)); serviceName = reader.readLine(); } reader.close(); } else { LOG.warn("No resource file with name [{}] found.", name); } } catch (Exception e) { LOG.error("Error occured when looking for resource file " + name, e); } return services; }  }
ServiceProvider { public static <T> List<T> load(String name, Class<?> clazz) { LOG.info("Looking for a resource file of name [{}] ...", name); List<T> services = new ArrayList<T>(); try { ArrayList<String> names = new ArrayList<String>(); final InputStream is = getResourceAsStream(getContextClassLoader(), name); if (is != null) { BufferedReader reader; try { reader = new BufferedReader(new InputStreamReader(is, "UTF-8")); } catch (java.io.UnsupportedEncodingException e) { reader = new BufferedReader(new InputStreamReader(is)); } String serviceName = reader.readLine(); while (serviceName != null && !"".equals(serviceName)) { LOG.info( "Creating an instance as specified by file {} which was present in the path of the context classloader.", name); if (!names.contains(serviceName)) { names.add(serviceName); } services.add((T)initService(getContextClassLoader(), serviceName, clazz)); serviceName = reader.readLine(); } reader.close(); } else { LOG.warn("No resource file with name [{}] found.", name); } } catch (Exception e) { LOG.error("Error occured when looking for resource file " + name, e); } return services; }  static List<T> load(String name, Class<?> clazz); static T loadClass(String name, Class<?> clazz); }
ServiceProvider { public static <T> List<T> load(String name, Class<?> clazz) { LOG.info("Looking for a resource file of name [{}] ...", name); List<T> services = new ArrayList<T>(); try { ArrayList<String> names = new ArrayList<String>(); final InputStream is = getResourceAsStream(getContextClassLoader(), name); if (is != null) { BufferedReader reader; try { reader = new BufferedReader(new InputStreamReader(is, "UTF-8")); } catch (java.io.UnsupportedEncodingException e) { reader = new BufferedReader(new InputStreamReader(is)); } String serviceName = reader.readLine(); while (serviceName != null && !"".equals(serviceName)) { LOG.info( "Creating an instance as specified by file {} which was present in the path of the context classloader.", name); if (!names.contains(serviceName)) { names.add(serviceName); } services.add((T)initService(getContextClassLoader(), serviceName, clazz)); serviceName = reader.readLine(); } reader.close(); } else { LOG.warn("No resource file with name [{}] found.", name); } } catch (Exception e) { LOG.error("Error occured when looking for resource file " + name, e); } return services; }  static List<T> load(String name, Class<?> clazz); static T loadClass(String name, Class<?> clazz); static final String TRANSACTION_SERVICE_ID; static final String TRANSACTION_LISTENER_ID; static final String RPC_HOOK_ID; static final String ACL_VALIDATOR_ID; }