public class loadWebSource extends QueryDatabase
extends QueryDatabase, it need WebScraping object to construct itself. This class provide some method to load information to database and some other useful method
WebScraping
,
QueryDatabase
限定符和类型 | 字段和说明 |
---|---|
private java.sql.Timestamp |
maxDate |
private WebScraping |
wsp |
con
构造器和说明 |
---|
loadWebSource(WebScraping webSp,
loadCNF cnf)
a constructor for load information from Internet
need to load configuration file to know the path of resource and model of
reading.
|
限定符和类型 | 方法和说明 |
---|---|
WebScraping |
getWsp()
get the wsp (WebScraping object) from this object
|
void |
insert()
to insert data to the database
this method is synchronized which will be used in a thread.
|
boolean |
isScrap()
judge whether database should be insert data
if the maxDate in database is after the latest date of net, then it should
not be scraped. judge whether database latest time before net latest time
|
private java.sql.Timestamp |
queryMaxDate()
get the latest date and time from database
|
void |
setWsp(WebScraping wsp)
reset the wsp (WebScraping object)
|
private WebScraping wsp
private java.sql.Timestamp maxDate
public loadWebSource(WebScraping webSp, loadCNF cnf)
need to load configuration file to know the path of resource and model of reading. Also need the WebScraping object to scraping information
webSp,
- a WebScraping object webSp to scraping informationcnf,
- a cnf file to load configuration information.public void setWsp(WebScraping wsp)
wsp
- a webScraping objectpublic WebScraping getWsp()
public void insert()
this method is synchronized which will be used in a thread.
public boolean isScrap()
if the maxDate in database is after the latest date of net, then it should not be scraped. judge whether database latest time before net latest time
private java.sql.Timestamp queryMaxDate()