|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--PaP.XMLFileUtil
XMLFileUtil is utility class for reading from or writing to XML-files.
The parseXXX methods are methods implemented for parsing files with a
specific syntax, same as the writeXXX methods are implemented for writing
content to a file with a syntax that the parseXXX methods can understand.
The class can parse the files RoleList.xml, SessionDescriptions.xml or
UserProfiles.xml, or other files with equivalent syntax of either one of the
three mentionded files. The class can also write content to files with a
syntax equivalent of either SessionDescriptions.xml or UserProfiles.xml.
One of the methods can parse a line with Name-Value pairs delimited by white
space and the '=' character. Finally, the main() method can be used to
validate files with a syntax equivalent of either one of the three files
listed above.
Field Summary | |
private int |
ACTOR_MODUS
|
private int |
APPLICATION_MODUS
|
boolean |
debuggingEnabled
|
private int |
HEADER_MODUS
|
private int |
ROLESESSION_MODUS
|
private int |
USER_MODUS
|
Constructor Summary | |
XMLFileUtil()
Creates a new XMLFileUtil. |
Method Summary | |
private void |
dbg(java.lang.String dbg)
Writes a debug string to the console if debugging is enabled. |
java.lang.String |
hashtable2String(java.util.Hashtable ht)
Gets the content from the specified Hashtable and creates a string of it. |
static void |
main(java.lang.String[] args)
Used for debugging purposes as well as for validating a file. |
java.util.Hashtable |
parseActorStateLine(java.lang.String line)
Parses the specified string and divides it into tokens according to white space. |
java.util.ArrayList |
parseRoleList(java.lang.String filename)
Parses a file containing a list of Roles. |
java.util.ArrayList |
parseSessionDescriptions(java.lang.String filename)
Parses a file containing a list of sessiondescriptions. |
java.util.ArrayList |
parseUserProfiles(java.lang.String filename)
Parses a file containing a list of userprofiles. |
private static void |
showSyntax()
Shows the correct syntax to the user. |
void |
writeSessionsToFile(java.util.ArrayList sessions,
java.lang.String filename)
Writes the content of the specified ArrayList containing Session-objects to the specified file. |
void |
writeUserProfilesToFile(java.util.ArrayList users,
java.lang.String filename)
Writes the content of the specified ArrayList containing UserProfile-objects to the specified file. |
Methods inherited from class java.lang.Object |
|
Field Detail |
private final int HEADER_MODUS
private final int USER_MODUS
private final int APPLICATION_MODUS
private final int ACTOR_MODUS
private final int ROLESESSION_MODUS
public boolean debuggingEnabled
Constructor Detail |
public XMLFileUtil()
Method Detail |
public java.lang.String hashtable2String(java.util.Hashtable ht)
ht
- The Hashtable to be converted to a string.The
- string form of the hashtable.public java.util.Hashtable parseActorStateLine(java.lang.String line)
line
- The string to be parsed.public java.util.ArrayList parseRoleList(java.lang.String filename) throws java.lang.Exception
filename
- The name of the file to be parsed.java.lang.Exception
- if something goes wrong.public java.util.ArrayList parseSessionDescriptions(java.lang.String filename) throws java.lang.Exception
filename
- The name of the file to be parsed.java.lang.Exception
- if something goes wrong.public java.util.ArrayList parseUserProfiles(java.lang.String filename) throws java.lang.Exception
filename
- The name of the file to be parsed.java.lang.Exception
- if something goes wrong.public void writeSessionsToFile(java.util.ArrayList sessions, java.lang.String filename) throws java.lang.Exception
sessions
- ArrayList with the Session-objects to be saved.filename
- The name of the file to write to.java.lang.Exception
- if something goes wrong.public void writeUserProfilesToFile(java.util.ArrayList users, java.lang.String filename) throws java.lang.Exception
users
- ArrayList with the UserProfile-objects to be saved.filename
- The name of the file to write to.java.lang.Exception
- if something goes wrong.private void dbg(java.lang.String dbg)
dbg
- The debug string.public static void main(java.lang.String[] args) throws java.lang.Exception
private static void showSyntax()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |