📄 configinfo.java
字号:
/*
* FileName ConfigInfo.java
* Create Time 2005-8-1 9:12:53
* Author shiwei
* Descript 系统配置信息
* Version
*/
package com.snoics.reptile.system.conf;
import com.snoics.base.util.StringClass;
import com.snoics.reptile.regex.url.IUrlRegexMap;
import com.snoics.reptile.system.common.Common;
public class ConfigInfo {
private String websitename="";
private String charsetName="";
private String website="";
private String url="";
private String remoteurlflag="";
private String forbidurl="";
private String cachefile="";
private String filerootpath="";
private String indexpage="";
private String filenamelength="";
private String cacheunitsize;
private String startpage="";
private IUrlRegexMap urlRegexMap;
/**
* @return Returns the urlRegexMap.
*/
public IUrlRegexMap getUrlRegexMap() {
return urlRegexMap;
}
/**
* @param urlRegexMap The urlRegexMap to set.
*/
public void setUrlRegexMap(IUrlRegexMap urlRegexMap) {
this.urlRegexMap = urlRegexMap;
}
public ConfigInfo(){
}
/**
* 设置站点名称
* @param websitename
*/
public void setWebsitename(String websitename){
websitename=StringClass.getReplaceString(websitename," ","");
this.websitename=websitename;
}
/**
* 取得站点名称
* @return String
*/
public String getWebsitename(){
return websitename;
}
/**
* 设置站点地址
* @param website
*/
public void setWebsite(String website){
this.website=website;
}
/**
* 获取站点地址
* @return String
*/
public String getWebsite(){
String last=StringClass.getLastString(website,1);
if(!last.equals("/")){
website+="/";
}
return website;
}
/**
* 设置抓取的URL起点起点
* @param url
*/
public void setUrl(String url){
this.url=url;
}
/**
* 获取抓取的URL的起点
* @return String
*/
public String getUrl(){
if(url.equals("")){
url=getWebsite();
}
return url;
}
public String getRemoteurlflag() {
return remoteurlflag;
}
public void setRemoteurlflag(String remoteurlflag) {
this.remoteurlflag = remoteurlflag;
}
/**
* 设置不抓取的部分
* @param forbidurl
*/
public void setForbidurl(String forbidurl){
this.forbidurl=forbidurl;
}
/**
* 获取不抓取的部分
* @return String
*/
public String getForbidurl(){
forbidurl=StringClass.getString(forbidurl,"");
return forbidurl;
}
/**
* 设置缓存文件
* @param cachefile
*/
public void setCachefile(String cachefile){
cachefile=StringClass.getFormatPath(cachefile);
this.cachefile=cachefile;
}
/**
* 获取缓存文件
* @return String
*/
public String getCachefile(){
if(cachefile.equals("")){
cachefile=Common.getConfigHome()+"/"+Common.DEFAULT_CACHE_DIRECTORY+"/"+getWebsitename()+"."+Common.REPTILE_FILETYPE;
}
return cachefile;
}
/**
* 设置抓取文件保存路径
* @param filerootpath
*/
public void setFilerootpath(String filerootpath){
filerootpath=StringClass.getFormatPath(filerootpath);
this.filerootpath=filerootpath;
}
/**
* 获取抓取文件保存路径
* @return String
*/
public String getFilerootpath(){
if(filerootpath.equals("")){
filerootpath=Common.getConfigHome()+"/"+Common.DEFAULT_FILE_DIRECTORY+"/"+getWebsitename();
}
return filerootpath;
}
/**
* 设置首页文件名
* @param indexpage
*/
public void setIndexpage(String indexpage) {
this.indexpage=indexpage;
}
/**
* 获取首页文件名
* @return String
*/
public String getIndexpage() {
if(indexpage.equals("")) {
indexpage="index.htm;index.html;index.jsp;index.jspa;index.php;index.asp;index.aspx;default.html;default.htm,default.jsp;default.aspx;default.jspa;default.php;main.html;main.htm;main.jsp;main.asp;main.aspx;main.php;main.jspa;;";
}
return indexpage;
}
/**
* 设置保存文件名长度
* @param filenamelength
*/
public void setFilenamelength(String filenamelength){
int length=32;
try{
length=Integer.parseInt(filenamelength);
}catch(Exception e){
length=32;
}
this.filenamelength=String.valueOf(length);
}
/**
* 获取保存文件名长度
* @return String
*/
public String getFilenamelength(){
if(filenamelength.equals("")){
filenamelength="32";
}
return filenamelength;
}
/**
* 设置缓存单元大小
* @param cacheunitsize
*/
public void setCacheunitsize(String cacheunitsize){
this.cacheunitsize=cacheunitsize;
}
/**
* 获取缓存单元大小
* @return String
*/
public String getCacheunitsize(){
cacheunitsize=StringClass.getString(cacheunitsize,"");
if(cacheunitsize.equals("")){
cacheunitsize=Common.DEFAULT_CACHESIZE;
}
return cacheunitsize;
}
/**
* @return Returns the charsetName.
*/
public String getCharsetName() {
return charsetName;
}
/**
* @param charsetName The charsetName to set.
*/
public void setCharsetName(String charsetName) {
this.charsetName = charsetName;
}
/**
* 设置一个参数的值
* @param parameter 参数名称
* @param value 参数值
*/
public void setValue(String parameter,String value){
if(parameter.equals(Common.CONFIGFILE_NODE_WEBSITENAME)){
setWebsitename(value);
}else if(parameter.equals(Common.CONFIGFILE_NODE_WEBSITE)){
setWebsite(value);
}else if(parameter.equals(Common.CONFIGFILE_NODE_URL)){
setUrl(value);
}else if(parameter.equals(Common.CONFIGFILE_NODE_REMOTEURLFLAG)){
setRemoteurlflag(value);
}else if(parameter.equals(Common.CONFIGFILE_FORBIDURL)){
setForbidurl(value);
}else if(parameter.equals(Common.CONFIGFILE_NODE_CACHEFILE)){
setCachefile(value);
}else if(parameter.equals(Common.CONFIGFILE_NODE_CACHEUNITSIZE)){
setCacheunitsize(value);
}else if(parameter.equals(Common.CONFIGFILE_NODE_FILEROOTPATH)){
setFilerootpath(value);
}else if(parameter.equals(Common.CONFIGFILE_NODE_INDEXPAGE)){
setIndexpage(value);
}else if(parameter.equals(Common.CONFIGFILE_NODE_FILENAMELENGTH)){
setFilenamelength(value);
}else if(parameter.equals(Common.CONFIGFILE_NODE_STARTPAGE)){
setStartpage(value);
}else if(parameter.equals(Common.CONFIGFILE_NODE_CHARSETNAME)){
setCharsetName(value);
}
}
/**
* 取得参数值
* @param parameter 参数名称
* @return String
*/
public String getValue(String parameter){
String value="";
if(parameter.equals(Common.CONFIGFILE_NODE_WEBSITENAME)){
value=getWebsitename();
}else if(parameter.equals(Common.CONFIGFILE_NODE_WEBSITE)){
value=getWebsite();
}else if(parameter.equals(Common.CONFIGFILE_NODE_URL)){
value=getUrl();
}else if(parameter.equals(Common.CONFIGFILE_NODE_REMOTEURLFLAG)){
value=getRemoteurlflag();
}else if(parameter.equals(Common.CONFIGFILE_FORBIDURL)){
value=getForbidurl();
}else if(parameter.equals(Common.CONFIGFILE_NODE_CACHEFILE)){
value=getCachefile();
}else if(parameter.equals(Common.CONFIGFILE_NODE_CACHEUNITSIZE)){
value=getCacheunitsize();
}else if(parameter.equals(Common.CONFIGFILE_NODE_FILEROOTPATH)){
value=getFilerootpath();
}else if(parameter.equals(Common.CONFIGFILE_NODE_INDEXPAGE)){
value=getIndexpage();
}else if(parameter.equals(Common.CONFIGFILE_NODE_FILENAMELENGTH)){
value=getFilenamelength();
}else if(parameter.equals(Common.CONFIGFILE_NODE_STARTPAGE)){
value=getStartpage();
}else if(parameter.equals(Common.CONFIGFILE_NODE_CHARSETNAME)){
value=getCharsetName();
}
return value;
}
public String getStartpage() {
return startpage;
}
public void setStartpage(String startpage) {
this.startpage = startpage;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -