public IdentityRepository[] getPluggedInIdentityRepositries() { IExtension[] extensions = Platform.getExtensionRegistry() .getExtensionPoint(JSchCorePlugin.ID, JSchCorePlugin.PT_IDENTITYREPOSITORY) .getExtensions(); if (extensions.length == 0) return new IdentityRepository[0]; ArrayList tmp = new ArrayList(); for (int i = 0; i < extensions.length; i++) { IExtension extension = extensions[i]; IConfigurationElement[] configs = extension.getConfigurationElements(); if (configs.length == 0) { JSchCorePlugin.log( IStatus.ERROR, NLS.bind( "IdentityRepository {0} is missing required fields", (new Object[] {extension.getUniqueIdentifier()})), null); //$NON-NLS-1$ continue; } try { IConfigurationElement config = configs[0]; AbstractIdentityRepositoryFactory iirf = (AbstractIdentityRepositoryFactory) config.createExecutableExtension("run"); // $NON-NLS-1$ tmp.add(iirf.create()); } catch (CoreException ex) { JSchCorePlugin.log( IStatus.ERROR, NLS.bind( "Unable to instantiate identity repository {0}", (new Object[] {extension.getUniqueIdentifier()})), ex); //$NON-NLS-1$ } } IdentityRepository[] repositories = new IdentityRepository[tmp.size()]; for (int i = 0; i < tmp.size(); i++) { repositories[i] = (IdentityRepository) tmp.get(i); } return repositories; }
public void loadKnownHosts() { Preferences preferences = JSchCorePlugin.getPlugin().getPluginPreferences(); String ssh_home = preferences.getString(IConstants.KEY_SSH2HOME); if (ssh_home.length() == 0) ssh_home = PreferenceInitializer.SSH_HOME_DEFAULT; java.io.File file = new java.io.File(ssh_home, "known_hosts"); // $NON-NLS-1$ try { getJSch().setKnownHosts(file.getPath()); } catch (JSchException e) { JSchCorePlugin.log( IStatus.ERROR, NLS.bind( "An error occurred while loading the know hosts file {0}", file //$NON-NLS-1$ .getAbsolutePath()), e); } needToLoadKnownHosts = false; }