|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectsiuying.gm.app.gmailer4j.XMLStorage
public class XMLStorage
Open a directory, use files under this directorys as data store
| Field Summary | |
|---|---|
protected java.util.HashSet |
items
list of all items in storage |
protected static java.util.logging.Logger |
logger
|
| Method Summary | |
|---|---|
void |
close()
close a storage |
boolean |
containsId(java.lang.String id)
check if the thread with id specified existed in the store |
void |
flush()
do nothing in this implementation as we save every time we access file |
java.lang.Object |
get(java.lang.String id)
get thread from xml store by id |
java.lang.String |
getPostfix()
|
java.lang.String |
getUrl()
|
static XMLStorage |
getXMLStorage(java.lang.String path)
Open a XMLThreadStorage by url |
static XMLStorage |
getXMLStorage(java.lang.String path,
java.lang.String postfix)
Open a XMLThreadStorage by url |
java.util.Iterator |
iterator()
iterate through the threads in storage |
void |
open()
open a storage |
void |
put(java.lang.String id,
java.lang.Object thread)
save thread as xml |
void |
remove(java.lang.String id)
remove thread xml file |
void |
setPostfix(java.lang.String postfix)
|
void |
setUrl(java.lang.String url)
set the url/identifer of the storage depends on implementation |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.util.HashSet items
protected static java.util.logging.Logger logger
| Method Detail |
|---|
public java.lang.String getPostfix()
public void setPostfix(java.lang.String postfix)
public static XMLStorage getXMLStorage(java.lang.String path)
throws java.io.IOException
String - pathname directory to store the XML files
java.io.IOException - when open directory failed
public static XMLStorage getXMLStorage(java.lang.String path,
java.lang.String postfix)
throws java.io.IOException
String - pathname directory to store the XML filesString - postfix the files type treated as xml files, e.g. ".xml"
java.io.IOException - when open directory failed
public void setUrl(java.lang.String url)
throws java.lang.NullPointerException
GMStorage
setUrl in interface GMStoragejava.lang.NullPointerExceptionpublic java.lang.String getUrl()
public void open()
throws java.io.IOException
GMStorage
open in interface GMStoragejava.io.IOExceptionpublic void close()
GMStorage
close in interface GMStoragepublic boolean containsId(java.lang.String id)
containsId in interface GMStorageid - the id of the thread
public void put(java.lang.String id,
java.lang.Object thread)
throws java.io.IOException,
java.lang.NullPointerException
put in interface GMStoragejava.lang.NullPointerException - when id or thread is null
java.lang.IllegalArgumentException - when id is empty string
java.io.IOException
public java.lang.Object get(java.lang.String id)
throws java.io.IOException,
java.lang.NullPointerException
get in interface GMStoragejava.lang.NullPointerException - when id or thread is null
java.lang.IllegalArgumentException - when id is empty string
java.io.IOException
public void remove(java.lang.String id)
throws java.lang.NullPointerException,
java.lang.SecurityException
remove in interface GMStoragejava.lang.NullPointerException - when id is null
java.lang.SecurityException
public void flush()
throws java.io.IOException
flush in interface GMStoragejava.io.IOExceptionpublic java.util.Iterator iterator()
GMStorage
iterator in interface GMStorage
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||