Package org.rhq.core.domain.sync

Examples of org.rhq.core.domain.sync.ConsistencyValidatorFailureReport


                        }
                       
                        try {
                            validator = validateSingle(rdr, subject);
                        } catch (Exception e) {
                            failures.add(new ConsistencyValidatorFailureReport(validatorClass,
                                printExceptionToString(e)));
                        }
                        if (validator != null) {
                            consistencyValidators.add(validator);
                        }
View Full Code Here


        Set<ConsistencyValidator> requriedConsistencyValidators = synchronizer.getRequiredValidators();
       
        //check that all the required consistency validators were run
        for(ConsistencyValidator v : requriedConsistencyValidators) {
            if (!consistencyValidators.contains(v)) {
                ret.add(new ConsistencyValidatorFailureReport(v.getClass().getName(), "The validator '"
                    + v.getClass().getName() + "' is required by the synchronizer '" + synchronizerClass
                    + "' but was not found in the export file."));
            }
        }
       
        //don't bother checking if there are inconsistencies in the export file
        if (!ret.isEmpty()) {
            return ret;
        }
       
        boolean configured = false;
        Configuration importConfiguration = importConfigurations.get(synchronizerClass);

        Set<EntityValidator<X>> validators = null;
       
        //the passed in configuration has precedence over the default one inlined in
        //the config file.
        if (importConfiguration != null) {
            importer.configure(importConfiguration);
            validators = importer.getEntityValidators();
            for(EntityValidator<X> v : validators) {
                v.initialize(subject, entityManager);
            }
            configured = true;
        }
       
        while (rdr.hasNext()) {
            boolean bailout = false;
            switch (rdr.next()) {
            case XMLStreamConstants.START_ELEMENT:
                if (SynchronizationConstants.DEFAULT_CONFIGURATION_ELEMENT.equals(rdr.getName().getLocalPart())) {
                    if (!configured) {
                        importConfiguration = getDefaultConfiguration(rdr);
                    }
                } else if (SynchronizationConstants.DATA_ELEMENT.equals(rdr.getName().getLocalPart())) {
                   
                    //first check if the configure method has been called
                    if (!configured) {
                        importer.configure(importConfiguration);
                        validators = importer.getEntityValidators();
                        for(EntityValidator<X> v : validators) {
                            v.initialize(subject, entityManager);
                        }
                        configured = true;
                    }
                   
                    //now do the validation

                    rdr.nextTag();
                    X exportedEntity = importer.unmarshallExportedEntity(new ExportReader(rdr));                   
                   
                    for (EntityValidator<X> validator : validators) {
                        try {
                            validator.validateExportedEntity(exportedEntity);
                        } catch (Exception e) {
                            ValidationException v = new ValidationException("Failed to validate entity ["
                                + exportedEntity + "]", e);
                            ret.add(new ConsistencyValidatorFailureReport(validator.getClass().getName(),
                                printExceptionToString(v)));
                        }
                    }
                }
                break;
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.sync.ConsistencyValidatorFailureReport

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.