use of org.jclouds.domain.Credentials in project fabric8 by jboss-fuse.
the class ZookeeperCredentialStore method onConnected.
private void onConnected() {
// Whenever a connection to Zookeeper is made copy everything to Zookeeper.
for (Map.Entry<String, Credentials> entry : cache.asMap().entrySet()) {
String s = entry.getKey();
Credentials credentials = entry.getValue();
getStore().put(s, credentials);
}
}
use of org.jclouds.domain.Credentials in project whirr by apache.
the class ListClusterCommandTest method createTestCluster.
private Cluster createTestCluster(String[] ids, String[] roles) {
checkArgument(ids.length == roles.length, "each ID should have a role");
Credentials credentials = new Credentials("dummy", "dummy");
Set<Cluster.Instance> instances = Sets.newHashSet();
for (int i = 0; i < ids.length; i++) {
String ip = "127.0.0." + (i + 1);
instances.add(new Cluster.Instance(credentials, Sets.newHashSet(roles[i]), ip, ip, ids[i], null));
}
return new Cluster(instances);
}
use of org.jclouds.domain.Credentials in project whirr by apache.
the class ClusterController method toInstance.
private Cluster.Instance toInstance(NodeMetadata metadata, Cluster cluster, ClusterSpec spec) {
Credentials credentials = new Credentials(spec.getClusterUser(), spec.getPrivateKey());
Set<String> roles = Sets.newHashSet();
try {
if (cluster != null) {
roles = cluster.getInstanceMatching(withIds(metadata.getId())).getRoles();
}
} catch (NoSuchElementException e) {
}
return new Cluster.Instance(credentials, roles, Iterables.getFirst(metadata.getPublicAddresses().size() > 0 ? metadata.getPublicAddresses() : metadata.getPrivateAddresses(), null), Iterables.getFirst(metadata.getPrivateAddresses(), null), metadata.getId(), metadata);
}
use of org.jclouds.domain.Credentials in project whirr by apache.
the class RunScriptCommandTest method createTestCluster.
private Cluster createTestCluster(String[] ids, String[] roles) {
checkArgument(ids.length == roles.length, "each ID should have a role");
Credentials credentials = new Credentials("dummy", "dummy");
Set<Cluster.Instance> instances = Sets.newHashSet();
for (int i = 0; i < ids.length; i++) {
String ip = "127.0.0." + (i + 1);
instances.add(new Cluster.Instance(credentials, Sets.newHashSet(roles[i]), ip, ip, ids[i], null));
}
return new Cluster(instances);
}
use of org.jclouds.domain.Credentials in project whirr by apache.
the class ClusterStateStore method unserialize.
/**
* Rebuild the {@link Cluster} instance by using the string representation
*
* @param spec
* @param content
* @return
* @throws UnknownHostException
*/
protected Cluster unserialize(ClusterSpec spec, String content) throws UnknownHostException {
Credentials credentials = new Credentials(spec.getClusterUser(), spec.getPrivateKey());
Set<Cluster.Instance> instances = Sets.newLinkedHashSet();
for (String line : Splitter.on("\n").split(content)) {
if (line.trim().equals(""))
continue;
/* ignore empty lines */
Iterator<String> fields = Splitter.on("\t").split(line).iterator();
String id = fields.next();
Set<String> roles = Sets.newLinkedHashSet(Splitter.on(",").split(fields.next()));
String publicIPAddress = fields.next();
String privateIPAddress = fields.next();
instances.add(new Cluster.Instance(credentials, roles, publicIPAddress, privateIPAddress, id, null));
}
return new Cluster(instances);
}
Aggregations