org.rhq.enterprise.server.sync.validators
Interface ConsistencyValidator

All Known Implementing Classes:
DeployedAgentPluginsValidator

public interface ConsistencyValidator

Implementations of this interface can export a state and validate that the exported state is consistent with the environment the export is being imported to.

Think about the necessity of the two RHQ installations having the same plugins deployed so that the metric templates can be fully matched between them.

The validators are required to have a public no-arg constructor. If some configuration settings are required to be transfered over to the target installation, the implementation is free to include such data in the XML during the exportState(ExportWriter) method.

Author:
Lukas Krejci

Method Summary
 void exportState(ExportWriter writer)
          Exports the state this checker needs validated later on.
 void initialize(org.rhq.core.domain.auth.Subject subject, javax.persistence.EntityManager entityManager)
          Initializes the validator with the current authentication info and access to database.
 void initializeExportedStateValidation(ExportReader reader)
          This method initializes the consistency checker to perform the validateExportedState() method later on.
 void validateExportedState()
          Validates that the current RHQ installation is consistent with the state mandated during the export.
 

Method Detail

initialize

void initialize(org.rhq.core.domain.auth.Subject subject,
                javax.persistence.EntityManager entityManager)
Initializes the validator with the current authentication info and access to database. This method is only called during import.

Parameters:
subject - the currently authenticated user
entityManager - the entity manager that can be used to access the database if the validator needs to do so.

exportState

void exportState(ExportWriter writer)
                 throws XMLStreamException
Exports the state this checker needs validated later on. This method is being called during the export to capture that aspects of system that need to be satisfied on the target system.

Parameters:
writer -
Throws:
XMLStreamException

initializeExportedStateValidation

void initializeExportedStateValidation(ExportReader reader)
                                       throws XMLStreamException
This method initializes the consistency checker to perform the validateExportedState() method later on.

This method is called during import and the reader points to a structure previously stored by the exportState(ExportWriter) method on the source RHQ installation.

Parameters:
reader -
Throws:
XMLStreamException

validateExportedState

void validateExportedState()
                           throws InconsistentStateException
Validates that the current RHQ installation is consistent with the state mandated during the export.

This method is only ever called after the #initializeExportedStateValidation(XMLStreamReader) is invoked.

Throws:
InconsistentStateException - in case of failed consistency check


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.