- private static final Logger logger = LoggerFactory.getLogger(NetconfSSHActivator.class);
- private static final String EXCEPTION_MESSAGE = "Netconf ssh bridge is not available.";
- private IUserManager iUserManager;
- private BundleContext context = null;
-
- ServiceTrackerCustomizer<IUserManager, IUserManager> customizer = new ServiceTrackerCustomizer<IUserManager, IUserManager>(){
- @Override
- public IUserManager addingService(ServiceReference<IUserManager> reference) {
- logger.trace("Service {} added, let there be SSH bridge.", reference);
- iUserManager = context.getService(reference);
- try {
- onUserManagerFound(iUserManager);
- } catch (Exception e) {
- logger.trace("Can't start SSH server due to {}",e);
- }
- return iUserManager;
- }
- @Override
- public void modifiedService(ServiceReference<IUserManager> reference, IUserManager service) {
- logger.trace("Replacing modified service {} in netconf SSH.", reference);
- server.addUserManagerService(service);
- }
- @Override
- public void removedService(ServiceReference<IUserManager> reference, IUserManager service) {
- logger.trace("Removing service {} from netconf SSH. " +
- "SSH won't authenticate users until IUserManager service will be started.", reference);
- removeUserManagerService();
- }
- };
-