data
Class PropsManager

java.lang.Object
  extended by data.PropsManager

public class PropsManager
extends java.lang.Object

Singleton class that allows save and retrieve properties

Version:
1.0
Author:
Oscar Flores

Field Summary
private  java.util.Properties props
          Instance of properties we will use
private static java.lang.String propsPath
          File wich contain the properties.
private static PropsManager ref
          Reference of standalone class
 
Constructor Summary
private PropsManager()
          Singleton class.
 
Method Summary
static void checkProps()
          This method checks if there is a prop. file and a valid data folder.
 java.lang.Object clone()
           
static PropsManager getInstance()
          Return the singleton instance of this class
static java.lang.String getProp(java.lang.String key)
          Gets the property in the current file
 void loadProps()
          Loads previously saved Properties
static void removeProp(java.lang.String key)
          Removes a property from the current loaded instance
static void saveProps()
          Saves the current Properties
static void setProp(java.lang.String key, java.lang.String value)
          Sets a key with a value in the Props.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ref

private static PropsManager ref
Reference of standalone class


propsPath

private static java.lang.String propsPath
File wich contain the properties. Hidden in user home folder


props

private java.util.Properties props
Instance of properties we will use

Constructor Detail

PropsManager

private PropsManager()
Singleton class. Private constructor

Method Detail

checkProps

public static void checkProps()
This method checks if there is a prop. file and a valid data folder. If something there isn't in place, it will launch the First Run Dialog and will regenerate all.


loadProps

public void loadProps()
               throws java.io.IOException
Loads previously saved Properties

Throws:
java.io.IOException - if something wrong

saveProps

public static void saveProps()
                      throws java.io.IOException
Saves the current Properties

Throws:
java.io.IOException - if something wrong

setProp

public static void setProp(java.lang.String key,
                           java.lang.String value)
Sets a key with a value in the Props.

Parameters:
key - Key of the item
value - Value of the item

removeProp

public static void removeProp(java.lang.String key)
Removes a property from the current loaded instance

Parameters:
key - Key of the item to be deleted

getProp

public static java.lang.String getProp(java.lang.String key)
Gets the property in the current file

Parameters:
key - Key of the property
Returns:
Value of the property

getInstance

public static PropsManager getInstance()
Return the singleton instance of this class

Returns:
singleton class

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException