Search in sources :

Example 1 with Type

use of org.apache.asterix.event.management.ValueType.Type in project asterixdb by apache.

the class EventUtil method getEventLocation.

public static Node getEventLocation(Pattern pattern, List<Node> candidateLocations, Cluster cluster) {
    ValueType value = new ValueType(pattern.getEvent().getNodeid().getValue());
    Node location = null;
    Type vtype = value.getType();
    switch(vtype) {
        case ABS:
            location = getNodeFromId(value.getAbsoluteValue(), cluster);
            break;
        case RANDOM_RANGE:
            int nodeIndex = Randomizer.getInstance().getRandomInt(0, candidateLocations.size() - 1);
            location = candidateLocations.get(nodeIndex);
            break;
        case RANDOM_MIN_MAX:
            throw new IllegalStateException(" Canont configure a min max value range for location");
    }
    return location;
}
Also used : Type(org.apache.asterix.event.management.ValueType.Type) Node(org.apache.asterix.event.schema.cluster.Node)

Aggregations

Type (org.apache.asterix.event.management.ValueType.Type)1 Node (org.apache.asterix.event.schema.cluster.Node)1