private static void initLocal(final URI location) {
// 1. Find bundles inside local directory
File bundleDirectory = new File(location);
String[] bundleFiles = bundleDirectory.list();
if (bundleFiles == null) {
throw new NotFoundException("Local bundles directory " + location);
}
List<URL> bundleFileURLs = new ArrayList<URL>();
for (String file : bundleFiles) {
try {
bundleFileURLs.add(IOUtil.makeURL(bundleDirectory, file));
} catch (IOException ignore) {
// ignore exception and don't add bundle
LOG.debug("{}/{} is not a valid connector bundle", bundleDirectory.toString(), file, ignore);
}
}
if (bundleFileURLs.isEmpty()) {
LOG.warn("No connector bundles found in {}", location);
}
LOG.debug("Configuring local connector server:"
+ "\n\tFiles: {}", bundleFileURLs);
// 2. Get connector info manager
ConnectorInfoManager manager = ConnectorInfoManagerFactory.getInstance().getLocalManager(
bundleFileURLs.toArray(new URL[bundleFileURLs.size()]));
if (manager == null) {
throw new NotFoundException("Local ConnectorInfoManager");
}
CONN_MANAGERS.put(location, manager);
}