sql上报数据4
/**
*获取文件头
*
*@parampath
*@paramtabName
*@return返回文件头信息
*@throwsIOException
*/
publicStringgetColumn(Stringpath)throwsIOException
{
BufferedReaderbrFile=null;
Filefile=null;
Stringline=null;
try
{
file=newFile(path);
brFile=newBufferedReader(newInputStreamReader(
newFileInputStream(file)));
line=brFile.readLine();
}
finally
{
if(brFile!=null)
brFile.close();
}
returnline;
}
/**
*获取ORACLE数据库网络服务名
*@return
*/
publicStringgetOraNetServerName()
{
StringnetServerName=host.replace('.','_');
//StringnetServerName=host;
returnDASProperties.getPreOraNetServer()+netServerName;
}
/**
*配置OracleLOG文件
*@return
*/
publicStringconfigOracleLogFile()
{
StringBufferlogFile=newStringBuffer();
//以后要移除下面一行,此处是便于调试
logFile.append(getSqlLoadDirectory()).append("/").append(
fileName.substring(0,fileName.lastIndexOf(".")));
logFile.append("_"+(newDate()).getTime()+".log");
returnlogFile.toString();
}
/**
*配置OracleBad文件
*@return
*/
publicStringconfigOracleBadFile()
{
StringBufferbadFile=newStringBuffer();
badFile.append(getSqlLoadDirectory()).append("/").append(
DASProperties.getOracleBadFileName());
returnbadFile.toString();
}
/**
*从request请求中获取是否要删除SqlLoad日志文件的参数
*@seecom.security.dpi.basic.debug.DebugBean#processDebugRequest(java.util.Map)
*/
publicStringprocessDebugRequest(Map<String,Object>paramMap)
{
StringBuilderout=newStringBuilder();
StringscanDirectroy=null;
if(configerServer.getServiceType()==DASProperties.DAS_TYPE)
{
scanDirectroy=DASProperties.getDas_SqlLoadDirect();
}
elseif(configerServer.getServiceType()==DASProperties.ETL_TYPE)
{
scanDirectroy=DASProperties.getEtl_SqlLoadDirect();
}
else
{
out.append("serviceType"+configerServer.getServiceType()+"ERROR!");
returnout.toString();
}
if(paramMap!=null&¶mMap.size()>0)
{
if(paramMap.containsKey(FileUtil.backup))
{
setNeedDelLogFile(false);
setCurrentBackupFileState(FileUtil.backup);
out.append("StarttobackupDASsqlloadlogfiles!Thosefilesstorein"+scanDirectroy);
}
elseif(paramMap.containsKey(FileUtil.stopBackup))
{
setNeedDelLogFile(true);
setCurrentBackupFileState(FileUtil.stopBackup);
out.append("StoptobackupDASsqlloadlogfiles!");
}
elseif(paramMap.containsKey(FileUtil.delBackupFile))
{
//删除备份文件
String[]suffixs={".log"};
File[]files=FileUtil.findFiles(scanDirectroy,null,null,suffixs,null);
if(null!=files)
{
FileUtil.deleteFiles(files);
}
out.append("deleteDASsqlloadlogfiles!");
}
}
out.append("<br/><br/><ahref=\"debug/help\">return</a>");
returnout.toString();
}