|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.miami.romeo.main.DataIO
DataIO.
This class saves, retrieves or modifies the list of games.
Field Summary | |
protected java.sql.Connection |
conn
|
protected static java.lang.String |
dbUrl
|
javax.swing.JDialog |
dialog
|
static java.lang.String |
gameDocAvailability
|
static java.lang.String |
gameDocCategory
|
static java.lang.String |
gameDocCloneOf
|
static java.lang.String |
gameDocDescription
|
static java.lang.String |
gameDocDriver
|
static java.lang.String |
gameDocEntry
|
static java.lang.String |
gameDocFavorite
|
static java.lang.String |
gameDocIcon
|
static java.lang.String |
gameDocManufacturer
|
static java.lang.String |
gameDocName
|
static java.lang.String |
gameDocPath
|
static java.lang.String |
gameDocPlayed
|
static java.lang.String |
gameDocProductionYear
|
static java.lang.String |
gameDocRoot
|
static java.lang.String |
gameDocSample
|
static java.lang.String |
gameDocWorkingStatus
|
protected java.sql.PreparedStatement |
pstmt
|
protected java.sql.ResultSet |
rs
|
protected java.sql.Statement |
stmt
|
Constructor Summary | |
DataIO(Romeo romeo)
The constructor. |
Method Summary | |
int |
countRoms(java.lang.String xmame_path)
This method counts how many roms are available. |
protected void |
createTable(java.lang.String list_name)
This method creates a table. |
java.util.Vector |
getAvailableRoms()
This method retrieves available roms. |
protected java.util.Vector |
getData(java.lang.String xmame_path,
java.lang.String list_name)
This method returns a vector containing rom data. |
int |
getDataStoringType()
This method returns the data storing type: 0 to use xml document (default) 1 to use sql table 2 to use text file |
java.lang.String[] |
getInfoFromCatver(java.lang.String catverPath)
This method retrieves data from catver.ini |
java.lang.String[] |
getListOfAvailableRoms(java.util.Vector rom,
java.lang.String[] gameName)
This method returns an array with the same length of the game names. |
java.util.Vector |
getListOfGames(java.lang.String xmame_path,
java.lang.String list_name)
This method calls specific data retrieving void. |
java.lang.String[] |
getMamuIcons(java.lang.String[] gameName,
java.lang.String[] clone)
This method returns an array of strings with the paths to Mamu' s icons. |
java.lang.String[] |
getRomCategories(java.lang.String[] gameName)
This method retrieves a list of rom categories from catver.ini. |
java.lang.String[] |
getRomDirPaths()
This method gets the paths to the rom directories and then put them into an array of strings. |
java.io.File[] |
getRomDirs()
This method puts the rom dirs set by the user into an array of files. |
java.lang.String[] |
getRomPaths(java.util.Vector rom,
java.lang.String[] gameName)
This method returns the list of absolute paths for each game. |
protected java.util.Vector |
getSQLData(java.lang.String list_name)
This method retrieves the list of game from a MySQL' s table. |
protected java.util.Vector |
getTextData(java.lang.String list_name)
This method returns a vector containing data taken from a text file. |
protected java.util.Vector |
getXMLData(java.lang.String list_name)
This method returns a vector containing data taken from a XML Document |
org.dom4j.Document |
getXMLDoc(java.net.URL url)
This method returns the list of games document. |
boolean |
listOfGamesExists(java.lang.String xmame_path,
java.lang.String list_name)
This method returns true if the list of games exists, false otherwise. |
void |
listOfGamesWalk(org.dom4j.Document document)
We have to walk a large XML document tree (the list of games) then for performance we have to use a fast looping method which avoids the cost of creating an Iterator object for each loop. |
void |
listOfGamesWalk(org.dom4j.Document document,
org.dom4j.Element element)
We have to walk a large XML document tree (the list of games) then for performance we have to use a fast looping method which avoids the cost of creating an Iterator object for each loop. |
java.util.Vector |
saveListOfGames(java.lang.String xmame_path,
java.lang.String list_name)
This method saves a new list of games and returns it in a Vector. |
protected java.util.Vector |
saveSQLTable(java.lang.String xmame_path,
java.lang.String list_name,
java.lang.String list,
boolean listExists)
This method saves rom data into a MySQL' s table and returns a vector. |
protected java.util.Vector |
saveTextFile(java.lang.String xmame_path,
java.lang.String list_name)
This method saves rom data into a text file. |
protected java.util.Vector |
saveXMLDocument(java.lang.String xmame_path,
java.lang.String list_name)
This method saves rom data into a xml document and returns a vector. |
java.lang.String[] |
scanMamuDir(java.lang.String prefix)
This method scans Mamu dir and retrieves paths to available icons. |
protected void |
setUp()
This method creates resources used by getSQLData() & saveSQLTable() |
void |
showUpdateDialog()
This method creates a JDialog to show the saving process. |
protected boolean |
SQLTableExists(java.lang.String list_name,
java.lang.String table_created)
This method returns true if the SQL table exists, false otherwise. |
void |
tearDown()
This method destroys resources created during the I/O operations. |
protected boolean |
textFileExists(java.lang.String list_name)
This method returns true if the text file exists, false otherwise. |
void |
updateListOfGames(java.util.Vector vector,
java.lang.String xmame_path,
java.lang.String list_name)
This method updates the list of games. |
protected void |
updateSQLTable(java.util.Vector vector,
java.lang.String xmame_path,
java.lang.String list_name)
This method saves rom data into a MySQL' s table and returns a vector. |
protected void |
updateTextFile(java.util.Vector vector,
java.lang.String xmame_path,
java.lang.String list_name)
This method updates the text file. |
protected void |
updateXMLDocument(java.util.Vector vector,
java.lang.String xmame_path,
java.lang.String list_name)
This method saves rom data into a xml document and returns a vector. |
protected boolean |
XMLDocumentExists(java.lang.String list_name)
This method returns true if the XML Document exists, false otherwise. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public javax.swing.JDialog dialog
public static java.lang.String gameDocRoot
public static java.lang.String gameDocEntry
public static java.lang.String gameDocAvailability
public static java.lang.String gameDocDescription
public static java.lang.String gameDocName
public static java.lang.String gameDocProductionYear
public static java.lang.String gameDocManufacturer
public static java.lang.String gameDocWorkingStatus
public static java.lang.String gameDocCloneOf
public static java.lang.String gameDocFavorite
public static java.lang.String gameDocDriver
public static java.lang.String gameDocCategory
public static java.lang.String gameDocSample
public static java.lang.String gameDocPlayed
public static java.lang.String gameDocPath
public static java.lang.String gameDocIcon
protected java.sql.Connection conn
protected java.sql.ResultSet rs
protected java.sql.Statement stmt
protected java.sql.PreparedStatement pstmt
protected static java.lang.String dbUrl
Constructor Detail |
public DataIO(Romeo romeo)
romeo
- The main classMethod Detail |
public java.util.Vector saveListOfGames(java.lang.String xmame_path, java.lang.String list_name) throws java.lang.InterruptedException
xmame_path
- The path to the xmame executablelist_name
- The name of the list
java.lang.InterruptedException
showUpdateDialog()
,
getDataStoringType()
,
saveXMLDocument(String, String)
,
saveSQLTable(String, String, String, boolean)
,
saveTextFile(String, String)
public void showUpdateDialog()
UpdateDialog.getDialog()
public boolean listOfGamesExists(java.lang.String xmame_path, java.lang.String list_name)
xmame_path
- The path to xmamelist_name
- The name of the list
True
if the list of games exists,
false
otherwiseXMLDocumentExists(String)
,
SQLTableExists(String, String)
,
textFileExists(String)
public void updateListOfGames(java.util.Vector vector, java.lang.String xmame_path, java.lang.String list_name)
vector
- The Vector containing rom dataxmame_path
- The path to the xmame executablelist_name
- The name of the listgetDataStoringType()
,
updateXMLDocument(Vector, String, String)
,
updateSQLTable(Vector, String, String)
,
updateTextFile(Vector, String, String)
public java.util.Vector getListOfGames(java.lang.String xmame_path, java.lang.String list_name)
xmame_path
- The path to xmamelist_name
- The list name
Vector
containing rom datagetXMLData(String)
,
getSQLData(String)
,
getTextData(String)
public int getDataStoringType()
protected boolean XMLDocumentExists(java.lang.String list_name)
list_name
- The list name
True
if the XML Document exists,
false
otherwiseprotected java.util.Vector saveXMLDocument(java.lang.String xmame_path, java.lang.String list_name)
xmame_path
- The path to xmamelist_name
- The name of the list
vector
containing rom datagetData(String, String)
protected void updateXMLDocument(java.util.Vector vector, java.lang.String xmame_path, java.lang.String list_name)
vector
- The Vector
containing rom dataxmame_path
- The path to xmamelist_name
- The name of the list
vector
containing rom dataprotected java.util.Vector getXMLData(java.lang.String list_name)
list_name
- The name of the list of games
vector
containing rom datapublic org.dom4j.Document getXMLDoc(java.net.URL url) throws org.dom4j.DocumentException
url
- The list of games
Document
org.dom4j.DocumentException
public void listOfGamesWalk(org.dom4j.Document document)
document
- The document we want to walklistOfGamesWalk(Document, Element)
public void listOfGamesWalk(org.dom4j.Document document, org.dom4j.Element element)
document
- The document we want to walkelement
- The element to findprotected boolean SQLTableExists(java.lang.String list_name, java.lang.String table_created)
list_name
- The list nametable_created
- This String contains the names of the tables created
True
if the SQL table exists,
false
otherwiseprotected java.util.Vector saveSQLTable(java.lang.String xmame_path, java.lang.String list_name, java.lang.String list, boolean listExists)
xmame_path
- The path to xmamelist_name
- The list name used by other data storing typeslist
- The list namelistExists
- True if the list exists, false otherwise
vector
containing rom datasetUp()
,
tearDown()
protected void updateSQLTable(java.util.Vector vector, java.lang.String xmame_path, java.lang.String list_name)
vector
- The vector conatining the data to savexmame_path
- The path to xmamelist_name
- The list name
vector
containing rom datasetUp()
,
tearDown()
protected java.util.Vector getSQLData(java.lang.String list_name)
list_name
- The list name
vector
containing game datasetUp()
,
tearDown()
protected void setUp() throws java.lang.Exception
Exception
- if an error occurs
java.lang.Exception
protected void createTable(java.lang.String list_name) throws java.lang.Exception
list_name
- The list name
Exception
- if an error occurs
java.lang.Exception
public void tearDown() throws java.lang.Exception
Exception
- DOCUMENT ME!
java.lang.Exception
protected boolean textFileExists(java.lang.String list_name)
list_name
- The list name
True
if the text file exists,
false
otherwiseprotected java.util.Vector saveTextFile(java.lang.String xmame_path, java.lang.String list_name)
xmame_path
- The path to xmamelist_name
- The name of the list
vector
containing game dataprotected void updateTextFile(java.util.Vector vector, java.lang.String xmame_path, java.lang.String list_name)
vector
- The vector conatining the data to savexmame_path
- The path to xmamelist_name
- The name of the list
vector
containing game dataprotected java.util.Vector getTextData(java.lang.String list_name)
list_name
- The name of the list of games
Vector
protected java.util.Vector getData(java.lang.String xmame_path, java.lang.String list_name)
xmame_path
- The path to the xmame executablelist_name
- The path to the list of games
Vector
of rom datapublic java.lang.String[] getMamuIcons(java.lang.String[] gameName, java.lang.String[] clone)
gameName
- The game namesclone
- The list of clones
public java.lang.String[] scanMamuDir(java.lang.String prefix)
public int countRoms(java.lang.String xmame_path)
number (int)
of available romsgetAvailableRoms()
public java.lang.String[] getListOfAvailableRoms(java.util.Vector rom, java.lang.String[] gameName)
rom
- A Vector filled with the available games and their absolute pathgameName
- The list of game names
list
of game availabilitypublic java.lang.String[] getRomPaths(java.util.Vector rom, java.lang.String[] gameName)
rom
- A Vector filled with the available games and their absolute pathgameName
- The list of game names
list
of absolute path for the each gamepublic java.util.Vector getAvailableRoms()
list
of available gamesgetRomDirs()
public java.io.File[] getRomDirs()
list
of rom directoriesgetRomDirPaths()
public java.lang.String[] getRomDirPaths()
list
of rom dir pathsUtils.parseValues(String, char)
public java.lang.String[] getRomCategories(java.lang.String[] gameName)
gameName
- The games
Xmame.getRomNames(String[])
,
getInfoFromCatver(String)
public java.lang.String[] getInfoFromCatver(java.lang.String catverPath)
catverPath
- The path to catver.ini
array
of data strings from catver.ini
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |