org.rhq.enterprise.server.sync.validators
Class DeployedAgentPluginsValidator

java.lang.Object
  extended by org.rhq.enterprise.server.sync.validators.DeployedAgentPluginsValidator
All Implemented Interfaces:
ConsistencyValidator

public class DeployedAgentPluginsValidator
extends Object
implements ConsistencyValidator

This implementation checks that the two installations have the exact same plugins deployed. Note that this class is currently not used by any synchronizer but exists for "demo" purposes.

Author:
Lukas Krejci

Nested Class Summary
static class DeployedAgentPluginsValidator.ConsistentPlugin
           
 
Constructor Summary
DeployedAgentPluginsValidator()
           
DeployedAgentPluginsValidator(PluginManagerLocal pluginManager)
           
 
Method Summary
 boolean equals(Object obj)
           
 void exportState(ExportWriter writer)
          Exports the state this checker needs validated later on.
 Set<DeployedAgentPluginsValidator.ConsistentPlugin> getPluginsToValidate()
          Provided for testability
 int hashCode()
           
 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 ConsistencyValidator.validateExportedState() method later on.
 void setPluginsToValidate(Set<DeployedAgentPluginsValidator.ConsistentPlugin> pluginsToValidate)
          Provided for testability
 void validateExportedState()
          Validates that the current RHQ installation is consistent with the state mandated during the export.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeployedAgentPluginsValidator

public DeployedAgentPluginsValidator()

DeployedAgentPluginsValidator

public DeployedAgentPluginsValidator(PluginManagerLocal pluginManager)
Method Detail

getPluginsToValidate

public Set<DeployedAgentPluginsValidator.ConsistentPlugin> getPluginsToValidate()
Provided for testability

Returns:
the pluginsToValidate

setPluginsToValidate

public void setPluginsToValidate(Set<DeployedAgentPluginsValidator.ConsistentPlugin> pluginsToValidate)
Provided for testability

Parameters:
pluginsToValidate - the pluginsToValidate to set

initialize

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

Specified by:
initialize in interface ConsistencyValidator
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

public void exportState(ExportWriter writer)
                 throws XMLStreamException
Description copied from interface: ConsistencyValidator
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.

Specified by:
exportState in interface ConsistencyValidator
Throws:
XMLStreamException

initializeExportedStateValidation

public void initializeExportedStateValidation(ExportReader reader)
                                       throws XMLStreamException
Description copied from interface: ConsistencyValidator
This method initializes the consistency checker to perform the ConsistencyValidator.validateExportedState() method later on.

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

Specified by:
initializeExportedStateValidation in interface ConsistencyValidator
Throws:
XMLStreamException

validateExportedState

public void validateExportedState()
                           throws InconsistentStateException
Description copied from interface: ConsistencyValidator
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.

Specified by:
validateExportedState in interface ConsistencyValidator
Throws:
InconsistentStateException - in case of failed consistency check

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object


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