Class AbstractStore<T>
java.lang.Object
org.wso2.carbon.mediation.initializer.persistence.AbstractStore<T>
- Type Parameters:
T-
- Direct Known Subclasses:
APIStore,EndpointStore,EndpointTemplateStore,EventSourceStore,ExecutorStore,ImportStore,InboundStore,LocalEntryStore,MessageProcessorStore,MessageStoreStore,ProxyServiceStore,SequenceStore,StartupStore,SynapseRegistryStore,TemplateStore
The abstract class which can be used to access a persistence storage of a
specific type of mediation configuration elements. Implementations of this
abstract class should ideally be parameterized to prevent it from handling
more than one type of objects. This abstract class provides supports basic
persistence activities of save and delete. Registry persistence activities
can also be handled by this implementation if required.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected org.apache.commons.logging.Logprotected org.apache.synapse.config.xml.MultiXMLConfigurationSerializer -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected abstract voiddeleteFile(String fileName, org.apache.synapse.config.SynapseConfiguration config) Delete the specified file from the persistence store.protected abstract StringgetFileName(T obj) Inspect the given object and find the file name to which it should be serialized toprotected abstract TgetObjectToPersist(String name, org.apache.synapse.config.SynapseConfiguration config) Find the specified object from the SynaspeConfiguration to be saved to the persistence storeprotected voidhandleException(String msg, Exception e) voidprotected abstract org.apache.axiom.om.OMElementsaveToFile(T obj, org.apache.synapse.config.SynapseConfiguration synapseConfig) Serialize and save the given object to the local file systemprotected abstract org.apache.axiom.om.OMElementSerialize the given object into XML
-
Field Details
-
log
protected org.apache.commons.logging.Log log -
configPath
-
serializer
protected org.apache.synapse.config.xml.MultiXMLConfigurationSerializer serializer
-
-
Constructor Details
-
AbstractStore
-
-
Method Details
-
save
-
delete
-
saveToFile
protected abstract org.apache.axiom.om.OMElement saveToFile(T obj, org.apache.synapse.config.SynapseConfiguration synapseConfig) Serialize and save the given object to the local file system- Parameters:
obj- Object to be savedsynapseConfig- synapse configuration- Returns:
- The OMElement generated as a result of the serialization or null
-
deleteFile
protected abstract void deleteFile(String fileName, org.apache.synapse.config.SynapseConfiguration config) Delete the specified file from the persistence store. File name is provided as an argument and it is up to the implementation to the calculate the exact file path using the file name and other available data.- Parameters:
fileName- Name of the file to be deletedconfig- synapse configuration
-
getObjectToPersist
protected abstract T getObjectToPersist(String name, org.apache.synapse.config.SynapseConfiguration config) Find the specified object from the SynaspeConfiguration to be saved to the persistence store- Parameters:
name- Name or unique ID of the objectconfig- Current SynapseConfiguration- Returns:
- The named object or null if such an object doesn't exist
-
getFileName
Inspect the given object and find the file name to which it should be serialized to- Parameters:
obj- The object to be inspected- Returns:
- A file name as a string or null if no file name is specified
-
serialize
Serialize the given object into XML- Parameters:
obj- The object to be serialized- Returns:
- The resulting OMElement
-
handleException
-