@PreAuthorize("hasRole('" + StandardEntitlement.RESOURCE_LIST + "')") @Transactional(readOnly = true) public List<ResourceTO> list() { return resourceDAO.findAll().stream().map(binder::getResourceTO).collect(Collectors.toList()); }
@Transactional(readOnly = true) @Override public void load() { // This is needed in order to avoid encoding problems when sending error messages via REST CurrentLocale.set(Locale.ENGLISH); // Load all connector bundles connIdBundleManager.getConnManagers(); // Load all resource-specific connectors int connectors = 0; for (ExternalResource resource : resourceDAO.findAll()) { LOG.info("Registering resource-connector pair {}-{}", resource, resource.getConnector()); try { registerConnector(resource); connectors++; } catch (Exception e) { LOG.error("While registering resource-connector pair {}-{}", resource, resource.getConnector(), e); } } LOG.info("Done loading {} connectors", connectors); }
@Transactional(readOnly = true) @Override public void unload() { int connectors = 0; for (ExternalResource resource : resourceDAO.findAll()) { String beanName = getBeanName(resource); if (ApplicationContextProvider.getBeanFactory().containsSingleton(beanName)) { LOG.info("Unegistering resource-connector pair {}-{}", resource, resource.getConnector()); getConnector(resource).dispose(); unregisterConnector(beanName); connectors++; } } LOG.info("Done unloading {} connectors", connectors); ConnectorFacadeFactory.getInstance().dispose(); connIdBundleManager.resetConnManagers(); LOG.info("All connector resources disposed"); } }
resourceDAO.findAll().forEach(resource -> { EventCategory propEventCategory = new EventCategory(EventCategoryType.PROPAGATION); EventCategory pullEventCategory = new EventCategory(EventCategoryType.PULL);
PLATFORM_INFO.getResources().addAll(resourceDAO.findAll().stream(). map(Entity::getKey).collect(Collectors.toList())); return null;