Class MediationPersistenceManager
java.lang.Object
org.wso2.carbon.mediation.initializer.persistence.MediationPersistenceManager
Manages all persistence activities related to mediation configuration. Takes care
of saving configurations to the file system, registry and updating such configurations
as and when necessary. All the mediation components (proxy services, sequences etc)
should use this implementation to handle their persistence requirements. This class
does not immediately carry out persistence requests. Requests are first queued up and
then executed as batch jobs. Therefore admin services which initiate persistence
requests does not have to 'wait' for disk and network I/O often associated with
persistence activities. This improves the UI response times and system usability
in a great deal.
-
Constructor Summary
ConstructorsConstructorDescriptionMediationPersistenceManager(String configPath, org.apache.synapse.config.SynapseConfiguration synapseConfiguration, long interval, String configName) Initialize the mediation persistence manager instance and start accepting and processing persistence requests. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCAppArtifactsAfterPersist(org.apache.synapse.config.SynapseConfiguration synapseConfiguration, org.apache.synapse.config.SynapseConfiguration cAppConfig) Add the CApp artifact configuration to the current configuration, after persist the other artifacts into the default locationvoiddeleteItem(String name, String fileName, int itemType) Delete a particular item in the saved mediation configuration.voiddestroy()protected LockgetLock(org.apache.axis2.engine.AxisConfiguration axisConfig) booleanorg.apache.synapse.config.SynapseConfigurationremoveCAppArtifactsBeforePersist(org.apache.synapse.config.SynapseConfiguration synapseConfiguration) voidsaveFullConfiguration(boolean registryOnly) Make a request to save the complete mediation configuration (the entire SynapseConfiguration) to be saved to the file system and the registry.voidSave changes made to a particular item of the mediation configuration.
-
Constructor Details
-
MediationPersistenceManager
public MediationPersistenceManager(String configPath, org.apache.synapse.config.SynapseConfiguration synapseConfiguration, long interval, String configName) Initialize the mediation persistence manager instance and start accepting and processing persistence requests. Persistence requests are carried out on the local file system and if required on the registry as well.- Parameters:
configPath- Path to the file/directory where configuration should be saved insynapseConfiguration- synapse configuration to be usedinterval- The wait time for the mediation persistence worker threadconfigName- Name of the configuration to be used
-
-
Method Details
-
destroy
public void destroy() -
isInitialized
public boolean isInitialized() -
saveItem
Save changes made to a particular item of the mediation configuration. Changes are saved to the local file system and if required to the registry as well. Types of supported mediation configuration items are defined in ServiceBusConstants. If the item to be saved should be written to its own configuration file, the file name attribute must be set on the item (in the SynapseConfiguration). Leaving the file name as null will cause the item to be persisted into the top level synapse.xml file.- Parameters:
name- Name/ID of the configuration itemitemType- type of the configuration item
-
deleteItem
Delete a particular item in the saved mediation configuration. Item is removed from the local file system and if required to the registry as well. Types of supported mediation configuration items are defined in ServiceBusConstants.- Parameters:
name- Name/ID of the configuration itemfileName- Name of the file where the item is currently saved initemType- Type of the configuration item
-
saveFullConfiguration
public void saveFullConfiguration(boolean registryOnly) Make a request to save the complete mediation configuration (the entire SynapseConfiguration) to be saved to the file system and the registry. This will remove all the existing requests already in the job queue and add a single new entry.- Parameters:
registryOnly- Whether or not to save the configuration to the registry only
-
addCAppArtifactsAfterPersist
public void addCAppArtifactsAfterPersist(org.apache.synapse.config.SynapseConfiguration synapseConfiguration, org.apache.synapse.config.SynapseConfiguration cAppConfig) Add the CApp artifact configuration to the current configuration, after persist the other artifacts into the default location- Parameters:
synapseConfiguration- Current ConfigurationcAppConfig- CApp artifact configuration
-
removeCAppArtifactsBeforePersist
public org.apache.synapse.config.SynapseConfiguration removeCAppArtifactsBeforePersist(org.apache.synapse.config.SynapseConfiguration synapseConfiguration) - Parameters:
synapseConfiguration- Contains all the configuration includes CApp artifact configs- Returns:
- new Configuration which removes all the CApp related configs
-
getLock
-