net.sourceforge.jdbdump.connect
Class Configuration

java.lang.Object
  extended by net.sourceforge.jdbdump.connect.Configuration

public class Configuration
extends java.lang.Object

This class is a Singleton, which purpose is to manage system's configuration data such as:

Data is passed to/from a subclass of ConfigurationIO class, which gives great flexibility in choose of configuration data storage place and access methods.

Author:
tymoteusz

Method Summary
 void addBackup(DatabaseBackupData dbd)
          Adds data about database backup to current configuration.
 void addDatabase(DatabaseConnectionData dcd)
          Adds data about database connection to current configuration.
 java.lang.Object clone()
          Prevents cloning the Configuration object, and therefore reduces the possibility of creating more than one object - we are avoiding such situations, becouse Configuration is implementing Singleton design pattern
 java.lang.String getBackupDir()
           
 java.util.Hashtable<java.lang.String,DatabaseBackupData> getBackups()
          Returns list of backuped databases
 java.util.Hashtable<java.lang.String,DatabaseConnectionData> getConnections()
          Returns list of configured database connections
 java.lang.String getEmail()
           
static Configuration getInstance()
          This method is the only possibility to get an instance of class Configuration.
 void loadData()
          Loads configuration data to the Configuration object
 void removeBackup(DatabaseBackupData dbd)
          Removes data about database backup from current configuration.
 void removeBackup(java.lang.String title, java.lang.String date)
          Removes data about database backup from current configuration.
 void removeDatabase(DatabaseConnectionData dbc)
          Removes data about database connection from current configuration.
 void removeDatabase(java.lang.String title)
          Removes data about database connection from current configuration.
 void saveData()
          Saves configuration storred in the Configuration object.
 boolean setAutoload(boolean value)
          Changes value of autoload setting.
 boolean setAutosave(boolean value)
          Changes value of autosave setting.
 void setEmail(java.lang.String e)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static Configuration getInstance()
                                 throws java.lang.InstantiationException,
                                        java.lang.IllegalAccessException,
                                        java.lang.ClassNotFoundException,
                                        java.io.IOException
This method is the only possibility to get an instance of class Configuration. Aim for this limitation is to keep control on object creation.

Returns:
the Singleton Configuration object;
Throws:
java.lang.ClassNotFoundException
java.lang.IllegalAccessException
java.lang.InstantiationException
java.io.IOException

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Prevents cloning the Configuration object, and therefore reduces the possibility of creating more than one object - we are avoiding such situations, becouse Configuration is implementing Singleton design pattern

Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException - if one tries to clone a Configuration object

setAutosave

public boolean setAutosave(boolean value)
Changes value of autosave setting.

Parameters:
value - new setting of the autosave flag.
Returns:
old value
See Also:
autosave, #save()

setAutoload

public boolean setAutoload(boolean value)
Changes value of autoload setting.

Parameters:
value - new setting of the autoload flag.
Returns:
old value
See Also:
autoload, #reload()

addDatabase

public void addDatabase(DatabaseConnectionData dcd)
Adds data about database connection to current configuration.

Parameters:
dcd - database connection to be added

removeDatabase

public void removeDatabase(java.lang.String title)
Removes data about database connection from current configuration.

Parameters:
title - name of database connection to be removed

removeDatabase

public void removeDatabase(DatabaseConnectionData dbc)
Removes data about database connection from current configuration.

Parameters:
dcd - database connection to be removed

addBackup

public void addBackup(DatabaseBackupData dbd)
Adds data about database backup to current configuration.

Parameters:
dcd - database backup info to be added

removeBackup

public void removeBackup(java.lang.String title,
                         java.lang.String date)
Removes data about database backup from current configuration.

Parameters:
title - name of database backup info to be removed
date - date of database backup info to be removed

removeBackup

public void removeBackup(DatabaseBackupData dbd)
Removes data about database backup from current configuration.

Parameters:
dbd - database backup info to be removed

getConnections

public java.util.Hashtable<java.lang.String,DatabaseConnectionData> getConnections()
Returns list of configured database connections

Returns:
list of configured database connections

getBackups

public java.util.Hashtable<java.lang.String,DatabaseBackupData> getBackups()
Returns list of backuped databases

Returns:
list of backuped databases

getEmail

public java.lang.String getEmail()

setEmail

public void setEmail(java.lang.String e)

saveData

public void saveData()
              throws java.io.IOException
Saves configuration storred in the Configuration object.

Throws:
java.io.IOException

loadData

public void loadData()
              throws java.io.IOException,
                     java.lang.ClassNotFoundException
Loads configuration data to the Configuration object

Throws:
java.io.IOException
java.lang.ClassNotFoundException

getBackupDir

public java.lang.String getBackupDir()


Copyright © 2005-2006 AGH International University of Science and Technology. All Rights Reserved.