Class MetadataFileHandler
- java.lang.Object
-
- org.wso2.carbon.logging.appender.http.utils.queue.MetadataFileHandler
-
public class MetadataFileHandler extends Object
This class is used to handle the metadata file of the queue.
-
-
Constructor Summary
Constructors Constructor Description MetadataFileHandler(String filePath)
Constructor of the MetadataFileHandler class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addJsonArray(String key, com.google.gson.JsonArray value)
Adds an array to the metadata file.void
close()
Closes the metadata file.Optional<com.google.gson.JsonArray>
getAsJsonArray(String key)
Returns the value of the given key.boolean
isInitialized()
Returns if the metadata file is initialized.void
setIsInitialized(boolean isInitialized)
Sets if the metadata file is initialized.
-
-
-
Constructor Detail
-
MetadataFileHandler
public MetadataFileHandler(String filePath) throws PersistentQueueException
Constructor of the MetadataFileHandler class.- Parameters:
filePath
- path of the metadata file.- Throws:
PersistentQueueException
- if an error occurs while creating the metadata file.
-
-
Method Detail
-
getAsJsonArray
public Optional<com.google.gson.JsonArray> getAsJsonArray(String key)
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
public void close() throws PersistentQueueException
Closes the metadata file.- Throws:
PersistentQueueException
- if an error occurs while closing the metadata file.
-
-