org.rhq.enterprise.server.sync
Class SynchronizationManagerBean

java.lang.Object
  extended by org.rhq.enterprise.server.sync.SynchronizationManagerBean
All Implemented Interfaces:
SynchronizationManagerLocal, SynchronizationManagerRemote

public class SynchronizationManagerBean
extends Object
implements SynchronizationManagerLocal, SynchronizationManagerRemote

Author:
Lukas Krejci

Constructor Summary
SynchronizationManagerBean()
           
 
Method Summary
 org.rhq.core.domain.sync.ExportReport exportAllSubsystems(org.rhq.core.domain.auth.Subject subject)
          Don't use this method if you access it from the same JVM.
 org.rhq.core.domain.sync.ExportWrapper exportAllSubsystemsLocally(org.rhq.core.domain.auth.Subject subject)
          This method returns an export wrapper that contains the structure to contain the future messages from the export process and an input stream that is going to create the export (and fill in the messages) while it is being read.
 org.rhq.core.domain.sync.ImportConfigurationDefinition getImportConfigurationDefinition(String synchronizerClass)
          Returns the configuration definition of the import for synchronizer of given type.
 List<org.rhq.core.domain.sync.ImportConfigurationDefinition> getImportConfigurationDefinitionOfAllSynchronizers()
          Returns the configuration definitions of all known importers.
 org.rhq.core.domain.sync.ImportReport importAllSubsystems(org.rhq.core.domain.auth.Subject subject, byte[] exportFile, List<org.rhq.core.domain.sync.ImportConfiguration> configurations)
          Imports everything from the export file.
 org.rhq.core.domain.sync.ImportReport importAllSubsystems(org.rhq.core.domain.auth.Subject subject, InputStream exportFile, List<org.rhq.core.domain.sync.ImportConfiguration> configurations)
           
 void setSynchronizerFactory(SynchronizerFactory factory)
          Provided for testability reasons.
 void validate(org.rhq.core.domain.auth.Subject subject, byte[] exportFile)
           
 void validate(org.rhq.core.domain.auth.Subject subject, InputStream exportFile)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SynchronizationManagerBean

public SynchronizationManagerBean()
Method Detail

setSynchronizerFactory

public void setSynchronizerFactory(SynchronizerFactory factory)
Description copied from interface: SynchronizationManagerLocal
Provided for testability reasons. DON'T USE OUTSIDE TESTS.

Using this method one can provide a custom factory for Synchronizers. This way one can export/import different types of entities than by default.

Specified by:
setSynchronizerFactory in interface SynchronizationManagerLocal

exportAllSubsystems

public org.rhq.core.domain.sync.ExportReport exportAllSubsystems(org.rhq.core.domain.auth.Subject subject)
Description copied from interface: SynchronizationManagerLocal
Don't use this method if you access it from the same JVM. The #exportAllSubsystemsLocally() is more memory efficient.

This method executes the export of all subsystems and serializes the data into an byte array.

Specified by:
exportAllSubsystems in interface SynchronizationManagerLocal
Specified by:
exportAllSubsystems in interface SynchronizationManagerRemote
Parameters:
subject - the logged in user
Returns:
the export report
See Also:
SynchronizationManagerRemote#exportAllSubsystems()

exportAllSubsystemsLocally

public org.rhq.core.domain.sync.ExportWrapper exportAllSubsystemsLocally(org.rhq.core.domain.auth.Subject subject)
Description copied from interface: SynchronizationManagerLocal
This method returns an export wrapper that contains the structure to contain the future messages from the export process and an input stream that is going to create the export (and fill in the messages) while it is being read.

This minimizes the memory needed to hold the export data to just 64K (the size of the buffer to hold the data). The memory consumption will of course be also determined by the amount of data being read from the database but the point is that not all the data will be held in memory (because the exporters for various subsystems will be called in sequence) and that the data doesn't have to reside in the memory in two forms - the internal datastructures AND the serialized form of the export file that it is going to be transfered as.

Specified by:
exportAllSubsystemsLocally in interface SynchronizationManagerLocal
Parameters:
subject - the logged in user that has Permission.MANAGE_INVENTORY permission
Returns:
a wrapper using which one can read the export file "lazily".

importAllSubsystems

public org.rhq.core.domain.sync.ImportReport importAllSubsystems(org.rhq.core.domain.auth.Subject subject,
                                                                 InputStream exportFile,
                                                                 List<org.rhq.core.domain.sync.ImportConfiguration> configurations)
                                                          throws ValidationException,
                                                                 ImportException
Specified by:
importAllSubsystems in interface SynchronizationManagerLocal
Throws:
ValidationException
ImportException

importAllSubsystems

public org.rhq.core.domain.sync.ImportReport importAllSubsystems(org.rhq.core.domain.auth.Subject subject,
                                                                 byte[] exportFile,
                                                                 List<org.rhq.core.domain.sync.ImportConfiguration> configurations)
                                                          throws ValidationException,
                                                                 ImportException
Description copied from interface: SynchronizationManagerRemote
Imports everything from the export file.

Specified by:
importAllSubsystems in interface SynchronizationManagerLocal
Specified by:
importAllSubsystems in interface SynchronizationManagerRemote
Parameters:
subject - the authenticated user
exportFile - the contents of the export file
configurations - the configurations of individual importers to be used when importing or null if the default configurations should be used for all the importers.
Returns:
the report describing the result of the import
Throws:
ValidationException
ImportException
See Also:
SynchronizationManagerRemote#importAllSubsystems(Subject, byte[], Set)

validate

public void validate(org.rhq.core.domain.auth.Subject subject,
                     InputStream exportFile)
              throws ValidationException
Specified by:
validate in interface SynchronizationManagerLocal
Throws:
ValidationException

validate

public void validate(org.rhq.core.domain.auth.Subject subject,
                     byte[] exportFile)
              throws ValidationException
Specified by:
validate in interface SynchronizationManagerLocal
Specified by:
validate in interface SynchronizationManagerRemote
Throws:
ValidationException
See Also:
SynchronizationManagerRemote.validate(Subject, byte[])

getImportConfigurationDefinition

public org.rhq.core.domain.sync.ImportConfigurationDefinition getImportConfigurationDefinition(String synchronizerClass)
Description copied from interface: SynchronizationManagerRemote
Returns the configuration definition of the import for synchronizer of given type.

Specified by:
getImportConfigurationDefinition in interface SynchronizationManagerLocal
Specified by:
getImportConfigurationDefinition in interface SynchronizationManagerRemote
Returns:
See Also:
SynchronizationManagerRemote.getImportConfigurationDefinition(String)

getImportConfigurationDefinitionOfAllSynchronizers

public List<org.rhq.core.domain.sync.ImportConfigurationDefinition> getImportConfigurationDefinitionOfAllSynchronizers()
Description copied from interface: SynchronizationManagerRemote
Returns the configuration definitions of all known importers.

Specified by:
getImportConfigurationDefinitionOfAllSynchronizers in interface SynchronizationManagerLocal
Specified by:
getImportConfigurationDefinitionOfAllSynchronizers in interface SynchronizationManagerRemote
Returns:
See Also:
SynchronizationManagerRemote.getImportConfigurationDefinitionOfAllSynchronizers()


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