public class PersistenceManager
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
void |
backupConfigFiles()
Proceed with a backup.
|
static boolean |
canWrite(java.io.File file)
Test if it is possible to write to a certain file/directory.
|
static java.io.File |
getConfigDir()
Get configuration directory
|
static java.io.File |
getDataDir()
Get data directory
|
java.io.File |
getLogFile()
Get file used for logging
|
static void |
instantiate()
Create instance of PersistenceManager.
|
boolean |
isFirstInstance()
Checks if this is the first instance of the program.
|
void |
loadConfig()
Load program configuration
|
void |
loadContacts()
Load contacts
|
void |
loadGatewayProperties()
Load gateway properties.
|
void |
loadGateways()
Load gateways
|
void |
loadHistory()
Load sms history
|
void |
loadKeyring()
Load keyring.
|
void |
loadQueue()
Load sms queue
|
void |
saveConfig()
Save program configuration
|
void |
saveContacts()
Save contacts
|
void |
saveGateway(java.lang.String scriptName,
java.lang.String scriptContents,
byte[] icon)
Save new gateway to file.
|
void |
saveGatewayProperties()
Save gateway properties.
|
void |
saveHistory()
Save sms history
|
void |
saveKeyring()
Save keyring.
|
void |
saveQueue()
Save sms queue
|
static void |
setCustomDirs(java.lang.String configDir,
java.lang.String dataDir)
Set custom directories
|
public static java.io.File getConfigDir()
public static java.io.File getDataDir()
public static void setCustomDirs(java.lang.String configDir, java.lang.String dataDir)
public static void instantiate() throws java.io.IOException
java.io.IOException
- could not read/write configuration files/directoriespublic java.io.File getLogFile()
public void saveConfig() throws java.io.IOException
java.io.IOException
public void loadConfig() throws java.lang.Exception
java.lang.Exception
public void saveContacts() throws java.io.IOException
java.io.IOException
public void loadContacts() throws java.lang.Exception
java.lang.Exception
public void saveQueue() throws java.io.IOException
java.io.IOException
public void loadQueue() throws java.lang.Exception
java.lang.Exception
public void saveHistory() throws java.io.IOException
java.io.IOException
public void loadHistory() throws java.lang.Exception
java.lang.Exception
public void saveKeyring() throws java.lang.Exception
java.lang.Exception
public void loadKeyring() throws java.lang.Exception
java.lang.Exception
public void loadGateways() throws java.io.IOException, java.beans.IntrospectionException, org.xml.sax.SAXException
java.io.IOException
- When there is problem accessing gateway directory or filesjava.beans.IntrospectionException
- When current JRE does not support JavaScript executionorg.xml.sax.SAXException
- When related XML files are not validpublic void saveGateway(java.lang.String scriptName, java.lang.String scriptContents, byte[] icon) throws java.io.IOException
scriptName
- name of the gateway/script (without suffix), not null nor emptyscriptContents
- contents of the gateway script file, not null nor emptyicon
- gateway icon, may be nulljava.io.IOException
public void loadGatewayProperties() throws java.lang.Exception
java.lang.Exception
public void saveGatewayProperties() throws java.lang.Exception
java.lang.Exception
public boolean isFirstInstance()
public void backupConfigFiles() throws java.io.IOException
java.io.IOException
public static boolean canWrite(java.io.File file)
file
- File, existing or not existing; not null