|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jpop.net.PoplogDocClient
org.jpop.net.PoplogCachedClient
A PoplogDocClient that uses a document cache to minimize server requests. All the abstract methods in PoplogDocClient plus some more need to be implemented by any class that extends this client, ut given that they are messages that is alright.
Field Summary | |
static java.lang.String |
CACHE_DEFAULT_DIR
The directory where the cache is to be stored by default |
static java.lang.String |
DOC_DEFAULT
common file names |
static java.lang.String |
DOC_DOC_SUBDIR
Subdirectories for the actual files |
static java.lang.String |
DOC_HELP_SUBDIR
Subdirectories for the actual files |
static java.lang.String |
DOC_REF_SUBDIR
Subdirectories for the actual files |
static java.lang.String |
DOC_SUBDIR
The name of the cache subdirectories |
static java.lang.String |
DOC_TEACH_SUBDIR
Subdirectories for the actual files |
static java.lang.String |
HELP_DEFAULT
common file names |
static java.lang.String |
HELP_FILE
common file names |
static java.lang.String |
INFO_SUBDIR
The name of the cache subdirectories |
static java.lang.String |
LICENSE_FILE
common file names |
static java.lang.String |
LIST_ALL_FILE
common file names |
static java.lang.String |
LIST_DOC_FILE
common file names |
static java.lang.String |
LIST_HELP_FILE
common file names |
static java.lang.String |
LIST_REF_FILE
common file names |
static java.lang.String |
LIST_SUBDIR
The name of the cache subdirectories |
static java.lang.String |
LIST_TEACH_FILE
common file names |
static java.lang.String |
REF_DEFAULT
common file names |
static java.lang.String |
TEACH_DEFAULT
common file names |
Fields inherited from class org.jpop.net.PoplogDocClient |
ERROR_MESG, SERVER_MESG, TEXT_MESG, WARNING_MESG |
Constructor Summary | |
PoplogCachedClient(java.lang.String serverName,
int port,
java.lang.String cacheDir)
Constructor for the object. |
Method Summary | |
void |
close()
Closes the client |
java.lang.String |
getCacheDir()
Gets the cache dir attribute of the PoplogCachedClient object. |
void |
getDoc(java.lang.String type,
java.lang.String docname)
Gets the doc required from the server |
java.io.File |
getDocFile(java.lang.String type,
java.lang.String name)
Gets the file for the name requested from section type |
void |
getHelp()
Gets the help message from the server |
java.io.File |
getHelpFile()
Gets the cached file for the server's help |
void |
getLicense()
Get the license from the server |
java.io.File |
getLicenseFile()
Gets the cached file for the server's license |
void |
getList(java.lang.String list)
Gets the list required from the server or from the cache as required |
java.io.File |
getListFile(java.lang.String list)
Gets the file for the list determined by "list" |
static void |
main(java.lang.String[] args)
Main method. |
void |
setCache(java.lang.String cacheDir)
Sets the cache attribute of the PoplogCachedClient object |
Methods inherited from class org.jpop.net.PoplogDocClient |
clientConnected, clientDisconnected, connect, docReceived, errorReceived, exceptionGenerated, getInfo, getPort, getServerName, getVersion, help, helpReceived, info, isConnected, license, licenseReceived, listReceived, messageReceived, parse, println, resolveDocName, run, version, warningReceived |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String CACHE_DEFAULT_DIR
public static final java.lang.String DOC_SUBDIR
public static final java.lang.String LIST_SUBDIR
public static final java.lang.String INFO_SUBDIR
public static final java.lang.String DOC_DOC_SUBDIR
public static final java.lang.String DOC_HELP_SUBDIR
public static final java.lang.String DOC_REF_SUBDIR
public static final java.lang.String DOC_TEACH_SUBDIR
public static final java.lang.String LICENSE_FILE
public static final java.lang.String HELP_FILE
public static final java.lang.String LIST_ALL_FILE
public static final java.lang.String LIST_REF_FILE
public static final java.lang.String LIST_DOC_FILE
public static final java.lang.String LIST_HELP_FILE
public static final java.lang.String LIST_TEACH_FILE
public static final java.lang.String REF_DEFAULT
public static final java.lang.String TEACH_DEFAULT
public static final java.lang.String DOC_DEFAULT
public static final java.lang.String HELP_DEFAULT
Constructor Detail |
public PoplogCachedClient(java.lang.String serverName, int port, java.lang.String cacheDir) throws java.net.UnknownHostException, java.io.IOException
port
- The port the server listens tocacheDir
- The local directory in which we will be storing cached
pages. If this value is null the client will not use the cache at all and all requests
will go through the serverserverName
-
java.net.UnknownHostException
- When the host cannot be reached
java.io.IOException
- When communication with the server cannot be establishedMethod Detail |
public static void main(java.lang.String[] args)
args
- The commands line argumentspublic void setCache(java.lang.String cacheDir) throws java.net.UnknownHostException, java.io.IOException
PoplogCachedClient
object
cacheDir
- The local directory where cache is supposed to go. If null,
the client will not use cache and all requests will go through the server
java.net.UnknownHostException
- When the host cannot be reached
java.io.IOException
- When communication with the server cannot be establishedpublic java.lang.String getCacheDir()
PoplogCachedClient
object.
cacheDir
value. If null, the cache is not being usedpublic java.io.File getListFile(java.lang.String list) throws java.io.IOException
list
- the name of the list we want the file for
java.io.IOException
- when the list file cannot be gotten because list is not validpublic void getList(java.lang.String list)
getList
in interface ClientInterface
getList
in class PoplogDocClient
list
- any one of 'REF', 'HELP', 'TEACH', 'DOC' or ''public java.io.File getDocFile(java.lang.String type, java.lang.String name) throws java.io.IOException
name
- the name of the document we want the file fortype
- The place the document is to come from, like REF, or HELP
java.io.IOException
- when the file cannot be gotten or its not validpublic void getDoc(java.lang.String type, java.lang.String docname) throws ClientException
getDoc
in interface ClientInterface
getDoc
in class PoplogDocClient
type
- any one of 'REF', 'HELP', 'TEACH' or 'DOC'docname
- either the name of a file or ''
ClientException
- When the client can't read from the serverpublic java.io.File getHelpFile()
public void getHelp()
getHelp
in interface ClientInterface
getHelp
in class PoplogDocClient
public java.io.File getLicenseFile()
public void getLicense()
getLicense
in interface ClientInterface
getLicense
in class PoplogDocClient
public void close() throws java.io.IOException
close
in interface ClientInterface
close
in class PoplogDocClient
java.io.IOException
- When we can't close
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |