private Map<String, EntityListAddonWebObjectBuilder> getBuilders() { if (builders != null) { return builders; } try { builders = componentManager.getInstanceMap(EntityListAddonWebObjectBuilder.class); return builders; } catch (ComponentLookupException e) { throw new RuntimeException("Failed to initialize entity list addon transformer", e); } }
@Override public Map<String, Vocabulary> get() { try { return this.cm.get().getInstanceMap(Vocabulary.class); } catch (ComponentLookupException e) { return Collections.emptyMap(); } } }
/** * @return the list of available CAPTCHA implementation names */ public List<String> getCaptchaNames() { List<String> names = new ArrayList<>(); try { names = new ArrayList<>(componentManager.getInstanceMap(Captcha.class).keySet()); } catch (Exception e) { logger.error("Failed to get list of captcha names", e); } return names; }
@Override public <T> Map<String, T> getInstanceMap(Type role) throws ComponentLookupException { return getComponentManager().getInstanceMap(role); }
/** * Get the names of all the measurements handlers. * * @return a set with the names of all the measurement handlers, or an empty set if there was a problem retrieving * the actual values */ public Set<String> getAvailableMeasurementNames() { try { Map<String, MeasurementHandler> handlers = this.componentManager.get().getInstanceMap(MeasurementHandler.class); if (handlers != null) { Set<String> result = new TreeSet<>(MeasurementNameSorter.instance); result.addAll(handlers.keySet()); return result; } } catch (ComponentLookupException ex) { this.logger.warn("Failed to list available measurement types", ex); } return Collections.emptySet(); }
/** * Get the names of all the measurements handlers. * * @return a set with the names of all the measurement handlers, or an empty set if there was a problem retrieving * the actual values */ public Set<String> getAvailableMeasurementNames() { try { Map<String, MeasurementHandler> handlers = this.componentManager.get().getInstanceMap(MeasurementHandler.class); if (handlers != null) { Set<String> result = new TreeSet<String>(MeasurementNameSorter.instance); result.addAll(handlers.keySet()); return result; } } catch (ComponentLookupException ex) { this.logger.warn("Failed to list available measurement types", ex); } return Collections.emptySet(); }
/** * Get the names of all the measurements handlers. * * @return a set with the names of all the measurement handlers, or an empty set if there was a problem retrieving * the actual values */ public Set<String> getAvailableMeasurementNames() { try { Map<String, MeasurementHandler> handlers = this.componentManager.get().getInstanceMap(MeasurementHandler.class); if (handlers != null) { Set<String> result = new TreeSet<>(MeasurementNameSorter.instance); result.addAll(handlers.keySet()); return result; } } catch (ComponentLookupException ex) { this.logger.warn("Failed to list available measurement types", ex); } return Collections.emptySet(); }
@Override public List<String> listActions() { List<String> actionNames = new ArrayList<>(this.strutsActionNames); // Note: We don't cache the action names coming from Resource Reference Handlers as some extensions could // contribute some. try { Map<String, ResourceReferenceHandler<EntityResourceAction>> componentMap = this.contextComponentManagerProvider.get().getInstanceMap( new DefaultParameterizedType(null, ResourceReferenceHandler.class, EntityResourceAction.class)); for (String key : componentMap.keySet()) { actionNames.add(key); } } catch (ComponentLookupException e) { // This should not happen normally. throw new RuntimeException("Failed to locate Resource Reference Handlers", e); } return actionNames; }
private Map<String, DataReader<T>> getReaders() { try { return this.cm.get().getInstanceMap( new DefaultParameterizedType(null, DataReader.class, getImplementationType())); } catch (ComponentLookupException e) { return null; } }
private Map<String, DataReader<T>> getReaders() { try { return this.cm.get().getInstanceMap( new DefaultParameterizedType(null, DataReader.class, getImplementationType())); } catch (ComponentLookupException e) { return null; } }
@Override @SuppressWarnings("unchecked") public <T> Map<String, T> getInstanceMap(Type roleType) throws ComponentLookupException { Map<String, T> components = new HashMap<>(); Map<String, ComponentEntry<?>> entries = this.componentEntries.get(roleType); // Add local components if (entries != null) { for (Map.Entry<String, ComponentEntry<?>> entry : entries.entrySet()) { try { components.put(entry.getKey(), getComponentInstance((ComponentEntry<T>) entry.getValue())); } catch (Exception e) { throw new ComponentLookupException( "Failed to lookup component with type [" + roleType + "] and hint [" + entry.getKey() + "]", e); } } } // Add parent components if (getParent() != null) { // If the hint already exists in the children Component Manager then don't add the one from the parent. for (Map.Entry<String, T> entry : getParent().<T>getInstanceMap(roleType).entrySet()) { if (!components.containsKey(entry.getKey())) { components.put(entry.getKey(), entry.getValue()); } } } return components; }
allMacros = this.componentManager.get().getInstanceMap(Macro.class); } catch (ComponentLookupException e) { throw new MacroLookupException("Failed to lookup Macros", e);
@Override public Collection<NotificationFilter> getAllFilters(boolean allWikis) throws NotificationException { if (allWikis) { String currentWikiId = wikiDescriptorManager.getCurrentWikiId(); Map<String, NotificationFilter> filters = new HashMap<>(); try { for (String wikiId : wikiDescriptorManager.getAllIds()) { modelContext.setCurrentEntityReference(new WikiReference(wikiId)); filters.putAll(componentManager.getInstanceMap(NotificationFilter.class)); } } catch (Exception e) { throw new NotificationException(ERROR_MESSAGE, e); } finally { modelContext.setCurrentEntityReference(new WikiReference(currentWikiId)); } return new HashSet<>(filters.values()); } else { // Get filters from the current wiki only try { return new HashSet<>(componentManager.getInstanceList(NotificationFilter.class)); } catch (Exception e) { throw new NotificationException(ERROR_MESSAGE, e); } } }
componentDependency = componentManager.getInstanceMap( ((ParameterizedType) cd.getRoleType()).getActualTypeArguments()[1]); } else {
Map<String, UserManager> managers = this.componentManager.getInstanceMap(UserManager.class); managers.remove("default"); for (UserManager manager : managers.values()) {
} else if (roleClass.isAssignableFrom(Map.class)) { component = (T) this.componentManager.getInstanceMap(ReflectionUtils.getLastTypeGenericArgument(this.roleHint .getRoleType())); } else if (ReflectionUtils.getDirectAnnotation(ComponentRole.class, roleClass) != null