org.radrails.db.core
Class YMLFile

java.lang.Object
  extended byorg.radrails.db.core.YMLFile

public class YMLFile
extends java.lang.Object

Parses a YML file and returns objects which describe how to connect to the available databases.

Version:
0.1
Author:
hgoale

Constructor Summary
YMLFile()
          Default constructor.
YMLFile(YMLFile file)
          Copy constructor.
 
Method Summary
 void addListener(IYMLFileChangeListener listener)
          Add a listener.
 java.lang.String asText()
          Gets the contents of what the YML file should be.
 DatabaseDescriptor getDbDevelopment()
          Gets the dbDevelopment.
 DatabaseDescriptor getDbProduction()
          Gets the dbProduction.
 DatabaseDescriptor getDbTest()
          Gets the dbTest.
 void load(java.io.Reader reader)
          Parses a YML file and sets the DatabaseDescriptors for this class.
 void removeListener(IYMLFileChangeListener listener)
          Remove a listener.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

YMLFile

public YMLFile()
Default constructor.


YMLFile

public YMLFile(YMLFile file)
Copy constructor.

Parameters:
file - The YMLFile to create a new YMLFile from.
Method Detail

addListener

public void addListener(IYMLFileChangeListener listener)
Add a listener.

Parameters:
listener - The IYMLFileChangeListener to add.

removeListener

public void removeListener(IYMLFileChangeListener listener)
Remove a listener.

Parameters:
listener - The IYMLFileChangeListener to remove.

getDbDevelopment

public DatabaseDescriptor getDbDevelopment()
Gets the dbDevelopment.

Returns:
Returns the dbDevelopment, or null if no development database is defined.

getDbProduction

public DatabaseDescriptor getDbProduction()
Gets the dbProduction.

Returns:
Returns the dbProduction, or null if no development database is defined.

getDbTest

public DatabaseDescriptor getDbTest()
Gets the dbTest.

Returns:
Returns the dbTest, or null if no development database is defined.

load

public void load(java.io.Reader reader)
          throws java.io.IOException
Parses a YML file and sets the DatabaseDescriptors for this class.

Throws:
java.io.FileNotFoundException - If the file could not be found.
java.io.IOException - If the file could not be parsed.

asText

public java.lang.String asText()
Gets the contents of what the YML file should be.

Returns:
A String of the contents of the file.
Throws:
java.io.FileNotFoundException - If the file can not be found.
java.io.IOException - If an error occurred during the save process.