@Test public void getInitializerExactMatch() { assertSame(this.initializerList.get(0), this.groupedJobInitializerManager.getGroupedJobInitializer( new JobGroupPath(Collections.singletonList("foo")))); assertSame(this.initializerList.get(3), this.groupedJobInitializerManager.getGroupedJobInitializer( new JobGroupPath(Arrays.asList("foo", "bar", "buz")))); }
@Override public GroupedJobInitializer getGroupedJobInitializer(JobGroupPath jobGroupPath) { GroupedJobInitializer result = null; if (jobGroupPath != null) { result = this.cachedInitializers.get(jobGroupPath.toString()); if (result == null) { try { List<GroupedJobInitializer> initializers = this.componentManagerProvider.get().getInstanceList(GroupedJobInitializer.class); JobGroupPath currentPath = jobGroupPath; while (currentPath != null && result == null) { result = search(currentPath, initializers); currentPath = currentPath.getParent(); } } catch (ComponentLookupException e) { this.logger.error("Error while loading GroupedJobInitializer component: [{}]", ExceptionUtils.getRootCauseMessage(e)); } } } if (result == null) { result = this.defaultGoupedJobInitializer; } if (jobGroupPath != null) { this.cachedInitializers.set(jobGroupPath.toString(), result); } return result; }
DefaultGroupedJobInitializerManager implements GroupedJobInitializerManager, Initializable { @Override public GroupedJobInitializer getGroupedJobInitializer(JobGroupPath jobGroupPath) { GroupedJobInitializer result = null; if (jobGroupPath != null) { result = this.cachedInitializers.get(jobGroupPath.toString()); if (result == null) { try { List<GroupedJobInitializer> initializers = this.componentManagerProvider.get().getInstanceList(GroupedJobInitializer.class); JobGroupPath currentPath = jobGroupPath; while (currentPath != null && result == null) { result = search(currentPath, initializers); currentPath = currentPath.getParent(); } } catch (ComponentLookupException e) { this.logger.error("Error while loading GroupedJobInitializer component: [{}]", ExceptionUtils.getRootCauseMessage(e)); } } } if (result == null) { result = this.defaultGoupedJobInitializer; } if (jobGroupPath != null) { this.cachedInitializers.set(jobGroupPath.toString(), result); } return result; } }
DefaultGroupedJobInitializerManager implements GroupedJobInitializerManager, Initializable { @Override public GroupedJobInitializer getGroupedJobInitializer(JobGroupPath jobGroupPath) { GroupedJobInitializer result = null; if (jobGroupPath != null) { result = this.cachedInitializers.get(jobGroupPath.toString()); if (result == null) { try { List<GroupedJobInitializer> initializers = this.componentManagerProvider.get().getInstanceList(GroupedJobInitializer.class); JobGroupPath currentPath = jobGroupPath; while (currentPath != null && result == null) { result = search(currentPath, initializers); currentPath = currentPath.getParent(); } } catch (ComponentLookupException e) { this.logger.error("Error while loading GroupedJobInitializer component: [{}]", ExceptionUtils.getRootCauseMessage(e)); } } } if (result == null) { result = this.defaultGoupedJobInitializer; } if (jobGroupPath != null) { this.cachedInitializers.set(jobGroupPath.toString(), result); } return result; }  }
DefaultGroupedJobInitializerManager implements GroupedJobInitializerManager, Initializable { @Override public GroupedJobInitializer getGroupedJobInitializer(JobGroupPath jobGroupPath) { GroupedJobInitializer result = null; if (jobGroupPath != null) { result = this.cachedInitializers.get(jobGroupPath.toString()); if (result == null) { try { List<GroupedJobInitializer> initializers = this.componentManagerProvider.get().getInstanceList(GroupedJobInitializer.class); JobGroupPath currentPath = jobGroupPath; while (currentPath != null && result == null) { result = search(currentPath, initializers); currentPath = currentPath.getParent(); } } catch (ComponentLookupException e) { this.logger.error("Error while loading GroupedJobInitializer component: [{}]", ExceptionUtils.getRootCauseMessage(e)); } } } if (result == null) { result = this.defaultGoupedJobInitializer; } if (jobGroupPath != null) { this.cachedInitializers.set(jobGroupPath.toString(), result); } return result; }  @Override void initialize(); @Override GroupedJobInitializer getGroupedJobInitializer(JobGroupPath jobGroupPath); @Override void invalidateCache(); }
DefaultGroupedJobInitializerManager implements GroupedJobInitializerManager, Initializable { @Override public GroupedJobInitializer getGroupedJobInitializer(JobGroupPath jobGroupPath) { GroupedJobInitializer result = null; if (jobGroupPath != null) { result = this.cachedInitializers.get(jobGroupPath.toString()); if (result == null) { try { List<GroupedJobInitializer> initializers = this.componentManagerProvider.get().getInstanceList(GroupedJobInitializer.class); JobGroupPath currentPath = jobGroupPath; while (currentPath != null && result == null) { result = search(currentPath, initializers); currentPath = currentPath.getParent(); } } catch (ComponentLookupException e) { this.logger.error("Error while loading GroupedJobInitializer component: [{}]", ExceptionUtils.getRootCauseMessage(e)); } } } if (result == null) { result = this.defaultGoupedJobInitializer; } if (jobGroupPath != null) { this.cachedInitializers.set(jobGroupPath.toString(), result); } return result; }  @Override void initialize(); @Override GroupedJobInitializer getGroupedJobInitializer(JobGroupPath jobGroupPath); @Override void invalidateCache();  }