public ComputeServiceContext getContext(Provider provider) { ComputeServiceContext context = contextForProvider.get(provider); Credentials credentials = provider.getCredentials(); if (context == null && provider.areCredentialsSetup()) { provider.registerCredentialsChangedListener(this); context = ContextBuilder.newBuilder(provider.getId()) .credentials(credentials.getKey(), credentials.getSecret()) .modules(ImmutableSet.<Module>of(new JschSshClientModule())) .buildView(ComputeServiceContext.class); } return context; }
public Provider getProviderById(String id) { for (Provider provider : providers) { if (provider.getId().equals(id)) return provider; } return null; }