@Test public void testGetServicesByType() { dsm.startup(); int currentSize = dsm.getServicesByType(ConcreteExample.class).size(); assertTrue(currentSize > 0); List<ConcreteExample> l = dsm.getServicesByType(ConcreteExample.class); assertNotNull(l); assertEquals("azeckoski", l.get(0).getName()); l = null; List<SampleAnnotationBean> l2 = dsm.getServicesByType(SampleAnnotationBean.class); assertNotNull(l2); assertTrue(l2.size() >= 1); l2 = null; }
@SuppressWarnings("unchecked") @Override public <T> List<T> getServicesByType(Class<T> type) { checkRunning(); if (type == null) { throw new IllegalArgumentException("type cannot be null"); } List<T> services = new ArrayList<>(); Map<String, T> beans; try { beans = applicationContext.getBeansOfType(type, true, true); services.addAll((Collection<? extends T>) beans.values()); } catch (BeansException e) { throw new RuntimeException("Failed to get beans of type (" + type + "): " + e.getMessage(), e); } Collections.sort(services, new ServiceManagerUtils.ServiceComparator()); return services; }
DSpaceServiceManager implements ServiceManagerSystem { @SuppressWarnings("unchecked") @Override public <T> List<T> getServicesByType(Class<T> type) { checkRunning(); if (type == null) { throw new IllegalArgumentException("type cannot be null"); } List<T> services = new ArrayList<>(); Map<String, T> beans; try { beans = applicationContext.getBeansOfType(type, true, true); services.addAll((Collection<? extends T>) beans.values()); } catch (BeansException e) { throw new RuntimeException("Failed to get beans of type (" + type + "): " + e.getMessage(), e); } Collections.sort(services, new ServiceManagerUtils.ServiceComparator()); return services; } }
DSpaceServiceManager implements ServiceManagerSystem { @SuppressWarnings("unchecked") @Override public <T> List<T> getServicesByType(Class<T> type) { checkRunning(); if (type == null) { throw new IllegalArgumentException("type cannot be null"); } List<T> services = new ArrayList<>(); Map<String, T> beans; try { beans = applicationContext.getBeansOfType(type, true, true); services.addAll((Collection<? extends T>) beans.values()); } catch (BeansException e) { throw new RuntimeException("Failed to get beans of type (" + type + "): " + e.getMessage(), e); } Collections.sort(services, new ServiceManagerUtils.ServiceComparator()); return services; } DSpaceServiceManager(DSpaceConfigurationService configurationService); protected  DSpaceServiceManager(DSpaceConfigurationService configurationService,
            String... springXmlConfigFiles); }
DSpaceServiceManager implements ServiceManagerSystem { @SuppressWarnings("unchecked") @Override public <T> List<T> getServicesByType(Class<T> type) { checkRunning(); if (type == null) { throw new IllegalArgumentException("type cannot be null"); } List<T> services = new ArrayList<>(); Map<String, T> beans; try { beans = applicationContext.getBeansOfType(type, true, true); services.addAll((Collection<? extends T>) beans.values()); } catch (BeansException e) { throw new RuntimeException("Failed to get beans of type (" + type + "): " + e.getMessage(), e); } Collections.sort(services, new ServiceManagerUtils.ServiceComparator()); return services; } DSpaceServiceManager(DSpaceConfigurationService configurationService); protected  DSpaceServiceManager(DSpaceConfigurationService configurationService,
            String... springXmlConfigFiles); boolean isRunning(); ListableBeanFactory getBeanFactory(); @Override ClassPathXmlApplicationContext getApplicationContext(); void notifyServiceManagerReady(); @Override void shutdown(); @Override void startup(); @Override void registerService(String name, Object service); @Override void registerServiceNoAutowire(String name, Object service); @SuppressWarnings("unchecked") @Override T registerServiceClass(String name, Class<T> type); @Override void unregisterService(String name); @SuppressWarnings("unchecked") @Override T getServiceByName(String name, Class<T> type); @SuppressWarnings("unchecked") @Override List<T> getServicesByType(Class<T> type); @Override List<String> getServicesNames(); @Override boolean isServiceExists(String name); @Override Map<String, Object> getServices(); @Override void pushConfig(Map<String, Object> properties); static String[] getSpringPaths(boolean testMode, String[] configPaths,
                                          DSpaceConfigurationService configurationService); }
DSpaceServiceManager implements ServiceManagerSystem { @SuppressWarnings("unchecked") @Override public <T> List<T> getServicesByType(Class<T> type) { checkRunning(); if (type == null) { throw new IllegalArgumentException("type cannot be null"); } List<T> services = new ArrayList<>(); Map<String, T> beans; try { beans = applicationContext.getBeansOfType(type, true, true); services.addAll((Collection<? extends T>) beans.values()); } catch (BeansException e) { throw new RuntimeException("Failed to get beans of type (" + type + "): " + e.getMessage(), e); } Collections.sort(services, new ServiceManagerUtils.ServiceComparator()); return services; } DSpaceServiceManager(DSpaceConfigurationService configurationService); protected  DSpaceServiceManager(DSpaceConfigurationService configurationService,
            String... springXmlConfigFiles); boolean isRunning(); ListableBeanFactory getBeanFactory(); @Override ClassPathXmlApplicationContext getApplicationContext(); void notifyServiceManagerReady(); @Override void shutdown(); @Override void startup(); @Override void registerService(String name, Object service); @Override void registerServiceNoAutowire(String name, Object service); @SuppressWarnings("unchecked") @Override T registerServiceClass(String name, Class<T> type); @Override void unregisterService(String name); @SuppressWarnings("unchecked") @Override T getServiceByName(String name, Class<T> type); @SuppressWarnings("unchecked") @Override List<T> getServicesByType(Class<T> type); @Override List<String> getServicesNames(); @Override boolean isServiceExists(String name); @Override Map<String, Object> getServices(); @Override void pushConfig(Map<String, Object> properties); static String[] getSpringPaths(boolean testMode, String[] configPaths,
                                          DSpaceConfigurationService configurationService); static final String CONFIG_PATH; static final String CORE_RESOURCE_PATH; static final String ADDON_RESOURCE_PATH; }