@PreAuthorize("hasRole('" + StandardEntitlement.CONNECTOR_LIST + "')") @Transactional(readOnly = true) public List<ConnInstanceTO> list(final String lang) { CurrentLocale.set(StringUtils.isBlank(lang) ? Locale.ENGLISH : new Locale(lang)); return connInstanceDAO.findAll().stream(). filter(connInstance -> connInstance != null). map(connInstance -> { ConnInstanceTO result = null; try { result = binder.getConnInstanceTO(connInstance); } catch (NotFoundException e) { LOG.error("Connector '{}#{}' not found", connInstance.getBundleName(), connInstance.getVersion()); } return result; }).collect(Collectors.toList()); }
@Override public Pair<URI, ConnectorInfo> getConnectorInfo(final ConnInstance connInstance) { // check ConnIdLocation URI uriLocation = null; try { uriLocation = URIUtils.buildForConnId(connInstance.getLocation()); } catch (Exception e) { throw new IllegalArgumentException("Invalid ConnId location " + connInstance.getLocation(), e); } // create key for search all properties ConnectorKey key = new ConnectorKey( connInstance.getBundleName(), connInstance.getVersion(), connInstance.getConnectorName()); if (LOG.isDebugEnabled()) { LOG.debug("\nBundle name: " + key.getBundleName() + "\nBundle version: " + key.getBundleVersion() + "\nBundle class: " + key.getConnectorName()); } // get the specified connector ConnectorInfo info = null; if (getConnManagers().containsKey(uriLocation)) { info = getConnManagers().get(uriLocation).findConnectorInfo(key); } if (info == null) { throw new NotFoundException("ConnectorInfo for location " + connInstance.getLocation() + " and key " + key); } return Pair.of(uriLocation, info); }
connInstanceTO.setBundleName(connInstance.getBundleName()); connInstanceTO.setConnectorName(connInstance.getConnectorName()); connInstanceTO.setVersion(connInstance.getVersion()); connInstanceTO.setDisplayName(connInstance.getDisplayName()); connInstanceTO.setConnRequestTimeout(connInstance.getConnRequestTimeout());