Search in sources :

Example 1 with InstanceTypeType

use of es.bsc.compss.types.resources.jaxb.InstanceTypeType in project compss by bsc-wdc.

the class Validator method validateInstanceTypes.

private void validateInstanceTypes(InstanceTypesType instances) throws InvalidElementException {
    List<String> instanceNames = new ArrayList<String>();
    List<InstanceTypeType> instances_list = instances.getInstanceType();
    if (instances_list != null) {
        for (InstanceTypeType i : instances.getInstanceType()) {
            if (instanceNames.contains(i.getName())) {
                throw new InvalidElementException("Instances", "Attribute Instance " + i.getName(), "Name already used");
            } else {
                instanceNames.add(i.getName());
                validateInstance(i);
            }
        }
    } else {
        // Empty inner elements
        throw new InvalidElementException("InstanceTypes", "", "Content is empty");
    }
}
Also used : ArrayList(java.util.ArrayList) InvalidElementException(es.bsc.compss.types.resources.exceptions.InvalidElementException) InstanceTypeType(es.bsc.compss.types.resources.jaxb.InstanceTypeType)

Aggregations

InvalidElementException (es.bsc.compss.types.resources.exceptions.InvalidElementException)1 InstanceTypeType (es.bsc.compss.types.resources.jaxb.InstanceTypeType)1 ArrayList (java.util.ArrayList)1