org.apache.whirr
Class RolePredicates

java.lang.Object
  extended by org.apache.whirr.RolePredicates

public class RolePredicates
extends Object

Predicates for matching Cluster.Instances with certain cluster roles.


Constructor Summary
RolePredicates()
           
 
Method Summary
static com.google.common.base.Predicate<Cluster.Instance> allRolesIn(Set<String> roles)
           
static com.google.common.base.Predicate<Cluster.Instance> anyRoleIn(Set<String> roles)
           
static com.google.common.base.Predicate<Cluster.Instance> onlyRolesIn(Set<String> roles)
           
static com.google.common.base.Predicate<Cluster.Instance> role(String role)
           
static com.google.common.base.Predicate<Cluster.Instance> withIds(Set<String> ids)
           
static com.google.common.base.Predicate<Cluster.Instance> withIds(String... ids)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RolePredicates

public RolePredicates()
Method Detail

role

public static com.google.common.base.Predicate<Cluster.Instance> role(String role)
Parameters:
role -
Returns:
A Predicate that matches Cluster.Instances whose roles include role.

onlyRolesIn

public static com.google.common.base.Predicate<Cluster.Instance> onlyRolesIn(Set<String> roles)
Parameters:
roles -
Returns:
A Predicate that matches Cluster.Instances whose roles are exactly the same as those in roles.

allRolesIn

public static com.google.common.base.Predicate<Cluster.Instance> allRolesIn(Set<String> roles)
Parameters:
roles -
Returns:
A Predicate that matches Cluster.Instances whose roles contain all of roles.

anyRoleIn

public static com.google.common.base.Predicate<Cluster.Instance> anyRoleIn(Set<String> roles)
Parameters:
roles -
Returns:
A Predicate that matches Cluster.Instances whose roles contain at least one of roles.

withIds

public static com.google.common.base.Predicate<Cluster.Instance> withIds(String... ids)
Parameters:
ids - list of instance ids
Returns:
A Predicate that matches Cluster.Instance whose id is found in the IDs list

withIds

public static com.google.common.base.Predicate<Cluster.Instance> withIds(Set<String> ids)
Parameters:
ids - list of instance ids
Returns:
A Predicate that matches Cluster.Instance whose id is found in the IDs list


Copyright © 2010-2012 The Apache Software Foundation. All Rights Reserved.