private ConfDAO confDAO;
public ConnectorInfoManager getConnectorManager() throws NotFoundException, MissingConfKeyException {
// 1. Bundles directory
SyncopeConf connectorBundleDir = confDAO.find("connid.bundles.directory");
// 2. Find bundles inside that directory
File bundleDirectory = new File(connectorBundleDir.getValue());
String[] bundleFiles = bundleDirectory.list();
if (bundleFiles == null) {
throw new NotFoundException("Bundles from dir " + connectorBundleDir.getValue());
}
List<URL> bundleFileURLs = new ArrayList<URL>();
for (String file : bundleFiles) {
try {
bundleFileURLs.add(IOUtil.makeURL(bundleDirectory, file));
} catch (Exception ignore) {
// ignore exception and don't add bundle
if (LOG.isDebugEnabled()) {
LOG.debug(bundleDirectory.toString() + "/" + file + "\"" + " is not a valid connector bundle.",
ignore);
}
}
}
if (bundleFileURLs.isEmpty()) {
throw new NotFoundException("Bundles from dir " + connectorBundleDir.getValue());
}
LOG.debug("Bundle file URLs: {}", bundleFileURLs);
// 3. Get connector info manager
ConnectorInfoManager manager = ConnectorInfoManagerFactory.getInstance().getLocalManager(