Class MetadataFileHandler
java.lang.Object
org.wso2.carbon.logging.appender.http.utils.queue.MetadataFileHandler
This class is used to handle the metadata file of the queue.
-
Constructor Summary
ConstructorsConstructorDescriptionMetadataFileHandler(String filePath) Constructor of the MetadataFileHandler class. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddJsonArray(String key, com.google.gson.JsonArray value) Adds an array to the metadata file.voidclose()Closes the metadata file.Optional<com.google.gson.JsonArray> getAsJsonArray(String key) Returns the value of the given key.booleanReturns if the metadata file is initialized.voidsetIsInitialized(boolean isInitialized) Sets if the metadata file is initialized.
-
Constructor Details
-
MetadataFileHandler
Constructor of the MetadataFileHandler class.- Parameters:
filePath- path of the metadata file.- Throws:
PersistentQueueException- if an error occurs while creating the metadata file.
-
-
Method Details
-
getAsJsonArray
Returns the value of the given key.- Parameters:
key- key of the value.- Returns:
- value of the given key.
-
addJsonArray
public void addJsonArray(String key, com.google.gson.JsonArray value) throws PersistentQueueException Adds an array to the metadata file.- Parameters:
key- key of the array.value- array to be added to metadata file.- Throws:
PersistentQueueException- if an error occurs while adding the array to the metadata file.
-
isInitialized
public boolean isInitialized()Returns if the metadata file is initialized.- Returns:
- boolean if the metadata file is initialized.
-
setIsInitialized
public void setIsInitialized(boolean isInitialized) Sets if the metadata file is initialized.- Parameters:
isInitialized- boolean if the metadata file is initialized.
-
close
Closes the metadata file.- Throws:
PersistentQueueException- if an error occurs while closing the metadata file.
-